BlinkenArea - GitList
Repositories
Blog
Wiki
Blinker
Code
Commits
Branches
Tags
Search
Tree:
1a209d4
Branches
Tags
master
Blinker
src
noarch
StringParser.h
implement frame rate limiter
Stefan Schuermans
commited
1a209d4
at 2014-01-03 00:52:55
StringParser.h
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 */ #ifndef BLINKER_STRINGPARSER_H #define BLINKER_STRINGPARSER_H #include <string> namespace Blinker { /// a simple string parser class StringParser { public: /** * @brief constructor * @param[in] str string to parse */ StringParser(const std::string &str); public: /** * @brief parse fixed character * @param[in] chr character to expect * @return if expected character was found and processed */ bool fixChr(char chr); /** * @brief parse one character out of a set * @param[in] set set of characters allowed * @param[out] chr character parsed * @return if a character from the set was found and processed */ bool oneChrOf(const std::string &set, char &chr); /** * @brief parse boolean value * @param[out] boolVal boolean value parsed from string * @return if parsing was successful */ bool boolVal(bool &boolVal); /** * @brief parse unsigned number * @param[out] uint number parsed from string * @return if parsing was successful */ bool uintNo(unsigned int &uint); /** * @brief parse unsigned number and check minimum * @param[in] min minimum value to expect * @param[out] uint number parsed from string * @return if parsing was successful */ bool uintMin(unsigned int min, unsigned int &uint); /** * @brief parse signed number * @param[out] sint number parsed from string * @return if parsing was successful */ bool sintNo(int &sint); /** * @brief parse floating point value * @param[out] fl floating point value parsed from string * @return if parsing was successful */ bool floatVal(float &fl); /** * @brief parse until a delimiter is found * @param[in] delim set of delimiter characters * @param[in] empty if empty substring is okay * @param[out] str substring parsed * @return if a substring was found and processed */ bool untilDelim(const std::string &delim, bool empty, std::string &str); /** * @brief check if parsing is done * @return if parsing is done (i.e. has arrived at the end of the string) */ bool isDone(); protected: std::string m_str; ///< string begin parsed std::string::const_iterator m_it; ///< current position of parsing }; // class StringParser } // namespace Blinker #endif // #ifndef BLINKER_STRINGPARSER_H