src/misc.h

changeset 185
6fea53f1ffc2
parent 183
f1b8cb53d2a2
child 188
4e686b771996
equal deleted inserted replaced
184:fae3bc9ce319 185:6fea53f1ffc2
27 27
28 class QColor; 28 class QColor;
29 class QAction; 29 class QAction;
30 30
31 // Prime numbers 31 // Prime numbers
32 extern const ushort g_uaPrimes[NUM_PRIMES]; 32 extern const ushort g_primes[NUM_PRIMES];
33 33
34 // Returns whether a given string represents a floating point number. 34 // Returns whether a given string represents a floating point number.
35 bool isNumber (str& zToken); 35 bool isNumber (str& zToken);
36 36
37 // Converts a float value to a string value. 37 // Converts a float value to a string value.
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

mercurial