Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7216 in orxonox.OLD for branches/std/src/lib


Ignore:
Timestamp:
Mar 12, 2006, 8:54:30 AM (19 years ago)
Author:
bensch
Message:

orxonox/std:: compile and run again, with many more std::strings….

Location:
branches/std/src/lib
Files:
38 edited

Legend:

Unmodified
Added
Removed
  • branches/std/src/lib/coord/p_node.cc

    r7193 r7216  
    540540 * @param childName the name of the child to add to this PNode
    541541 */
    542 void PNode::addChild (const char* childName)
     542void PNode::addChild (const std::string& childName)
    543543{
    544544  PNode* childNode = dynamic_cast<PNode*>(ClassList::getObject(childName, CL_PARENT_NODE));
     
    624624 * @param parentName the name of the Parent to set to this PNode
    625625 */
    626 void PNode::setParent (const char* parentName)
     626void PNode::setParent (const std::string& parentName)
    627627{
    628628  PNode* parentNode = dynamic_cast<PNode*>(ClassList::getObject(parentName, CL_PARENT_NODE));
     
    631631  else
    632632    PRINTF(2)("Not Found PNode's (%s::%s) new Parent by Name: %s\n",
    633               this->getClassName(), this->getName(), parentName);
     633        this->getClassName(), this->getName(), parentName.c_str());
    634634}
    635635
     
    699699 * @param parentMode a String representing this parentingMode
    700700 */
    701 void PNode::setParentMode (const char* parentingMode)
     701void PNode::setParentMode (const std::string& parentingMode)
    702702{
    703703  this->setParentMode(PNode::charToParentingMode(parentingMode));
     
    10681068 * @return the int corresponding to the named parentingMode
    10691069 */
    1070 PARENT_MODE PNode::charToParentingMode(const char* parentingMode)
    1071 {
    1072   if (!strcmp(parentingMode, "local-rotate"))
     1070PARENT_MODE PNode::charToParentingMode(const std::string& parentingMode)
     1071{
     1072  if (parentingMode == "local-rotate")
    10731073    return (PNODE_LOCAL_ROTATE);
    1074   else  if (!strcmp(parentingMode, "rotate-movement"))
     1074  else  if (parentingMode == "rotate-movement")
    10751075    return (PNODE_ROTATE_MOVEMENT);
    1076   else  if (!strcmp(parentingMode, "movement"))
     1076  else  if (parentingMode == "movement")
    10771077    return (PNODE_MOVEMENT);
    1078   else  if (!strcmp(parentingMode, "all"))
     1078  else  if (parentingMode == "all")
    10791079    return (PNODE_ALL);
    1080   else  if (!strcmp(parentingMode, "rotate-and-move"))
     1080  else  if (parentingMode == "rotate-and-move")
    10811081    return (PNODE_ROTATE_AND_MOVE);
    10821082}
  • branches/std/src/lib/coord/p_node.h

    r7076 r7216  
    143143  // PARENTING //
    144144  void addChild (PNode* child);
    145   void addChild (const char* childName);
     145  void addChild (const std::string& childName);
    146146  void removeChild (PNode* child);
    147147  void removeNode();
     
    151151  /** @param parent the new parent of this node */
    152152  inline void setParent (PNode* parent) { parent->addChild(this); };
    153   void setParent (const char* parentName);
     153  void setParent (const std::string& parentName);
    154154  /** @returns the parent of this PNode */
    155155  inline PNode* getParent () const { return this->parent; };
     
    162162  // PARENTING_MODE AND OTHER FLAGS //
    163163  void setParentMode (PARENT_MODE parentMode);
    164   void setParentMode (const char* parentingMode);
     164  void setParentMode (const std::string& parentingMode);
    165165  /** @returns the Parenting mode of this node */
    166166  int getParentMode() const { return 0x000f & this->parentMode; };
     
    184184  // HELPER_FUNCTIONS //
    185185  static const char* parentingModeToChar(int parentingMode);
    186   static PARENT_MODE charToParentingMode(const char* parentingMode);
     186  static PARENT_MODE charToParentingMode(const std::string& parentingMode);
    187187  float distance(const PNode* node) const { return (this->getAbsCoor() - node->getAbsCoor()).len(); };
    188188
  • branches/std/src/lib/graphics/effects/fog_effect.cc

    r7193 r7216  
    126126 * @param mode the mode character
    127127 */
    128 GLint FogEffect::charToFogMode(const char* mode)
     128GLint FogEffect::stringToFogMode(const std::string& mode)
    129129{
    130   if( !strcmp( "GL_LINEAR", mode))
     130  if(mode == "GL_LINEAR")
    131131    return GL_LINEAR;
    132   else if( !strcmp("GL_EXP", mode))
     132  else if(mode == "GL_EXP")
    133133    return GL_EXP;
    134   else if(!strcmp("GL_EXP2", mode) )
     134  else if(mode == "GL_EXP2" )
    135135    return GL_EXP2;
    136136  else
  • branches/std/src/lib/graphics/effects/fog_effect.h

    r7107 r7216  
    2626    virtual bool deactivate();
    2727
    28     inline void setFogMode(const char* mode) { this->fogMode = this->charToFogMode(mode); }
     28    inline void setFogMode(const std::string& mode) { this->fogMode = this->stringToFogMode(mode); }
    2929    inline void setFogDensity(float density) { this->fogDensity = density; }
    3030    inline void setFogRange(float start, float end) { this->fogStart = start; this->fogEnd = end; }
     
    3333
    3434  private:
    35     GLint charToFogMode(const char* mode);
     35    GLint stringToFogMode(const std::string& mode);
    3636
    3737
  • branches/std/src/lib/graphics/effects/lense_flare.cc

    r7193 r7216  
    147147 *  7th: Texture of the third burst
    148148 */
    149 void LenseFlare::addFlare(const char* textureName)
     149void LenseFlare::addFlare(const std::string& textureName)
    150150{
    151151  if( this->flares.size() > LF_MAX_FLARES)
     
    159159  bb->setSize(50, 50);
    160160  this->flares.push_back(bb);
    161   PRINTF(0)("Added a Lenseflare Billboard with texture %s\n", textureName);
     161  PRINTF(4)("Added a Lenseflare Billboard with texture %s\n", textureName.c_str());
    162162
    163163  // the first flare belongs to the light source
     
    167167    bb->setVisibility(true);
    168168  }
    169   PRINTF(0)("Finished adding\n", textureName);
     169  PRINTF(4)("Finished adding\n");
    170170}
    171171
  • branches/std/src/lib/graphics/effects/lense_flare.h

    r7015 r7216  
    3939    virtual void tick(float dt);
    4040
    41     void addFlare(const char* textureName);
     41    void addFlare(const std::string& textureName);
    4242
    4343
  • branches/std/src/lib/graphics/render2D/billboard.cc

    r7193 r7216  
    7878void Billboard::loadParams(const TiXmlElement* root)
    7979{
    80   LoadParam(root, "texture", this, Billboard, setTexture)
     80  LoadParam(root, "texture", this->material, Material, setDiffuseMap)
    8181      .describe("the texture-file to load onto the Billboard");
    8282
     
    100100 * @param textureFile The texture-file to load onto the crosshair
    101101 */
    102 void Billboard::setTexture(const char* textureFile)
     102void Billboard::setTexture(const std::string& textureFile)
    103103{
    104104  this->material->setDiffuseMap(textureFile);
  • branches/std/src/lib/graphics/render2D/billboard.h

    r6815 r7216  
    3030
    3131    void setSize(float sizeX, float sizeY);
    32     void setTexture(const char* textureFile);
     32    void setTexture(const std::string& textureFile);
    3333    void attachTo(PNode* pnode);
    3434
  • branches/std/src/lib/graphics/render2D/element_2d.cc

    r7199 r7216  
    180180 * @param alignment the alignment @see loadParams
    181181*/
    182 void Element2D::setAlignment(const char* alignment)
    183 {
    184   if (!strcmp(alignment, "center"))
     182void Element2D::setAlignment(const std::string& alignment)
     183{
     184  if (alignment == "center")
    185185    this->setAlignment(E2D_ALIGN_CENTER);
    186   else if (!strcmp(alignment, "left"))
     186  else if (alignment == "left")
    187187    this->setAlignment(E2D_ALIGN_LEFT);
    188   else if (!strcmp(alignment, "right"))
     188  else if (alignment == "right")
    189189    this->setAlignment(E2D_ALIGN_RIGHT);
    190   else if (!strcmp(alignment, "screen-center"))
     190  else if (alignment == "screen-center")
    191191    this->setAlignment(E2D_ALIGN_SCREEN_CENTER);
    192192}
     
    213213/**
    214214 * sets the layer onto which this 2D-element is projected to.
    215  * @param layer the layer @see loadParams @see Element2D::charToLayer2D(const char* layer)
    216  */
    217 void Element2D::setLayer(const char* layer)
     215 * @param layer the layer @see loadParams @see Element2D::charToLayer2D(const std::string& layer)
     216 */
     217void Element2D::setLayer(const std::string& layer)
    218218{
    219219  this->setLayer(Element2D::charToLayer2D(layer));
     
    235235 * @param bindNode the name of the Node (should be existing)
    236236 */
    237 void Element2D::setBindNode(const char* bindNode)
     237void Element2D::setBindNode(const std::string& bindNode)
    238238{
    239239  const PNode* tmpBindNode = dynamic_cast<const PNode*>(ClassList::getObject(bindNode, CL_PARENT_NODE));
     
    572572 * @param childName the name of the child to add to this PNode
    573573 */
    574 void Element2D::addChild2D (const char* childName)
     574void Element2D::addChild2D (const std::string& childName)
    575575{
    576576  Element2D* childNode = dynamic_cast<Element2D*>(ClassList::getObject(childName, CL_ELEMENT_2D));
     
    651651 * @param parentName the name of the Parent to set to this Element2D
    652652 */
    653 void Element2D::setParent2D (const char* parentName)
     653void Element2D::setParent2D (const std::string& parentName)
    654654{
    655655  Element2D* parentNode = dynamic_cast<Element2D*>(ClassList::getObject(parentName, CL_ELEMENT_2D));
     
    658658  else
    659659    PRINTF(2)("Not Found Element2D's (%s::%s) new Parent by Name: %s\n",
    660                 this->getClassName(), this->getName(), parentName);
     660                this->getClassName(), this->getName(), parentName.c_str());
    661661}
    662662
     
    704704 * @param bias the speed to iterate to this new Positions
    705705 */
    706 void Element2D::setParentSoft2D(const char* parentName, float bias)
     706void Element2D::setParentSoft2D(const std::string& parentName, float bias)
    707707{
    708708  Element2D* parentNode = dynamic_cast<Element2D*>(ClassList::getObject(parentName, CL_ELEMENT_2D));
     
    724724 * @param parentMode a String representing this parentingMode
    725725 */
    726 void Element2D::setParentMode2D (const char* parentingMode)
     726void Element2D::setParentMode2D (const std::string& parentingMode)
    727727{
    728728  this->setParentMode2D(Element2D::charToParentingMode2D(parentingMode));
     
    10931093 * @return the int corresponding to the named parentingMode
    10941094 */
    1095 E2D_PARENT_MODE Element2D::charToParentingMode2D(const char* parentingMode)
    1096 {
    1097   if (!strcmp(parentingMode, "local-rotate"))
     1095E2D_PARENT_MODE Element2D::charToParentingMode2D(const std::string& parentingMode)
     1096{
     1097  if (parentingMode == "local-rotate")
    10981098    return (E2D_PARENT_LOCAL_ROTATE);
    1099   else  if (!strcmp(parentingMode, "rotate-movement"))
     1099  else  if (parentingMode == "rotate-movement")
    11001100    return (E2D_PARENT_ROTATE_MOVEMENT);
    1101   else  if (!strcmp(parentingMode, "movement"))
     1101  else  if (parentingMode == "movement")
    11021102    return (E2D_PARENT_MOVEMENT);
    1103   else  if (!strcmp(parentingMode, "all"))
     1103  else  if (parentingMode == "all")
    11041104    return (E2D_PARENT_ALL);
    1105   else  if (!strcmp(parentingMode, "rotate-and-move"))
     1105  else  if (parentingMode == "rotate-and-move")
    11061106    return (E2D_PARENT_ROTATE_AND_MOVE);
    11071107}
     
    11391139 * @returns the E2D_LAYER on success, E2D_DEFAULT_LAYER on error.
    11401140 */
    1141 E2D_LAYER Element2D::charToLayer2D(const char* layer)
    1142 {
    1143   if (!strcmp(layer, "top"))
     1141E2D_LAYER Element2D::charToLayer2D(const std::string& layer)
     1142{
     1143  if (layer =="top")
    11441144    return (E2D_LAYER_TOP);
    1145   else  if (!strcmp(layer, "medium"))
     1145  else  if (layer == "medium")
    11461146    return (E2D_LAYER_MEDIUM);
    1147   else  if (!strcmp(layer, "bottom"))
     1147  else  if (layer == "bottom")
    11481148    return (E2D_LAYER_BOTTOM);
    1149   else  if (!strcmp(layer, "below-all"))
     1149  else  if (layer == "below-all")
    11501150    return (E2D_LAYER_BELOW_ALL);
    11511151  else
  • branches/std/src/lib/graphics/render2D/element_2d.h

    r7052 r7216  
    102102    /** @param alignment the new Alignment of the 2D-Element */
    103103    inline void setAlignment(E2D_ALIGNMENT alignment) { this->alignment = alignment; };
    104     void setAlignment(const char* alignment);
     104    void setAlignment(const std::string& alignment);
    105105    inline E2D_ALIGNMENT getAlignment() const { return this->alignment; };
    106106
    107107    // LAYERING //
    108108    void setLayer(E2D_LAYER layer);
    109     void setLayer(const char* layer);
     109    void setLayer(const std::string& layer);
    110110    /** @returns the Layer this Element is drawn to */
    111111    inline E2D_LAYER getLayer() const { return this->layer; };
     
    121121    /** @param bindNode the Node this 2D-element should follow. if NULL the Element will not follow anything */
    122122    inline void setBindNode(const PNode* bindNode) { this->bindNode = bindNode; };
    123     void setBindNode(const char* bindNode);
     123    void setBindNode(const std::string& bindNode);
    124124    inline const PNode* getBindNode() const { return this->bindNode; };
    125125
     
    181181
    182182    void addChild2D (Element2D* child);
    183     void addChild2D (const char* childName);
     183    void addChild2D (const std::string& childName);
    184184    void removeChild2D (Element2D* child);
    185185    void remove2D();
     
    187187    /** @param parent the new parent of this Element2D */
    188188    void setParent2D (Element2D* parent) { parent->addChild2D(this); };
    189     void setParent2D (const char* parentName);
     189    void setParent2D (const std::string& parentName);
    190190    /** @returns the parent of this Element2D */
    191191    inline Element2D* getParent2D () const { return this->parent; };
     
    194194
    195195    void setParentSoft2D(Element2D* parentNode, float bias = 1.0);
    196     void setParentSoft2D(const char* parentName, float bias = 1.0);
     196    void setParentSoft2D(const std::string& parentName, float bias = 1.0);
    197197
    198198    void setParentMode2D (E2D_PARENT_MODE parentMode);
    199     void setParentMode2D (const char* parentingMode);
     199    void setParentMode2D (const std::string& parentingMode);
    200200    /** @returns the Parenting mode of this node */
    201201    int getParentMode2D() const { return this->parentMode; };
     
    213213    // helper functions //
    214214    static const char* parentingModeToChar2D(int parentingMode);
    215     static E2D_PARENT_MODE charToParentingMode2D(const char* parentingMode);
     215    static E2D_PARENT_MODE charToParentingMode2D(const std::string& parentingMode);
    216216
    217217    static const char* layer2DToChar(E2D_LAYER layer);
    218     static E2D_LAYER charToLayer2D(const char* layer);
     218    static E2D_LAYER charToLayer2D(const std::string& layer);
    219219
    220220  private:
  • branches/std/src/lib/graphics/text_engine/text.cc

    r7207 r7216  
    5050  if (this->font != NULL && this->font != Font::getDefaultFont())
    5151    ResourceManager::getInstance()->unload(this->font);
    52 
    53   if (this->text)
    54     delete[] this->text;
    5552}
    5653
     
    6461  // initialize this Text
    6562  this->font = NULL;
    66   this->text = NULL;
    67   this->externText = NULL;
     63  this->text = "";
    6864  this->setAlignment(TEXT_DEFAULT_ALIGNMENT);
    6965  this->blending = TEXT_DEFAULT_BLENDING;
    7066  this->color = TEXT_DEFAULT_COLOR;
    7167  this->setSize(TEXT_DEFAULT_SIZE);
    72   this->setText(NULL);
     68  this->setText("");
    7369}
    7470
     
    104100 * @param text the new text to set
    105101 */
    106 void Text::setText(const char* text, bool isExtern)
    107 {
    108   if (isExtern)
    109   {
    110     this->externText = text;
    111 
    112     if (unlikely(this->text != NULL))
    113     {
    114       delete[] this->text;
    115       this->text = NULL;
    116     }
    117   }
    118   else
    119   {
    120     this->externText = NULL;
    121     if (this->text)
    122       delete[] this->text;
    123     if (text != NULL)
    124     {
    125       this->text = new char[strlen(text)+1];
    126       strcpy(this->text, text);
    127     }
    128     else
    129       this->text = NULL;
    130   }
     102void Text::setText(const std::string& text)
     103{
     104  this->text = text;
    131105
    132106  // setting up the Text-Width if DYNAMIC
     
    138112
    139113    float width = 0;
    140     const char* tmpText = this->externText;
    141     if (this->externText == NULL)
    142       tmpText = this->text;
    143     if (tmpText != NULL)
     114    if (!this->text.empty())
    144115    {
    145       while (*tmpText != '\0')
     116      for (unsigned int i = 0; i < this->text.size(); i++)
    146117      {
    147         if(glyphArray[*tmpText] != NULL)
     118        if(glyphArray[this->text[i]] != NULL)
    148119        {
    149           width += glyphArray[*tmpText]->advance;
     120          width += glyphArray[this->text[i]]->advance;
    150121        }
    151         tmpText++;
    152122      }
    153123      this->setSizeX2D(width *this->getSizeY2D());
     
    190160    glBindTexture(GL_TEXTURE_2D, Font::getDefaultFont()->getTexture());
    191161  }
    192   const char* tmpText = this->externText;
    193   if (this->externText == NULL)
    194     tmpText = this->text;
    195   if (likely(tmpText != NULL))
     162  if (likely(!this->text.empty()))
    196163  {
    197164    glTranslatef(getAbsCoor2D().x, getAbsCoor2D().y, 0);
     
    201168
    202169    glBegin(GL_QUADS);
    203     while (likely(*tmpText != '\0'))
     170    for (unsigned int i = 0; i < this->text.size(); i++)
    204171    {
    205       if(likely((tmpGlyph = glyphArray[*tmpText]) != NULL))
     172      if(likely((tmpGlyph = glyphArray[this->text[i]]) != NULL))
    206173      {
    207174        glTexCoord2f(tmpGlyph->texCoord[1], tmpGlyph->texCoord[2]);
     
    219186        posX += tmpGlyph->advance * this->getSizeY2D();
    220187      }
    221       ++tmpText;
    222188    }
    223189    glEnd();
     
    232198void Text::debug() const
    233199{
    234   if (this->externText == NULL)
    235     PRINT(0)("=== TEXT: %s ===\n", this->text);
    236   else
    237     PRINT(0)("=== TEXT: %s ===\n", this->externText);
     200  PRINT(0)("=== TEXT: %s ===\n", this->text.c_str());
    238201
    239202  if (this->getBindNode())
  • branches/std/src/lib/graphics/text_engine/text.h

    r7207 r7216  
    4545    void setFont(const std::string& fontFile, unsigned int renderSize);
    4646
    47     void setText(const char* text, bool isExtern = false);
     47    void setText(const std::string& text);
    4848
    4949    /** @returns the String this Text displays */
    50     inline const char* getText() const { return (externText == NULL)?this->text:this->externText; };
     50    inline const std::string& getText() const { return this->text; };
    5151    /** @param blending the blending intensity to set (between 0.0 and 1.0) */
    5252    inline void setBlending(float blending) { this->blending = blending; };
     
    6969    Font*             font;           //!< Font of this text
    7070
    71     char*             text;           //!< The text to display
    72     const char*       externText;     //!< the text to Display from an external Source.
     71    std::string       text;           //!< The text to display
    7372    Vector            color;          //!< The color of the font.
    7473    float             blending;       //!< The blending intensity.
  • branches/std/src/lib/lang/base_object.cc

    r7214 r7216  
    9595void BaseObject::setName (const std::string& objectName)
    9696{
    97   printf("TEST\n");
    9897  this->objectName = objectName;
    99   printf("TEST2\n");
    10098}
    10199
  • branches/std/src/lib/lang/class_list.cc

    r7199 r7216  
    3737 *  Creates a new ClassList
    3838*/
    39 ClassList::ClassList(ClassID classID, unsigned long classIDFull, const char* className)
    40 {
    41   this->className = className;
     39ClassList::ClassList(ClassID classID, unsigned long classIDFull, const std::string& className)
     40  : className(className)
     41{
    4242  this->classID = classID;
    4343  this->classIDFull = classIDFull;
     
    5656
    5757//! a List of all strings of all classes, that have registered so far.
    58 std::list<const char*> ClassList::classNames;
     58std::list<std::string> ClassList::classNames;
    5959
    6060/**
     
    6767 * !! Before unsing the ClassList, as it creates the ClassLits
    6868 */
    69 ClassList* ClassList::addToClassList(BaseObject* objectPointer, ClassID classID, unsigned long classIDFull, const char* className)
     69ClassList* ClassList::addToClassList(BaseObject* objectPointer, ClassID classID, unsigned long classIDFull, const std::string& className)
    7070{
    7171  if (unlikely(classList == NULL))
    7272    ClassList::classList = new list<ClassList>();
    7373
    74   PRINTF(5)("subscribe a '%s'\n", className );
     74  PRINTF(5)("subscribe a '%s'\n", className.c_str() );
    7575
    7676  ClassList* regClass = ClassList::getClassList(classID);
     
    113113 * befor it changes anything.
    114114 */
    115 const std::list<const char*>* ClassList::getClassNames()
     115const std::list<std::string>* ClassList::getClassNames()
    116116{
    117117  if (ClassList::classNames.size() != ClassList::classList->size())
     
    155155 * @return the List accessed by classID, or NULL if not found
    156156 */
    157 const std::list<BaseObject*>* ClassList::getList(const char* className)
     157const std::list<BaseObject*>* ClassList::getList(const std::string& className)
    158158{
    159159  ClassList* fl;
     
    191191 * @returns the ClassList with className as specifyer, or NULL if not
    192192 */
    193 ClassList* ClassList::getClassList(const char* className)
    194 {
    195   if (className == NULL)
     193ClassList* ClassList::getClassList(const std::string& className)
     194{
     195  if (className.empty())
    196196    return NULL;
    197197  std::list<ClassList>::iterator classIT = find (classList->begin(), classList->end(), className);
     
    207207 * @todo: speed this up!!
    208208 */
    209 BaseObject* ClassList::getObject(const char* objectName, ClassID classID)
     209BaseObject* ClassList::getObject(const std::string& objectName, ClassID classID)
    210210{
    211211  if (classID != CL_NULL)
     
    216216      std::list<BaseObject*>::iterator bo;
    217217      for (bo = cl->objectList.begin(); bo != cl->objectList.end(); bo++)
    218         if ((*bo)->getName() != NULL && !strcmp((*bo)->getName(), objectName))
     218        if ((*bo)->getName() != NULL && objectName == (*bo)->getName())
    219219          return (*bo);
    220220    }
     
    227227      std::list<BaseObject*>::iterator bo;
    228228      for (bo = (*cl).objectList.begin(); bo != (*cl).objectList.end(); bo++)
    229         if ((*bo)->getName() != NULL && !strcmp((*bo)->getName(), objectName))
     229        if ((*bo)->getName() != NULL && objectName == (*bo)->getName())
    230230          return (*bo);
    231231    }
     
    276276    if (object->isA((*cl).classID))
    277277  {
    278     PRINT(0)("=%s::0x%.8X=-", (*cl).className, (*cl).classID);
     278    PRINT(0)("=%s::0x%.8X=-", (*cl).className.c_str(), (*cl).classID);
    279279  }
    280280}
     
    285285 * @return a String containing the name of the Class, NULL if the Class was not found
    286286 */
    287 const char* ClassList::IDToString(ClassID classID)
    288 {
     287const std::string& ClassList::IDToString(ClassID classID)
     288{
     289  static const std::string empty("");
     290
    289291  ClassList* cl = ClassList::getClassList(classID);
    290   return (cl != NULL) ? cl->className : NULL;
     292  return (cl != NULL) ? cl->className : empty;
    291293}
    292294
     
    296298 * @return the ClassID. CL_NULL, if the class was not found.
    297299 */
    298 ClassID ClassList::StringToID(const char* className)
     300ClassID ClassList::StringToID(const std::string& className)
    299301{
    300302  ClassList* cl = ClassList::getClassList(className);
     
    307309 * @returns true on match, false otherwise
    308310 */
    309 bool ClassList::operator==(const char* className)
    310 {
    311   if (likely( className != NULL && this->className != NULL))
    312     return (!strcmp(this->className, className));
    313   else
    314     return false;
     311bool ClassList::operator==(const std::string& className)
     312{
     313  return (this->className == className);
    315314}
    316315
     
    342341      while (pow(10, lenCount) <= (*cl).objectList.size())
    343342        ++lenCount;
    344       for (int i=0; i < 30-strlen((*cl).className) - lenCount; i++)
     343      for (int i=0; i < 30-(*cl).className.size() - lenCount; i++)
    345344        (niceString[i]) = ' ';
    346       niceString[30-strlen((*cl).className) - lenCount] = '\0';
    347 
    348       PRINT(0)("| CLASS %s::%s %d\n", (*cl).className, niceString, (*cl).objectList.size());
     345      niceString[30-(*cl).className.size() - lenCount] = '\0';
     346
     347      PRINT(0)("| CLASS %s::%s %d\n", (*cl).className.c_str(), niceString, (*cl).objectList.size());
    349348
    350349      if (debugLevel >=2 && (*cl).objectList.size() > 0)
     
    371370 * @see ClassList::debug
    372371 */
    373 void ClassList::debugS(const char* className, unsigned int debugLevel)
     372void ClassList::debugS(const std::string& className, unsigned int debugLevel)
    374373{
    375374  ClassList::debug(debugLevel, ClassList::StringToID(className));
  • branches/std/src/lib/lang/class_list.h

    r7165 r7216  
    1010#include "class_id.h"
    1111#include <list>
     12#include <string>
    1213#ifndef NULL
    1314#define NULL     0    //!< NULL
     
    3233class ClassList {
    3334  public:
    34     ClassList(ClassID classID, unsigned long classIDFull, const char* className);
     35    ClassList(ClassID classID, unsigned long classIDFull, const std::string& className);
    3536    virtual ~ClassList();
    3637
    3738    /* MAINTENANCE FUNCTIONS THESE ARE !!ONLY FOR BASEOBJECT !! */
    38     static ClassList*                     addToClassList(BaseObject* objectPointer, ClassID classID, unsigned long classIDFull, const char* className);
     39    static ClassList*                     addToClassList(BaseObject* objectPointer, ClassID classID, unsigned long classIDFull, const std::string& className);
    3940    static void                           removeFromClassList(BaseObject* objectPointer);
    4041
     
    4243
    4344    static const std::list<BaseObject*>*  getList(ClassID classID = CL_NULL);// { return (ClassList* fl = ClassList::getClassList(classID) != NULL)? &(fl->objectList) : NULL; };
    44     static const std::list<BaseObject*>*  getList(const char* className); // { return (ClassList* fl = ClassList::getClassList(className) != NULL)? &(fl->objectList) : NULL;  };
    45     static const std::list<const char*>*  getClassNames();
    46     static BaseObject*                    getObject(const char* name, ClassID classID = CL_NULL);
     45    static const std::list<BaseObject*>*  getList(const std::string& className); // { return (ClassList* fl = ClassList::getClassList(className) != NULL)? &(fl->objectList) : NULL;  };
     46    static const std::list<std::string>*  getClassNames();
     47    static BaseObject*                    getObject(const std::string& name, ClassID classID = CL_NULL);
    4748    static bool                           exists(const BaseObject* object, ClassID classID = CL_NULL);
    4849
     
    5152    static void                           whatIs(const BaseObject* object);
    5253
    53     static const char*                    IDToString(ClassID classID = CL_NULL);
    54     static ClassID                        StringToID(const char* className);
     54    static const std::string&             IDToString(ClassID classID = CL_NULL);
     55    static ClassID                        StringToID(const std::string& className);
    5556    static void                           debug(unsigned int debugLevel = 0, ClassID classID = CL_NULL);
    56     static void                           debugS(const char* className = NULL, unsigned int debugLevel = 0);
     57    static void                           debugS(const std::string& className = "", unsigned int debugLevel = 0);
    5758
    5859    inline bool                           operator==(ClassID classID) { return (this->classID == classID); };
    59     bool                                  operator==(const char* className);
     60    bool                                  operator==(const std::string& className);
    6061    inline ClassID                        getLeafClassID() const { return this->classID; };
    6162
    6263  private:
    6364    static ClassList*                     getClassList(ClassID classID);
    64     static ClassList*                     getClassList(const char* className);
     65    static ClassList*                     getClassList(const std::string& className);
    6566
    6667  private:
    67     ClassID                         classID;                //!< ClassID stored in this ClassList
    68     unsigned long                   classIDFull;            //!< The Full ClassID of this Class.
     68    ClassID                               classID;                //!< ClassID stored in this ClassList
     69    unsigned long                         classIDFull;            //!< The Full ClassID of this Class.
    6970
    70     const char*                     className;              //!< Name of the Class Stored here
     71    const std::string                     className;              //!< Name of the Class Stored here
    7172
    72     std::list<BaseObject*>          objectList;             //!< A list of Objects belonging to this Class
     73    std::list<BaseObject*>                objectList;             //!< A list of Objects belonging to this Class
    7374
    7475    // STATIC MEMBERS
    75     static std::list<ClassList>*    classList;              //!< The first Class in the List
    76     static std::list<const char*>   classNames;             //!< a List of all Names of all classes, that have registered so far.
     76    static std::list<ClassList>*          classList;              //!< The first Class in the List
     77    static std::list<std::string>         classNames;             //!< a List of all Names of all classes, that have registered so far.
    7778};
    7879
  • branches/std/src/lib/particles/dot_particles.h

    r6652 r7216  
    2121  virtual void loadParams(const TiXmlElement* root);
    2222
    23   void setMaterialTexture(const char* textureFile);
     23  void setMaterialTexture(const std::string& textureFile);
    2424
    2525  /** @returns the Material that lies on this particles */
  • branches/std/src/lib/particles/model_particles.cc

    r7198 r7216  
    8989 * @param textureFile the Texture to load onto these ModelParticles
    9090 */
    91 void ModelParticles::setMaterialTexture(const char* textureFile)
     91void ModelParticles::setMaterialTexture(const std::string& textureFile)
    9292{
    9393  this->material.setDiffuseMap(textureFile);
  • branches/std/src/lib/particles/model_particles.h

    r6629 r7216  
    2020  virtual void loadParams(const TiXmlElement* root);
    2121
    22   void setMaterialTexture(const char* textureFile);
     22  void setMaterialTexture(const std::string& textureFile);
    2323
    2424  /** @returns the Material that lies on this particles */
  • branches/std/src/lib/particles/sprite_particles.cc

    r7198 r7216  
    8989 * @param textureFile the Texture to load onto these SpriteParticles
    9090 */
    91 void SpriteParticles::setMaterialTexture(const char* textureFile)
     91void SpriteParticles::setMaterialTexture(const std::string& textureFile)
    9292{
    9393  this->material.setDiffuseMap(textureFile);
  • branches/std/src/lib/particles/sprite_particles.h

    r6626 r7216  
    2121  virtual void loadParams(const TiXmlElement* root);
    2222
    23   void setMaterialTexture(const char* textureFile);
     23  void setMaterialTexture(const std::string& textureFile);
    2424
    2525  /** @returns the Material that lies on this particles */
  • branches/std/src/lib/physics/physics_connection.cc

    r7193 r7216  
    7373 * @param subjectName the name of the Subject for this PhysicsConnection
    7474*/
    75 void PhysicsConnection::setSubject(const char* subjectName)
     75void PhysicsConnection::setSubject(const std::string& subjectName)
    7676{
    7777  this->subject = PhysicsEngine::getInstance()->getPhysicsInterfaceByName(subjectName);
    7878  if (this->subject == NULL)
    7979  {
    80     PRINTF(2)("subject: (%s) not found for PhysicsConnection\n", subjectName);
     80    PRINTF(2)("subject: (%s) not found for PhysicsConnection\n", subjectName.c_str());
    8181  }
    8282  else
     
    8787* @param fieldName the Name of the Field for this connection
    8888*/
    89 void PhysicsConnection::setField(const char* fieldName)
     89void PhysicsConnection::setField(const std::string& fieldName)
    9090{
    9191  this->field = PhysicsEngine::getInstance()->getFieldByName(fieldName);
    9292  if (this->field == NULL)
    9393  {
    94         PRINTF(2)("field: (%s) not found for PhysicsConnection\n", fieldName);
     94    PRINTF(2)("field: (%s) not found for PhysicsConnection\n", fieldName.c_str());
    9595  }
    9696  else
  • branches/std/src/lib/physics/physics_connection.h

    r5257 r7216  
    3535  virtual ~PhysicsConnection();
    3636
    37   void setSubject(const char* subjectName);
    38   void setField(const char* fieldName);
     37  void setSubject(const std::string& subjectName);
     38  void setField(const std::string& fieldName);
    3939
    4040  void apply() const;
  • branches/std/src/lib/physics/physics_engine.cc

    r7193 r7216  
    128128  @returns the PhysicsInterface if found, or NULL if not
    129129 */
    130 PhysicsInterface* PhysicsEngine::getPhysicsInterfaceByName(const char* physicsInterfaceName) const
     130PhysicsInterface* PhysicsEngine::getPhysicsInterfaceByName(const std::string& physicsInterfaceName) const
    131131{
    132132  BaseObject* interface = ClassList::getObject(physicsInterfaceName, CL_PHYSICS_INTERFACE);
     
    157157
    158158/**
    159 * @param FieldName the Name of the PhysicsInterface to search for
     159* @param fieldName the Name of the PhysicsInterface to search for
    160160  @returns the Field if found, or NULL if not
    161161 */
    162 Field* PhysicsEngine::getFieldByName(const char* FieldName) const
     162Field* PhysicsEngine::getFieldByName(const std::string& fieldName) const
    163163{
    164164  list<Field*>::const_iterator field;
    165165  for (field = this->fields.begin(); field != this->fields.end(); field++)
    166     if (!strcmp(FieldName, (*field)->getName()))
     166    if (fieldName == (*field)->getName())
    167167      return (*field);
    168168  return NULL;
     
    197197  @returns the PhysicsConnection if found, or NULL if not
    198198 */
    199 PhysicsConnection* PhysicsEngine::getPhysicsConnectionByName(const char* physicsConnectionName) const
     199PhysicsConnection* PhysicsEngine::getPhysicsConnectionByName(const std::string& physicsConnectionName) const
    200200{
    201201  list<PhysicsConnection*>::const_iterator pc;
    202202  for (pc = this->connections.begin(); pc != this->connections.end(); pc++)
    203     if (!strcmp(physicsConnectionName, (*pc)->getName()))
     203    if (physicsConnectionName == (*pc)->getName())
    204204      delete (*pc);
    205205  return NULL;
  • branches/std/src/lib/physics/physics_engine.h

    r6512 r7216  
    3131  void loadConnections(const TiXmlElement* root);
    3232
    33   PhysicsInterface*      getPhysicsInterfaceByName(const char* physicsInterfaceName) const;
     33  PhysicsInterface*      getPhysicsInterfaceByName(const std::string& physicsInterfaceName) const;
    3434
    3535  void                   addField(Field* field);
    3636  void                   removeField(Field* field);
    37   Field*                 getFieldByName(const char* FieldName) const;
     37  Field*                 getFieldByName(const std::string& fieldName) const;
    3838
    3939  void                   addConnection(PhysicsConnection* connection);
    4040  void                   removeConnection(PhysicsConnection* connection);
    41   PhysicsConnection*     getPhysicsConnectionByName(const char* physicsConnectionName) const;
     41  PhysicsConnection*     getPhysicsConnectionByName(const std::string& physicsConnectionName) const;
    4242
    4343
  • branches/std/src/lib/shell/shell.cc

    r7198 r7216  
    8585  this->lineSpacing = 0;
    8686  this->bActive = true;
    87   this->fontFile = new char[strlen(SHELL_DEFAULT_FONT)+1];
    88   strcpy(this->fontFile, SHELL_DEFAULT_FONT);
     87  this->fontFile = SHELL_DEFAULT_FONT;
    8988
    9089
     
    110109    delete this->bufferText[i];
    111110  delete[] this->bufferText;
    112   delete[] this->fontFile;
    113111  // delete the inputLine
    114112  delete this->shellInput;
     
    139137    if (!top)
    140138    {
    141       this->bufferText[i]->setText((*textLine), true);
     139      this->bufferText[i]->setText((*textLine));
    142140    if (textLine != ShellBuffer::getInstance()->getBuffer()->begin())
    143141      top = true;
     
    167165    if (textLine != ShellBuffer::getInstance()->getBuffer()->begin())
    168166    {
    169       this->bufferText[i]->setText((*textLine), false);
     167      this->bufferText[i]->setText((*textLine));
    170168      textLine--;
    171169    }
     
    181179 * (be aware that within orxonox fontFile is relative to the Data-Dir)
    182180 */
    183 void Shell::setFont(const char* fontFile)
     181void Shell::setFont(const std::string& fontFile)
    184182{
    185183//   if (!ResourceManager::isInDataDir(fontFile))
    186184//     return false;
    187185
    188   if (this->fontFile != NULL)
    189     delete[] this->fontFile;
    190 
    191   this->fontFile = new char[strlen(fontFile)+1];
    192   strcpy(this->fontFile, fontFile);
     186  this->fontFile = fontFile;
    193187
    194188  this->rebuildText();
     
    245239 * @param fileName the filename of the Image to load
    246240 */
    247 void Shell::setBackgroundImage(const char* fileName)
     241void Shell::setBackgroundImage(const std::string& fileName)
    248242{
    249243  this->backgroundMaterial->setDiffuseMap(fileName);
     
    340334    for (int i = 0; i < this->bufferDisplaySize; i++)
    341335    {
    342       this->bufferText[i]->setText(NULL, true);
     336      this->bufferText[i]->setText("");
    343337    }
    344338
     
    351345 * @param text the text to output.
    352346 */
    353 void Shell::printToDisplayBuffer(const char* text)
     347void Shell::printToDisplayBuffer(const std::string& text)
    354348{
    355349  if(likely(bufferText != NULL))
     
    382376    this->bufferText[0] = lastText;
    383377
    384     this->bufferText[0]->setText(text, true);
     378    this->bufferText[0]->setText(text);
    385379  }
    386380}
     
    427421  for (unsigned int i = 0; i < this->bufferDisplaySize; i++)
    428422  {
    429     this->bufferText[i]->setText((*it), false);
     423    this->bufferText[i]->setText((*it));
    430424    it--;
    431425  }
  • branches/std/src/lib/shell/shell.h

    r5784 r7216  
    5353    inline bool isActive() const { return this->bActive; };
    5454
    55     void setFont(const char* fontFile);
     55    void setFont(const std::string& fontFile);
    5656    void setTextSize(unsigned int textSize, unsigned int lineSpacing = 1);
    5757    void setTextColor(float r, float g, float b, float a);
    5858    void setBackgroundColor(float r, float g, float b, float a);
    59     void setBackgroundImage(const char* fileName);
     59    void setBackgroundImage(const std::string& fileName);
    6060
    6161    void resetValues();
     
    6464    // BUFFERS
    6565    void setBufferDisplaySize(unsigned int bufferDisplaySize);
    66     void printToDisplayBuffer(const char* text);
     66    void printToDisplayBuffer(const std::string& text);
    6767    void moveDisplayBuffer(int lineCount);
    6868
     
    8383
    8484    //     void testI (int i);
    85     //     void testS (const char* s);
     85    //     void testS (const std::string& s);
    8686    //     void testB (bool b);
    8787    //     void testF (float f);
    88     //     void testSF (const char* s, float f);
     88    //     void testSF (const std::string& s, float f);
    8989
    9090  private:
     
    9595    unsigned int                textSize;               //!< The size of the text.
    9696    float                       textColor[4];           //!< The text's color [r,g,b,a].
    97     char*                       fontFile;               //!< The file containing the font.
     97    std::string                 fontFile;               //!< The file containing the font.
    9898    Material*                   backgroundMaterial;     //!< A material for the background.
    9999
  • branches/std/src/lib/shell/shell_command.cc

    r7211 r7216  
    153153 * @return true on success, false otherwise.
    154154 */
    155 bool ShellCommand::execute(const char* executionString)
     155bool ShellCommand::execute(const std::string& executionString)
    156156{
    157157  if (ShellCommandClass::commandClassList == NULL)
     
    184184          {
    185185            if (inputSplits.getCount() > 1)
    186               (*alias)->getCommand()->executor->execute(objectList->front(), executionString+inputSplits.getOffset(1));
     186            {
     187
     188              (*alias)->getCommand()->executor->execute(objectList->front(), executionString.substr(inputSplits.getOffset(1), executionString.size())); /// TODO CHECK IF OK
     189            }
    187190            else
    188191              (*alias)->getCommand()->executor->execute(objectList->front(), "");
     
    240243              return false;
    241244            if (inputSplits.getCount() > fktPos+1)
    242               (*cmdIT)->executor->execute(objectPointer, executionString+inputSplits.getOffset(fktPos +1));
     245              (*cmdIT)->executor->execute(objectPointer, executionString.substr(inputSplits.getOffset(fktPos +1), executionString.size())); /// TODO CHECK IF OK
    243246            else
    244247              (*cmdIT)->executor->execute(objectPointer, "");
     
    326329  for (classIT = ShellCommandClass::commandClassList->begin(); classIT != ShellCommandClass::commandClassList->end(); classIT++)
    327330  {
    328     PRINT(0)("Class:'%s' registered %d commands: \n", (*classIT)->className, (*classIT)->commandList.size());
     331    PRINT(0)("Class:'%s' registered %d commands: \n", (*classIT)->className.c_str(), (*classIT)->commandList.size());
    329332
    330333    list<ShellCommand*>::iterator cmdIT;
  • branches/std/src/lib/shell/shell_command.h

    r7201 r7216  
    6161  friend class ShellCommandClass;
    6262  public:
    63     static bool execute (const char* executionString);
     63    static bool execute (const std::string& executionString);
    6464
    6565    ShellCommand* describe(const char* description);
  • branches/std/src/lib/shell/shell_command_class.cc

    r5780 r7216  
    3636 * @param className the Name of the command-class to create
    3737 */
    38 ShellCommandClass::ShellCommandClass(const char* className)
     38ShellCommandClass::ShellCommandClass(const std::string& className)
     39  : className(className)
    3940{
    4041  this->setClassID(CL_SHELL_COMMAND_CLASS, "ShellCommandClass");
    4142  this->setName(className);
    4243
    43   this->className = className;
    4444  this->classID = CL_NULL;
    4545
     
    6565 * @returns true on success, false otherwise
    6666 */
    67 bool ShellCommandClass::getCommandListOfClass(const char* className, std::list<const char*>* stringList)
    68 {
    69   if (stringList == NULL || className == NULL)
     67bool ShellCommandClass::getCommandListOfClass(const std::string& className, std::list<std::string>* stringList)
     68{
     69  if (stringList == NULL)
    7070    return false;
    7171
     
    7373  for(elem = ShellCommandClass::commandClassList->begin(); elem != ShellCommandClass::commandClassList->end(); elem++)
    7474  {
    75     if (!strcmp ((*elem)->getName(), className))
     75    if (className == (*elem)->getName())
    7676    {
    7777      list<ShellCommand*>::iterator command;
     
    8888 * @returns true on success, false otherwise
    8989 */
    90 bool ShellCommandClass::getCommandListOfAlias(std::list<const char*>* stringList)
     90bool ShellCommandClass::getCommandListOfAlias(std::list<std::string>* stringList)
    9191{
    9292  if (stringList == NULL || ShellCommandClass::aliasList == NULL)
     
    138138  for (classIT = ShellCommandClass::commandClassList->begin(); classIT != ShellCommandClass::commandClassList->end(); classIT++)
    139139  {
    140     if (!strcmp(className, (*classIT)->className))
     140    if (className == (*classIT)->className)
    141141    {
    142142      if ((*classIT)->classID == CL_NULL)
     
    154154 * @returns the CommandClass if found, or a new CommandClass if not
    155155 */
    156 ShellCommandClass* ShellCommandClass::getCommandClass(const char* className)
     156ShellCommandClass* ShellCommandClass::getCommandClass(const std::string& className)
    157157{
    158158  if (ShellCommandClass::commandClassList == NULL)
     
    162162  for (classIT = ShellCommandClass::commandClassList->begin(); classIT != ShellCommandClass::commandClassList->end(); classIT++)
    163163  {
    164     if (!strcmp(className, (*classIT)->className))
     164    if (className == (*classIT)->className)
    165165    {
    166166      return (*classIT);
     
    186186 * @param className: the Class of Commands to show help about
    187187 */
    188 void ShellCommandClass::help(const char* className)
    189 {
    190   if (className == NULL)
    191     return;
     188void ShellCommandClass::help(const std::string& className)
     189{
    192190  if (likely(ShellCommandClass::commandClassList != NULL))
    193191  {
     
    195193    for (classIT = ShellCommandClass::commandClassList->begin(); classIT != ShellCommandClass::commandClassList->end(); classIT++)
    196194    {
    197       if ((*classIT)->className && !strcasecmp(className, (*classIT)->className))
     195      if (className == (*classIT)->className)
    198196      {
    199         PRINT(0)("Class:'%s' registered %d commands: \n", (*classIT)->className, (*classIT)->commandList.size());
     197        PRINT(0)("Class:'%s' registered %d commands: \n", (*classIT)->className.c_str(), (*classIT)->commandList.size());
    200198        list<ShellCommand*>::const_iterator cmdIT;
    201199        for (cmdIT = (*classIT)->commandList.begin(); cmdIT != (*classIT)->commandList.end(); cmdIT++)
     
    212210      }
    213211    }
    214     PRINTF(3)("Class %s not found in Command's classes\n", className);
     212    PRINTF(3)("Class %s not found in Command's classes\n", className.c_str());
    215213  }
    216214  else
  • branches/std/src/lib/shell/shell_command_class.h

    r6981 r7216  
    2727    /** @returns the CommandClassList */
    2828    static const std::list<ShellCommandClass*>* getCommandClassList() { return ShellCommandClass::commandClassList; };
    29     static bool getCommandListOfClass(const char* className, std::list<const char*>* stringList);
    30     static bool getCommandListOfAlias(std::list<const char*>* aliasList);
     29    static bool getCommandListOfClass(const std::string& className, std::list<std::string>* stringList);
     30    static bool getCommandListOfAlias(std::list<std::string>* aliasList);
    3131
    32     static ShellCommandClass* getCommandClass(const char* className);
     32    static ShellCommandClass* getCommandClass(const std::string& className);
    3333    static void unregisterAllCommands();
    3434
    35     static void help (const char* className);
     35    static void help (const std::string& className);
    3636
    3737  private:
    38     ShellCommandClass(const char* className);
     38    ShellCommandClass(const std::string& className);
    3939    virtual ~ShellCommandClass();
    4040
     
    4343
    4444  private:
    45     const char*                            className;                 //!< The Name of the Class. This should match the ClassName of the Commands Class.
     45    const std::string                      className;                 //!< The Name of the Class. This should match the ClassName of the Commands Class.
    4646    long                                   classID;                   //!< The classID of this Class
    4747    std::list<ShellCommand*>               commandList;               //!< A list of Commands from this Class
  • branches/std/src/lib/shell/shell_completion.cc

    r7211 r7216  
    7676
    7777  // Check if we are in a input. eg. the supplied string "class " and now we complete either function or object
    78   if (this->input->getInput() != NULL &&
    79       strrchr(this->input->getInput(), ' ') >= this->input->getInput() + strlen(this->input->getInput())-1)
     78  if (this->input->getInput()[this->input->getInput().size()-1] == ' ')
    8079  {
    8180    emptyComplete = true;
     
    8382
    8483  // CREATE INPUTS
    85   if (this->input->getInput() == NULL)
    86     completionLine = "";
    87   else
    88     completionLine = this->input->getInput() + strspn(this->input->getInput(), " \t\n");
    89   SubString inputSplits(completionLine, " \t\n,");
     84  SubString inputSplits(this->input->getInput(), " \t\n,");
    9085
    9186  // What String will be completed
     
    151146  if (unlikely(classBegin == NULL))
    152147    return false;
    153   const std::list<const char*>* clList = ClassList::getClassNames();
     148  const std::list<std::string>* clList = ClassList::getClassNames();
    154149  if (clList != NULL)
    155150  {
     
    195190  if (unlikely(functionBegin == NULL))
    196191    return false;
    197   std::list<const char*> fktList;
     192  std::list<std::string> fktList;
    198193  ShellCommandClass::getCommandListOfClass(className, &fktList);
    199194  //printf("%s\n", boList->firstElement()->getName());
     
    212207  if (unlikely(aliasBegin == NULL))
    213208    return false;
    214   std::list<const char*> aliasList;
     209  std::list<std::string> aliasList;
    215210  ShellCommandClass::getCommandListOfAlias(&aliasList);
    216211  //printf("%s\n", boList->firstElement()->getName());
     
    295290 * !! The strings MUST NOT be deleted !!
    296291 */
    297 bool ShellCompletion::addToCompleteList(const std::list<const char*>* inputList, const char* completionBegin, SHELLC_TYPE type)
     292bool ShellCompletion::addToCompleteList(const std::list<std::string>* inputList, const char* completionBegin, SHELLC_TYPE type)
    298293{
    299294  if (inputList == NULL || completionBegin == NULL)
     
    301296  unsigned int searchLength = strlen(completionBegin);
    302297
    303   list<const char*>::const_iterator string;
     298  list<std::string>::const_iterator string;
    304299  for (string = inputList->begin(); string != inputList->end(); string++)
    305300  {
    306     if (strlen(*string) >= searchLength &&
    307         !strncasecmp(*string, completionBegin, searchLength))
     301    if ((*string).size() >= searchLength &&
     302          !strncasecmp((*string).c_str(), completionBegin, searchLength))
    308303    {
    309304      ShellC_Element newElem;
    310       newElem.name = *string;
     305      newElem.name = (*string).c_str();
    311306      newElem.type = type;
    312307      this->completionList.push_back(newElem);
  • branches/std/src/lib/shell/shell_completion.h

    r5784 r7216  
    5252  bool generalComplete(const char* begin, const char* displayAs = "%s", const char* addBack = NULL, const char* addFront = NULL);
    5353
    54   bool addToCompleteList(const std::list<const char*>* inputList, const char* completionBegin, SHELLC_TYPE type);
     54  bool addToCompleteList(const std::list<std::string>* inputList, const char* completionBegin, SHELLC_TYPE type);
    5555  bool addToCompleteList(const std::list<BaseObject*>* inputList, const char* completionBegin, SHELLC_TYPE type);
    5656  void emptyCompletionList();
  • branches/std/src/lib/shell/shell_input.cc

    r7207 r7216  
    4646  this->setClassID(CL_SHELL_INPUT, "ShellInput");
    4747
    48   this->inputLine = new char[1];
    49   this->inputLine[0] = '\0';
     48  this->inputLine = "";
    5049  this->historyIT = this->history.begin();
    5150  this->setHistoryLength(50);
     
    7069{
    7170  // delete what has to be deleted here
    72   delete[] this->inputLine;
    7371  delete this->completion;
    7472
    7573  while (!this->history.empty())
    7674  {
    77     delete[] this->history.front();
    7875    this->history.pop_front();
    7976  }
     
    9693void ShellInput::flush()
    9794{
    98   if (likely(this->inputLine != NULL))
    99   {
    100     delete[] this->inputLine;
    101   }
    102   this->inputLine = new char[1];
    103   *this->inputLine = '\0';
    104   this->setText(this->inputLine, true);
     95  this->inputLine.clear();
     96  this->setText(this->inputLine);
    10597}
    10698
     
    109101 * @param text the new Text to set as InputLine
    110102 */
    111 void ShellInput::setInputText(const char* text)
    112 {
    113   delete[] this->inputLine;
    114   if (text == NULL)
    115   {
    116     this->inputLine = new char[1];
    117     this->inputLine[0] = '\0';
    118   }
    119   else
    120   {
    121     this->inputLine = new char[strlen(text)+1];
    122     strcpy(this->inputLine, text);
    123   }
    124   this->setText(this->inputLine, true);
     103void ShellInput::setInputText(const std::string& text)
     104{
     105  this->inputLine = text;
     106  this->setText(this->inputLine);
    125107}
    126108
     
    134116  if (this->historyScrolling)
    135117  {
    136     delete[] this->history.back();
    137118    this->history.pop_back();
    138119    this->historyScrolling = false;
    139120  }
    140121
    141   char* addCharLine = new char[strlen(this->inputLine)+2];
    142 
    143   sprintf(addCharLine, "%s%c", this->inputLine, character);
    144   delete[] this->inputLine;
    145   this->inputLine = addCharLine;
    146   this->setText(this->inputLine, true);
     122  this->inputLine += character;
     123  this->setText(this->inputLine);
    147124}
    148125
     
    151128 * @param characters a \\0 terminated char-array to add to the InputLine
    152129 */
    153 void ShellInput::addCharacters(const char* characters)
     130void ShellInput::addCharacters(const std::string& characters)
    154131{
    155132  if (this->historyScrolling)
    156133  {
    157     delete[] this->history.back();
    158134    this->history.pop_back();
    159135    this->historyScrolling = false;
    160136  }
    161137
    162   char* addCharLine = new char[strlen(this->inputLine)+strlen(characters)+1];
    163 
    164   sprintf(addCharLine, "%s%s", this->inputLine, characters);
    165   delete[] this->inputLine;
    166   this->inputLine = addCharLine;
    167   this->setText(this->inputLine, true);
     138  this->inputLine += characters;
     139  this->setText(this->inputLine);
    168140}
    169141
     
    176148  if (this->historyScrolling)
    177149  {
    178     delete[] this->history.back();
    179150    this->history.pop_back();
    180151    this->historyScrolling = false;
    181152  }
    182 
    183   if (strlen(this->inputLine) == 0)
    184     return;
    185 
    186   if (characterCount > strlen(this->inputLine))
    187     characterCount = strlen(this->inputLine);
    188 
    189   char* removeCharLine = new char[strlen(this->inputLine)-characterCount+1];
    190 
    191   strncpy(removeCharLine, this->inputLine, strlen(this->inputLine)-characterCount);
    192   removeCharLine[strlen(this->inputLine)-characterCount] = '\0';
    193   delete[] this->inputLine;
    194   this->inputLine = removeCharLine;
    195   this->setText(this->inputLine, true);
     153  if (this->inputLine.size() < characterCount)
     154    characterCount = this->inputLine.size();
     155
     156  this->inputLine.erase(this->inputLine.size() - characterCount, this->inputLine.size());
     157  this->setText(this->inputLine);
    196158}
    197159
     
    202164bool ShellInput::executeCommand()
    203165{
    204   ShellBuffer::addBufferLineStatic("Execute Command: %s\n", this->inputLine);
    205 
    206   if (strlen(this->inputLine) == 0)
     166  ShellBuffer::addBufferLineStatic("Execute Command: %s\n", this->inputLine.c_str());
     167
     168  if (this->inputLine.empty())
    207169    return false;
    208170
    209   char* newCommand = new char[strlen(this->inputLine)+1];
    210   strcpy(newCommand, this->inputLine);
    211 
    212   ShellCommand::execute(newCommand);
     171  ShellCommand::execute(this->inputLine);
    213172
    214173  // removing the eventually added Entry (from scrolling) to the List
    215174  if (this->historyScrolling)
    216175  {
    217     delete[] this->history.back();
    218176    this->history.pop_back();
    219177    this->historyScrolling = false;
     
    221179
    222180  // adding the new Command to the History
    223   this->history.push_back(newCommand);
     181  this->history.push_back(this->inputLine);
    224182  if (this->history.size() > this->historyLength)
    225183  {
    226     delete[] this->history.front();
    227184    this->history.pop_front();
    228185  }
     
    241198  if (!this->historyScrolling)
    242199  {
    243     char* currentText = new char[strlen(this->inputLine)+1];
    244     strcpy(currentText, this->inputLine);
    245     this->history.push_back(currentText);
     200    this->history.push_back(this->inputLine);
    246201    this->historyScrolling = true;
    247202    this->historyIT = --this->history.end();
     
    250205  if(this->historyIT != this->history.begin())
    251206  {
    252     char* prevElem = *(--this->historyIT);
    253     if (prevElem == NULL)
     207    std::string prevElem = *(--this->historyIT);
     208    /*if (prevElem == NULL) /// TODO STD
    254209      return;
    255     else
     210    else */
    256211    {
    257212      this->flush();
     
    270225  if (this->historyIT != this->history.end())
    271226  {
    272     char* nextElem = *(++this->historyIT);
    273     if (nextElem == NULL)
     227    std::string nextElem = *(++this->historyIT);
     228    /*    if (nextElem == NULL) /// TODO FIX STD
    274229      return;
    275     else
     230    else */
    276231    {
    277232      this->flush();
     
    285240 * prints out some nice help about the Shell
    286241 */
    287 void ShellInput::help(const char* className, const char* functionName)
    288 {
    289   printf("%s::%s\n", className, functionName);
    290 
    291   if (strlen(className) == 0)
     242void ShellInput::help(const std::string& className, const std::string& functionName)
     243{
     244  printf("%s::%s\n", className.c_str(), functionName.c_str());
     245
     246  if (className.empty())
    292247  {
    293248    PRINT(0)("Help for the most important Shell-commands\n");
     
    298253    PRINT(0)("- Also try 'help className'");
    299254  }
    300   else if (strlen (className) > 0 && strlen (functionName) == 0)
     255  else if (!className.empty() && functionName.empty())
    301256  {
    302257    ShellCommandClass::help(className);
  • branches/std/src/lib/shell/shell_input.h

    r5786 r7216  
    3131
    3232  /** @returns the inputLine */
    33   const char* getInput() const { return this->inputLine; };
     33  const std::string& getInput() const { return this->inputLine; };
    3434
    3535  // InputLine
    3636  void flush();
    37   void setInputText(const char* text);
     37  void setInputText(const std::string& text);
    3838  void addCharacter(char character);
    39   void addCharacters(const char* characters);
     39  void addCharacters(const std::string& characters);
    4040  void removeCharacters(unsigned int characterCount = 1);
    4141  void setRepeatDelay(float repeatDelay, float repeatRate);
     
    4747  void historyMoveDown();
    4848
    49   void help(const char* className = "", const char* function = "");
     49  void help(const std::string& className = "", const std::string& function = "");
    5050
    5151  virtual void tick(float dt);
     
    5454 private:
    5555    // HANDLING TEXT INPUT
    56    ShellCompletion*            completion;             //!< The Completion Interface.
     56   ShellCompletion*                  completion;       //!< The Completion Interface.
    5757
    58    char*                       inputLine;              //!< the Char-Array of the Buffer
    59    float                       repeatRate;             //!< The Repeat-Delay.
    60    float                       repeatDelay;            //!< The delay of the first Character of a given Character.
    61    float                       delayed;                //!< how much of the delay is remaining.
    62    Uint16                      pressedKey;             //!< the pressed key that will be repeated.
     58   std::string                       inputLine;        //!< the Char-Array of the Buffer
     59   float                             repeatRate;       //!< The Repeat-Delay.
     60   float                             repeatDelay;      //!< The delay of the first Character of a given Character.
     61   float                             delayed;          //!< how much of the delay is remaining.
     62   Uint16                            pressedKey;       //!< the pressed key that will be repeated.
    6363
    64    std::list<char*>            history;                //!< The history of given commands.
    65    std::list<char*>::iterator  historyIT;
    66    unsigned int                historyLength;          //!< The maximum length of the InputHistory.
    67    bool                        historyScrolling;      //!< true if we are scrolling through the history.
     64   std::list<std::string>            history;          //!< The history of given commands.
     65   std::list<std::string>::iterator  historyIT;        //!< The locator that tells us, where we are in the history.
     66   unsigned int                      historyLength;    //!< The maximum length of the InputHistory.
     67   bool                              historyScrolling; //!< true if we are scrolling through the history.
    6868};
    6969
  • branches/std/src/lib/util/executor/executor.h

    r7214 r7216  
    271271    {
    272272      SubString sub;
    273       printf("===%s\n", parameters.c_str());
    274273      sub.split(parameters, " \n\t,", '\\');
    275       sub.debug();
    276274//! FUNCTOR_LIST is the List of Executive Functions
    277275#define FUNCTOR_LIST(x) ExecutorExecute ## x
  • branches/std/src/lib/util/executor/functor_list.h

    r7214 r7216  
    9898
    9999  FUNCTOR_LIST(0)();
    100   //! makes functions with one cstring
    101   FUNCTOR_LIST(1)(l_CSTRING);
    102   //! makes functions with two cstrings
    103   FUNCTOR_LIST(2)(l_CSTRING, l_CSTRING);
    104   //! makes functions with three cstrings
    105   FUNCTOR_LIST(3)(l_CSTRING, l_CSTRING, l_CSTRING);
    106   //! makes functions with four cstrings
    107   FUNCTOR_LIST(4)(l_CSTRING, l_CSTRING, l_CSTRING, l_CSTRING);
    108 
    109100  //! makes functions with one string
    110101  FUNCTOR_LIST(1)(l_STRING);
     
    151142
    152143  //! mixed values:
    153   FUNCTOR_LIST(2)(l_CSTRING, l_FLOAT);
     144  FUNCTOR_LIST(2)(l_STRING, l_FLOAT);
    154145  FUNCTOR_LIST(2)(l_UINT, l_LONG);
    155   FUNCTOR_LIST(2)(l_CSTRING, l_UINT);
     146  FUNCTOR_LIST(2)(l_STRING, l_UINT);
    156147
    157   FUNCTOR_LIST(3)(l_CSTRING, l_FLOAT, l_UINT);
     148  FUNCTOR_LIST(3)(l_STRING, l_FLOAT, l_UINT);
    158149
    159150
  • branches/std/src/lib/util/helper_functions.cc

    r7214 r7216  
    104104{
    105105  if (STRING.size() > 0)
    106   {
    107     printf("DECISION1: %s\n", STRING.c_str());
    108106    return STRING;
    109   }
    110107  else
    111   {
    112     printf("DECISION2: %s\n", defaultValue.c_str());
    113108    return defaultValue;
    114   }
    115109}
    116110
  • branches/std/src/lib/util/loading/load_param.cc

    r7214 r7216  
    6666          ((this->executor->getType() & Executor_NoLoadString) == Executor_NoLoadString)))
    6767    {
    68       PRINTF(0)("Loading value '%s' with Parameters '%s' onto: %s::%s\n", this->paramName.c_str(), loadString.c_str(), this->object->getClassName(), this->object->getName());
     68      PRINTF(4)("Loading value '%s' with Parameters '%s' onto: %s::%s\n", this->paramName.c_str(), loadString.c_str(), this->object->getClassName(), this->object->getName());
    6969      this->executor->execute(this->object, loadString);
    7070    }
Note: See TracChangeset for help on using the changeset viewer.