18 |
18 |
19 #ifndef LDCONFIG_H |
19 #ifndef LDCONFIG_H |
20 #define LDCONFIG_H |
20 #define LDCONFIG_H |
21 |
21 |
22 #include "types.h" |
22 #include "types.h" |
|
23 #include <QStringList> |
23 |
24 |
24 // ============================================================================= |
25 // ============================================================================= |
25 // StringParser |
26 // StringParser |
26 // |
27 // |
27 // String parsing utility |
28 // String parsing utility |
28 // ============================================================================= |
29 // ============================================================================= |
29 class LDConfigParser { |
30 class LDConfigParser |
30 public: |
31 { public: |
31 LDConfigParser (str inText, char sep); |
32 LDConfigParser (str inText, char sep); |
32 |
33 |
33 bool atEnd(); |
34 bool atEnd(); |
34 bool atBeginning(); |
35 bool atBeginning(); |
35 bool next (str& val); |
36 bool next (str& val); |
36 bool peekNext (str& val); |
37 bool peekNext (str& val); |
37 bool getToken (str& val, const ushort pos); |
38 bool getToken (str& val, const int pos); |
38 bool findToken (short& result, char const* needle, short args); |
39 bool findToken (short& result, char const* needle, short args); |
39 size_t size(); |
40 size_t size(); |
40 void rewind(); |
41 void rewind(); |
41 void seek (short amount, bool rel); |
42 void seek (short amount, bool rel); |
42 bool tokenCompare (short inPos, const char* sOther); |
43 bool tokenCompare (short inPos, const char* sOther); |
43 |
44 |
44 str operator[] (const size_t idx) { |
45 str operator[] (const size_t idx) |
45 return m_tokens[idx]; |
46 { return m_tokens[idx]; |
46 } |
47 } |
47 |
48 |
48 private: |
49 private: |
49 List<str> m_tokens; |
50 QStringList m_tokens; |
50 short m_pos; |
51 int m_pos; |
51 }; |
52 }; |
52 |
53 |
53 void parseLDConfig(); |
54 void parseLDConfig(); |
54 |
55 |
55 #endif // LDCONFIG_H |
56 #endif // LDCONFIG_H |