From 6bf1e46ccc93777ca9f62746ada0e18c72fcf138 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 9 May 2012 11:50:57 +0200 Subject: Port to use regex from libcutl instead of libbackend-elements --- xsd/cxx/tree/name-processor.cxx | 46 ++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 19 deletions(-) (limited to 'xsd/cxx/tree/name-processor.cxx') diff --git a/xsd/cxx/tree/name-processor.cxx b/xsd/cxx/tree/name-processor.cxx index b731b82..ad1720f 100644 --- a/xsd/cxx/tree/name-processor.cxx +++ b/xsd/cxx/tree/name-processor.cxx @@ -6,12 +6,12 @@ #include #include +#include + #include #include #include -#include - #include #include @@ -288,9 +288,17 @@ namespace CXX } public: - typedef BackendElements::Regex::Expression Regex; - typedef BackendElements::Regex::Format RegexFormat; - typedef Cult::Containers::Vector RegexVector; + typedef cutl::re::wregexsub Regex; + typedef cutl::re::wformat RegexFormat; + + struct RegexVector: Cult::Containers::Vector + { + void + push_back (String const& r) + { + Cult::Containers::Vector::push_back (Regex (r)); + } + }; String process_regex (String const& name, @@ -306,11 +314,11 @@ namespace CXX i != rv.rend (); ++i) { if (trace) - os << "try: '" << i->pattern () << "' : "; + os << "try: '" << i->regex () << "' : "; if (i->match (name)) { - String r (i->merge (name)); + String r (i->replace (name)); if (trace) os << "'" << r << "' : +" << endl; @@ -340,11 +348,11 @@ namespace CXX i != primary.rend (); ++i) { if (trace) - os << "try: '" << i->pattern () << "' : "; + os << "try: '" << i->regex () << "' : "; if (i->match (name)) { - String r (i->merge (name)); + String r (i->replace (name)); if (trace) os << "'" << r << "' : +" << endl; @@ -360,11 +368,11 @@ namespace CXX i != backup.rend (); ++i) { if (trace) - os << "try: '" << i->pattern () << "' : "; + os << "try: '" << i->regex () << "' : "; if (i->match (name)) { - String r (i->merge (name)); + String r (i->replace (name)); if (trace) os << "'" << r << "' : +" << endl; @@ -395,11 +403,11 @@ namespace CXX i != rv.rend (); ++i) { if (trace) - os << "try: '" << i->pattern () << "' : "; + os << "try: '" << i->regex () << "' : "; if (i->match (s)) { - String r (i->merge (s)); + String r (i->replace (s)); if (trace) os << "'" << r << "' : +" << endl; @@ -431,11 +439,11 @@ namespace CXX i != primary.rend (); ++i) { if (trace) - os << "try: '" << i->pattern () << "' : "; + os << "try: '" << i->regex () << "' : "; if (i->match (s)) { - String r (i->merge (s)); + String r (i->replace (s)); if (trace) os << "'" << r << "' : +" << endl; @@ -451,11 +459,11 @@ namespace CXX i != backup.rend (); ++i) { if (trace) - os << "try: '" << i->pattern () << "' : "; + os << "try: '" << i->regex () << "' : "; if (i->match (s)) { - String r (i->merge (s)); + String r (i->replace (s)); if (trace) os << "'" << r << "' : +" << endl; @@ -503,12 +511,12 @@ namespace CXX { try { - rv.push_back (Regex (*i)); + rv.push_back (*i); } catch (RegexFormat const& e) { os << "error: invalid " << id << " name regex: '" << - e.expression () << "': " << e.description () << endl; + e.regex () << "': " << e.description ().c_str () << endl; throw Failed (); } -- cgit v1.1