![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
00001 #ifndef __CODEGENMACROS_H 00002 #define __CODEGENMACROS_H 00003 00004 // 00005 // This file is meant to contain macros that help with code generation 00006 // Please, try to avoid making macros that do work and instead ensure they only generate code 00007 // Please, ensure macros in this file are brief, but flexible 00008 // Please, ensure all macros will cause as much compiler headache as possible when used incorrectly 00009 // Don't let people get away with using the macro incorrectly! 00010 // 00011 00016 #define INLINE __inline 00017 00024 #define GET(name, type, value) type name() const { return value; } 00025 00033 #define GET_NONCONST(name, type, value) type name() { return value; } 00034 00041 #define SET(name, type, value) void name(type val) { value = val; } 00042 00047 #define SET_DECL(name, type) void name(type val); 00048 00053 #define GET_SET(getName, setName, type, val) INLINE type getName() const { return val; } INLINE void setName(type newValue) { val = newValue; } 00054 00059 #define SET_FLAG(name, type, value) void name(type newValue) { value |= newValue; } 00060 #define UNSET_FLAG(name, type, value) void name(type newValue) { value &= !newValue; } 00061 #define GET_FLAG(name, type, value) bool name(type checkValue) { return (value|checkValue) > 0; } 00062 00070 #define FOREACH(iterName, collectionType, collectionName) collectionType::const_iterator iterName; collectionType::const_iterator __endIter = collectionName.end(); for(iterName = collectionName.begin(); iterName != __endIter; ++iterName) 00071 00072 #endif __CODEGENMACROS_H
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.