Sat, 07 Sep 2013 13:23:09 +0300
Merge branch 'master' into gl, reworked stuff
Conflicts:
src/gldraw.cpp
src/gldraw.h
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | * Copyright (C) 2013 Santeri Piippo |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
421
diff
changeset
|
4 | * |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
8 | * (at your option) any later version. |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
421
diff
changeset
|
9 | * |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
421
diff
changeset
|
14 | * |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | */ |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #ifndef TYPES_H |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | #define TYPES_H |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
22 | #include <QString> |
290
be0c367e7420
Added primitive scanning, replaced parts list in subfile add dialog with it
Santeri Piippo <crimsondusk64@gmail.com>
parents:
288
diff
changeset
|
23 | #include <QObject> |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
24 | #include <deque> |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | #include "common.h" |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | |
381
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
27 | class LDObject; |
287
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
28 | |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
29 | typedef QChar qchar; |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
30 | typedef QString str; |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
31 | template<class T> class ConstListReverser; |
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
32 | template<class T> using c_rev = ConstListReverser<T>; |
461
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
456
diff
changeset
|
33 | class StringConfig; |
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
456
diff
changeset
|
34 | class IntConfig; |
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
456
diff
changeset
|
35 | class FloatConfig; |
287
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
36 | class QFile; |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
37 | class QTextStream; |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
38 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
39 | typedef unsigned int uint; |
188
4e686b771996
Further removal of hungarian notation
Santeri Piippo <crimsondusk64@gmail.com>
parents:
183
diff
changeset
|
40 | typedef unsigned short ushort; |
4e686b771996
Further removal of hungarian notation
Santeri Piippo <crimsondusk64@gmail.com>
parents:
183
diff
changeset
|
41 | typedef unsigned long ulong; |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
42 | typedef qint8 int8; |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
43 | typedef qint16 int16; |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
44 | typedef qint32 int32; |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
45 | typedef qint64 int64; |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
46 | typedef quint8 uint8; |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
47 | typedef quint16 uint16; |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
48 | typedef quint32 uint32; |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
49 | typedef quint64 uint64; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
50 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
51 | template<class T> using initlist = std::initializer_list<T>; |
293
a0ed563e14b2
Added support for regex-based primitive categorization
Santeri Piippo <crimsondusk64@gmail.com>
parents:
290
diff
changeset
|
52 | template<class T, class R> using pair = std::pair<T, R>; |
272
2074672a6554
Cleansed the string class, moved implementations from header to code file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
271
diff
changeset
|
53 | using std::size_t; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
54 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
55 | enum Axis { X, Y, Z }; |
274
d232fe4d88a6
Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
273
diff
changeset
|
56 | static const Axis g_Axes[3] = { X, Y, Z }; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
57 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
58 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
59 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
60 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
61 | // matrix |
381
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
62 | // |
274
d232fe4d88a6
Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
273
diff
changeset
|
63 | // A mathematical 3 x 3 matrix |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
64 | // ============================================================================= |
191
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
65 | class matrix { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
66 | public: |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
67 | matrix() {} |
191
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
68 | matrix (initlist<double> vals); |
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
69 | matrix (double fillval); |
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
70 | matrix (double vals[]); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
71 | |
191
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
72 | double determinant () const; |
268
778eed342ee4
Make LDMatrixObject's transform and pos members properties
Santeri Piippo <crimsondusk64@gmail.com>
parents:
261
diff
changeset
|
73 | matrix mult (matrix other) const; |
191
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
74 | void puts () const; |
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
75 | str stringRep () const; |
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
76 | void zero (); |
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
77 | double& val (const uint idx) { return m_vals[idx]; } |
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
78 | const double& val (const uint idx) const { return m_vals[idx]; } |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
79 | |
191
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
80 | matrix& operator= (matrix other); |
268
778eed342ee4
Make LDMatrixObject's transform and pos members properties
Santeri Piippo <crimsondusk64@gmail.com>
parents:
261
diff
changeset
|
81 | matrix operator* (matrix other) const { return mult (other); } |
191
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
82 | double& operator[] (const uint idx) { return m_vals[idx]; } |
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
83 | const double& operator[] (const uint idx) const { return m_vals[idx]; } |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
84 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
85 | private: |
191
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
86 | double m_vals[9]; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
87 | }; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
88 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
89 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
90 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
91 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
92 | // vertex |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
93 | // |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
94 | // Vertex class, contains a single point in 3D space. Not to be confused with |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
95 | // LDVertex, which is a vertex used in an LDraw part file. |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
96 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
97 | class vertex { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
98 | public: |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
99 | vertex() {} |
191
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
100 | vertex (double x, double y, double z); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
101 | |
191
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
102 | double& coord (const ushort n) { return m_coords[n]; } |
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
103 | const double& coord (const ushort n) const { return m_coords[n]; } |
268
778eed342ee4
Make LDMatrixObject's transform and pos members properties
Santeri Piippo <crimsondusk64@gmail.com>
parents:
261
diff
changeset
|
104 | vertex midpoint (const vertex& other); |
778eed342ee4
Make LDMatrixObject's transform and pos members properties
Santeri Piippo <crimsondusk64@gmail.com>
parents:
261
diff
changeset
|
105 | void move (const vertex& other); |
778eed342ee4
Make LDMatrixObject's transform and pos members properties
Santeri Piippo <crimsondusk64@gmail.com>
parents:
261
diff
changeset
|
106 | str stringRep (bool mangled) const; |
191
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
107 | void transform (matrix matr, vertex pos); |
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
108 | double& x () { return m_coords[X]; } |
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
109 | const double& x () const { return m_coords[X]; } |
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
110 | double& y () { return m_coords[Y]; } |
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
111 | const double& y () const { return m_coords[Y]; } |
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
112 | double& z () { return m_coords[Z]; } |
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
113 | const double& z () const { return m_coords[Z]; } |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
114 | |
268
778eed342ee4
Make LDMatrixObject's transform and pos members properties
Santeri Piippo <crimsondusk64@gmail.com>
parents:
261
diff
changeset
|
115 | vertex& operator+= (const vertex& other); |
270
f5f2353af0d9
fixed: subfiles and radials couldn't be moved, made add-picking with control work again despite its double-use as range picking, changed 'Name' to 'Title' in new part dialog and widened it a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
268
diff
changeset
|
116 | vertex operator+ (const vertex& other) const; |
191
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
117 | vertex operator/ (const double d) const; |
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
118 | vertex& operator/= (const double d); |
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
119 | bool operator== (const vertex& other) const; |
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
120 | bool operator!= (const vertex& other) const; |
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
121 | vertex operator- () const; |
261
c4ad4e3c6839
Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
253
diff
changeset
|
122 | int operator< (const vertex& other) const; |
191
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
123 | double& operator[] (const Axis ax); |
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
124 | const double& operator[] (const Axis ax) const; |
219
70eb948a2b02
Added ability to set the depth value to something else than 0.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
125 | double& operator[] (const int ax); |
70eb948a2b02
Added ability to set the depth value to something else than 0.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
126 | const double& operator[] (const int ax) const; |
191
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
127 | |
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
128 | private: |
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
129 | double m_coords[3]; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
130 | }; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
131 | |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
132 | // ============================================================================= |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
133 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
134 | // ============================================================================= |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
135 | // List |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
136 | // |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
137 | // Array class that wraps around std::deque |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
138 | // ============================================================================= |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
139 | template<class T> class List { |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
140 | public: |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
141 | typedef typename std::deque<T>::iterator it; |
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
142 | typedef typename std::deque<T>::const_iterator c_it; |
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
143 | typedef typename std::deque<T>::reverse_iterator r_it; |
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
144 | typedef typename std::deque<T>::const_reverse_iterator cr_it; |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
145 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
146 | List() {} |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
147 | List (initlist<T> vals) { |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
148 | m_vect = vals; |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
149 | } |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
150 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
151 | it begin() { |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
152 | return m_vect.begin(); |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
153 | } |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
154 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
155 | c_it begin() const { |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
156 | return m_vect.cbegin(); |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
157 | } |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
158 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
159 | it end() { |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
160 | return m_vect.end(); |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
161 | } |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
162 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
163 | c_it end() const { |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
164 | return m_vect.cend(); |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
165 | } |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
166 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
167 | r_it rbegin() { |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
168 | return m_vect.rbegin(); |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
169 | } |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
170 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
171 | cr_it crbegin() const { |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
172 | return m_vect.crbegin(); |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
173 | } |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
174 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
175 | r_it rend() { |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
176 | return m_vect.rend(); |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
177 | } |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
178 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
179 | cr_it crend() const { |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
180 | return m_vect.crend(); |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
181 | } |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
182 | |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
183 | void erase (ulong pos) { |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
184 | assert (pos < size()); |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
185 | m_vect.erase (m_vect.begin() + pos); |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
186 | } |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
187 | |
293
a0ed563e14b2
Added support for regex-based primitive categorization
Santeri Piippo <crimsondusk64@gmail.com>
parents:
290
diff
changeset
|
188 | T& push_back (const T& value) { |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
189 | m_vect.push_back (value); |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
190 | return m_vect[m_vect.size() - 1]; |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
191 | } |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
192 | |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
193 | void push_back (const List<T>& vals) { |
261
c4ad4e3c6839
Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
253
diff
changeset
|
194 | for (const T& val : vals) |
c4ad4e3c6839
Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
253
diff
changeset
|
195 | push_back (val); |
c4ad4e3c6839
Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
253
diff
changeset
|
196 | } |
c4ad4e3c6839
Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
253
diff
changeset
|
197 | |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
198 | bool pop (T& val) { |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
199 | if (size() == 0) |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
200 | return false; |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
201 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
202 | val = m_vect[size() - 1]; |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
203 | erase (size() - 1); |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
204 | return true; |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
205 | } |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
206 | |
293
a0ed563e14b2
Added support for regex-based primitive categorization
Santeri Piippo <crimsondusk64@gmail.com>
parents:
290
diff
changeset
|
207 | T& operator<< (const T& value) { |
a0ed563e14b2
Added support for regex-based primitive categorization
Santeri Piippo <crimsondusk64@gmail.com>
parents:
290
diff
changeset
|
208 | return push_back (value); |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
209 | } |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
210 | |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
211 | void operator<< (const List<T>& vals) { |
261
c4ad4e3c6839
Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
253
diff
changeset
|
212 | push_back (vals); |
c4ad4e3c6839
Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
253
diff
changeset
|
213 | } |
c4ad4e3c6839
Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
253
diff
changeset
|
214 | |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
215 | bool operator>> (T& value) { |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
216 | return pop (value); |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
217 | } |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
218 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
219 | List<T> reverse() const { |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
220 | List<T> rev; |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
221 | |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
222 | for (const T& val : c_rev<T> (*this)) |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
223 | rev << val; |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
224 | |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
225 | return rev; |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
226 | } |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
227 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
228 | void clear() { |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
229 | m_vect.clear(); |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
230 | } |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
231 | |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
232 | void insert (ulong pos, const T& value) { |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
233 | m_vect.insert (m_vect.begin() + pos, value); |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
234 | } |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
235 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
236 | void makeUnique() { |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
237 | // Remove duplicate entries. For this to be effective, the List must be |
261
c4ad4e3c6839
Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
253
diff
changeset
|
238 | // sorted first. |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
239 | sort(); |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
240 | it pos = std::unique (begin(), end()); |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
241 | resize (std::distance (begin(), pos)); |
261
c4ad4e3c6839
Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
253
diff
changeset
|
242 | } |
c4ad4e3c6839
Added ability to snap to pre-existing vertices while drawing, added changelog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
253
diff
changeset
|
243 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
244 | ulong size() const { |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
245 | return m_vect.size(); |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
246 | } |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
247 | |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
248 | T& operator[] (ulong n) { |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
249 | assert (n < size()); |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
250 | return m_vect[n]; |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
251 | } |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
252 | |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
253 | const T& operator[] (ulong n) const { |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
254 | assert (n < size()); |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
255 | return m_vect[n]; |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
256 | } |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
257 | |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
258 | void resize (std::ptrdiff_t size) { |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
259 | m_vect.resize (size); |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
260 | } |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
261 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
262 | void sort() { |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
263 | std::sort (begin(), end()); |
253
0737c217a54d
Added ability to have multiple GLRenderers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
264 | } |
0737c217a54d
Added ability to have multiple GLRenderers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
251
diff
changeset
|
265 | |
273
0a9141118630
Restructed recent files handling, the list shouldn't screw the hell up anymore.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
272
diff
changeset
|
266 | ulong find (const T& needle) { |
0a9141118630
Restructed recent files handling, the list shouldn't screw the hell up anymore.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
272
diff
changeset
|
267 | ulong i = 0; |
0a9141118630
Restructed recent files handling, the list shouldn't screw the hell up anymore.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
272
diff
changeset
|
268 | for (const T& hay : *this) { |
0a9141118630
Restructed recent files handling, the list shouldn't screw the hell up anymore.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
272
diff
changeset
|
269 | if (hay == needle) |
0a9141118630
Restructed recent files handling, the list shouldn't screw the hell up anymore.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
272
diff
changeset
|
270 | return i; |
0a9141118630
Restructed recent files handling, the list shouldn't screw the hell up anymore.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
272
diff
changeset
|
271 | |
0a9141118630
Restructed recent files handling, the list shouldn't screw the hell up anymore.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
272
diff
changeset
|
272 | i++; |
0a9141118630
Restructed recent files handling, the list shouldn't screw the hell up anymore.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
272
diff
changeset
|
273 | } |
0a9141118630
Restructed recent files handling, the list shouldn't screw the hell up anymore.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
272
diff
changeset
|
274 | |
0a9141118630
Restructed recent files handling, the list shouldn't screw the hell up anymore.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
272
diff
changeset
|
275 | return -1u; |
0a9141118630
Restructed recent files handling, the list shouldn't screw the hell up anymore.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
272
diff
changeset
|
276 | } |
0a9141118630
Restructed recent files handling, the list shouldn't screw the hell up anymore.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
272
diff
changeset
|
277 | |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
278 | private: |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
279 | std::deque<T> m_vect; |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
280 | }; |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
219
diff
changeset
|
281 | |
487
a350c4b25133
Merge branch 'master' into gl, reworked stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents:
461
diff
changeset
|
282 | template<class T> static inline T& operator>> (const T& a, List<T>& b) { |
a350c4b25133
Merge branch 'master' into gl, reworked stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents:
461
diff
changeset
|
283 | b.insert (0, a); |
a350c4b25133
Merge branch 'master' into gl, reworked stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents:
461
diff
changeset
|
284 | return b; |
a350c4b25133
Merge branch 'master' into gl, reworked stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents:
461
diff
changeset
|
285 | } |
a350c4b25133
Merge branch 'master' into gl, reworked stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents:
461
diff
changeset
|
286 | |
287
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
287 | // ============================================================================= |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
288 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
289 | // ============================================================================= |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
290 | // ListReverser (aka rev) |
287
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
291 | // |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
292 | // Helper class used to reverse-iterate Lists in range-for-loops. |
287
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
293 | // ============================================================================= |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
294 | template<class T> class ListReverser { |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
295 | public: |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
296 | typedef typename List<T>::r_it it; |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
297 | |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
298 | ListReverser (List<T>& vect) { |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
299 | m_vect = &vect; |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
300 | } |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
301 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
302 | it begin() { |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
303 | return m_vect->rbegin(); |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
304 | } |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
305 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
306 | it end() { |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
307 | return m_vect->rend(); |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
308 | } |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
309 | |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
310 | private: |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
311 | List<T>* m_vect; |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
312 | }; |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
313 | |
287
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
314 | // ============================================================================= |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
315 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
316 | // ============================================================================= |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
317 | // ConstListReverser (aka c_rev) |
287
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
318 | // |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
319 | // Like ListReverser, except works on const Lists. |
287
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
320 | // ============================================================================= |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
321 | template<class T> class ConstListReverser { |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
322 | public: |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
323 | typedef typename List<T>::cr_it it; |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
324 | |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
325 | ConstListReverser (const List<T>& vect) { |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
326 | m_vect = &vect; |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
327 | } |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
328 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
329 | it begin() const { |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
330 | return m_vect->crbegin(); |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
331 | } |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
332 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
333 | it end() const { |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
334 | return m_vect->crend(); |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
335 | } |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
336 | |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
337 | private: |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
338 | const List<T>* m_vect; |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
339 | }; |
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
340 | |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
341 | template<class T> using rev = ListReverser<T>; |
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
342 | template<class T> using c_rev = ConstListReverser<T>; |
271
d5ec224c1879
Laid down the foundations of the new history system
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
343 | |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
344 | // ============================================================================= |
287
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
345 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
346 | // ============================================================================= |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
347 | // StringFormatArg |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
348 | // |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
349 | // Converts a given value into a string that can be retrieved with ::value(). |
287
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
350 | // Used as the argument type to the formatting functions, hence its name. |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
351 | // ============================================================================= |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
352 | class StringFormatArg { |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
353 | public: |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
354 | StringFormatArg (const str& v); |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
355 | StringFormatArg (const char& v); |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
356 | StringFormatArg (const uchar& v); |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
357 | StringFormatArg (const qchar& v); |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
358 | |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
359 | #define NUMERIC_FORMAT_ARG(T,C) \ |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
360 | StringFormatArg (const T& v) { \ |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
361 | char valstr[32]; \ |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
362 | sprintf (valstr, "%" #C, v); \ |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
363 | m_val = valstr; \ |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
364 | } |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
365 | |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
366 | NUMERIC_FORMAT_ARG (int, d) |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
367 | NUMERIC_FORMAT_ARG (short, d) |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
368 | NUMERIC_FORMAT_ARG (long, ld) |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
369 | NUMERIC_FORMAT_ARG (uint, u) |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
370 | NUMERIC_FORMAT_ARG (ushort, u) |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
371 | NUMERIC_FORMAT_ARG (ulong, lu) |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
372 | |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
373 | StringFormatArg (const float& v); |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
374 | StringFormatArg (const double& v); |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
375 | StringFormatArg (const vertex& v); |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
376 | StringFormatArg (const matrix& v); |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
377 | StringFormatArg (const char* v); |
461
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
456
diff
changeset
|
378 | StringFormatArg (const StringConfig& v); |
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
456
diff
changeset
|
379 | StringFormatArg (const IntConfig& v); |
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
456
diff
changeset
|
380 | StringFormatArg (const FloatConfig& v); |
322
5e701c3c3d8e
Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
297
diff
changeset
|
381 | StringFormatArg (const void* v); |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
382 | |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
383 | template<class T> StringFormatArg (const List<T>& v) { |
297
2cbd8ac8293b
Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
293
diff
changeset
|
384 | m_val = "{ "; |
2cbd8ac8293b
Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
293
diff
changeset
|
385 | |
2cbd8ac8293b
Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
293
diff
changeset
|
386 | uint i = 0; |
2cbd8ac8293b
Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
293
diff
changeset
|
387 | for (const T& it : v) { |
2cbd8ac8293b
Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
293
diff
changeset
|
388 | if (i++) |
2cbd8ac8293b
Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
293
diff
changeset
|
389 | m_val += ", "; |
2cbd8ac8293b
Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
293
diff
changeset
|
390 | |
2cbd8ac8293b
Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
293
diff
changeset
|
391 | StringFormatArg arg (it); |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
392 | m_val += arg.value(); |
297
2cbd8ac8293b
Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
293
diff
changeset
|
393 | } |
2cbd8ac8293b
Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
293
diff
changeset
|
394 | |
2cbd8ac8293b
Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
293
diff
changeset
|
395 | if (i) |
2cbd8ac8293b
Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
293
diff
changeset
|
396 | m_val += " "; |
2cbd8ac8293b
Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
293
diff
changeset
|
397 | |
2cbd8ac8293b
Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
293
diff
changeset
|
398 | m_val += "}"; |
2cbd8ac8293b
Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
293
diff
changeset
|
399 | } |
2cbd8ac8293b
Added license header to primitives.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
293
diff
changeset
|
400 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
401 | str value() const { return m_val; } |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
402 | private: |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
403 | str m_val; |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
404 | }; |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
405 | |
287
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
406 | // ============================================================================= |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
407 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
408 | // ============================================================================= |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
409 | // File |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
410 | // |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
411 | // A file interface with simple interface and support for range-for-loops. |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
412 | // ============================================================================= |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
413 | class File { |
403
43c1f5b17bfd
Made File::iterator private - it's used only for range-for loops so it should not be used by anything else than File itself.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
402
diff
changeset
|
414 | private: |
287
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
415 | // Iterator class to enable range-for-loop support. Rough hack.. don't use directly! |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
416 | class iterator { |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
417 | public: |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
418 | iterator() : m_file (null) {} // end iterator has m_file == null |
288
2980d7fd948e
Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents:
287
diff
changeset
|
419 | iterator (File* f); |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
420 | void operator++(); |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
421 | str operator*(); |
287
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
422 | bool operator== (iterator& other); |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
423 | bool operator!= (iterator& other); |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
424 | |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
425 | private: |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
426 | File* m_file; |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
427 | str m_text; |
288
2980d7fd948e
Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents:
287
diff
changeset
|
428 | bool m_gotdata = false; |
287
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
429 | }; |
403
43c1f5b17bfd
Made File::iterator private - it's used only for range-for loops so it should not be used by anything else than File itself.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
402
diff
changeset
|
430 | |
43c1f5b17bfd
Made File::iterator private - it's used only for range-for loops so it should not be used by anything else than File itself.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
402
diff
changeset
|
431 | public: |
287
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
432 | enum OpenType { |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
433 | Read, |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
434 | Write, |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
435 | Append |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
436 | }; |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
437 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
438 | File(); |
287
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
439 | File (str path, File::OpenType rtype); |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
440 | File (FILE* fp, File::OpenType rtype); |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
441 | ~File(); |
287
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
442 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
443 | bool atEnd() const; |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
444 | iterator begin(); |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
445 | void close(); |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
446 | iterator& end(); |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
447 | bool flush(); |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
448 | bool isNull() const; |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
449 | bool readLine (str& line); |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
450 | void rewind(); |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
451 | bool open (FILE* fp, OpenType rtype); |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
452 | bool open (str path, OpenType rtype, FILE* fp = null); |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
453 | void write (str msg); |
288
2980d7fd948e
Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents:
287
diff
changeset
|
454 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
455 | bool operator!() const; |
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
456 | operator bool() const; |
287
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
457 | |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
458 | private: |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
459 | QFile* m_file; |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
460 | QTextStream* m_textstream; |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
461 | iterator m_endIterator; |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
462 | }; |
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
463 | |
380
e442d9b7c251
Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
322
diff
changeset
|
464 | // ============================================================================= |
381
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
465 | // LDBoundingBox |
380
e442d9b7c251
Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
322
diff
changeset
|
466 | // |
e442d9b7c251
Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
322
diff
changeset
|
467 | // The bounding box is the box that encompasses a given set of objects. |
e442d9b7c251
Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
322
diff
changeset
|
468 | // v0 is the minimum vertex, v1 is the maximum vertex. |
e442d9b7c251
Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
322
diff
changeset
|
469 | // ============================================================================= |
381
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
470 | class LDBoundingBox { |
380
e442d9b7c251
Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
322
diff
changeset
|
471 | READ_PROPERTY (bool, empty, setEmpty) |
e442d9b7c251
Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
322
diff
changeset
|
472 | READ_PROPERTY (vertex, v0, setV0) |
e442d9b7c251
Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
322
diff
changeset
|
473 | READ_PROPERTY (vertex, v1, setV1) |
e442d9b7c251
Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
322
diff
changeset
|
474 | |
e442d9b7c251
Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
322
diff
changeset
|
475 | public: |
381
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
476 | LDBoundingBox(); |
380
e442d9b7c251
Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
322
diff
changeset
|
477 | void reset(); |
e442d9b7c251
Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
322
diff
changeset
|
478 | void calculate(); |
e442d9b7c251
Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
322
diff
changeset
|
479 | double size() const; |
e442d9b7c251
Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
322
diff
changeset
|
480 | void calcObject (LDObject* obj); |
e442d9b7c251
Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
322
diff
changeset
|
481 | void calcVertex (const vertex& v); |
e442d9b7c251
Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
322
diff
changeset
|
482 | vertex center() const; |
e442d9b7c251
Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
322
diff
changeset
|
483 | |
381
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
484 | LDBoundingBox& operator<< (LDObject* obj); |
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
485 | LDBoundingBox& operator<< (const vertex& v); |
380
e442d9b7c251
Moved the bbox class to types
Santeri Piippo <crimsondusk64@gmail.com>
parents:
322
diff
changeset
|
486 | }; |
287
3fcccd8c3357
Added a File type that wraps around QFile and provides stuff like a null file and range-for-iterating
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
487 | |
381
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
488 | // Formatter function |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
381
diff
changeset
|
489 | str DoFormat (List<StringFormatArg> args); |
381
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
490 | |
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
491 | // printf replacement |
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
492 | void doPrint (File& f, initlist<StringFormatArg> args); |
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
493 | void doPrint (FILE* f, initlist<StringFormatArg> args); // heh |
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
494 | |
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
495 | // log() - universal access to the message log. Defined here so that I don't have |
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
496 | // to include messagelog.h here and recompile everything every time that file changes. |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
497 | void DoLog (std::initializer_list<StringFormatArg> args); |
381
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
498 | |
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
499 | // Macros to access these functions |
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
500 | # ifndef IN_IDE_PARSER |
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
501 | #define fmt(...) DoFormat ({__VA_ARGS__}) |
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
502 | # define print(...) doPrint (g_file_stdout, {__VA_ARGS__}) |
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
503 | # define fprint(F, ...) doPrint (F, {__VA_ARGS__}) |
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
504 | # define log(...) DoLog({ __VA_ARGS__ }); |
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
505 | #else |
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
506 | str fmt (const char* fmtstr, ...); |
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
507 | void print (const char* fmtstr, ...); |
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
508 | void fprint (File& f, const char* fmtstr, ...); |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
403
diff
changeset
|
509 | void log (const char* fmtstr, ...); |
381
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
510 | #endif |
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
511 | |
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
512 | extern File g_file_stdout; |
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
513 | extern File g_file_stderr; |
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
514 | extern const vertex g_origin; // Vertex at (0, 0, 0) |
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
515 | extern const matrix g_identity; // Identity matrix |
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
516 | |
456 | 517 | static const double pi = 3.14159265358979323846; |
381
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
518 | |
241f65769a57
restructure; removed g_BBox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
380
diff
changeset
|
519 | #endif // TYPES_H |