BlinkenArea - GitList
Repositories
Blog
Wiki
Blinker
Code
Commits
Branches
Tags
Search
Tree:
362c1f4
Branches
Tags
master
Blinker
src
common
SyncRecv.cpp
update copyright header
Stefan Schuermans
commited
362c1f4
at 2019-05-04 17:17:10
SyncRecv.cpp
Blame
History
Raw
/* Blinker Copyright 2011-2019 Stefan Schuermans <stefan@blinkenarea.org> Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html a blinkenarea.org project */ #include "SyncRecv.h" namespace Blinker { /** * @brief check if playlist entry name matches sync name * @param[in] playlist name in playlist * @param[in] sync name from synchronization information * @return true if name matches, false otherwise */ bool SyncRecv::checkName(const std::string &playlist, const std::string &sync) { std::string::size_type pos, noprefix; std::string noext; unsigned int underscore; // full match if (playlist == sync) return true; // match without file extension pos = playlist.rfind('.'); noext = playlist.substr(0, pos); if (noext == sync) return true; // match without ignore prefix ".*__" noprefix = 0; underscore = 0; for (pos = 0; pos < noext.length(); ++pos) { if (noext.at(pos) == '_') { underscore++; if (underscore >= 2) noprefix = pos + 1; } else { underscore = 0; } } if (noext.substr(noprefix) == sync) return true; // no match return false; } /// constructor SyncRecv::SyncRecv() { } /// virtual destructor SyncRecv::~SyncRecv() { } } // namespace Blinker