Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 15, 2006, 3:10:45 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the std-branche back, it runs on windows and Linux

svn merge https://svn.orxonox.net/orxonox/branches/std . -r7202:HEAD

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/util/loading/load_param_description.cc

    r7130 r7221  
    2222 * @param paramName the name of the parameter to load
    2323 */
    24 LoadParamDescription::LoadParamDescription(const char* paramName)
     24LoadParamDescription::LoadParamDescription(const std::string& paramName)
    2525{
    2626  this->types = NULL;
    27   this->description = NULL;
    2827  this->defaultValues = NULL;
    29   this->paramName = new char[strlen(paramName)+1];
    30   strcpy(this->paramName, paramName);
     28  this->paramName = paramName;
    3129}
    3230
     
    4644  delete[] this->types;
    4745  delete[] this->defaultValues;
    48   delete[] this->paramName;
    49   delete[] this->description;
    5046}
    5147
     
    5349 * @param descriptionText The text to set as a description for this Parameter
    5450 */
    55 void LoadParamDescription::setDescription(const char* descriptionText)
    56 {
    57   this->description = new char[strlen(descriptionText)+1];
    58   strcpy(this->description, descriptionText);
     51void LoadParamDescription::setDescription(const std::string& descriptionText)
     52{
     53  this->description = descriptionText;
    5954}
    6055
     
    6459void LoadParamDescription::print() const
    6560{
    66   PRINT(3)(" <%s>", this->paramName);
     61  PRINT(3)(" <%s>", this->paramName.c_str());
    6762  for (int i = 0; i < this->paramCount; i++)
    6863  {
     
    10196//     }
    10297  }
    103   PRINT(3)("</%s>", this->paramName);
    104   if (this->description)
    105     PRINT(3)(" -- %s", this->description);
     98  PRINT(3)("</%s>", this->paramName.c_str());
     99  if (!this->description.empty())
     100    PRINT(3)(" -- %s", this->description.c_str());
    106101  // default values
    107102  if (this->paramCount > 0)
     
    139134 * @param className the name of the class to be loadable
    140135 */
    141 LoadClassDescription::LoadClassDescription(const char* className)
    142 {
    143   this->className = new char[strlen(className)+1];
    144   strcpy(this->className, className);
     136LoadClassDescription::LoadClassDescription(const std::string& className)
     137{
     138  this->className = className;
    145139
    146140  if (LoadClassDescription::classList == NULL)
     
    161155    this->paramList.pop_front();
    162156  }
    163 
    164   delete[] this->className;
    165157}
    166158
     
    187179   Otherwise it returns a new classDescription
    188180 */
    189 LoadClassDescription* LoadClassDescription::addClass(const char* className)
     181LoadClassDescription* LoadClassDescription::addClass(const std::string& className)
    190182{
    191183  if (LoadClassDescription::classList != NULL)
     
    194186    while (it != LoadClassDescription::classList->end())
    195187    {
    196       if (!strcmp((*it)->className, className))
     188      if ((*it)->className == className)
    197189      {
    198190        return (*it);
     
    205197
    206198/**
    207  *  does the same as addClass(const char* className), but with params
     199 *  does the same as addClass(const std::string& className), but with params
    208200 * @param paramName the name of the parameter to add.
    209201 */
    210 LoadParamDescription* LoadClassDescription::addParam(const char* paramName)
     202LoadParamDescription* LoadClassDescription::addParam(const std::string& paramName)
    211203{
    212204  std::list<LoadParamDescription*>::iterator it = this->paramList.begin();
    213205  while (it != this->paramList.end())
    214206  {
    215     if (!strcmp((*it)->paramName, paramName))
     207    if ((*it)->paramName == paramName)
    216208    {
    217209      return NULL;
     
    231223 * @todo implement it
    232224 */
    233 void LoadClassDescription::printAll(const char* fileName)
     225void LoadClassDescription::printAll(const std::string& fileName)
    234226{
    235227  PRINT(3)("===============================================================\n");
     
    240232    while (classDesc != LoadClassDescription::classList->end())
    241233    {
    242       PRINT(3)("<%s>\n", (*classDesc)->className);
     234      PRINT(3)("<%s>\n", (*classDesc)->className.c_str());
    243235      std::list<LoadParamDescription*>::iterator param = (*classDesc)->paramList.begin();
    244236      while (param != (*classDesc)->paramList.end())
     
    247239        param++;
    248240      }
    249       PRINT(3)("</%s>\n\n", (*classDesc)->className);
     241      PRINT(3)("</%s>\n\n", (*classDesc)->className.c_str());
    250242      classDesc++;
    251243    }
     
    262254 * !! The strings MUST NOT be deleted !!
    263255 */
    264 std::list<const char*> LoadClassDescription::searchClassWithShort(const char* classNameBegin)
     256std::list<std::string> LoadClassDescription::searchClassWithShort(const std::string& classNameBegin)
    265257{
    266258  /// FIXME
    267259  // NOT USED
    268260/*  unsigned int searchLength = strlen(classNameBegin);
    269   std::list<const char*> retVal;
     261  std::list<const std::string&> retVal;
    270262
    271263  tIterator<LoadClassDescription>* iterator = LoadClassDescription::classList->getIterator();
Note: See TracChangeset for help on using the changeset viewer.