- Timestamp:
- Sep 16, 2006, 2:29:28 PM (18 years ago)
- Location:
- branches/new_class_id/src/lib/util
- Files:
-
- 2 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/util/Makefile.am
r9742 r9743 9 9 executor/executor.cc \ 10 10 executor/executor_lua.cc \ 11 executor/executor_lua_state.cc \ 11 12 executor/executor_substring.cc 12 13 … … 49 50 executor/executor_xml.h \ 50 51 executor/executor_lua.h \ 52 executor/executor_lua_state.h \ 51 53 executor/executor_substring.h \ 52 54 executor/executor_generic.h \ -
branches/new_class_id/src/lib/util/executor/executor_generic.h
r9742 r9743 55 55 #endif /* __EXECUTOR_GENERIC_H_ */ 56 56 57 57 58 #ifdef __EXECUTOR_FUNCTIONAL_NAME 58 59 59 /////////// 60 60 //// 0 //// … … 101 101 102 102 103 104 105 103 /////////// 106 104 //// 1 //// … … 148 146 149 147 150 151 152 148 /////////// 153 149 //// 2 //// … … 196 192 197 193 198 199 200 194 /////////// 201 195 //// 3 //// … … 242 236 }; 243 237 }; 244 245 246 238 247 239 … … 292 284 }; 293 285 }; 294 295 296 297 286 298 287 -
branches/new_class_id/src/lib/util/executor/executor_lua_state.cc
r9735 r9743 16 16 //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ 17 17 18 #include "executor_lua .h"18 #include "executor_lua_state.h" 19 19 20 20 #include "lunar.h" -
branches/new_class_id/src/lib/util/executor/executor_lua_state.h
r9742 r9743 21 21 22 22 23 #ifndef __EXECUTOR_ SUBSTRING_H_24 #define __EXECUTOR_ SUBSTRING_H_23 #ifndef __EXECUTOR_LUA_STATE_H_ 24 #define __EXECUTOR_LUA_STATE_H_ 25 25 26 26 27 27 #include "executor_generic.h" 28 #include " substring.h"28 #include "luaincl.h" 29 29 30 template<typename type> type fromLua(lua_State* state, int index); 31 template<> bool fromLua<bool>(lua_State* state, int index); 32 template<> int fromLua<int>(lua_State* state, int index); 33 template<> unsigned int fromLua<unsigned int>(lua_State* state, int index); 34 template<> float fromLua<float>(lua_State* state, int index); 35 template<> char fromLua<char>(lua_State* state, int index); 36 template<> const std::string& fromLua<const std::string&>(lua_State* state, int index); 30 37 31 template<typename type> type fromString(const std::string& input, type defaultValue) { return defaultValue; }; 32 template<> bool fromString<bool>(const std::string& input, bool defaultValue); 33 template<> int fromString<int>(const std::string& input, int defaultValue); 34 template<> unsigned int fromString<unsigned int>(const std::string& input, unsigned int defaultValue); 35 template<> float fromString<float>(const std::string& input, float defaultValue); 36 template<> char fromString<char>(const std::string& input, char defaultValue); 37 template<> const std::string& fromString<const std::string&>(const std::string& input, const std::string& defaultValue); 38 39 template<typename type> type fromMulti(const MultiType& multi) { /* return defaultValue; */ }; 40 template<> bool fromMulti<bool>(const MultiType& multi); 41 template<> int fromMulti<int>(const MultiType& multi); 42 template<> unsigned int fromMulti<unsigned int>(const MultiType& multi); 43 template<> float fromMulti<float>(const MultiType& multi); 44 template<> char fromMulti<char>(const MultiType& multi); 45 template<> const std::string& fromMulti<const std::string&>(const MultiType& multi); 46 47 48 template<typename type> type getDefault(const MultiType* const defaultValues, unsigned int i) { return (type)0; }; 49 template<> bool getDefault<bool>(const MultiType* const defaultValues, unsigned int i); 50 template<> int getDefault<int>(const MultiType* const defaultValues, unsigned int i); 51 template<> unsigned int getDefault<unsigned int>(const MultiType* const defaultValues, unsigned int i); 52 template<> float getDefault<float>(const MultiType* const defaultValues, unsigned int i); 53 template<> char getDefault<char>(const MultiType* const defaultValues, unsigned int i); 54 template<> const std::string& getDefault<const std::string&>(const MultiType* const defaultValues, unsigned int i); 55 38 template<typename type> void toLua(lua_State* state, type value); 39 template<> void toLua<bool>(lua_State* state, bool value); 40 template<> void toLua<int>(lua_State* state, int value); 41 template<> void toLua<unsigned int>(lua_State* state, unsigned int value); 42 template<> void toLua<float>(lua_State* state, float value); 43 template<> void toLua<char>(lua_State* state, char value); 44 template<> void toLua<const std::string&>(lua_State* state, const std::string& value); 56 45 57 46 /** … … 60 49 * @param default The default Values. 61 50 */ 62 template<> class ExecutorEvaluater < const SubString>51 template<> class ExecutorEvaluater <lua_State*> 63 52 { 64 53 public: … … 68 57 */ 69 58 template <typename ToType, int index> 70 ToType operator()( const SubString& CallValue, const MultiType* const defaults)59 ToType operator()(lua_State*& CallValue, const MultiType* const defaults) 71 60 { 72 return (CallValue.size() > index) ? 73 fromString<ToType>(CallValue[index], getDefault<ToType>(defaults, index)) : 74 fromMulti<ToType>(defaults[index]); 61 return (fromLua<ToType>(CallValue, index)); 75 62 } 76 static const SubString& defaultValue() { return SubString::NullSubString; };63 static lua_State*& defaultValue() { static lua_State* nullState; return nullState; }; 77 64 }; 78 65 79 #endif /* __EXECUTOR_ SUBSTRING_H_ */66 #endif /* __EXECUTOR_LUA_STATE_H_ */
Note: See TracChangeset
for help on using the changeset viewer.