src/ldconfig.h

Tue, 07 Jan 2014 12:21:46 +0200

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Tue, 07 Jan 2014 12:21:46 +0200
changeset 606
3dd6f343ec06
parent 603
47e7773c7841
permissions
-rw-r--r--

- removed the 'str' typedef, use QString directly

406
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
600
209e3f1f7b2c - updated copyright year. Best wishes for 2014!
Santeri Piippo <crimsondusk64@gmail.com>
parents: 538
diff changeset
3 * Copyright (C) 2013, 2014 Santeri Piippo
406
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
538
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
19 #ifndef LDFORGE_LDCONFIG_H
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
20 #define LDFORGE_LDCONFIG_H
406
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include "types.h"
496
d6cbf21af8fb nuked "container_cast"
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
23 #include <QStringList>
406
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 // =============================================================================
538
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
26 // LDConfigParser
406
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27 //
538
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
28 // String parsing utility for parsing ldconfig.ldr
406
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 // =============================================================================
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
30 class LDConfigParser
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
31 {
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
32 public:
606
3dd6f343ec06 - removed the 'str' typedef, use QString directly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 603
diff changeset
33 LDConfigParser (QString inText, char sep);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
34
538
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
35 bool isAtEnd();
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
36 bool isAtBeginning();
606
3dd6f343ec06 - removed the 'str' typedef, use QString directly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 603
diff changeset
37 bool getNextToken (QString& val);
3dd6f343ec06 - removed the 'str' typedef, use QString directly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 603
diff changeset
38 bool peekNextToken (QString& val);
3dd6f343ec06 - removed the 'str' typedef, use QString directly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 603
diff changeset
39 bool getToken (QString& val, const int pos);
538
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
40 bool findToken (int& result, char const* needle, int args);
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
41 int getSize();
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
42 void rewind();
538
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
43 void seek (int amount, bool rel);
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
44 bool tokenCompare (int inPos, const char* sOther);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
45
606
3dd6f343ec06 - removed the 'str' typedef, use QString directly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 603
diff changeset
46 inline QString operator[] (const int idx)
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
47 {
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
48 return m_tokens[idx];
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
49 }
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
50
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
51 private:
496
d6cbf21af8fb nuked "container_cast"
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
52 QStringList m_tokens;
d6cbf21af8fb nuked "container_cast"
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
53 int m_pos;
406
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
54 };
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56 void parseLDConfig();
5371baa17346 Separated LDConfig.ldr-specific stuff to ldconfig.cpp/h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
57
538
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
58 #endif // LDFORGE_LDCONFIG_H

mercurial