diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-29 20:32:43 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-29 20:32:43 +0300 |
commit | aef032f93b7bdc6e5908b2fa5f940a43bcfce50e (patch) | |
tree | c76e0fe4c2cd43ad5849061cf1f947639a41bfbd /src | |
parent | 2d32dc27210d16102f9200de115f2c3f79a5cb22 (diff) | |
download | plus-aef032f93b7bdc6e5908b2fa5f940a43bcfce50e.tar.gz plus-aef032f93b7bdc6e5908b2fa5f940a43bcfce50e.tar.bz2 plus-aef032f93b7bdc6e5908b2fa5f940a43bcfce50e.tar.xz plus-aef032f93b7bdc6e5908b2fa5f940a43bcfce50e.zip |
Add support for strong typed enums.
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/enums/simpletypes/enumdefines.h | 46 |
3 files changed, 48 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d2a925e6b..0ea642998 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1062,6 +1062,7 @@ SET(SRCS enums/simpletypes/booldefines.h enums/simpletypes/damaged.h enums/simpletypes/enable.h + enums/simpletypes/enumdefines.h enums/simpletypes/equipm.h enums/simpletypes/equipped.h enums/simpletypes/favorite.h diff --git a/src/Makefile.am b/src/Makefile.am index 374382f58..4c6612e63 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1191,6 +1191,7 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ enums/simpletypes/booldefines.h \ enums/simpletypes/damaged.h \ enums/simpletypes/enable.h \ + enums/simpletypes/enumdefines.h \ enums/simpletypes/equipm.h \ enums/simpletypes/equipped.h \ enums/simpletypes/favorite.h \ 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 |