diff -r c595cfb4791c -r 31540c1f22ea src/ldconfig.h --- a/src/ldconfig.h Wed Oct 23 13:14:17 2013 +0300 +++ b/src/ldconfig.h Mon Jan 20 15:04:26 2014 +0200 @@ -1,6 +1,6 @@ /* * LDForge: LDraw parts authoring CAD - * Copyright (C) 2013 Santeri Piippo + * Copyright (C) 2013, 2014 Santeri Piippo * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,34 +16,36 @@ * along with this program. If not, see . */ -#ifndef LDCONFIG_H -#define LDCONFIG_H +#ifndef LDFORGE_LDCONFIG_H +#define LDFORGE_LDCONFIG_H #include "types.h" #include // ============================================================================= -// StringParser +// LDConfigParser // -// String parsing utility +// String parsing utility for parsing ldconfig.ldr // ============================================================================= class LDConfigParser -{ public: - LDConfigParser (str inText, char sep); +{ + public: + LDConfigParser (QString inText, char sep); - bool atEnd(); - bool atBeginning(); - bool next (str& val); - bool peekNext (str& val); - bool getToken (str& val, const int pos); - bool findToken (short& result, char const* needle, short args); - size_t size(); + bool isAtEnd(); + bool isAtBeginning(); + bool getNextToken (QString& val); + bool peekNextToken (QString& val); + bool getToken (QString& val, const int pos); + bool findToken (int& result, char const* needle, int args); + int getSize(); void rewind(); - void seek (short amount, bool rel); - bool tokenCompare (short inPos, const char* sOther); + void seek (int amount, bool rel); + bool tokenCompare (int inPos, const char* sOther); - str operator[] (const size_t idx) - { return m_tokens[idx]; + inline QString operator[] (const int idx) + { + return m_tokens[idx]; } private: @@ -53,4 +55,4 @@ void parseLDConfig(); -#endif // LDCONFIG_H +#endif // LDFORGE_LDCONFIG_H