[Companion] Refactor settings system (CompStoreObj/AppData/etc):
~ All stored properties are fully dynamic, using an extended version of the Qt Property System; ~ CompStoreObj is now QObject subclass; + All properties now have change notifier signals; ~ Do not store default values in settings; + Add _reset() and _default() functions for each property; + Settings import now ignores all non-existent properties automatically; + Add settings export functions; + Add more version macros; ~ Remove template functions; ~ Move DownloadBranchType and create NewModelAction enums and register with Qt meta system; ~ Multiple efficiency and optimization changes (const functions, literals, etc).
This commit is contained in:
@@ -21,10 +21,26 @@
|
||||
#ifndef _MACROS_H_
|
||||
#define _MACROS_H_
|
||||
|
||||
#include <QDataStream>
|
||||
#include <iterator>
|
||||
|
||||
// #define DIM(arr) (sizeof((arr))/sizeof((arr)[0]))
|
||||
// new way for c++11
|
||||
#define DIM(arr__) ((size_t)(std::end((arr__)) - std::begin((arr__))))
|
||||
|
||||
#ifndef CONCATENATE
|
||||
#define CONCATENATE_IMPL(A, B) A ## B
|
||||
#define CONCATENATE(A, B) CONCATENATE_IMPL(A, B)
|
||||
#endif
|
||||
|
||||
#define CREATE_ENUM_STREAM_OPS3(functype, type, datatype) \
|
||||
functype QDataStream& operator << (QDataStream &out, type &e) { return out << (datatype&)e; } \
|
||||
functype QDataStream& operator >> (QDataStream &in, type &e) { in >> (datatype&)e; return in; }
|
||||
|
||||
#define CREATE_ENUM_STREAM_OPS2(type, datatype) CREATE_ENUM_STREAM_OPS3(inline, type, datatype)
|
||||
#define CREATE_ENUM_STREAM_OPS(type) CREATE_ENUM_STREAM_OPS2(type, quint32)
|
||||
|
||||
#define CREATE_ENUM_FRIEND_STREAM_OPS2(type, datatype) CREATE_ENUM_STREAM_OPS3(friend inline , type, datatype)
|
||||
#define CREATE_ENUM_FRIEND_STREAM_OPS(type) CREATE_ENUM_FRIEND_STREAM_OPS2(type, quint32)
|
||||
|
||||
#endif // _MACROS_H_
|
||||
|
||||
Reference in New Issue
Block a user