Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Nov 12, 2005, 1:40:06 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: ShellCommand now uses MultiType instead of many different strange constellations →
saves space and complexity (a bit complexity at least)

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

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/util/multi_type.cc

    r5545 r5552  
    3030MultiType::MultiType()
    3131{
    32   this->type = MT_NULL;
    33   this->storedString = NULL;
    34 }
    35 
     32  this->init();
     33}
    3634/**
    3735 * creates a multiType out of a boolean
     
    178176  if (this->storedString != NULL)
    179177    delete[] this->storedString;
    180   this->storedString = new char[strlen(value)+1];
    181   strcpy(storedString, value);
    182 
    183   this->value.String = this->storedString;
     178
     179  if (value == NULL)
     180  {
     181    this->storedString = new char[1];
     182    this->storedString[0] = '\0';
     183    this->value.String = this->storedString;
     184    return;
     185  }
     186  else
     187  {
     188    this->storedString = new char[strlen(value)+1];
     189    strcpy(storedString, value);
     190    this->value.String = this->storedString;
     191  }
    184192}
    185193
  • trunk/src/lib/util/multi_type.h

    r5551 r5552  
    5757    inline MT_Type getType() const { return this->type; };
    5858
     59
     60    /* RETRIEVING FUNCTIONS */
    5961    bool getBool() const;
    6062    int getInt() const;
Note: See TracChangeset for help on using the changeset viewer.