13 #ifndef __IniParser_h__
14 #define __IniParser_h__
41 #pragma GCC visibility push(hidden)
57 #pragma GCC visibility pop
88 int compile (
const string& pattern,
bool ignore_case) {
92 y2error (
"Regex_t @%p already compiled",
this);
99 ret = regcomp (&
regex, pattern.c_str (),
100 REG_EXTENDED | (ignore_case ? REG_ICASE : 0));
104 regerror (ret, &
regex, error, 256);
105 y2error (
"Regex_t %s error: %s", pattern.c_str (), error);
130 int compile (
const string& pattern,
bool ignore_case) {
133 y2error (
"Regex_t @%p already compiled",
this);
139 return rxtp->compile (pattern, ignore_case);
142 const regex_t *
regex ()
const {
return &
rxtp->regex; }
159 operator bool () {
return matches.size () > 0; }
172 regmatch_t rm_matches[nmatch];
173 if (0 == regexec (rx.
regex (), s.c_str (), nmatch, rm_matches, 0))
177 rest = s.substr (0, rm_matches[0].rm_so) +
178 s.substr (rm_matches[0].rm_eo);
183 rm_matches[0].rm_so = -1;
188 for (i = 0; i < nmatch && rm_matches[i].rm_so != -1; ++i)
190 matches.push_back (s.substr (rm_matches[i].rm_so,
191 rm_matches[i].rm_eo - rm_matches[i].rm_so));
458 string getFileName (
const string&sec,
int rb)
const;
477 #endif//__IniParser_h__