summaryrefslogtreecommitdiff
path: root/noncore/games/sfcave-sdl/stringtokenizer.h
Unidiff
Diffstat (limited to 'noncore/games/sfcave-sdl/stringtokenizer.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/sfcave-sdl/stringtokenizer.h46
1 files changed, 23 insertions, 23 deletions
diff --git a/noncore/games/sfcave-sdl/stringtokenizer.h b/noncore/games/sfcave-sdl/stringtokenizer.h
index 3f299a6..51daa42 100644
--- a/noncore/games/sfcave-sdl/stringtokenizer.h
+++ b/noncore/games/sfcave-sdl/stringtokenizer.h
@@ -1,23 +1,23 @@
1#ifndef __STRINGTOKENIZER_H 1#ifndef __STRINGTOKENIZER_H
2#define __STRINGTOKENIZER_H 2#define __STRINGTOKENIZER_H
3 3
4#include <vector> 4#include <vector>
5using namespace std; 5using namespace std;
6 6
7class StringTokenizer : public vector<string> 7class StringTokenizer : public vector<string>
8{ 8{
9 public: 9 public:
10 StringTokenizer(const string &rStr, const string &rDelimiters = " ,\n") 10 StringTokenizer(const string &rStr, const string &rDelimiters = " ,\n")
11 { 11 {
12 string::size_type lastPos(rStr.find_first_not_of(rDelimiters, 0)); 12 string::size_type lastPos(rStr.find_first_not_of(rDelimiters, 0));
13 string::size_type pos(rStr.find_first_of(rDelimiters, lastPos)); 13 string::size_type pos(rStr.find_first_of(rDelimiters, lastPos));
14 while (string::npos != pos || string::npos != lastPos) 14 while (string::npos != pos || string::npos != lastPos)
15 { 15 {
16 push_back(rStr.substr(lastPos, pos - lastPos)); 16 push_back(rStr.substr(lastPos, pos - lastPos));
17 lastPos = rStr.find_first_not_of(rDelimiters, pos); 17 lastPos = rStr.find_first_not_of(rDelimiters, pos);
18 pos = rStr.find_first_of(rDelimiters, lastPos); 18 pos = rStr.find_first_of(rDelimiters, lastPos);
19 } 19 }
20 } 20 }
21}; 21};
22 22
23#endif 23#endif