Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7214 in orxonox.OLD for branches/std/src/lib/lang


Ignore:
Timestamp:
Mar 10, 2006, 7:18:03 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: now the branche works again, as it did before

Location:
branches/std/src/lib/lang
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/std/src/lib/lang/base_object.cc

    r7203 r7214  
    3737  this->classID = CL_BASE_OBJECT;
    3838
    39   this->objectName = NULL;
     39  this->objectName = "";
    4040  this->classList = NULL;
    4141  this->xmlElem = NULL;
     
    5252
    5353  //  delete []this->className;
    54   if (this->objectName)
    55     delete[] this->objectName;
    5654  if (this->xmlElem != NULL)
    5755    delete this->xmlElem;
     
    9795void BaseObject::setName (const std::string& objectName)
    9896{
    99   if (this->objectName)
    100     delete[] this->objectName;
    101   if (!objectName.empty())
    102   {
    103     this->objectName = new char[objectName.size()+1];
    104     strcpy(this->objectName, objectName.c_str());
    105   }
    106   else
    107     this->objectName = NULL;
     97  printf("TEST\n");
     98  this->objectName = objectName;
     99  printf("TEST2\n");
    108100}
    109101
     
    175167bool BaseObject::operator==(const char* objectName)
    176168{
    177   if (likely(this->objectName != NULL && objectName != NULL))
    178     return (strcmp(this->objectName, objectName)) ? false : true;
     169  return (objectName != NULL && this->objectName == objectName);
    179170}
    180171
     
    197188int BaseObject::writeState( const byte * data, int length, int sender )
    198189{
    199   SYNCHELP_READ_BEGIN();
    200 
    201   if ( objectName )
     190  /// FIXME STD
     191
     192  /*  SYNCHELP_READ_BEGIN();
     193
     194  if ( !objectName.empty() )
    202195  {
    203196    delete[] objectName;
     
    211204  }
    212205
    213   return SYNCHELP_READ_N;
     206  return SYNCHELP_READ_N;*/
    214207}
    215208
     
    222215int BaseObject::readState( byte * data, int maxLength )
    223216{
    224   SYNCHELP_WRITE_BEGIN();
     217///FIXME STD
     218  /*  SYNCHELP_WRITE_BEGIN();
    225219
    226220  //PRINTF(0)("objectname = %s\n", this->objectName);
    227221  SYNCHELP_WRITE_STRING( this->objectName, NWT_BO_NAME );
    228222
    229   return SYNCHELP_WRITE_N;
    230 }
     223  return SYNCHELP_WRITE_N;*/
     224}
  • branches/std/src/lib/lang/base_object.h

    r7203 r7214  
    3333  void setName (const std::string& newName);
    3434  /** returns the Name of this Object */
    35   inline const char* getName ()const { return this->objectName; };
     35  inline const char* getName ()const { return this->objectName.c_str(); };
    3636  /** @returns the XML-Element with whicht this Object was loaded */
    3737  inline TiXmlNode* getXmlElem() const { return this->xmlElem; };
     
    6060    const char*        className;        //!< the name of the class
    6161    long               classID;          //!< this is the id from the class_id.h enumeration
    62     char*              objectName;       //!< The name of this object
     62    std::string        objectName;       //!< The name of this object
    6363
    6464    ClassList*         classList;        //!< Pointer to the ClassList this Object is inside of
Note: See TracChangeset for help on using the changeset viewer.