diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-10-18 15:48:59 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-10-18 15:48:59 +0200 |
commit | c319d785aef76c4e05859b81f956e446eb5a674d (patch) | |
tree | d999ddea037333d9fcefeb92527625e206d1481f /xsde/cxx | |
parent | cc17e8ca58b9f9257aaec09d73bd8f57aaa37dc4 (diff) |
Use numerical value instead of symbolic enumerator name
The enumerator names might not have been assigned.
Diffstat (limited to 'xsde/cxx')
-rw-r--r-- | xsde/cxx/hybrid/default-value.cxx | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/xsde/cxx/hybrid/default-value.cxx b/xsde/cxx/hybrid/default-value.cxx index 712f405..abcc211 100644 --- a/xsde/cxx/hybrid/default-value.cxx +++ b/xsde/cxx/hybrid/default-value.cxx @@ -203,14 +203,31 @@ namespace CXX Enumeration& x (base_enum ? *base_enum : e); - os << member_ << x.context ().get<String> ("value") << "("; + os << member_ << x.context ().get<String> ("value") << "(" << endl; Enumeration::NamesIteratorPair ip (x.find (value_)); if (ip.first != ip.second) { - Enumerator& er (dynamic_cast<Enumerator&> (ip.first->named ())); - os << fq_name (e) << "::" << ename (er); + // Use the numerical value instead of the symbolic enumerator + // because the enumerator names might not have been assigned + // (included/imported schemas). + // + String const& vt (e.context ().get<String> ("value-type")); + + Size n (0); + { + Enumeration const& tmp (x); + for (Enumeration::NamesConstIterator i (tmp.names_begin ()); + &i->named () != &ip.first->named (); ++i) + n++; + } + + os << "static_cast< " << fq_name (e) << "::" << vt << " > (" << + n << "UL)"; + + //Enumerator& er (dynamic_cast<Enumerator&> (ip.first->named ())); + //os << fq_name (e) << "::" << ename (er); } os << ");"; |