28 #include <boost/algorithm/string.hpp>
33 std::string description,
37 std::string casesensitivity,
38 std::string requirement,
40 std::vector<std::string> mapValues,
45 boost::replace_first(output,
"%name%",
formatName(name));
48 boost::replace_first(output,
"%default%",
formatDefault(getValue(name, default_)));
49 boost::replace_first(output,
"%casesensitive%", formatCaseSennsitivity(casesensitivity));
51 boost::replace_first(output,
"%regex%",
formatRegex(regex));
52 boost::replace_first(output,
"%values%",
formatValues(mapValues));
59 return std::string(
"%name%:")
84 if (!
min.empty() &&
max.empty())
86 bounds = formatEntry(
min,
"Min: ");
88 else if (
min.empty() && !
max.empty())
90 bounds = formatEntry(
max,
"Max: ");
92 else if (!
min.empty() && !
max.empty())
94 bounds = formatEntry(
"Bounds: [" +
min +
"; " +
max +
"]");
102 return formatEntry(default_,
"Default: ");
105 std::string PropertyDefinitionFormatter::formatCaseSennsitivity(std::string caseSensitivity)
107 return formatEntry(caseSensitivity,
"Case sensitivity: ");
112 return formatEntry(requirement,
"Required: ");
117 return formatEntry(regex,
"Format: ");
122 std::string valueStrings;
124 if (mapValues.size() > 0)
126 valueStrings += formatEntry(
"Possible values:");
128 std::vector<std::string>::iterator it = mapValues.begin();
130 while (it != mapValues.end())
146 return "\t\t - " +
value +
"\n";
149 std::string PropertyDefinitionFormatter::formatEntry(std::string entry, std::string prefix, std::string suffix)
153 return "\t - " +
prefix + entry + suffix +
"\n";
156 return std::string();