Made DEFINE_FLAG_ACCESS_METHODS a function macro

Fri, 18 Nov 2016 03:01:38 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Fri, 18 Nov 2016 03:01:38 +0200
changeset 1059
7800dbb00632
parent 1058
695edd4f0411
child 1060
940b3e565ac3

Made DEFINE_FLAG_ACCESS_METHODS a function macro

src/ldDocument.h file | annotate | diff | comparison | revisions
src/macros.h file | annotate | diff | comparison | revisions
--- a/src/ldDocument.h	Fri Nov 18 02:56:53 2016 +0200
+++ b/src/ldDocument.h	Fri Nov 18 03:01:38 2016 +0200
@@ -128,7 +128,7 @@
 	LDGLData* m_gldata;
 	DocumentManager* m_manager;
 
-	DEFINE_FLAG_ACCESS_METHODS
+	DEFINE_FLAG_ACCESS_METHODS(m_flags)
 	void addKnownVertices (LDObject* obj);
 	void mergeVertices();
 };
--- a/src/macros.h	Fri Nov 18 02:56:53 2016 +0200
+++ b/src/macros.h	Fri Nov 18 03:01:38 2016 +0200
@@ -59,7 +59,7 @@
 
 #define ConfigOption(...)
 
-#define DEFINE_FLAG_ACCESS_METHODS \
-	bool checkFlag(Flag flag) const { return !!(m_flags & flag); } \
-	void setFlag(Flag flag) { m_flags |= flag; } \
-	void unsetFlag(Flag flag) { m_flags &= ~flag; }
+#define DEFINE_FLAG_ACCESS_METHODS(FLAGS) \
+	bool checkFlag(decltype(FLAGS) flag) const { return !!(FLAGS & flag); } \
+	void setFlag(decltype(FLAGS) flag) { FLAGS |= flag; } \
+	void unsetFlag(decltype(FLAGS) flag) { FLAGS &= ~flag; }

mercurial