aboutsummaryrefslogtreecommitdiff
path: root/xsde/cxx/parser/parser-inline.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-03-28 16:53:35 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-03-28 16:53:35 +0200
commit4332a60585a14ff51bc54d29a4a81d37b3b1df81 (patch)
treefd3b807e3f5b3841371d509505a50498d21a2f99 /xsde/cxx/parser/parser-inline.cxx
parentc2d201480002a24c05f1f4bc934036555b79cad6 (diff)
Validate enumerations in the xsd:string parser/serializer
Diffstat (limited to 'xsde/cxx/parser/parser-inline.cxx')
-rw-r--r--xsde/cxx/parser/parser-inline.cxx56
1 files changed, 47 insertions, 9 deletions
diff --git a/xsde/cxx/parser/parser-inline.cxx b/xsde/cxx/parser/parser-inline.cxx
index def8434..528ff86 100644
--- a/xsde/cxx/parser/parser-inline.cxx
+++ b/xsde/cxx/parser/parser-inline.cxx
@@ -24,9 +24,41 @@ namespace CXX
virtual Void
traverse (Type& e)
{
+ String const& name (ename (e));
+
+ Boolean facets (false); // Whether we need to set facets.
+ if (validation)
+ {
+ StringBasedType t (facets);
+ t.dispatch (e);
+ }
+
+ UnsignedLong enum_count (0);
+ if (facets)
+ {
+ for (Type::NamesIterator i (e.names_begin ()), end (e.names_end ());
+ i != end; ++i)
+ ++enum_count;
+ }
+
+ if (facets || tiein)
+ os << "// " << name << endl
+ << "//" << endl
+ << endl;
+
+ if (facets && !tiein)
+ {
+ os << inl
+ << name << "::" << endl
+ << name << " ()" << endl
+ << "{"
+ << "this->_enumeration_facet (_xsde_" << name << "_enums_, " <<
+ enum_count << "UL);"
+ << "}";
+ }
+
if (tiein)
{
- String const& name (ename (e));
String const& impl (etiein (e));
// We have to use "real" (non-typedef) base name in base
@@ -36,25 +68,31 @@ namespace CXX
String fq_base (fq_name (base));
String real_fq_base (real_fq_name (base));
- os << "// " << name << endl
- << "//" << endl
- << endl;
-
os << inl
<< name << "::" << endl
<< name << " (" << fq_base << "* tiein)" << endl
<< ": " << real_fq_base << " (tiein, 0)," << endl
<< " " << impl << " (0)"
- << "{"
- << "}";
+ << "{";
+
+ if (facets)
+ os << "this->_enumeration_facet (_xsde_" << name <<
+ "_enums_, " << enum_count << "UL);";
+
+ os << "}";
os << inl
<< name << "::" << endl
<< name << " (" << name << "* impl, void*)" << endl
<< ": " << real_fq_base << " (impl, 0)," << endl
<< " " << impl << " (impl)"
- << "{"
- << "}";
+ << "{";
+
+ if (facets)
+ os << "this->_enumeration_facet (_xsde_" << name <<
+ "_enums_, " << enum_count << "UL);";
+
+ os << "}";
}
}
};