Octane v1.01.20 - The Open Compression Toolkit for C++ | http://octane.sourceforge.net/ |
#include <stringparser.hpp>
Breaks up a string into space-delimited tokens.
The class operates on a copy of the string, to avoid any synchronization issues. This should not be a problem for performance if the string implementation is reference counted.
Definition at line 33 of file stringparser.hpp.
Public Member Functions | |
stringparser (const std::string &_s) | |
Constructor. | |
std::string | get_token () |
Get next token from string. |
|
Constructor.
Definition at line 38 of file stringparser.hpp.
00038 : s(_s), idx(0) { ; } |
|
Get next token from string.
Definition at line 43 of file stringparser.hpp. Referenced by OctaneTester::ParseCommand().
00044 { 00045 if (idx == std::string::npos) return ""; 00046 00047 std::string::size_type p = s.find_first_not_of(' ', idx); 00048 00049 if (p == std::string::npos) return ""; 00050 00051 idx = s.find_first_of(' ', p); 00052 00053 if (idx == std::string::npos) return s.substr(p); 00054 00055 return s.substr(p, idx - p); 00056 } |