00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef SHAREDMACROS_H
00025 #define SHAREDMACROS_H
00026
00027
00028 #include <QObject>
00029
00030
00031 #ifndef DECLARE_CLASS_TYPE(TYPE)
00032 #define DECLARE_CLASS_TYPE(TYPE) \
00033 static int classType() { return TYPE; } \
00034 virtual int type() const { return TYPE; }
00035 #endif
00036
00037
00038 #ifndef DECLARE_CLASS_CATEGORY(CATEGORY)
00039 #define DECLARE_CLASS_CATEGORY(CATEGORY) \
00040 static int classCategory() { return CATEGORY; } \
00041 virtual int category() const { return CATEGORY; }
00042 #endif
00043
00044
00045 #ifndef DECLARE_CLASS_KEY(KEY)
00046 #define DECLARE_CLASS_KEY(KEY) \
00047 static const QByteArray& classKey() { \
00048 static const QByteArray str(KEY); \
00049 return str; \
00050 } \
00051 virtual const QByteArray& key() const { return classKey(); }
00052 #endif
00053
00054 #ifndef DECLARE_CLASS_KEY_NONREF(KEY)
00055 #define DECLARE_CLASS_KEY_NONREF(KEY) \
00056 static QByteArray classKey() { \
00057 static const QByteArray str(KEY); \
00058 return str; \
00059 } \
00060 virtual QByteArray key() const { return classKey(); }
00061 #endif
00062
00063
00064 #ifndef DECLARE_CLASS_TITLE(TITLE)
00065 #define DECLARE_CLASS_TITLE(TITLE) \
00066 static const QString& classTitle() { \
00067 static const QString str( QObject::tr(TITLE) ); \
00068 return str; \
00069 } \
00070 virtual const QString& title() const { return classTitle(); }
00071 #endif
00072
00073 #ifndef DECLARE_CLASS_TITLE_NONREF(TITLE)
00074 #define DECLARE_CLASS_TITLE_NONREF(TITLE) \
00075 static QString classTitle() { \
00076 static const QString str( QObject::tr(TITLE) ); \
00077 return str; \
00078 } \
00079 virtual QString title() const { return classTitle(); }
00080 #endif
00081
00082
00083 #ifndef DECLARE_CLASS_TITLE_NONTR(TITLE)
00084 #define DECLARE_CLASS_TITLE_NONTR(TITLE) \
00085 static const QString& classTitle() { \
00086 static const QString str( TITLE ); \
00087 return str; \
00088 } \
00089 virtual const QString& title() const { return classTitle(); }
00090 #endif
00091
00092
00093 #ifndef DECLARE_CLASS_DESCRIPTION(DESCRIPTION)
00094 #define DECLARE_CLASS_DESCRIPTION(DESCRIPTION) \
00095 static const QString& classDescription() { \
00096 static const QString str( QObject::tr(DESCRIPTION) ); \
00097 return str; \
00098 } \
00099 virtual const QString& description() const { return classDescription(); }
00100 #endif
00101
00102 #ifndef DECLARE_CLASS_DESCRIPTION_NONREF(DESCRIPTION)
00103 #define DECLARE_CLASS_DESCRIPTION_NONREF(DESCRIPTION) \
00104 static QString classDescription() { \
00105 static const QString str( QObject::tr(DESCRIPTION) ); \
00106 return str; \
00107 } \
00108 virtual QString description() const { return classDescription(); }
00109 #endif
00110
00111
00112 #ifndef DECLARE_CLASS_DESCRIPTION_NONTR(DESCRIPTION)
00113 #define DECLARE_CLASS_DESCRIPTION_NONTR(DESCRIPTION) \
00114 static const QString& classDescription() { \
00115 static const QString str( DESCRIPTION ); \
00116 return str; \
00117 } \
00118 virtual const QString& description() const { return classDescription(); }
00119 #endif
00120
00121 #ifndef DECLARE_CLASS_DESCRIPTION_METHODS
00122 #define DECLARE_CLASS_DESCRIPTION_METHODS \
00123 static const QString& classDescription(); \
00124 virtual const QString& description() const { return classDescription(); }
00125 #endif
00126
00127 #ifndef DECLARE_CLASS_DESCRIPTION_METHODS_NONREF
00128 #define DECLARE_CLASS_DESCRIPTION_METHODS_NONREF \
00129 static QString classDescription(); \
00130 virtual QString description() const { return classDescription(); }
00131 #endif
00132
00133
00134 #endif // ! SHAREDMACROS_H