summaryrefslogtreecommitdiff
path: root/libxsd/xsd/cxx
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 /libxsd/xsd/cxx
parent0d4790ae071990d18883c0fb799b938ff53b5c62 (diff)
Do not store flags in containers
Diffstat (limited to 'libxsd/xsd/cxx')
-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
6 files changed, 101 insertions, 85 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)
{
}