-#ifdef __GNUG__
-#pragma implementation
-#endif
-
#include <config.h>
#include <sys/types.h>
+
+#ifdef HAVE_REGEX_H
#include <regex.h>
+#else
+#include "lyxregex.h"
+#endif
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
#include "LRegex.h"
using std::make_pair;
///
struct LRegex::Impl {
///
- re_pattern_buffer * preg;
+ regex_t * preg;
///
int error_code;
///
Impl(string const & regex)
- : preg(new re_pattern_buffer), error_code(0)
+ : preg(new regex_t), error_code(0)
{
error_code = regcomp(preg, regex.c_str(), REG_EXTENDED);
}
}
///
- LRegex::MatchPair first_match(string const & str) const
+ LRegex::MatchPair const first_match(string const & str) const
{
regmatch_t tmp;
regexec(preg, str.c_str(), 1, &tmp, 0);
}
///
- string getError() const
+ string const getError() const
{
size_t nr = regerror(error_code, preg, 0, 0);
char * tmp = new char[nr];
}
-LRegex::MatchPair LRegex::first_match(string const & str) const
+LRegex::MatchPair const LRegex::first_match(string const & str) const
{
return impl->first_match(str);
}
-string LRegex::getError() const
+string const LRegex::getError() const
{
return impl->getError();
}