BlinkenArea - GitList
Repositories
Blog
Wiki
Blinker
Code
Commits
Branches
Tags
Search
Tree:
7d53fae
Branches
Tags
master
Blinker
src
common
SyncRecv.cpp
change local file name prefix to ignore from 000. to 0aA__
Stefan Schuermans
commited
7d53fae
at 2014-05-04 09:35:59
SyncRecv.cpp
Blame
History
Raw
/* Blinker Copyright 2011-2014 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