src/format.h

Sat, 06 Jan 2018 17:57:03 +0200

author
Santeri Piippo
date
Sat, 06 Jan 2018 17:57:03 +0200
changeset 1225
ffcbdce88978
parent 1222
34def2630300
child 1231
ce0c9f2e6b9c
permissions
-rw-r--r--

simplify

655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
1222
34def2630300 happy new year 2018
Santeri Piippo
parents: 1221
diff changeset
3 * Copyright (C) 2013 - 2018 Teemu Piippo
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #pragma once
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #include "basics.h"
795
195fa1fff9c3 - changed all color usage to use LDColor classes instead of color indices. Added support for direct colors.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 794
diff changeset
21 #include "colors.h"
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22
1221
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
23 extern void printToLog(const QString& msg);
1011
4fdd74a04790 Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1010
diff changeset
24
1221
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
25
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
26 inline const QString& toString(const QString& text)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27 {
1221
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
28 return text;
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
29 }
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
30
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
31
1221
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
32 inline QString toString(char character)
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
33 {
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
34 return QString {character};
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
35 }
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
36
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37
1221
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
38 inline QString toString(unsigned char character)
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
39 {
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
40 return QString {character};
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
41 }
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
42
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
43
1221
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
44 inline QString toString(QChar character)
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
45 {
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
46 return character;
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
47 }
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
49
1221
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
50 inline QString toString(int value)
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
51 {
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
52 return QString::number(value);
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
53 }
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
54
1011
4fdd74a04790 Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1010
diff changeset
55
1221
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
56 inline QString toString(short int value)
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
57 {
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
58 return QString::number(value);
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
59 }
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
60
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
61
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
62 inline QString toString(long int value)
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
63 {
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
64 return QString::number(value);
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
65 }
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
66
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
67
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
68 inline QString toString(unsigned int value)
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
69 {
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
70 return QString::number(value);
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
71 }
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
72
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
73
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
74 inline QString toString(unsigned long int value)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
75 {
1221
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
76 return QString::number(value);
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
77 }
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
78
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
79
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
80 inline QString toString(unsigned short int value)
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
81 {
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
82 return QString::number(value);
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
83 }
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
84
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
85
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
86 inline QString toString(float value)
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
87 {
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
88 return QString::number(value);
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
89 }
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
90
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
91
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
92 inline QString toString(double value)
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
93 {
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
94 return QString::number(value);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
95 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
96
1011
4fdd74a04790 Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1010
diff changeset
97
1221
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
98 inline QString toString(const Vertex& position)
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
99 {
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
100 return position.toString();
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
101 }
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
102
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
103
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
104 inline QString toString(const Matrix& transformation)
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
105 {
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
106 return transformation.toString();
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
107 }
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
108
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
109
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
110 inline QString toString(const char* text)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
111 {
1221
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
112 return text;
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
113 }
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
114
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
115
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
116 inline QString toString(LDColor color)
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
117 {
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
118 return color.indexString();
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
119 }
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
120
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
121
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
122 inline QString toString(const void* pointer)
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
123 {
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
124 QString result;
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
125 result.sprintf("%p", pointer);
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
126 return result;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
127 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
128
1011
4fdd74a04790 Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1010
diff changeset
129
1221
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
130 template<typename T, int N>
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
131 QString toString(T(&array)[N])
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
132 {
1221
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
133 QString rep = "{";
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
134
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
135 for (int i = 0; i < N; ++i)
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
136 {
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
137 if (i > 0)
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
138 rep += ", ";
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
139 rep += toString(array[i]);
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
140 }
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
141
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
142 rep += "}";
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
143 return rep;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
144 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
145
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
146
1221
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
147 template<typename T>
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
148 QString toString(const QList<T>& list)
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
149 {
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
150 QString result = "{";
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
151
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
152 for (const T& element : list)
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
153 {
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
154 if (&element != &list.first())
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
155 result += ", ";
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
156
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
157 result += toString(element);
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
158 }
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
159
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
160 result += "}";
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
161 return result;
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
162 }
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
163
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
164
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
165 /*
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
166 * Formats the message with the given args using QString::arg().
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
167 */
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
168 template<typename Arg1, typename... Rest>
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
169 QString format(const QString& string, Arg1 arg1, Rest&&... rest)
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
170 {
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
171 return format(string.arg(toString(arg1)), rest...);
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
172 }
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
173
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
174
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
175 template<typename... Rest>
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
176 const QString& format(const QString& string)
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
177 {
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
178 return string;
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
179 }
1011
4fdd74a04790 Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1010
diff changeset
180
4fdd74a04790 Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1010
diff changeset
181
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
182 // Format and print the given args to the message log.
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
183 template<typename... Args>
1221
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
184 void print(const QString& formatString, Args&&... args)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
185 {
1221
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
186 printToLog(format(formatString, args...));
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
187 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
188
1221
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
189
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
190 template<typename... Args>
1221
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
191 void fprint(FILE* filePointer, const QString& formatString, Args&&... args)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
192 {
1221
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
193 fprintf(filePointer, "%s", qPrintable(format(formatString, args...)));
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
194 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
195
1011
4fdd74a04790 Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1010
diff changeset
196
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
197 template<typename... Args>
1221
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
198 void fprint(QIODevice& device, const QString& formatString, Args&&... args)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
199 {
1221
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
200 device.write(format(formatString, args...).toUtf8());
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
201 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
202
1011
4fdd74a04790 Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1010
diff changeset
203
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
204 // Exactly like print() except no-op in release builds.
1221
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
205 #ifndef RELEASE
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
206 template<typename... Args>
1221
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
207 void dprint(const QString& formatString, Args&&... args)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
208 {
1221
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
209 print(formatString, args...);
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
210 }
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
211 #else
1221
7f6715f08faf revamped format.h
Santeri Piippo
parents: 1217
diff changeset
212 template<typename... Args>
1217
314e12e23c3a fix paren style
Santeri Piippo
parents: 1011
diff changeset
213 void dprint(QString, Args...) {}
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
214 #endif

mercurial