BlinkenArea - GitList
Repositories
Blog
Wiki
Blinker
Code
Commits
Branches
Tags
Search
Tree:
bfcc171
Branches
Tags
master
Blinker
src
common
Transform.cpp
implement stream transformations rotation and mirroring
Stefan Schuermans
commited
bfcc171
at 2014-01-03 12:40:21
Transform.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 <sstream> #include <string> #include "Transform.h" namespace Blinker { /// constructor Transform::Transform(): m_type(None) { } /** * @brief parse from string format * @param[in] str string format * @return if parsing was successful */ bool Transform::fromStr(const std::string &str) { if (str == "none") { m_type = None; return true; } else if (str == "rotcw") { m_type = RotCW; return true; } else if (str == "rotccw") { m_type = RotCCW; return true; } else if (str == "rothalf") { m_type = RotHalf; return true; } else if (str == "mirhor") { m_type = MirHor; return true; } else if (str == "mirver") { m_type = MirVer; return true; } else if (str == "mirdiag") { m_type = MirDiag; return true; } else if (str == "mirdiag2") { m_type = MirDiag2; return true; } else return false; } /** * @brief convert to string format * @return string format */ std::string Transform::toStr() const { switch (m_type) { case None: return "none"; case RotCW: return "rotcw"; case RotCCW: return "rotccw"; case RotHalf: return "rothalf"; case MirHor: return "mirhor"; case MirVer: return "mirver"; case MirDiag: return "mirdiag"; case MirDiag2: return "mirdiag2"; default: return ""; } } } // namespace Blinker