aboutsummaryrefslogtreecommitdiff
path: root/xsde/cxx/serializer
diff options
context:
space:
mode:
Diffstat (limited to 'xsde/cxx/serializer')
-rw-r--r--xsde/cxx/serializer/elements.cxx4
-rw-r--r--xsde/cxx/serializer/elements.hxx4
-rw-r--r--xsde/cxx/serializer/generator.cxx41
-rw-r--r--xsde/cxx/serializer/serializer-header.cxx2
-rw-r--r--xsde/cxx/serializer/type-processor.cxx17
5 files changed, 32 insertions, 36 deletions
diff --git a/xsde/cxx/serializer/elements.cxx b/xsde/cxx/serializer/elements.cxx
index 76947ea..7802e5d 100644
--- a/xsde/cxx/serializer/elements.cxx
+++ b/xsde/cxx/serializer/elements.cxx
@@ -328,12 +328,12 @@ namespace CXX
case header:
case source:
{
- inc_path = ctx_.hxx_expr->merge (path_str);
+ inc_path = ctx_.hxx_expr->replace (path_str);
break;
}
case impl_header:
{
- inc_path = ctx_.hxx_impl_expr->merge (path_str);
+ inc_path = ctx_.hxx_impl_expr->replace (path_str);
break;
}
}
diff --git a/xsde/cxx/serializer/elements.hxx b/xsde/cxx/serializer/elements.hxx
index b61aa83..ada9371 100644
--- a/xsde/cxx/serializer/elements.hxx
+++ b/xsde/cxx/serializer/elements.hxx
@@ -8,7 +8,7 @@
#include <sstream>
-#include <backend-elements/regex.hxx>
+#include <cutl/re.hxx>
#include <cxx/elements.hxx>
@@ -33,7 +33,7 @@ namespace CXX
class Context: public CXX::Context
{
public:
- typedef BackendElements::Regex::Expression<Char> Regex;
+ typedef cutl::re::regexsub Regex;
public:
Context (std::wostream&,
diff --git a/xsde/cxx/serializer/generator.cxx b/xsde/cxx/serializer/generator.cxx
index 4b31497..167dae5 100644
--- a/xsde/cxx/serializer/generator.cxx
+++ b/xsde/cxx/serializer/generator.cxx
@@ -7,6 +7,8 @@
#include <boost/filesystem/fstream.hpp>
+#include <cutl/re.hxx>
+
#include <cult/containers/set.hxx>
#include <cult/containers/vector.hxx>
@@ -14,7 +16,6 @@
#include <cutl/compiler/cxx-indenter.hxx>
#include <cutl/compiler/sloc-counter.hxx>
-#include <backend-elements/regex.hxx>
#include <backend-elements/indentation/clip.hxx>
#include <xsd-frontend/semantic-graph.hxx>
@@ -625,7 +626,7 @@ namespace CXX
using std::ios_base;
namespace Indentation = BackendElements::Indentation;
- typedef BackendElements::Regex::Expression<Char> Regex;
+ typedef cutl::re::regexsub Regex;
try
{
@@ -871,7 +872,7 @@ namespace CXX
if (!hxx_expr.match (name))
{
wcerr << "error: header expression '" <<
- hxx_expr.pattern () << "' does not match '" <<
+ hxx_expr.regex ().str ().c_str () << "' does not match '" <<
name.c_str () << "'" << endl;
throw Failed ();
}
@@ -879,7 +880,7 @@ namespace CXX
if (inline_ && !ixx_expr.match (name))
{
wcerr << "error: inline expression '" <<
- ixx_expr.pattern () << "' does not match '" <<
+ ixx_expr.regex ().str ().c_str () << "' does not match '" <<
name.c_str () << "'" << endl;
throw Failed ();
}
@@ -887,7 +888,7 @@ namespace CXX
if (source && !cxx_expr.match (name))
{
wcerr << "error: source expression '" <<
- cxx_expr.pattern () << "' does not match '" <<
+ cxx_expr.regex ().str ().c_str () << "' does not match '" <<
name.c_str () << "'" << endl;
throw Failed ();
}
@@ -897,7 +898,7 @@ namespace CXX
if (!hxx_impl_expr.match (name))
{
wcerr << "error: implementation header expression '" <<
- hxx_impl_expr.pattern () << "' does not match '" <<
+ hxx_impl_expr.regex ().str ().c_str () << "' does not match '" <<
name.c_str () << "'" << endl;
throw Failed ();
}
@@ -905,7 +906,7 @@ namespace CXX
if (!cxx_impl_expr.match (name))
{
wcerr << "error: implementation source expression '" <<
- cxx_impl_expr.pattern () << "' does not match '" <<
+ cxx_impl_expr.regex ().str ().c_str () << "' does not match '" <<
name.c_str () << "'" << endl;
throw Failed ();
}
@@ -913,15 +914,15 @@ namespace CXX
if (!cxx_driver_expr.match (name))
{
wcerr << "error: driver source expression '" <<
- cxx_driver_expr.pattern () << "' does not match '" <<
+ cxx_driver_expr.regex ().str ().c_str () << "' does not match '" <<
name.c_str () << "'" << endl;
throw Failed ();
}
}
- NarrowString hxx_name (hxx_expr.merge (name));
- NarrowString ixx_name (inline_ ? ixx_expr.merge (name) : NarrowString ());
- NarrowString cxx_name (source ? cxx_expr.merge (name) : NarrowString ());
+ NarrowString hxx_name (hxx_expr.replace (name));
+ NarrowString ixx_name (inline_ ? ixx_expr.replace (name) : NarrowString ());
+ NarrowString cxx_name (source ? cxx_expr.replace (name) : NarrowString ());
NarrowString hxx_impl_name;
NarrowString cxx_impl_name;
@@ -929,9 +930,9 @@ namespace CXX
if (impl || driver)
{
- hxx_impl_name = hxx_impl_expr.merge (name);
- cxx_impl_name = cxx_impl_expr.merge (name);
- cxx_driver_name = cxx_driver_expr.merge (name);
+ hxx_impl_name = hxx_impl_expr.replace (name);
+ cxx_impl_name = cxx_impl_expr.replace (name);
+ cxx_driver_name = cxx_driver_expr.replace (name);
}
Path hxx_path (hxx_name, boost::filesystem::native);
@@ -1202,7 +1203,7 @@ namespace CXX
sloc_filter sloc (hxx);
- String guard (guard_expr.merge (guard_prefix + hxx_name));
+ String guard (guard_expr.replace (guard_prefix + hxx_name));
guard = ctx.escape (guard); // Make it a C++ id.
std::transform (guard.begin (), guard.end(), guard.begin (), upcase);
@@ -1582,7 +1583,7 @@ namespace CXX
Context ctx (hxx_impl, schema, file_path, ops,
&hxx_expr, &ixx_expr, &hxx_impl_expr);
- String guard (guard_expr.merge (guard_prefix + hxx_impl_name));
+ String guard (guard_expr.replace (guard_prefix + hxx_impl_name));
guard = ctx.escape (guard); // Make it a C++ id.
std::transform (guard.begin (), guard.end(), guard.begin (), upcase);
@@ -1662,18 +1663,18 @@ namespace CXX
throw Failed ();
}
- catch (BackendElements::Regex::Format<Char> const& e)
+ catch (cutl::re::format const& e)
{
wcerr << "error: invalid regex: '" <<
- e.expression ().c_str () << "': " <<
+ e.regex ().c_str () << "': " <<
e.description ().c_str () << endl;
throw Failed ();
}
- catch (BackendElements::Regex::Format<WideChar> const& e)
+ catch (cutl::re::wformat const& e)
{
wcerr << "error: invalid regex: '" <<
- e.expression () << "': " << e.description () << endl;
+ e.regex () << "': " << e.description ().c_str () << endl;
throw Failed ();
}
diff --git a/xsde/cxx/serializer/serializer-header.cxx b/xsde/cxx/serializer/serializer-header.cxx
index ea07ca5..939a052 100644
--- a/xsde/cxx/serializer/serializer-header.cxx
+++ b/xsde/cxx/serializer/serializer-header.cxx
@@ -1906,7 +1906,7 @@ namespace CXX
if (extern_xml_schema)
{
- String name (ctx.hxx_expr->merge (extern_xml_schema));
+ String name (ctx.hxx_expr->replace (extern_xml_schema));
ctx.os << "#include " << ctx.process_include_path (name) << endl
<< endl;
diff --git a/xsde/cxx/serializer/type-processor.cxx b/xsde/cxx/serializer/type-processor.cxx
index a07ff31..3c3a025 100644
--- a/xsde/cxx/serializer/type-processor.cxx
+++ b/xsde/cxx/serializer/type-processor.cxx
@@ -74,11 +74,6 @@ namespace CXX
{
// Check if the namespace matches.
//
- //@@ Should probably store precompiled regex somewhere
- // instead of doing it every time.
- //
- boost::basic_regex<WideChar> ns_expr;
-
Boolean ns_match;
if (!n->xsd_name ().empty ())
@@ -110,8 +105,8 @@ namespace CXX
{
if (!n->xsd_name ().empty ())
{
- cxx_ns = n->xsd_name ().merge (
- n->cxx_name (), ns_name, true);
+ cxx_ns = n->xsd_name ().replace (
+ ns_name, n->cxx_name (), true);
}
else
cxx_ns = n->cxx_name ();
@@ -123,16 +118,16 @@ namespace CXX
//
String ret_type (cxx_ns);
- ret_type += t->xsd_name ().merge (
- t->cxx_ret_name (), t_name, true);
+ ret_type += t->xsd_name ().replace (
+ t_name, t->cxx_ret_name (), true);
String arg_type;
if (t->cxx_arg_name ())
{
arg_type = cxx_ns;
- arg_type += t->xsd_name ().merge (
- t->cxx_arg_name (), t_name, true);
+ arg_type += t->xsd_name ().replace (
+ t_name, t->cxx_arg_name (), true);
}
else
{