aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-06-02 04:27:02 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-06-02 04:27:02 +0200
commit4d3692a500bd5cf2bd500e1eb0632850ca8260ab (patch)
tree410bb4070e6e766531d13e3481156f1013bd08dc
parent0d4790ae071990d18883c0fb799b938ff53b5c62 (diff)
Do not store flags in containers
-rw-r--r--libxsd/xsd/cxx/tree/containers.hxx78
-rw-r--r--libxsd/xsd/cxx/tree/containers.txx42
-rw-r--r--libxsd/xsd/cxx/tree/list.hxx20
-rw-r--r--libxsd/xsd/cxx/tree/parsing.txx34
-rw-r--r--libxsd/xsd/cxx/tree/stream-extraction.hxx6
-rw-r--r--libxsd/xsd/cxx/tree/types.hxx6
-rw-r--r--xsd/cxx/tree/tree-inline.cxx2
-rw-r--r--xsd/cxx/tree/tree-source.cxx30
8 files changed, 116 insertions, 102 deletions
diff --git a/libxsd/xsd/cxx/tree/containers.hxx b/libxsd/xsd/cxx/tree/containers.hxx
index 29f1388..b460dd8 100644
--- a/libxsd/xsd/cxx/tree/containers.hxx
+++ b/libxsd/xsd/cxx/tree/containers.hxx
@@ -132,11 +132,11 @@ namespace xsd
public:
~one ();
- one (flags, container*);
+ one (container*);
- one (const T&, flags, container*);
+ one (const T&, container*);
- one (std::auto_ptr<T>, flags, container*);
+ one (std::auto_ptr<T>, container*);
one (const one&, flags, container*);
@@ -157,7 +157,10 @@ namespace xsd
}
void
- set (const T&);
+ set (const T& x)
+ {
+ set (x, 0);
+ }
void
set (std::auto_ptr<T>);
@@ -178,8 +181,11 @@ namespace xsd
}
protected:
+ void
+ set (const T&, flags);
+
+ protected:
T* x_;
- flags flags_;
container* container_;
};
@@ -188,12 +194,12 @@ namespace xsd
class one<T, true>
{
public:
- one (flags, container*)
+ one (container*)
: present_ (false)
{
}
- one (const T& x, flags, container*)
+ one (const T& x, container*)
: x_ (x), present_ (true)
{
}
@@ -259,13 +265,13 @@ namespace xsd
~optional ();
explicit
- optional (flags = 0, container* = 0);
+ optional (container* = 0);
explicit
- optional (const T&, flags = 0, container* = 0);
+ optional (const T&, container* = 0);
explicit
- optional (std::auto_ptr<T>, flags = 0, container* = 0);
+ optional (std::auto_ptr<T>, container* = 0);
optional (const optional&, flags = 0, container* = 0);
@@ -332,7 +338,10 @@ namespace xsd
}
void
- set (const T&);
+ set (const T& x)
+ {
+ set (x, 0);
+ }
void
set (std::auto_ptr<T>);
@@ -349,13 +358,15 @@ namespace xsd
return std::auto_ptr<T> (x);
}
- private:
+ protected:
+ void
+ set (const T&, flags);
+
void
true_ ();
- private:
+ protected:
T* x_;
- flags flags_;
container* container_;
};
@@ -367,13 +378,13 @@ namespace xsd
{
public:
explicit
- optional (flags = 0, container* = 0)
+ optional (container* = 0)
: present_ (false)
{
}
explicit
- optional (const T&, flags = 0, container* = 0);
+ optional (const T&, container* = 0);
optional (const optional&, flags = 0, container* = 0);
@@ -859,33 +870,33 @@ namespace xsd
typedef base_sequence::allocator_type allocator_type;
protected:
- sequence_common (flags f, container* c)
- : flags_ (f), container_ (c)
+ sequence_common (container* c)
+ : container_ (c)
{
}
sequence_common (size_type n, const type& x, container* c)
- : flags_ (0), container_ (c)
+ : container_ (c)
{
assign (n, x);
}
template <typename I>
sequence_common (const I& begin, const I& end, container* c)
- : flags_ (0), container_ (c)
+ : container_ (c)
{
assign (begin, end);
}
sequence_common (const sequence_common& v, flags f, container* c)
- : flags_ (f), container_ (c)
+ : container_ (c)
{
v_.reserve (v.v_.size ());
for (base_const_iterator i (v.v_.begin ()), e (v.v_.end ());
i != e; ++i)
{
- ptr p ((**i)._clone (flags_, container_));
+ ptr p ((**i)._clone (f, container_));
v_.push_back (p);
}
}
@@ -906,7 +917,7 @@ namespace xsd
{
// We have no ptr_ref.
//
- ptr p ((**si)._clone (flags_, container_));
+ ptr p ((**si)._clone (0, container_));
*di = p;
}
@@ -958,7 +969,7 @@ namespace xsd
for (base_iterator i (v_.begin ()), e (v_.end ()); i != e; ++i)
{
- ptr p (x._clone (flags_, container_));
+ ptr p (x._clone (0, container_));
*i = p;
}
}
@@ -974,7 +985,7 @@ namespace xsd
for (I i (begin); i != end; ++i)
{
- ptr p (i->_clone (flags_, container_));
+ ptr p (i->_clone (0, container_));
v_.push_back (p);
}
}
@@ -990,7 +1001,7 @@ namespace xsd
for (base_iterator i (v_.begin () + old), e (v_.end ());
i != e; ++i)
{
- ptr p (x._clone (flags_, container_));
+ ptr p (x._clone (0, container_));
*i = p;
}
}
@@ -1004,7 +1015,7 @@ namespace xsd
for (base_iterator i (v_.end () - d); n != 0; --n)
{
- ptr r (x._clone (flags_, container_));
+ ptr r (x._clone (0, container_));
*(--i) = r;
}
}
@@ -1021,7 +1032,7 @@ namespace xsd
for (I i (end);;)
{
--i;
- ptr r (i->_clone (flags_, container_));
+ ptr r (i->_clone (0, container_));
p = v_.insert (p, r);
if (i == begin)
@@ -1031,7 +1042,6 @@ namespace xsd
}
protected:
- flags flags_;
container* container_;
base_sequence v_;
};
@@ -1075,8 +1085,8 @@ namespace xsd
public:
explicit
- sequence (flags f = 0, container* c = 0)
- : sequence_common (f, c)
+ sequence (container* c = 0)
+ : sequence_common (c)
{
}
@@ -1260,7 +1270,7 @@ namespace xsd
void
push_back (const T& x)
{
- v_.push_back (ptr (x._clone (flags_, container_)));
+ v_.push_back (ptr (x._clone (0, container_)));
}
void
@@ -1296,7 +1306,7 @@ namespace xsd
{
return iterator (
v_.insert (
- position.base (), ptr (x._clone (flags_, container_))));
+ position.base (), ptr (x._clone (0, container_))));
}
iterator
@@ -1368,7 +1378,7 @@ namespace xsd
public:
explicit
- sequence (flags = 0, container* = 0)
+ sequence (container* = 0)
{
}
diff --git a/libxsd/xsd/cxx/tree/containers.txx b/libxsd/xsd/cxx/tree/containers.txx
index 8c40e94..a27af48 100644
--- a/libxsd/xsd/cxx/tree/containers.txx
+++ b/libxsd/xsd/cxx/tree/containers.txx
@@ -23,23 +23,23 @@ namespace xsd
template<typename T>
one<T, false>::
- one (flags f, container* c)
- : x_ (0), flags_ (f), container_ (c)
+ one (container* c)
+ : x_ (0), container_ (c)
{
}
template<typename T>
one<T, false>::
- one (const T& x, flags f, container* c)
- : x_ (0), flags_ (f), container_ (c)
+ one (const T& x, container* c)
+ : x_ (0), container_ (c)
{
set (x);
}
template<typename T>
one<T, false>::
- one (std::auto_ptr<T> x, flags f, container* c)
- : x_ (0), flags_ (f), container_ (c)
+ one (std::auto_ptr<T> x, container* c)
+ : x_ (0), container_ (c)
{
set (x);
}
@@ -47,10 +47,10 @@ namespace xsd
template<typename T>
one<T, false>::
one (const one<T, false>& x, flags f, container* c)
- : x_ (0), flags_ (f), container_ (c)
+ : x_ (0), container_ (c)
{
if (x.present ())
- set (x.get ());
+ set (x.get (), f);
}
template<typename T>
@@ -73,12 +73,12 @@ namespace xsd
template<typename T>
void one<T, false>::
- set (const T& x)
+ set (const T& x, flags f)
{
// We always do a fresh copy because T may not be x's
// dynamic type.
//
- T* r (x._clone (flags_, container_));
+ T* r (x._clone (f, container_));
delete x_;
x_ = r;
@@ -113,23 +113,23 @@ namespace xsd
template <typename T>
optional<T, false>::
- optional (flags f, container* c)
- : x_ (0), flags_ (f), container_ (c)
+ optional (container* c)
+ : x_ (0), container_ (c)
{
}
template <typename T>
optional<T, false>::
- optional (const T& x, flags f, container* c)
- : x_ (0), flags_ (f), container_ (c)
+ optional (const T& x, container* c)
+ : x_ (0), container_ (c)
{
set (x);
}
template <typename T>
optional<T, false>::
- optional (std::auto_ptr<T> x, flags f, container* c)
- : x_ (0), flags_ (f), container_ (c)
+ optional (std::auto_ptr<T> x, container* c)
+ : x_ (0), container_ (c)
{
set (x);
}
@@ -137,10 +137,10 @@ namespace xsd
template <typename T>
optional<T, false>::
optional (const optional<T, false>& x, flags f, container* c)
- : x_ (0), flags_ (f), container_ (c)
+ : x_ (0), container_ (c)
{
if (x)
- set (*x);
+ set (*x, f);
}
template <typename T>
@@ -172,12 +172,12 @@ namespace xsd
template <typename T>
void optional<T, false>::
- set (const T& x)
+ set (const T& x, flags f)
{
// We always do a fresh copy because T may not be x's
// dynamic type.
//
- T* r (x._clone (flags_, container_));
+ T* r (x._clone (f, container_));
delete x_;
x_ = r;
@@ -220,7 +220,7 @@ namespace xsd
//
template <typename T>
optional<T, true>::
- optional (const T& y, flags, container*)
+ optional (const T& y, container*)
: present_ (false)
{
set (y);
diff --git a/libxsd/xsd/cxx/tree/list.hxx b/libxsd/xsd/cxx/tree/list.hxx
index 30416e6..0a455cf 100644
--- a/libxsd/xsd/cxx/tree/list.hxx
+++ b/libxsd/xsd/cxx/tree/list.hxx
@@ -39,8 +39,8 @@ namespace xsd
{
public:
explicit
- list (flags f = 0, container* c = 0)
- : sequence<T> (f, c)
+ list (container* c = 0)
+ : sequence<T> (c)
{
}
@@ -60,8 +60,8 @@ namespace xsd
template <typename S>
list (istream<S>&, flags = 0, container* c = 0);
- list (const list<T, C, ST, false>& v, flags f = 0, container* c = 0)
- : sequence<T> (v, f, c)
+ list (const list<T, C, ST, false>& l, flags f = 0, container* c = 0)
+ : sequence<T> (l, f, c)
{
}
@@ -77,7 +77,9 @@ namespace xsd
private:
void
- init (const std::basic_string<C>&, const xercesc::DOMElement*);
+ init (const std::basic_string<C>&,
+ const xercesc::DOMElement*,
+ flags);
};
@@ -88,8 +90,8 @@ namespace xsd
{
public:
explicit
- list (flags f = 0, container* c = 0)
- : sequence<T> (f, c)
+ list (container* c = 0)
+ : sequence<T> (c)
{
}
@@ -108,8 +110,8 @@ namespace xsd
template <typename S>
list (istream<S>&, flags = 0, container* c = 0);
- list (const list<T, C, ST, true>& s, flags f = 0, container* c = 0)
- : sequence<T> (s, f, c)
+ list (const list<T, C, ST, true>& l, flags f = 0, container* c = 0)
+ : sequence<T> (l, f, c)
{
}
diff --git a/libxsd/xsd/cxx/tree/parsing.txx b/libxsd/xsd/cxx/tree/parsing.txx
index 929bf9f..bdeb539 100644
--- a/libxsd/xsd/cxx/tree/parsing.txx
+++ b/libxsd/xsd/cxx/tree/parsing.txx
@@ -176,17 +176,19 @@ namespace xsd
template <typename T, typename C, schema_type::value ST>
list<T, C, ST, false>::
list (const xercesc::DOMElement& e, flags f, container* c)
- : sequence<T> (flags (f & ~flags::keep_dom), c) // ambiguous
+ : sequence<T> (c)
{
- init (text_content<C> (e), &e);
+ init (text_content<C> (e), &e, f & ~flags::keep_dom);
}
template <typename T, typename C, schema_type::value ST>
list<T, C, ST, false>::
list (const xercesc::DOMAttr& a, flags f, container* c)
- : sequence<T> (flags (f & ~flags::keep_dom), c) // ambiguous
+ : sequence<T> (c)
{
- init (xml::transcode<C> (a.getValue ()), a.getOwnerElement ());
+ init (xml::transcode<C> (a.getValue ()),
+ a.getOwnerElement (),
+ f & ~flags::keep_dom);
}
template <typename T, typename C, schema_type::value ST>
@@ -195,14 +197,16 @@ namespace xsd
const xercesc::DOMElement* e,
flags f,
container* c)
- : sequence<T> (flags (f & ~flags::keep_dom), c) // ambiguous
+ : sequence<T> (c)
{
- init (s, e);
+ init (s, e, f & ~flags::keep_dom);
}
template <typename T, typename C, schema_type::value ST>
void list<T, C, ST, false>::
- init (const std::basic_string<C>& s, const xercesc::DOMElement* parent)
+ init (const std::basic_string<C>& s,
+ const xercesc::DOMElement* parent,
+ flags f)
{
if (s.size () == 0)
return;
@@ -226,7 +230,7 @@ namespace xsd
ptr r (
new T (basic_string<C> (data + i, j - i),
parent,
- this->flags_,
+ f,
this->container_));
this->v_.push_back (r);
@@ -240,7 +244,7 @@ namespace xsd
ptr r (
new T (basic_string<C> (data + i, size - i),
parent,
- this->flags_,
+ f,
this->container_));
this->v_.push_back (r);
@@ -252,16 +256,16 @@ namespace xsd
template <typename T, typename C, schema_type::value ST>
list<T, C, ST, true>::
- list (const xercesc::DOMElement& e, flags f, container* c)
- : sequence<T> (flags (f & ~flags::keep_dom), c) // ambiguous
+ list (const xercesc::DOMElement& e, flags, container* c)
+ : sequence<T> (c)
{
init (text_content<C> (e), &e);
}
template <typename T, typename C, schema_type::value ST>
inline list<T, C, ST, true>::
- list (const xercesc::DOMAttr& a, flags f, container* c)
- : sequence<T> (flags (f & ~flags::keep_dom), c) // ambiguous
+ list (const xercesc::DOMAttr& a, flags, container* c)
+ : sequence<T> (c)
{
init (xml::transcode<C> (a.getValue ()), a.getOwnerElement ());
}
@@ -270,9 +274,9 @@ namespace xsd
inline list<T, C, ST, true>::
list (const std::basic_string<C>& s,
const xercesc::DOMElement* parent,
- flags f,
+ flags,
container* c)
- : sequence<T> (flags (f & ~flags::keep_dom), c) // ambiguous
+ : sequence<T> (c)
{
init (s, parent);
}
diff --git a/libxsd/xsd/cxx/tree/stream-extraction.hxx b/libxsd/xsd/cxx/tree/stream-extraction.hxx
index d5367c8..e8f1368 100644
--- a/libxsd/xsd/cxx/tree/stream-extraction.hxx
+++ b/libxsd/xsd/cxx/tree/stream-extraction.hxx
@@ -55,7 +55,7 @@ namespace xsd
template <typename S>
list<T, C, ST, false>::
list (istream<S>& s, flags f, container* c)
- : sequence<T> (f, c)
+ : sequence<T> (c)
{
std::size_t size;
istream_common::as_size<std::size_t> as_size (size);
@@ -76,8 +76,8 @@ namespace xsd
template <typename T, typename C, schema_type::value ST>
template <typename S>
list<T, C, ST, true>::
- list (istream<S>& s, flags f, container* c)
- : sequence<T> (f, c)
+ list (istream<S>& s, flags, container* c)
+ : sequence<T> (c)
{
std::size_t size;
istream_common::as_size<std::size_t> as_size (size);
diff --git a/libxsd/xsd/cxx/tree/types.hxx b/libxsd/xsd/cxx/tree/types.hxx
index 3fbac75..5afa49d 100644
--- a/libxsd/xsd/cxx/tree/types.hxx
+++ b/libxsd/xsd/cxx/tree/types.hxx
@@ -1014,7 +1014,7 @@ namespace xsd
* @brief Default constructor creates no elements.
*/
nmtokens ()
- : base_type (0, this)
+ : base_type (this)
{
}
@@ -2483,7 +2483,7 @@ namespace xsd
* @brief Default constructor creates no elements.
*/
idrefs ()
- : base_type (0, this)
+ : base_type (this)
{
}
@@ -3677,7 +3677,7 @@ namespace xsd
* @brief Default constructor creates no elements.
*/
entities ()
- : base_type (0, this)
+ : base_type (this)
{
}
diff --git a/xsd/cxx/tree/tree-inline.cxx b/xsd/cxx/tree/tree-inline.cxx
index 5f224d3..431bc0a 100644
--- a/xsd/cxx/tree/tree-inline.cxx
+++ b/xsd/cxx/tree/tree-inline.cxx
@@ -54,7 +54,7 @@ namespace CXX
os << inl
<< name << "::" << endl
<< name << " ()" << endl
- << ": " << base_type << " ( " << flags_type << " (0), this)"
+ << ": " << base_type << " (this)"
<< "{"
<< "}";
diff --git a/xsd/cxx/tree/tree-source.cxx b/xsd/cxx/tree/tree-source.cxx
index 5295527..c972357 100644
--- a/xsd/cxx/tree/tree-source.cxx
+++ b/xsd/cxx/tree/tree-source.cxx
@@ -1384,22 +1384,21 @@ namespace CXX
// sequence
//
os << "," << endl
- << " " << member << " (" << flags_type << " (), this)";
+ << " " << member << " (this)";
}
else if (min (e) == 0)
{
// optional
//
os << "," << endl
- << " " << member << " (" << flags_type << " (), this)";
+ << " " << member << " (this)";
}
else
{
// one
//
os << "," << endl
- << " " << member << " (" << ename (e) << ", " <<
- flags_type << " (), this)";
+ << " " << member << " (" << ename (e) << ", this)";
}
}
@@ -1415,7 +1414,7 @@ namespace CXX
// optional
//
os << "," << endl
- << " " << member << " (" << flags_type << " (), this)";
+ << " " << member << " (this)";
}
else
{
@@ -1429,13 +1428,12 @@ namespace CXX
//
os << "," << endl
<< " " << member << " (" <<
- edefault_value (a) << " (), " << flags_type << " (), this)";
+ edefault_value (a) << " (), this)";
}
else
{
os << "," << endl
- << " " << member << " (" << ename (a) << ", " <<
- flags_type << " (), this)";
+ << " " << member << " (" << ename (a) << ", this)";
}
}
}
@@ -1619,7 +1617,7 @@ namespace CXX
String const& member (emember (m));
os << "," << endl
- << " " << member << " (f, this)";
+ << " " << member << " (this)";
}
};
@@ -1678,7 +1676,7 @@ namespace CXX
String const& member (emember (e));
os << "," << endl
- << " " << member << " (" << flags_type << " (), this)";
+ << " " << member << " (this)";
}
virtual Void
@@ -1693,11 +1691,11 @@ namespace CXX
//
os << "," << endl
<< " " << member << " (" <<
- edefault_value (a) << " (), " << flags_type << " (), this)";
+ edefault_value (a) << " (), this)";
}
else
os << "," << endl
- << " " << member << " (" << flags_type << " (), this)";
+ << " " << member << " (this)";
}
};
@@ -3247,7 +3245,7 @@ namespace CXX
{
os << name << "::" << endl
<< name << " ()" << endl
- << ": " << member << " (0, 0)"
+ << ": " << member << " (0)"
<< "{"
<< "}";
}
@@ -3256,7 +3254,7 @@ namespace CXX
//
os << name << "::" << endl
<< name << " (const " << type << "& x)" << endl
- << ": " << member << " (x, 0, 0)"
+ << ": " << member << " (x, 0)"
<< "{"
<< "}";
@@ -3267,7 +3265,7 @@ namespace CXX
{
os << name << "::" << endl
<< name << " (::std::auto_ptr< " << type << " > p)" << endl
- << ": " << member << " (p, 0, 0)"
+ << ": " << member << " (p, 0)"
<< "{"
<< "}";
}
@@ -3286,7 +3284,7 @@ namespace CXX
os << name << "::" << endl
<< name << " (const " << xerces_ns << "::DOMElement& e, " <<
flags_type << " f)" << endl
- << ": " << member << " (f, 0)"
+ << ": " << member << " (0)"
<< "{"
<< "const " << qname_type << " n (" << endl
<< "::xsd::cxx::xml::dom::name< " << char_type << " > (e));"