28 #include <boost/algorithm/string.hpp>
34 std::string description,
38 std::string casesensitivity,
39 std::string requirement,
41 std::vector<std::string> mapValues,
46 boost::replace_first(output,
"%name%",
formatName(name));
49 boost::replace_first(output,
"%default%",
formatDefault(getValue(name, default_)));
50 boost::replace_first(output,
"%casesensitive%", formatCaseSennsitivity(casesensitivity));
52 boost::replace_first(output,
"%regex%",
formatRegex(regex));
53 boost::replace_first(output,
"%values%",
formatValues(mapValues));
61 return std::string(
"%name%:") +
"\t%description%\n" +
"\tAttributes:\n" +
"%default%" +
62 "%bounds%" +
"%casesensitive%" +
"%required%" +
"%regex%" +
"%values%";
82 if (!
min.empty() &&
max.empty())
84 bounds = formatEntry(
min,
"Min: ");
86 else if (
min.empty() && !
max.empty())
88 bounds = formatEntry(
max,
"Max: ");
90 else if (!
min.empty() && !
max.empty())
92 bounds = formatEntry(
"Bounds: [" +
min +
"; " +
max +
"]");
101 return formatEntry(default_,
"Default: ");
105 PropertyDefinitionFormatter::formatCaseSennsitivity(std::string caseSensitivity)
107 return formatEntry(caseSensitivity,
"Case sensitivity: ");
113 return formatEntry(requirement,
"Required: ");
119 return formatEntry(regex,
"Format: ");
125 std::string valueStrings;
127 if (mapValues.size() > 0)
129 valueStrings += formatEntry(
"Possible values:");
131 std::vector<std::string>::iterator it = mapValues.begin();
133 while (it != mapValues.end())
150 return "\t\t - " +
value +
"\n";
154 PropertyDefinitionFormatter::formatEntry(std::string entry, std::string prefix, std::string suffix)
158 return "\t - " +
prefix + entry + suffix +
"\n";
161 return std::string();