1 | /* |
---|
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: |
---|
12 | main-programmer: Benjamin Grauer |
---|
13 | co-programmer: ... |
---|
14 | */ |
---|
15 | |
---|
16 | #include "load_param_description.h" |
---|
17 | |
---|
18 | #include "multi_type.h" |
---|
19 | #include "debug.h" |
---|
20 | |
---|
21 | /** |
---|
22 | * @param paramName the name of the parameter to load |
---|
23 | */ |
---|
24 | LoadParamDescription::LoadParamDescription(const std::string& paramName) |
---|
25 | : name(paramName) |
---|
26 | { } |
---|
27 | |
---|
28 | /** |
---|
29 | * removes all the alocated memory |
---|
30 | */ |
---|
31 | LoadParamDescription::~LoadParamDescription() |
---|
32 | { |
---|
33 | } |
---|
34 | |
---|
35 | /** |
---|
36 | * @param descriptionText The text to set as a description for this Parameter |
---|
37 | */ |
---|
38 | void LoadParamDescription::setDescription(const std::string& descriptionText) |
---|
39 | { |
---|
40 | this->description = descriptionText; |
---|
41 | } |
---|
42 | |
---|
43 | /** |
---|
44 | * prints out this parameter, its input method and the description (if availiable) |
---|
45 | */ |
---|
46 | void LoadParamDescription::print() const |
---|
47 | { |
---|
48 | PRINT(3)(" <%s>", this->name.c_str()); |
---|
49 | for (unsigned int i = 0; i < this->parameterCount; i++) |
---|
50 | { |
---|
51 | if (i > 0) |
---|
52 | PRINT(3)(","); |
---|
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 | // } |
---|
84 | } |
---|
85 | PRINT(3)("</%s>", this->name.c_str()); |
---|
86 | if (!this->description.empty()) |
---|
87 | PRINT(3)(" -- %s", this->description.c_str()); |
---|
88 | // default values |
---|
89 | if (this->parameterCount > 0) |
---|
90 | { |
---|
91 | PRINT(3)(" (Default: "); |
---|
92 | for (unsigned int i = 0; i < this->parameterCount; i++) |
---|
93 | { |
---|
94 | if (i > 0) |
---|
95 | PRINT(3)(", "); |
---|
96 | if (this->types[i] == "string") |
---|
97 | { // leave brackets !! |
---|
98 | PRINT(3)("\"%s\"", this->defaultValues[i].c_str()); |
---|
99 | } |
---|
100 | else |
---|
101 | { |
---|
102 | PRINT(3)("%s", this->defaultValues[i].c_str()); |
---|
103 | } |
---|
104 | } |
---|
105 | PRINT(3)(")"); |
---|
106 | } |
---|
107 | PRINT(3)("\n"); |
---|
108 | } |
---|