BlinkenArea - GitList
Repositories
Blog
Wiki
Blinker
Code
Commits
Branches
Tags
Search
Tree:
f544b7e
Branches
Tags
master
Blinker
src
common
SyncRecv.cpp
implement synchronization feature for player
Stefan Schuermans
commited
f544b7e
at 2014-01-03 21:44:12
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; std::string noext; // 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 number prefix "[0-9]*[._-]?" for (pos = 0; pos < noext.length() && std::isdigit(noext.at(pos)); ++pos); if (pos < noext.length() && (noext.at(pos) == '.' || noext.at(pos) == '_' || noext.at(pos) == '-')) ++pos; noext = noext.substr(pos); if (noext == sync) return true; // no match return false; } /// constructor SyncRecv::SyncRecv() { } /// virtual destructor SyncRecv::~SyncRecv() { } } // namespace Blinker