28 #include <boost/regex.hpp>
30 #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,
47 std::string pageHeader;
51 const boost::regex rx(
"[a-zA-Z0-9_\\-]+\\.([a-zA-Z0-9_\\-]+)\\.");
52 boost::match_results<std::string::const_iterator> results;
54 pageHeader =
"\n<!-- Prefix: " +
prefix +
" -->\n";
56 if (boost::regex_match(
60 "\\defgroup " + results[1] +
"_properties " + results[1] +
" Properties\n";
61 pageHeader +=
"\\ingroup Component-" + results[1] +
" componentproperties\n";
63 "\\brief This page shows the properties for the component \\ref Component-" +
64 results[1] +
" \"" + results[1] +
"\".\n\n";
66 else if (!lastPrefix.empty())
68 throw std::runtime_error(
"Non-component (application-specific) properties not at "
69 "beginning of iteration! (this should never happen)");
73 pageHeader +=
"Name & Description | Default | Bounds | Case-sensitive? | Required | "
76 "---- | ------- | ------ | --------------- | -------- | ----- | ------\n";
83 output = simox::alg::replace_first(
85 output = simox::alg::replace_first(
90 simox::alg::replace_first(output,
"%default%", escapeMarkdown(
formatDefault(default_)));
91 output = simox::alg::replace_first(
93 output = simox::alg::replace_first(
95 output = simox::alg::replace_first(output,
"%regex%", escapeMarkdown(
formatRegex(regex)));
99 return pageHeader + output;
104 std::vector<std::string> mapValues)
107 std::string valueStrings;
109 if (mapValues.size() > 0)
113 std::vector<std::string>::iterator it = mapValues.begin();
115 while (it != mapValues.end())
124 if (it != mapValues.end())
126 valueStrings +=
", ";
147 return std::string(
"<b>%name%</b> <br/> %description% | <b>%default%</b> | %bounds% | "
148 "%casesensitive% | %required% | %regex% | %values%\n");
152 PropertyDefinitionDoxygenComponentPagesFormatter::escapeMarkdown(std::string
s)
154 s = simox::alg::replace_all(
s,
"\"",
"\\\"");
155 s = simox::alg::replace_all(
s,
"*",
"\\*");
156 s = simox::alg::replace_all(
s,
"#",
"\\#");
157 s = simox::alg::replace_all(
s,
"(",
"\\(");
158 s = simox::alg::replace_all(
s,
")",
"\\)");
159 s = simox::alg::replace_all(
s,
"[",
"\\[");
160 s = simox::alg::replace_all(
s,
"]",
"\\]");
161 s = simox::alg::replace_all(
s,
"<",
"\\<");
162 s = simox::alg::replace_all(
s,
">",
"\\>");