Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 28, 2008, 10:13:58 PM (17 years ago)
Author:
landauf
Message:
  • added CommandExecutor
  • added ConsoleCommand macros
  • added getTypename to all MultiTypes
  • added 2 static maps to Identifier that contain all existing Identifiers with their names and lowercase names respectively.
  • added 2 maps to each Identifier that contain all console commands of the Identifier with their names and lowercase names respectively
  • using tolower(.) and toupper(.) instead of selfmade hacks in String.h
  • added AccessLevel enum
  • added some test-console-commands to OutputHandler, Ambient and SpaceShip
Location:
code/branches/core2/src/util
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core2/src/util/MultiTypeMath.cc

    r933 r947  
    144144}
    145145
     146std::string MultiTypeMath::getTypename() const
     147{
     148    if (this->type_ == MT_vector2)
     149        return "Vector2";
     150    else if (this->type_ == MT_vector3)
     151        return "Vector3";
     152    else if (this->type_ == MT_colourvalue)
     153        return "ColourValue";
     154    else if (this->type_ == MT_quaternion)
     155        return "Quaternion";
     156    else if (this->type_ == MT_radian)
     157        return "Radian";
     158    else if (this->type_ == MT_degree)
     159        return "Degree";
     160    else
     161        return MultiTypeString::getTypename();
     162}
     163
    146164std::string MultiTypeMath::toString() const
    147165{
  • code/branches/core2/src/util/MultiTypeMath.h

    r933 r947  
    145145        inline void getValue(orxonox::Degree*      variable) const { (*variable) = orxonox::Degree      (this->degree_);      }
    146146
     147        virtual std::string getTypename() const;
     148
    147149        virtual std::string toString() const;
    148150        virtual bool fromString(const std::string value);
  • code/branches/core2/src/util/MultiTypePrimitive.cc

    r933 r947  
    167167}
    168168
     169std::string MultiTypePrimitive::getTypename() const
     170{
     171    if (this->type_ == MT_void)
     172        return "pointer";
     173    else if (this->type_ == MT_int)
     174        return "int";
     175    else if (this->type_ == MT_uint)
     176        return "unsigned int";
     177    else if (this->type_ == MT_char)
     178        return "char";
     179    else if (this->type_ == MT_uchar)
     180        return "unsigned char";
     181    else if (this->type_ == MT_short)
     182        return "short";
     183    else if (this->type_ == MT_ushort)
     184        return "unsigned short";
     185    else if (this->type_ == MT_long)
     186        return "long";
     187    else if (this->type_ == MT_ulong)
     188        return "unsigned long";
     189    else if (this->type_ == MT_float)
     190        return "float";
     191    else if (this->type_ == MT_double)
     192        return "double";
     193    else if (this->type_ == MT_longdouble)
     194        return "long double";
     195    else if (this->type_ == MT_bool)
     196        return "bool";
     197    else
     198        return "unknown";
     199}
     200
    169201std::string MultiTypePrimitive::toString() const
    170202{
  • code/branches/core2/src/util/MultiTypePrimitive.h

    r933 r947  
    181181        inline bool      isA(MultiType type) const { return (this->type_ == type); }
    182182
     183        virtual std::string getTypename() const;
     184
    183185        virtual std::string toString() const;
    184186        virtual bool fromString(const std::string value);
  • code/branches/core2/src/util/MultiTypeString.cc

    r933 r947  
    104104}
    105105
     106std::string MultiTypeString::getTypename() const
     107{
     108    if (this->type_ == MT_constchar)
     109        return "string";
     110    else if (this->type_ == MT_string)
     111        return "string";
     112    else if (this->type_ == MT_xmlelement)
     113        return "XML-element";
     114    else
     115        return MultiTypePrimitive::getTypename();
     116}
     117
    106118std::string MultiTypeString::toString() const
    107119{
  • code/branches/core2/src/util/MultiTypeString.h

    r933 r947  
    115115        inline void getValue(orxonox::Element* variable) const { (*variable) = this->xmlelement_;     }
    116116
     117        virtual std::string getTypename() const;
     118
    117119        virtual std::string toString() const;
    118120        virtual bool fromString(const std::string value);
  • code/branches/core2/src/util/String.cc

    r931 r947  
    2525 *
    2626 */
     27
     28#include <cctype>
    2729
    2830#include "String.h"
     
    116118void lowercase(std::string* str)
    117119{
    118     static unsigned const char difference_between_A_and_a = 'A' - 'a';
    119 
    120     for (std::string::iterator it = (*str).begin(); it != (*str).end(); ++it)
    121         if ((*it) >= 'A' && (*it) <= 'Z')
    122             (*it) -= difference_between_A_and_a;
     120    for (unsigned int i = 0; i < str->size(); ++i)
     121    {
     122        (*str)[i] = tolower((*str)[i]);
     123    }
    123124}
    124125
     
    141142void uppercase(std::string* str)
    142143{
    143     static unsigned const char difference_between_A_and_a = 'A' - 'a';
    144 
    145     for (std::string::iterator it = (*str).begin(); it != (*str).end(); ++it)
    146         if ((*it) >= 'a' && (*it) <= 'z')
    147             (*it) += difference_between_A_and_a;
     144    for (unsigned int i = 0; i < str->size(); ++i)
     145    {
     146        (*str)[i] = toupper((*str)[i]);
     147    }
    148148}
    149149
Note: See TracChangeset for help on using the changeset viewer.