Changeset 4250 in orxonox.OLD for orxonox/branches/levelLoader/src/util/loading
- Timestamp:
- May 21, 2005, 10:31:55 PM (20 years ago)
- Location:
- orxonox/branches/levelLoader/src/util/loading
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/levelLoader/src/util/loading/factory.cc
r4249 r4250 11 11 ### File Specific: 12 12 main-programmer: Christian Meyer 13 co-programmer: ...13 co-programmer: Benjamin Grauer 14 14 */ 15 15 -
orxonox/branches/levelLoader/src/util/loading/factory.h
r4249 r4250 1 /* 2 orxonox - the future of 3D-vertical-scrollers 3 4 Copyright (C) 2004 orx 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2, or (at your option) 9 any later version. 10 11 ### File Specific: 12 main-programmer: Christian Meyer 13 co-programmer: Benjamin Grauer 14 */ 15 1 16 /*! 2 3 17 \file factory.h 18 \brief philosophy stuff 4 19 */ 20 5 21 6 22 #ifndef _FACTORY_H -
orxonox/branches/levelLoader/src/util/loading/load_param.cc
r4233 r4250 1 /* 2 orxonox - the future of 3D-vertical-scrollers 3 4 Copyright (C) 2004 orx 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2, or (at your option) 9 any later version. 10 11 ### File Specific: 12 main-programmer: Christian Meyer 13 co-programmer: ... 14 */ 15 16 #include "load_param.h" 17 18 //void BaseLoadParam::description(const char* paramDescription) 19 //{ 20 21 //} 22 23 -
orxonox/branches/levelLoader/src/util/loading/load_param.h
r4249 r4250 1 /* 2 orxonox - the future of 3D-vertical-scrollers 3 4 Copyright (C) 2004 orx 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2, or (at your option) 9 any later version. 10 11 ### File Specific: 12 main-programmer: Benjamin Grauer 13 co-programmer: ... 14 */ 15 16 /*! 17 \file load_param.h 18 \brief A Class and macro-functions, that makes our lives easy to load-in parameters 19 */ 1 20 2 21 #ifndef _LOAD_PARAM_H … … 48 67 49 68 // 2. TYPES 50 #define LoadParam2(type1, type2) \69 #define LoadParam2(type1, type2) \ 51 70 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE)) \ 52 71 { \ … … 67 86 68 87 // 3. TYPES 69 #define LoadParam3(type1, type2, type3) \88 #define LoadParam3(type1, type2, type3) \ 70 89 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE)) \ 71 90 { \ … … 86 105 87 106 // 4. TYPES 88 #define LoadParam4(type1, type2, type3, type4) \107 #define LoadParam4(type1, type2, type3, type4) \ 89 108 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE)) \ 90 109 { \ … … 103 122 }; 104 123 105 // abstract base class 106 class baseLoadParam 124 125 // 5. TYPES 126 #define LoadParam5(type1, type2, type3, type4, type5) \ 127 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE, type5##_TYPE)) \ 128 { \ 129 const char* loadString = grabParameter(root, paramName); \ 130 if (loadString != NULL) \ 131 { \ 132 SubString subLoads(loadString); \ 133 if (subLoads.getCount() == 5) \ 134 (*pt2Object.*function)(type1##_FUNC(subLoads.getString(0)), type2##_FUNC(subLoads.getString(1)), type3##_FUNC(subLoads.getString(2)), type4##_FUNC(subLoads.getString(3)), type5##_FUNC(subLoads.getString(4))); \ 135 else \ 136 PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n", \ 137 paramName, pt2Object->getClassName(), 5, subLoads.getCount()); \ 138 } \ 139 else \ 140 PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \ 141 }; 142 143 144 class LoadParamDescription 145 { 146 private: 147 int paramCount; 148 char** types; 149 }; 150 151 // abstract Base class 152 class BaseLoadParam 107 153 { 108 154 public: 109 void description(const char* description);110 155 }; 111 156 112 157 113 158 // derived template class 114 template<class T> class LoadParam : public baseLoadParam159 template<class T> class LoadParam : public BaseLoadParam 115 160 { 116 161 public: … … 129 174 LoadParam3(l_FLOAT, l_FLOAT, l_FLOAT); 130 175 LoadParam4(l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT); 131 132 133 176 }; 134 177
Note: See TracChangeset
for help on using the changeset viewer.