28 #include <SimoxUtility/algorithm/string/string_tools.h>
30 #include <boost/regex.hpp>
36 std::string description,
40 std::string casesensitivity,
41 std::string requirement,
43 std::vector<std::string>
values,
46 std::string pageHeader;
50 const boost::regex rx(
"[a-zA-Z0-9_\\-]+\\.([a-zA-Z0-9_\\-]+)\\.");
51 boost::match_results<std::string::const_iterator> results;
53 pageHeader =
"\n<!-- Prefix: " +
prefix +
" -->\n";
55 if (boost::regex_match(
prefix, results, rx))
57 pageHeader +=
"\\defgroup " + results[1] +
"_properties " + results[1] +
" Properties\n";
58 pageHeader +=
"\\ingroup Component-" + results[1] +
" componentproperties\n";
59 pageHeader +=
"\\brief This page shows the properties for the component \\ref Component-" + results[1] +
" \"" + results[1] +
"\".\n\n";
61 else if (!lastPrefix.empty())
63 throw std::runtime_error(
"Non-component (application-specific) properties not at beginning of iteration! (this should never happen)");
67 pageHeader +=
"Name & Description | Default | Bounds | Case-sensitive? | Required | Regex | Values\n";
68 pageHeader +=
"---- | ------- | ------ | --------------- | -------- | ----- | ------\n";
75 output = simox::alg::replace_first(output,
"%name%", escapeMarkdown(
formatName(
getPrefix() + name)));
76 output = simox::alg::replace_first(output,
"%description%", escapeMarkdown(
formatDescription(description)));
77 output = simox::alg::replace_first(output,
"%bounds%", escapeMarkdown(
formatBounds(
min,
max)));
78 output = simox::alg::replace_first(output,
"%default%", escapeMarkdown(
formatDefault(default_)));
79 output = simox::alg::replace_first(output,
"%casesensitive%", escapeMarkdown(
formatCaseSensitivity(casesensitivity)));
80 output = simox::alg::replace_first(output,
"%required%", escapeMarkdown(
formatRequirement(requirement)));
81 output = simox::alg::replace_first(output,
"%regex%", escapeMarkdown(
formatRegex(regex)));
82 output = simox::alg::replace_first(output,
"%values%", escapeMarkdown(
formatValues(
values)));
84 return pageHeader + output;
90 std::string valueStrings;
92 if (mapValues.size() > 0)
96 std::vector<std::string>::iterator it = mapValues.begin();
98 while (it != mapValues.end())
107 if (it != mapValues.end())
109 valueStrings +=
", ";
127 return std::string(
"<b>%name%</b> <br/> %description% | <b>%default%</b> | %bounds% | %casesensitive% | %required% | %regex% | %values%\n");
130 std::string PropertyDefinitionDoxygenComponentPagesFormatter::escapeMarkdown(std::string
s)
132 s = simox::alg::replace_all(
s,
"\"",
"\\\"");
133 s = simox::alg::replace_all(
s,
"*",
"\\*");
134 s = simox::alg::replace_all(
s,
"#",
"\\#");
135 s = simox::alg::replace_all(
s,
"(",
"\\(");
136 s = simox::alg::replace_all(
s,
")",
"\\)");
137 s = simox::alg::replace_all(
s,
"[",
"\\[");
138 s = simox::alg::replace_all(
s,
"]",
"\\]");
139 s = simox::alg::replace_all(
s,
"<",
"\\<");
140 s = simox::alg::replace_all(
s,
">",
"\\>");