Added some REFLECT_ macros, so the reflection code doesn't have to mess with the internals of reflection.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@218 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-03-18 22:45:02 +00:00
parent f2ce80d88a
commit dcfee659d0
10 changed files with 52 additions and 25 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ String IncludePackage::typeName() const { return _("include"); }
IMPLEMENT_REFLECTION(IncludePackage) {
REFLECT_BASE(Packaged);
if (tag.reading()) {
REFLECT_IF_READING {
// ingore
String version;
REFLECT(version);
+28
View File
@@ -101,6 +101,34 @@
/// Declare that the variables of a base class should also be reflected
#define REFLECT_BASE(Base) Base::reflect_impl(tag)
/// Reflect a group of declarations only when reading
/** Usage:
* @code
* REFLECT_IF_READING {
* // only executed by Reader
* }
* @endcode
*/
#define REFLECT_IF_READING if (tag.reading())
/// Reflect a group of declarations only when *not* reading
/** Usage:
* @code
* REFLECT_IF_NOT_READING {
* // only executed by Writer, GetMember, GetDefaultMember
* }
* @endcode
*/
#define REFLECT_IF_NOT_READING if (!tag.reading())
/// Add an alias for backwards compatability
/** If a key 'old' is encountered in the input file, it is interpreted as 'new' for versions < version
* Example:
* @code
* REFLECT_ALIAS(300, "style", "stylesheet") // prior to 0.3.0 style was used instead of stylesheet
* @encode
*/
#define REFLECT_ALIAS(version, old, new) tag.addAlias(version, _(old), _(new))
// ----------------------------------------------------------------------------- : Reflecting enums