Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/new_class_id/src/lib/util/loading/load_param_description.cc @ 9765

Last change on this file since 9765 was 9765, checked in by bensch, 18 years ago

compiles again

File size: 2.5 KB
RevLine 
[4597]1/*
[4250]2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   ### File Specific:
[4285]12   main-programmer: Benjamin Grauer
[4250]13   co-programmer: ...
14*/
15
[5546]16#include "load_param_description.h"
[5556]17
[5691]18#include "multi_type.h"
[8362]19#include "debug.h"
20
[4860]21/**
[4836]22 * @param paramName the name of the parameter to load
[5546]23 */
[7221]24LoadParamDescription::LoadParamDescription(const std::string& paramName)
[9765]25  : name(paramName)
26{ }
[4254]27
[4256]28/**
[4836]29 *  removes all the alocated memory
[5546]30 */
[4746]31LoadParamDescription::~LoadParamDescription()
[4254]32{
33}
34
[4256]35/**
[4836]36 * @param descriptionText The text to set as a description for this Parameter
[5546]37 */
[7221]38void LoadParamDescription::setDescription(const std::string& descriptionText)
[4255]39{
[7221]40  this->description = descriptionText;
[4255]41}
[4254]42
[4256]43/**
[4836]44 *  prints out this parameter, its input method and the description (if availiable)
[5546]45 */
[4746]46void LoadParamDescription::print() const
[4255]47{
[9765]48  PRINT(3)(" <%s>", this->name.c_str());
49  for (unsigned int i = 0; i < this->parameterCount; i++)
[5546]50  {
51    if (i > 0)
52      PRINT(3)(",");
[5634]53    // FIXME
54    //     switch (this->types[i])
55//     {
56//       default:
57//         PRINTF(3)("none");
58//         break;
59//       case ParameterBool:
60//         PRINT(3)("bool");
61//         break;
62//       case ParameterChar:
63//         PRINT(3)("char");
64//         break;
65//       case ParameterString:
66//         PRINT(3)("string");
67//         break;
68//       case ParameterInt:
69//         PRINT(3)("int");
70//         break;
71//       case ParameterUInt:
72//         PRINT(3)("Uint");
73//         break;
74//       case ParameterFloat:
75//         PRINT(3)("float");
76//         break;
77//       case ParameterLong:
78//         PRINT(3)("long");
79//         break;
80//       case ParameterXML:
81//         PRINT(3)("XML");
82//         break;
83//     }
[5546]84  }
[9765]85  PRINT(3)("</%s>", this->name.c_str());
[7221]86  if (!this->description.empty())
87    PRINT(3)(" -- %s", this->description.c_str());
[4623]88  // default values
[9765]89  if (this->parameterCount > 0)
[4623]90  {
[4637]91    PRINT(3)(" (Default: ");
[9765]92    for (unsigned int i = 0; i < this->parameterCount; i++)
[4623]93    {
94      if (i > 0)
95        PRINT(3)(", ");
[9765]96      if (this->types[i] == "string")
[4625]97      { // leave brackets !!
[9765]98        PRINT(3)("\"%s\"", this->defaultValues[i].c_str());
[4625]99      }
100      else
101      {
[9765]102        PRINT(3)("%s", this->defaultValues[i].c_str());
[4625]103      }
[4623]104    }
105    PRINT(3)(")");
106  }
[4255]107  PRINT(3)("\n");
108}
Note: See TracBrowser for help on using the repository browser.