14 * |
14 * |
15 * You should have received a copy of the GNU General Public License |
15 * You should have received a copy of the GNU General Public License |
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 */ |
17 */ |
18 |
18 |
19 #ifndef LDCONFIG_H |
19 #ifndef LDFORGE_LDCONFIG_H |
20 #define LDCONFIG_H |
20 #define LDFORGE_LDCONFIG_H |
21 |
21 |
22 #include "types.h" |
22 #include "types.h" |
23 #include <QStringList> |
23 #include <QStringList> |
24 |
24 |
25 // ============================================================================= |
25 // ============================================================================= |
26 // StringParser |
26 // LDConfigParser |
27 // |
27 // |
28 // String parsing utility |
28 // String parsing utility for parsing ldconfig.ldr |
29 // ============================================================================= |
29 // ============================================================================= |
30 class LDConfigParser |
30 class LDConfigParser |
31 { public: |
31 { public: |
32 LDConfigParser (str inText, char sep); |
32 LDConfigParser (str inText, char sep); |
33 |
33 |
34 bool atEnd(); |
34 bool isAtEnd(); |
35 bool atBeginning(); |
35 bool isAtBeginning(); |
36 bool next (str& val); |
36 bool getNextToken (str& val); |
37 bool peekNext (str& val); |
37 bool peekNextToken (str& val); |
38 bool getToken (str& val, const int pos); |
38 bool getToken (str& val, const int pos); |
39 bool findToken (short& result, char const* needle, short args); |
39 bool findToken (int& result, char const* needle, int args); |
40 size_t size(); |
40 int getSize(); |
41 void rewind(); |
41 void rewind(); |
42 void seek (short amount, bool rel); |
42 void seek (int amount, bool rel); |
43 bool tokenCompare (short inPos, const char* sOther); |
43 bool tokenCompare (int inPos, const char* sOther); |
44 |
44 |
45 str operator[] (const size_t idx) |
45 str operator[] (const int idx) |
46 { return m_tokens[idx]; |
46 { return m_tokens[idx]; |
47 } |
47 } |
48 |
48 |
49 private: |
49 private: |
50 QStringList m_tokens; |
50 QStringList m_tokens; |
51 int m_pos; |
51 int m_pos; |
52 }; |
52 }; |
53 |
53 |
54 void parseLDConfig(); |
54 void parseLDConfig(); |
55 |
55 |
56 #endif // LDCONFIG_H |
56 #endif // LDFORGE_LDCONFIG_H |