Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8408 in orxonox.OLD for trunk/src/lib/util


Ignore:
Timestamp:
Jun 14, 2006, 5:50:18 PM (19 years ago)
Author:
bensch
Message:

trunk: merged the script_engine branche back here
merged with command
svn merge https://svn.orxonox.net/orxonox/branches/script_engine . -r8284:HEAD
no conflicts

Location:
trunk/src/lib/util
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/util/executor/executor.h

    r8271 r8408  
    3333 *  Objects of any Class (Templated)
    3434 *  Default Values
    35  *  Functions with up to 5 parameters (more seems useless)
     35 *  Functions with up to 5 parameters (more seems overhead, split up the function)
    3636 *  Functions with many types (@see functor_list.h)
    3737 */
  • trunk/src/lib/util/executor/executor_functional.cc

    r8035 r8408  
    1515
    1616#include "executor.h"
    17 
    18 std::string ExecutorFunctional_returningString_from;
    19 std::string ExecutorFunctional_returningString_default;
     17std::string ExecutorFunctional_returningString_from[5];
    2018
    2119
     
    3230template<> float fromString<float>(const std::string& input, float defaultValue) { return isFloat(input, defaultValue); };
    3331template<> char fromString<char>(const std::string& input, char defaultValue) { return isInt(input, defaultValue); };
    34 template<> const std::string& fromString<const std::string&>(const std::string& input, const std::string& defaultValue) { return ExecutorFunctional_returningString_from = isString(input, defaultValue); };
     32template<> const std::string& fromString<const std::string&>(const std::string& input, const std::string& defaultValue) { return (input.size() > 0) ? input : defaultValue; };
    3533
    3634
     
    4846template<> float getDefault<float>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getFloat(); };
    4947template<> char getDefault<char>(const MultiType* const defaultValues, unsigned int i) { return defaultValues[i].getChar(); };
    50 template<> const std::string& getDefault<const std::string&>(const MultiType* const defaultValues, unsigned int i) { return ExecutorFunctional_returningString_default = defaultValues[i].getString(); };
     48template<> const std::string& getDefault<const std::string&>(const MultiType* const defaultValues, unsigned int i) { return ExecutorFunctional_returningString_from[i] = defaultValues[i].getString(); };
    5149
    5250
  • trunk/src/lib/util/executor/executor_lua.cc

    r8271 r8408  
    1818#include "executor_lua.h"
    1919
    20 std::string temp;
     20#include "lunar.h"
    2121
     22std::string temp[5];
     23
     24template<typename type> type* fromLua(lua_State* state, int index) { type *obj = Lunar<type>::check(state, 1); lua_remove(state, 1); return obj;};
    2225template<> bool fromLua<bool>(lua_State* state, int index) { return lua_toboolean(state, index); };
    2326template<> int fromLua<int>(lua_State* state, int index) { return (int)lua_tonumber(state, index); };
     
    2528template<> float fromLua<float>(lua_State* state, int index) { return (float)lua_tonumber(state, index); };
    2629template<> char fromLua<char>(lua_State* state, int index) { return (char)lua_tonumber(state, index); };
    27 template<> const std::string& fromLua<const std::string&>(lua_State* state, int index) { temp = lua_tostring(state, index); return temp; };
     30template<> const std::string& fromLua<const std::string&>(lua_State* state, int index) { temp[index] = lua_tostring(state, index); return temp[index]; };
    2831
    2932
    30 
     33template<typename type> void toLua(lua_State* state, type value) { Lunar<type>::push(state, value, false); };
    3134template<> void toLua<bool>(lua_State* state, bool value) { lua_pushboolean(state, (int) value); };
    3235template<> void toLua<int>(lua_State* state, int value)  { lua_pushnumber(state, (lua_Number) value); };
  • trunk/src/lib/util/executor/executor_lua.h

    r8271 r8408  
    1414
    1515
    16 template<typename type> type fromLua(lua_State* state, int index) { PRINTF(1)("NOT IMPLEMENTED\n"); };
     16template<typename type> type fromLua(lua_State* state, int index);
    1717template<> bool fromLua<bool>(lua_State* state, int index);
    1818template<> int fromLua<int>(lua_State* state, int index);
     
    2323
    2424
    25 template<typename type> void toLua(lua_State* state, type value) { PRINTF(1)("NOT IMPLEMENTED\n"); };
     25template<typename type> void toLua(lua_State* state, type value);
    2626template<> void toLua<bool>(lua_State* state, bool value);
    2727template<> void toLua<int>(lua_State* state, int value);
     
    339339};
    340340
    341 
    342 
    343 
    344 
    345 
    346 
    347341#endif /* _EXECUTOR_LUA_H */
  • trunk/src/lib/util/loading/load_param.cc

    r8316 r8408  
    3131  :  object(object), paramName(paramName)
    3232{
    33   this->object = object;
    3433  this->inLoadCycle = inLoadCycle;
    3534
  • trunk/src/lib/util/substring.h

    r7477 r8408  
    7070  inline unsigned int size() const { return this->strings.size(); };
    7171  /** @param i the i'th String @returns the i'th string from the subset of Strings */
    72 const std::string& operator[](unsigned int i) const { return (i < this->strings.size()) ? this->strings[i] : emptyString;return this->getString(i); };
     72  inline const std::string& operator[](unsigned int i) const { return (i < this->strings.size()) ? this->strings[i] : emptyString; };
    7373  /** @param i the i'th String @returns the i'th string from the subset of Strings */
    74   const std::string& getString(unsigned int i) const { return (*this)[i]; };
     74  inline const std::string& getString(unsigned int i) const { return (*this)[i]; };
    7575
    7676  // the almighty algorithm.
Note: See TracChangeset for help on using the changeset viewer.