src/basics.h

changeset 1062
4119185b56ca
parent 1058
695edd4f0411
child 1063
1f15c52c11f6
equal deleted inserted replaced
1061:273333700685 1062:4119185b56ca
20 #include <QString> 20 #include <QString>
21 #include <QObject> 21 #include <QObject>
22 #include <QStringList> 22 #include <QStringList>
23 #include <QMetaType> 23 #include <QMetaType>
24 #include <QVector3D> 24 #include <QVector3D>
25 #include <QVector>
25 #include <functional> 26 #include <functional>
26 #include <math.h> 27 #include <math.h>
27 #include "macros.h" 28 #include "macros.h"
28 #include "transform.h" 29 #include "transform.h"
29 #include "types/matrix.h" 30 #include "types/matrix.h"
210 return x >= EnumLimits<Enum>::First and x <= EnumLimits<Enum>::Last; 211 return x >= EnumLimits<Enum>::First and x <= EnumLimits<Enum>::Last;
211 } 212 }
212 213
213 double getRadialPoint(int segment, int divisions, double(*func)(double)); 214 double getRadialPoint(int segment, int divisions, double(*func)(double));
214 QVector<QLineF> makeCircle(int segments, int divisions, double radius); 215 QVector<QLineF> makeCircle(int segments, int divisions, double radius);
216
217 //
218 // Get the amount of elements in something.
219 //
220 template<typename T, size_t N>
221 int length(T(&)[N])
222 {
223 return N;
224 }
225
226 static inline int length(const QString& string)
227 {
228 return string.size();
229 }
230
231 template<typename T>
232 int length(const QVector<T>& vector)
233 {
234 return vector.size();
235 }

mercurial