675:450827da2376 | 676:f7f965742fd5 |
---|---|
21 | 21 |
22 #include <QString> | 22 #include <QString> |
23 #include <QObject> | 23 #include <QObject> |
24 #include <QStringList> | 24 #include <QStringList> |
25 #include <QMetaType> | 25 #include <QMetaType> |
26 #include <QVector> | |
26 #include "PropertyMacro.h" | 27 #include "PropertyMacro.h" |
27 | 28 |
28 class LDObject; | 29 class LDObject; |
29 class QFile; | 30 class QFile; |
30 class QTextStream; | 31 class QTextStream; |
229 StringFormatArg (const void* a) | 230 StringFormatArg (const void* a) |
230 { | 231 { |
231 m_val.sprintf ("%p", a); | 232 m_val.sprintf ("%p", a); |
232 } | 233 } |
233 | 234 |
234 template<class T> StringFormatArg (const QList<T>& a) | 235 template<class T, class R> void initFromList (const T& a) |
235 { | 236 { |
236 m_val = "{ "; | 237 m_val = "{ "; |
237 | 238 |
238 for (const T& it : a) | 239 for (const R& it : a) |
239 { | 240 { |
240 if (&it != &a.first()) | 241 if (&it != &a.first()) |
241 m_val += ", "; | 242 m_val += ", "; |
242 | 243 |
243 StringFormatArg arg (it); | 244 StringFormatArg arg (it); |
246 | 247 |
247 if (!a.isEmpty()) | 248 if (!a.isEmpty()) |
248 m_val += " "; | 249 m_val += " "; |
249 | 250 |
250 m_val += "}"; | 251 m_val += "}"; |
252 } | |
253 | |
254 template<class T> StringFormatArg (const QList<T>& a) | |
255 { | |
256 initFromList<QList<T>, T> (a); | |
257 } | |
258 | |
259 template<class T> StringFormatArg (const QVector<T>& a) | |
260 { | |
261 initFromList<QVector<T>, T> (a); | |
251 } | 262 } |
252 | 263 |
253 inline QString value() const | 264 inline QString value() const |
254 { | 265 { |
255 return m_val; | 266 return m_val; |