31 #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(
57 output = simox::alg::replace_first(output,
"%required%",
formatRequirement(requirement));
58 output = simox::alg::replace_first(output,
"%regex%",
formatRegex(regex));
61 std::string valueEntry;
71 valueEntry =
"<set value!>";
75 valueEntry = default_;
79 if (requirement.compare(
"no") == 0 &&
value.empty())
85 output = simox::alg::replace_first(output,
"%name%", name);
86 output = simox::alg::replace_first(output,
"%value%", valueEntry);
94 return std::string(
"%name%:") +
" %description%\n" +
"# Attributes:\n" +
"%default%" +
95 "%bounds%" +
"%casesensitive%" +
"%required%" +
"%regex%" +
"%values%" +
96 "%name% = %value%\n\n";
108 std::string commentDescription = simox::alg::replace_all(description,
"\n",
"\n# ");
110 return commentDescription;
118 if (!
min.empty() &&
max.empty())
122 else if (
min.empty() && !
max.empty())
126 else if (!
min.empty() && !
max.empty())
161 std::string valueStrings;
163 if (mapValues.size() > 0)
165 valueStrings +=
"# - Possible values: {";
167 std::vector<std::string>::iterator it = mapValues.begin();
169 while (it != mapValues.end())
178 valueStrings += (it != mapValues.end() ?
", " :
"}\n");
194 if (!details.empty())
196 std::stringstream strStream;
197 strStream << std::setfill(
' ') << std::left << std::setw(20) << name;
198 strStream << details;
200 return "# - " + strStream.str() +
"\n";
203 return std::string();
209 std::string formattedHeaderText =
"# " + headerText;
210 formattedHeaderText = simox::alg::replace_all(formattedHeaderText,
"\n",
"\n# ");
212 return "# ==================================================================\n" +
213 formattedHeaderText +
"\n" +
214 "# ==================================================================\n\n";