summaryrefslogtreecommitdiff
path: root/src/enums
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-29 20:32:43 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-29 20:32:43 +0300
commitaef032f93b7bdc6e5908b2fa5f940a43bcfce50e (patch)
treec76e0fe4c2cd43ad5849061cf1f947639a41bfbd /src/enums
parent2d32dc27210d16102f9200de115f2c3f79a5cb22 (diff)
downloadmanaverse-aef032f93b7bdc6e5908b2fa5f940a43bcfce50e.tar.gz
manaverse-aef032f93b7bdc6e5908b2fa5f940a43bcfce50e.tar.bz2
manaverse-aef032f93b7bdc6e5908b2fa5f940a43bcfce50e.tar.xz
manaverse-aef032f93b7bdc6e5908b2fa5f940a43bcfce50e.zip
Add support for strong typed enums.
Diffstat (limited to 'src/enums')
-rw-r--r--src/enums/simpletypes/enumdefines.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/enums/simpletypes/enumdefines.h b/src/enums/simpletypes/enumdefines.h
new file mode 100644
index 000000000..95ccad764
--- /dev/null
+++ b/src/enums/simpletypes/enumdefines.h
@@ -0,0 +1,46 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2015 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef ENUMS_SIMPLETYPES_ENUMDEFINES_H
+#define ENUMS_SIMPLETYPES_ENUMDEFINES_H
+
+#include "localconsts.h"
+
+#ifdef ADVGCC
+
+#define enumStart(name) enum class name
+#define enumEnd(name) ; \
+ typedef name name##T
+
+#else // ADVGCC
+
+#define enumStart(name) \
+ namespace name \
+ { \
+ enum T
+
+#define enumEnd(name) \
+ ;\
+ } \
+ typedef name::T name##T
+
+#endif // ADVGCC
+
+#endif // ENUMS_SIMPLETYPES_ENUMDEFINES_H