84 // |
84 // |
85 // String parsing utility |
85 // String parsing utility |
86 // ============================================================================= |
86 // ============================================================================= |
87 class StringParser { |
87 class StringParser { |
88 public: |
88 public: |
89 std::vector<str> zaTokens; |
89 StringParser (str inText, char sep); |
90 short dPos; |
|
91 |
|
92 StringParser (str zInText, char cSeparator); |
|
93 |
90 |
94 bool atEnd (); |
91 bool atEnd (); |
95 bool atBeginning (); |
92 bool atBeginning (); |
96 bool next (str& zVal); |
93 bool next (str& val); |
97 bool peekNext (str& zVal); |
94 bool peekNext (str& val); |
98 bool getToken (str& zVal, const ushort uInPos); |
95 bool getToken (str& val, const ushort pos); |
99 bool findToken (short& dResult, char const* sNeedle, short dArgs); |
96 bool findToken (short& result, char const* needle, short args); |
100 size_t size (); |
97 size_t size (); |
101 void rewind (); |
98 void rewind (); |
102 void seek (short dAmount, bool bRelative); |
99 void seek (short amount, bool rel); |
103 bool tokenCompare (short int dInPos, const char* sOther); |
100 bool tokenCompare (short inPos, const char* sOther); |
104 |
101 |
105 str operator[] (const size_t uIndex) { |
102 str operator[] (const size_t uIndex) { |
106 return zaTokens[uIndex]; |
103 return m_tokens[uIndex]; |
107 } |
104 } |
|
105 |
|
106 private: |
|
107 std::vector<str> m_tokens; |
|
108 short m_pos; |
108 }; |
109 }; |
109 |
110 |
110 #endif // MISC_H |
111 #endif // MISC_H |