src/ldConfig.h

Mon, 02 Jun 2014 12:50:40 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Mon, 02 Jun 2014 12:50:40 +0300
changeset 784
f82ab4d3c7b4
parent 739
152b33a6d51b
child 789
4b7306f52bb5
permissions
-rw-r--r--

- made LDDocument use shared pointers, this eliminates a lot of document-related crashes

655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2013, 2014 Santeri Piippo
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #pragma once
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #include "basics.h"
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21 #include <QStringList>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 // ============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24 //
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 // String parsing utility for parsing ldconfig.ldr
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26 //
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27 class LDConfigParser
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 public:
739
152b33a6d51b - type-aliased QString to String
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
30 LDConfigParser (String inText, char sep);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 bool isAtEnd();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 bool isAtBeginning();
739
152b33a6d51b - type-aliased QString to String
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
34 bool getNextToken (String& val);
152b33a6d51b - type-aliased QString to String
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
35 bool peekNextToken (String& val);
152b33a6d51b - type-aliased QString to String
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
36 bool getToken (String& val, const int pos);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37 bool findToken (int& result, char const* needle, int args);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38 int getSize();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39 void rewind();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40 void seek (int amount, bool rel);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41 bool tokenCompare (int inPos, const char* sOther);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42
739
152b33a6d51b - type-aliased QString to String
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
43 inline String operator[] (const int idx)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45 return m_tokens[idx];
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48 private:
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
49 QStringList m_tokens;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50 int m_pos;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
51 };
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
52
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53 void parseLDConfig();

mercurial