20 // This file is included one way or another in every source file of LDForge. |
20 // This file is included one way or another in every source file of LDForge. |
21 // Stuff defined and included here is universally included. |
21 // Stuff defined and included here is universally included. |
22 |
22 |
23 #ifndef LDFORGE_MAIN_H |
23 #ifndef LDFORGE_MAIN_H |
24 #define LDFORGE_MAIN_H |
24 #define LDFORGE_MAIN_H |
25 |
|
26 // Hack to make KDevelop parse QString properly. Q_REQUIRED_RESULT expands into |
|
27 // an __attribute__((warn_unused_result)) KDevelop's lexer doesn't seem to |
|
28 // understand, yielding an error and leaving some methods unlexed. |
|
29 // |
|
30 // The following first includes <QChar> to get Q_REQUIRED_RESULT defined first, |
|
31 // then re-defining it as nothing. This causes Q_REQUIRED_RESULT to essentially |
|
32 // "vanish" from QString's methods when KDevelop lexes them. |
|
33 // |
|
34 // Similar reasoning for Q_DECL_HIDDEN, except with Q_OBJECT this time. |
|
35 #ifdef IN_IDE_PARSER |
|
36 # include <QChar> |
|
37 # undef Q_REQUIRED_RESULT |
|
38 # undef Q_DECL_HIDDEN |
|
39 # define Q_REQUIRED_RESULT |
|
40 # define Q_DECL_HIDDEN |
|
41 #endif |
|
42 |
25 |
43 #include <stdio.h> |
26 #include <stdio.h> |
44 #include <stdlib.h> |
27 #include <stdlib.h> |
45 #include <stdint.h> |
28 #include <stdint.h> |
46 #include <stdarg.h> |
29 #include <stdarg.h> |
106 |
85 |
107 // Replace assert with a version that shows a GUI dialog if possible. |
86 // Replace assert with a version that shows a GUI dialog if possible. |
108 // On Windows I just can't get the actual error messages otherwise. |
87 // On Windows I just can't get the actual error messages otherwise. |
109 void assertionFailure (const char* file, int line, const char* funcname, const char* expr); |
88 void assertionFailure (const char* file, int line, const char* funcname, const char* expr); |
110 |
89 |
111 #ifdef assert |
90 #undef assert |
112 # undef assert |
|
113 #endif // assert |
|
114 |
91 |
115 #ifdef DEBUG |
92 #ifdef DEBUG |
116 # define assert(N) { ((N) ? (void) 0 : assertionFailure (__FILE__, __LINE__, FUNCNAME, #N)); } |
93 # define assert(N) { ((N) ? (void) 0 : assertionFailure (__FILE__, __LINE__, FUNCNAME, #N)); } |
117 #else |
94 #else |
118 # define assert(N) {} |
95 # define assert(N) {} |
119 #endif // DEBUG |
96 #endif // DEBUG |
120 |
97 |
121 // Version string identifier |
98 // Version string identifier |
122 QString versionString(); |
99 QString versionString(); |
123 QString fullVersionString(); |
100 QString fullVersionString(); |
|
101 |
|
102 QString getApplicationDirectory(); |
124 |
103 |
125 #define properties private |
104 #define properties private |
126 #define typedefs public |
105 #define typedefs public |
127 #define for_axes(AX) for (const Axis AX : std::initializer_list<const Axis> ({X, Y, Z})) |
106 #define for_axes(AX) for (const Axis AX : std::initializer_list<const Axis> ({X, Y, Z})) |
128 |
107 |