28 #include <SimoxUtility/algorithm/string/string_tools.h>
37 std::string description,
41 std::string casesensitivity,
42 std::string requirement,
44 std::vector<std::string>
values,
51 output = simox::alg::replace_first(output,
"%name%",
formatName(name));
52 output = simox::alg::replace_first(output,
"%description%",
formatDescription(description));
54 output = simox::alg::replace_first(output,
"%default%",
formatDefault(default_));
55 output = simox::alg::replace_first(output,
"%casesensitive%",
formatCaseSensitivity(casesensitivity));
56 output = simox::alg::replace_first(output,
"%required%",
formatRequirement(requirement));
57 output = simox::alg::replace_first(output,
"%regex%",
formatRegex(regex));
60 std::string valueEntry;
70 valueEntry =
"<set value!>";
74 valueEntry = default_;
78 if (requirement.compare(
"no") == 0 &&
value.empty())
84 output = simox::alg::replace_first(output,
"%name%", name);
85 output = simox::alg::replace_first(output,
"%value%", valueEntry);
92 return std::string(
"%name%:")
101 +
"%name% = %value%\n\n";
111 std::string commentDescription = simox::alg::replace_all(description,
"\n",
"\n# ");
113 return commentDescription;
120 if (!
min.empty() &&
max.empty())
124 else if (
min.empty() && !
max.empty())
128 else if (!
min.empty() && !
max.empty())
158 std::string valueStrings;
160 if (mapValues.size() > 0)
162 valueStrings +=
"# - Possible values: {";
164 std::vector<std::string>::iterator it = mapValues.begin();
166 while (it != mapValues.end())
175 valueStrings += (it != mapValues.end() ?
", " :
"}\n");
179 return valueStrings ;
189 if (!details.empty())
191 std::stringstream strStream;
192 strStream << std::setfill(
' ') << std::left << std::setw(20) << name;
193 strStream << details;
195 return "# - " + strStream.str() +
"\n";
198 return std::string();
203 std::string formattedHeaderText =
"# " + headerText;
204 formattedHeaderText = simox::alg::replace_all(formattedHeaderText,
"\n",
"\n# ");
206 return "# ==================================================================\n"
207 + formattedHeaderText +
"\n"
208 +
"# ==================================================================\n\n";