Constructor.
86{
87
88
89 TiXmlElement *regex = metric->FirstChildElement("regex");
90 if (regex)
91 {
92
93 const char *tmp = regex->GetText();
94 ASSERTL0(tmp,
"No text found in regex tag");
96 }
97
98
100 {
101 return;
102 }
103
104
105
106
107 TiXmlElement *matches = metric->FirstChildElement("matches");
108 if (matches)
109 {
110
111 for (TiXmlElement *match = matches->FirstChildElement("match"); match;
112 match = match->NextSiblingElement("match"))
113 {
114
115 m_matches.push_back(std::vector<std::string>());
116
117
118 for (TiXmlElement *field = match->FirstChildElement(
"field");
field;
120 {
121
122 const char *tmp =
field->GetText();
123
124 ASSERTL0(tmp,
"No text that specifies regex group "
125 "found in field tag");
127 }
128 }
129
130
132 "No match tag that specifies "
133 "regex groups was found inside matches tag.");
134
135
136
137 int size_min = 1E3;
138 int size_max = 0;
140 {
141 size_min = std::min((int)match.size(), size_min);
142 size_max = std::max((int)match.size(), size_max);
143 }
144 ASSERTL0(size_min != 0,
"No valid field tags found "
145 "for one of the match tags");
146 ASSERTL0(size_min == size_max,
"Number of valid field tags "
147 "not the same for all match tags");
148 }
149}
#define ASSERTL0(condition, msg)
Metric(TiXmlElement *metric, bool generate)
Constructor.
bool m_generate
Determines whether to generate this metric or not.
std::vector< std::vector< std::string > > m_matches
std::regex m_regexWarning