diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-05-09 11:50:57 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-05-09 11:50:57 +0200 |
commit | 6bf1e46ccc93777ca9f62746ada0e18c72fcf138 (patch) | |
tree | 89af9295e53ed2751f8343e32b55f799ce385c07 /xsd/cxx/tree/name-processor.cxx | |
parent | 3067cb353cca291d25b4b1fcf6acdb110e560536 (diff) |
Port to use regex from libcutl instead of libbackend-elements
Diffstat (limited to 'xsd/cxx/tree/name-processor.cxx')
-rw-r--r-- | xsd/cxx/tree/name-processor.cxx | 46 |
1 files changed, 27 insertions, 19 deletions
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 <sstream> #include <iostream> +#include <cutl/re.hxx> + #include <cult/containers/set.hxx> #include <cult/containers/map.hxx> #include <cult/containers/vector.hxx> -#include <backend-elements/regex.hxx> - #include <cxx/tree/default-value.hxx> #include <cxx/tree/name-processor.hxx> @@ -288,9 +288,17 @@ namespace CXX } public: - typedef BackendElements::Regex::Expression<WideChar> Regex; - typedef BackendElements::Regex::Format<WideChar> RegexFormat; - typedef Cult::Containers::Vector<Regex> RegexVector; + typedef cutl::re::wregexsub Regex; + typedef cutl::re::wformat RegexFormat; + + struct RegexVector: Cult::Containers::Vector<Regex> + { + void + push_back (String const& r) + { + Cult::Containers::Vector<Regex>::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 (); } |