Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 22, 2005, 2:15:45 AM (20 years ago)
Author:
bensch
Message:

orxonox/branches/levelLoader: description works

Location:
orxonox/branches/levelLoader/src/util/loading
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/levelLoader/src/util/loading/load_param.cc

    r4254 r4255  
    2424BaseLoadParam::BaseLoadParam(BaseObject* object, const char* paramName, int paramCount, ...)
    2525{
     26  this->paramDesc = NULL;
    2627  if (LoadClassDescription::parametersDescription)
    2728    {
     
    5051void BaseLoadParam::describe(const char* descriptionText)
    5152{
    52   if (this->paramDesc)
     53  if (LoadClassDescription::parametersDescription && this->paramDesc && !this->paramDesc->getDescription())
    5354    {
    54      
     55      this->paramDesc->setDescription(descriptionText);
    5556    }
    56 
    5757}
    58 
    5958
    6059LoadParamDescription::LoadParamDescription(const char* paramName)
    6160{
    6261  this->types = NULL;
     62  this->description = NULL;
    6363  this->paramName = new char[strlen(paramName)+1];
    6464  strcpy(this->paramName, paramName);
    6565}
     66
    6667
    6768LoadParamDescription::~LoadParamDescription(void)
     
    7374  delete []this->types;
    7475  delete []this->paramName;
     76}
     77
     78void LoadParamDescription::setDescription(const char* descriptionText)
     79{
     80  this->description = descriptionText;
     81}
     82
     83void LoadParamDescription::print(void) const
     84{
     85  PRINT(3)(" <%s>", this->paramName);
     86  for (int i = 0; i < this->paramCount; i++)
     87    {
     88      if (i > 0)
     89        PRINT(3)(",");
     90      PRINT(3)("%s", this->types[i]);
     91    }
     92  PRINT(3)("</%s>", this->paramName);
     93  if (this->description)
     94    PRINT(3)(" -- %s", this->description);
     95  PRINT(3)("\n");
    7596}
    7697
     
    93114}
    94115
     116
    95117LoadClassDescription::~LoadClassDescription(void)
    96118{
     
    105127    }
    106128  delete iterator;
    107 
    108129}
    109130
     
    137158        {
    138159          delete iterator;
    139           this->paramList->add(enumParamDesc);
    140160          return enumParamDesc;
    141161        }
     
    147167  return paramList->lastElement();
    148168}
     169
     170void LoadClassDescription::printAll(void)
     171{
     172  PRINT(3)("==============================================================\n");
     173  PRINT(3)(" Listing all the Loadable Options (loaded since Game started.\n\n");
     174  tIterator<LoadClassDescription>* classIT = LoadClassDescription::classList->getIterator();
     175  LoadClassDescription* enumClassDesc = classIT->nextElement();
     176  while (enumClassDesc)
     177    {
     178      PRINT(3)("<%s>\n", enumClassDesc->className);
     179      tIterator<LoadParamDescription>* paramIT = enumClassDesc->paramList->getIterator();
     180      LoadParamDescription* enumParamDesc = paramIT->nextElement();
     181      while (enumParamDesc)
     182        {
     183          enumParamDesc->print();
     184          enumParamDesc = paramIT->nextElement();
     185        }
     186      delete paramIT;
     187
     188      PRINT(3)("</%s>\n\n", enumClassDesc->className);
     189      enumClassDesc = classIT->nextElement();
     190    }
     191  delete classIT;
     192
     193}
  • orxonox/branches/levelLoader/src/util/loading/load_param.h

    r4254 r4255  
    162162  LoadParamDescription(const char* paramName);
    163163  ~LoadParamDescription(void);
     164
     165  void setDescription(const char* descriptionText);
     166  /** \returns the descriptionString */
     167  const char* getDescription(void) { return this->description;};
     168
     169  void print(void) const;
    164170 private:
    165171  char* paramName;
    166172  int paramCount;
    167173  char** types;
     174  const char* description;
    168175};
    169176
     
    178185  LoadParamDescription* addParam(const char* paramName);
    179186
    180   static bool parametersDescription;
    181  
     187  static void printAll(void);
     188
     189  static bool parametersDescription; 
    182190  static tList<LoadClassDescription>* classList;
    183191 private:
     
    189197class BaseLoadParam
    190198{
     199 public:
     200  void describe(const char* descriptionText);
     201
    191202 protected:
    192203  BaseLoadParam(BaseObject* object, const char* paramName, int paramCount, ...);
    193   void describe(const char* descriptionText);
    194204
    195205 protected:
Note: See TracChangeset for help on using the changeset viewer.