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/enums | |
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/enums')
-rw-r--r-- | src/enums/simpletypes/enumdefines.h | 46 |
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 |