// Copyright (c) 2005-2014 Code Synthesis Tools CC
//
// This program was generated by CodeSynthesis XSD, an XML Schema to
// C++ data binding compiler.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
// In addition, as a special exception, Code Synthesis Tools CC gives
// permission to link this program with the Xerces-C++ library (or with
// modified versions of Xerces-C++ that use the same license as Xerces-C++),
// and distribute linked combinations including the two. You must obey
// the GNU General Public License version 2 in all respects for all of
// the code used other than Xerces-C++. If you modify this copy of the
// program, you may extend this exception to your version of the program,
// but you are not obligated to do so. If you do not wish to do so, delete
// this exception statement from your version.
//
// Furthermore, Code Synthesis Tools CC makes a special exception for
// the Free/Libre and Open Source Software (FLOSS) which is described
// in the accompanying FLOSSE file.
//

#ifndef CXX_WORK_XSD_4_0_0_XSD_TESTS_CXX_TREE_CONTAINMENT_TEST_HXX
#define CXX_WORK_XSD_4_0_0_XSD_TESTS_CXX_TREE_CONTAINMENT_TEST_HXX

#ifndef XSD_USE_CHAR
#define XSD_USE_CHAR
#endif

#ifndef XSD_CXX_TREE_USE_CHAR
#define XSD_CXX_TREE_USE_CHAR
#endif

// Begin prologue.
//
//
// End prologue.

#include <xsd/cxx/config.hxx>

#if (XSD_INT_VERSION != 4000000L)
#error XSD runtime version mismatch
#endif

#include <xsd/cxx/pre.hxx>

#include <xsd/cxx/xml/char-utf8.hxx>

#include <xsd/cxx/tree/exceptions.hxx>
#include <xsd/cxx/tree/elements.hxx>
#include <xsd/cxx/tree/types.hxx>

#include <xsd/cxx/xml/error-handler.hxx>

#include <xsd/cxx/xml/dom/auto-ptr.hxx>

#include <xsd/cxx/tree/parsing.hxx>
#include <xsd/cxx/tree/parsing/byte.hxx>
#include <xsd/cxx/tree/parsing/unsigned-byte.hxx>
#include <xsd/cxx/tree/parsing/short.hxx>
#include <xsd/cxx/tree/parsing/unsigned-short.hxx>
#include <xsd/cxx/tree/parsing/int.hxx>
#include <xsd/cxx/tree/parsing/unsigned-int.hxx>
#include <xsd/cxx/tree/parsing/long.hxx>
#include <xsd/cxx/tree/parsing/unsigned-long.hxx>
#include <xsd/cxx/tree/parsing/boolean.hxx>
#include <xsd/cxx/tree/parsing/float.hxx>
#include <xsd/cxx/tree/parsing/double.hxx>
#include <xsd/cxx/tree/parsing/decimal.hxx>

namespace xml_schema
{
  // anyType and anySimpleType.
  //
  typedef ::xsd::cxx::tree::type type;
  typedef ::xsd::cxx::tree::simple_type< char, type > simple_type;
  typedef ::xsd::cxx::tree::type container;

  // 8-bit
  //
  typedef signed char byte;
  typedef unsigned char unsigned_byte;

  // 16-bit
  //
  typedef short short_;
  typedef unsigned short unsigned_short;

  // 32-bit
  //
  typedef int int_;
  typedef unsigned int unsigned_int;

  // 64-bit
  //
  typedef long long long_;
  typedef unsigned long long unsigned_long;

  // Supposed to be arbitrary-length integral types.
  //
  typedef long long integer;
  typedef long long non_positive_integer;
  typedef unsigned long long non_negative_integer;
  typedef unsigned long long positive_integer;
  typedef long long negative_integer;

  // Boolean.
  //
  typedef bool boolean;

  // Floating-point types.
  //
  typedef float float_;
  typedef double double_;
  typedef double decimal;

  // String types.
  //
  typedef ::xsd::cxx::tree::string< char, simple_type > string;
  typedef ::xsd::cxx::tree::normalized_string< char, string > normalized_string;
  typedef ::xsd::cxx::tree::token< char, normalized_string > token;
  typedef ::xsd::cxx::tree::name< char, token > name;
  typedef ::xsd::cxx::tree::nmtoken< char, token > nmtoken;
  typedef ::xsd::cxx::tree::nmtokens< char, simple_type, nmtoken > nmtokens;
  typedef ::xsd::cxx::tree::ncname< char, name > ncname;
  typedef ::xsd::cxx::tree::language< char, token > language;

  // ID/IDREF.
  //
  typedef ::xsd::cxx::tree::id< char, ncname > id;
  typedef ::xsd::cxx::tree::idref< char, ncname, type > idref;
  typedef ::xsd::cxx::tree::idrefs< char, simple_type, idref > idrefs;

  // URI.
  //
  typedef ::xsd::cxx::tree::uri< char, simple_type > uri;

  // Qualified name.
  //
  typedef ::xsd::cxx::tree::qname< char, simple_type, uri, ncname > qname;

  // Binary.
  //
  typedef ::xsd::cxx::tree::buffer< char > buffer;
  typedef ::xsd::cxx::tree::base64_binary< char, simple_type > base64_binary;
  typedef ::xsd::cxx::tree::hex_binary< char, simple_type > hex_binary;

  // Date/time.
  //
  typedef ::xsd::cxx::tree::time_zone time_zone;
  typedef ::xsd::cxx::tree::date< char, simple_type > date;
  typedef ::xsd::cxx::tree::date_time< char, simple_type > date_time;
  typedef ::xsd::cxx::tree::duration< char, simple_type > duration;
  typedef ::xsd::cxx::tree::gday< char, simple_type > gday;
  typedef ::xsd::cxx::tree::gmonth< char, simple_type > gmonth;
  typedef ::xsd::cxx::tree::gmonth_day< char, simple_type > gmonth_day;
  typedef ::xsd::cxx::tree::gyear< char, simple_type > gyear;
  typedef ::xsd::cxx::tree::gyear_month< char, simple_type > gyear_month;
  typedef ::xsd::cxx::tree::time< char, simple_type > time;

  // Entity.
  //
  typedef ::xsd::cxx::tree::entity< char, ncname > entity;
  typedef ::xsd::cxx::tree::entities< char, simple_type, entity > entities;

  typedef ::xsd::cxx::tree::content_order content_order;
  // Flags and properties.
  //
  typedef ::xsd::cxx::tree::flags flags;
  typedef ::xsd::cxx::tree::properties< char > properties;

  // Parsing/serialization diagnostics.
  //
  typedef ::xsd::cxx::tree::severity severity;
  typedef ::xsd::cxx::tree::error< char > error;
  typedef ::xsd::cxx::tree::diagnostics< char > diagnostics;

  // Exceptions.
  //
  typedef ::xsd::cxx::tree::exception< char > exception;
  typedef ::xsd::cxx::tree::bounds< char > bounds;
  typedef ::xsd::cxx::tree::duplicate_id< char > duplicate_id;
  typedef ::xsd::cxx::tree::parsing< char > parsing;
  typedef ::xsd::cxx::tree::expected_element< char > expected_element;
  typedef ::xsd::cxx::tree::unexpected_element< char > unexpected_element;
  typedef ::xsd::cxx::tree::expected_attribute< char > expected_attribute;
  typedef ::xsd::cxx::tree::unexpected_enumerator< char > unexpected_enumerator;
  typedef ::xsd::cxx::tree::expected_text_content< char > expected_text_content;
  typedef ::xsd::cxx::tree::no_prefix_mapping< char > no_prefix_mapping;

  // Error handler callback interface.
  //
  typedef ::xsd::cxx::xml::error_handler< char > error_handler;

  // DOM interaction.
  //
  namespace dom
  {
    // Automatic pointer for DOMDocument.
    //
    using ::xsd::cxx::xml::dom::auto_ptr;

#ifndef XSD_CXX_TREE_TREE_NODE_KEY__XML_SCHEMA
#define XSD_CXX_TREE_TREE_NODE_KEY__XML_SCHEMA
    // DOM user data key for back pointers to tree nodes.
    //
    const XMLCh* const tree_node_key = ::xsd::cxx::tree::user_data_keys::node;
#endif
  }
}

// Forward declarations.
//
namespace test
{
  class id_ex;
  class inner;
  class outer;
  class id;
  class ids;
  class idrefs1;
  class idref_list;
  class idrefs2;
  class model;
}


#include <memory>    // ::std::auto_ptr
#include <limits>    // std::numeric_limits
#include <algorithm> // std::binary_search

#include <xsd/cxx/xml/char-utf8.hxx>

#include <xsd/cxx/tree/exceptions.hxx>
#include <xsd/cxx/tree/elements.hxx>
#include <xsd/cxx/tree/containers.hxx>
#include <xsd/cxx/tree/list.hxx>

#include <xsd/cxx/xml/dom/parsing-header.hxx>

#ifndef XSD_DONT_INCLUDE_INLINE
#define XSD_DONT_INCLUDE_INLINE

#undef XSD_DONT_INCLUDE_INLINE
#else

#endif // XSD_DONT_INCLUDE_INLINE

namespace test
{
  class id_ex: public ::xml_schema::id
  {
    public:
    // id
    //
    typedef ::xml_schema::id id_type;
    typedef ::xsd::cxx::tree::optional< id_type > id_optional;
    typedef ::xsd::cxx::tree::traits< id_type, char > id_traits;

    const id_optional&
    id () const;

    id_optional&
    id ();

    void
    id (const id_type& x);

    void
    id (const id_optional& x);

    void
    id (::std::auto_ptr< id_type > p);

    // Constructors.
    //
    id_ex ();

    id_ex (const ::xml_schema::id&);

    id_ex (const ::xercesc::DOMElement& e,
           ::xml_schema::flags f = 0,
           ::xml_schema::container* c = 0);

    id_ex (const id_ex& x,
           ::xml_schema::flags f = 0,
           ::xml_schema::container* c = 0);

    virtual id_ex*
    _clone (::xml_schema::flags f = 0,
            ::xml_schema::container* c = 0) const;

    id_ex&
    operator= (const id_ex& x);

    virtual 
    ~id_ex ();

    // Implementation.
    //
    protected:
    void
    parse (::xsd::cxx::xml::dom::parser< char >&,
           ::xml_schema::flags);

    protected:
    id_optional id_;
  };

  class inner: public ::xml_schema::type
  {
    public:
    // id
    //
    typedef ::xml_schema::id id_type;
    typedef ::xsd::cxx::tree::optional< id_type > id_optional;
    typedef ::xsd::cxx::tree::traits< id_type, char > id_traits;

    const id_optional&
    id () const;

    id_optional&
    id ();

    void
    id (const id_type& x);

    void
    id (const id_optional& x);

    void
    id (::std::auto_ptr< id_type > p);

    // id-ex
    //
    typedef ::test::id_ex id_ex_type;
    typedef ::xsd::cxx::tree::optional< id_ex_type > id_ex_optional;
    typedef ::xsd::cxx::tree::traits< id_ex_type, char > id_ex_traits;

    const id_ex_optional&
    id_ex () const;

    id_ex_optional&
    id_ex ();

    void
    id_ex (const id_ex_type& x);

    void
    id_ex (const id_ex_optional& x);

    void
    id_ex (::std::auto_ptr< id_ex_type > p);

    // ref
    //
    typedef ::xml_schema::idref ref_type;
    typedef ::xsd::cxx::tree::optional< ref_type > ref_optional;
    typedef ::xsd::cxx::tree::traits< ref_type, char > ref_traits;

    const ref_optional&
    ref () const;

    ref_optional&
    ref ();

    void
    ref (const ref_type& x);

    void
    ref (const ref_optional& x);

    void
    ref (::std::auto_ptr< ref_type > p);

    // Constructors.
    //
    inner ();

    inner (const ::xercesc::DOMElement& e,
           ::xml_schema::flags f = 0,
           ::xml_schema::container* c = 0);

    inner (const inner& x,
           ::xml_schema::flags f = 0,
           ::xml_schema::container* c = 0);

    virtual inner*
    _clone (::xml_schema::flags f = 0,
            ::xml_schema::container* c = 0) const;

    inner&
    operator= (const inner& x);

    virtual 
    ~inner ();

    // Implementation.
    //
    protected:
    void
    parse (::xsd::cxx::xml::dom::parser< char >&,
           ::xml_schema::flags);

    protected:
    id_optional id_;
    id_ex_optional id_ex_;
    ref_optional ref_;
  };

  class outer: public ::xml_schema::type
  {
    public:
    // i
    //
    typedef ::test::inner i_type;
    typedef ::xsd::cxx::tree::optional< i_type > i_optional;
    typedef ::xsd::cxx::tree::traits< i_type, char > i_traits;

    const i_optional&
    i () const;

    i_optional&
    i ();

    void
    i (const i_type& x);

    void
    i (const i_optional& x);

    void
    i (::std::auto_ptr< i_type > p);

    // ref
    //
    typedef ::xml_schema::idref ref_type;
    typedef ::xsd::cxx::tree::optional< ref_type > ref_optional;
    typedef ::xsd::cxx::tree::traits< ref_type, char > ref_traits;

    const ref_optional&
    ref () const;

    ref_optional&
    ref ();

    void
    ref (const ref_type& x);

    void
    ref (const ref_optional& x);

    void
    ref (::std::auto_ptr< ref_type > p);

    // Constructors.
    //
    outer ();

    outer (const ::xercesc::DOMElement& e,
           ::xml_schema::flags f = 0,
           ::xml_schema::container* c = 0);

    outer (const outer& x,
           ::xml_schema::flags f = 0,
           ::xml_schema::container* c = 0);

    virtual outer*
    _clone (::xml_schema::flags f = 0,
            ::xml_schema::container* c = 0) const;

    outer&
    operator= (const outer& x);

    virtual 
    ~outer ();

    // Implementation.
    //
    protected:
    void
    parse (::xsd::cxx::xml::dom::parser< char >&,
           ::xml_schema::flags);

    protected:
    i_optional i_;
    ref_optional ref_;
  };

  class id: public ::xml_schema::type
  {
    public:
    // id
    //
    typedef ::xml_schema::id id1_type;
    typedef ::xsd::cxx::tree::traits< id1_type, char > id1_traits;

    const id1_type&
    id1 () const;

    id1_type&
    id1 ();

    void
    id1 (const id1_type& x);

    void
    id1 (::std::auto_ptr< id1_type > p);

    // Constructors.
    //
    id ();

    id (const id1_type&);

    id (const ::xercesc::DOMElement& e,
        ::xml_schema::flags f = 0,
        ::xml_schema::container* c = 0);

    id (const id& x,
        ::xml_schema::flags f = 0,
        ::xml_schema::container* c = 0);

    virtual id*
    _clone (::xml_schema::flags f = 0,
            ::xml_schema::container* c = 0) const;

    id&
    operator= (const id& x);

    virtual 
    ~id ();

    // Implementation.
    //
    protected:
    void
    parse (::xsd::cxx::xml::dom::parser< char >&,
           ::xml_schema::flags);

    protected:
    ::xsd::cxx::tree::one< id1_type > id1_;
  };

  class ids: public ::xml_schema::type
  {
    public:
    // id
    //
    typedef ::test::id id_type;
    typedef ::xsd::cxx::tree::sequence< id_type > id_sequence;
    typedef id_sequence::iterator id_iterator;
    typedef id_sequence::const_iterator id_const_iterator;
    typedef ::xsd::cxx::tree::traits< id_type, char > id_traits;

    const id_sequence&
    id () const;

    id_sequence&
    id ();

    void
    id (const id_sequence& s);

    // Constructors.
    //
    ids ();

    ids (const ::xercesc::DOMElement& e,
         ::xml_schema::flags f = 0,
         ::xml_schema::container* c = 0);

    ids (const ids& x,
         ::xml_schema::flags f = 0,
         ::xml_schema::container* c = 0);

    virtual ids*
    _clone (::xml_schema::flags f = 0,
            ::xml_schema::container* c = 0) const;

    ids&
    operator= (const ids& x);

    virtual 
    ~ids ();

    // Implementation.
    //
    protected:
    void
    parse (::xsd::cxx::xml::dom::parser< char >&,
           ::xml_schema::flags);

    protected:
    id_sequence id_;
  };

  class idrefs1: public ::xml_schema::type
  {
    public:
    // idrefs
    //
    typedef ::xml_schema::idrefs idrefs_type;
    typedef ::xsd::cxx::tree::traits< idrefs_type, char > idrefs_traits;

    const idrefs_type&
    idrefs () const;

    idrefs_type&
    idrefs ();

    void
    idrefs (const idrefs_type& x);

    void
    idrefs (::std::auto_ptr< idrefs_type > p);

    // Constructors.
    //
    idrefs1 ();

    idrefs1 (const idrefs_type&);

    idrefs1 (const ::xercesc::DOMElement& e,
             ::xml_schema::flags f = 0,
             ::xml_schema::container* c = 0);

    idrefs1 (const idrefs1& x,
             ::xml_schema::flags f = 0,
             ::xml_schema::container* c = 0);

    virtual idrefs1*
    _clone (::xml_schema::flags f = 0,
            ::xml_schema::container* c = 0) const;

    idrefs1&
    operator= (const idrefs1& x);

    virtual 
    ~idrefs1 ();

    // Implementation.
    //
    protected:
    void
    parse (::xsd::cxx::xml::dom::parser< char >&,
           ::xml_schema::flags);

    protected:
    ::xsd::cxx::tree::one< idrefs_type > idrefs_;
  };

  class idref_list: public ::xml_schema::simple_type,
    public ::xsd::cxx::tree::list< ::xml_schema::idref, char >
  {
    public:
    idref_list ();

    idref_list (size_type n, const ::xml_schema::idref& x);

    template < typename I >
    idref_list (const I& begin, const I& end)
    : ::xsd::cxx::tree::list< ::xml_schema::idref, char > (begin, end, this)
    {
    }

    idref_list (const ::xercesc::DOMElement& e,
                ::xml_schema::flags f = 0,
                ::xml_schema::container* c = 0);

    idref_list (const ::xercesc::DOMAttr& a,
                ::xml_schema::flags f = 0,
                ::xml_schema::container* c = 0);

    idref_list (const ::std::string& s,
                const ::xercesc::DOMElement* e,
                ::xml_schema::flags f = 0,
                ::xml_schema::container* c = 0);

    idref_list (const idref_list& x,
                ::xml_schema::flags f = 0,
                ::xml_schema::container* c = 0);

    virtual idref_list*
    _clone (::xml_schema::flags f = 0,
            ::xml_schema::container* c = 0) const;

    virtual 
    ~idref_list ();
  };

  class idrefs2: public ::xml_schema::type
  {
    public:
    // idrefs
    //
    typedef ::test::idref_list idrefs_type;
    typedef ::xsd::cxx::tree::traits< idrefs_type, char > idrefs_traits;

    const idrefs_type&
    idrefs () const;

    idrefs_type&
    idrefs ();

    void
    idrefs (const idrefs_type& x);

    void
    idrefs (::std::auto_ptr< idrefs_type > p);

    // Constructors.
    //
    idrefs2 ();

    idrefs2 (const idrefs_type&);

    idrefs2 (const ::xercesc::DOMElement& e,
             ::xml_schema::flags f = 0,
             ::xml_schema::container* c = 0);

    idrefs2 (const idrefs2& x,
             ::xml_schema::flags f = 0,
             ::xml_schema::container* c = 0);

    virtual idrefs2*
    _clone (::xml_schema::flags f = 0,
            ::xml_schema::container* c = 0) const;

    idrefs2&
    operator= (const idrefs2& x);

    virtual 
    ~idrefs2 ();

    // Implementation.
    //
    protected:
    void
    parse (::xsd::cxx::xml::dom::parser< char >&,
           ::xml_schema::flags);

    protected:
    ::xsd::cxx::tree::one< idrefs_type > idrefs_;
  };

  class model: public ::xml_schema::type
  {
    public:
    // ids
    //
    typedef ::test::ids ids_type;
    typedef ::xsd::cxx::tree::traits< ids_type, char > ids_traits;

    const ids_type&
    ids () const;

    ids_type&
    ids ();

    void
    ids (const ids_type& x);

    void
    ids (::std::auto_ptr< ids_type > p);

    // idrefs1
    //
    typedef ::test::idrefs1 idrefs1_type;
    typedef ::xsd::cxx::tree::traits< idrefs1_type, char > idrefs1_traits;

    const idrefs1_type&
    idrefs1 () const;

    idrefs1_type&
    idrefs1 ();

    void
    idrefs1 (const idrefs1_type& x);

    void
    idrefs1 (::std::auto_ptr< idrefs1_type > p);

    // idrefs2
    //
    typedef ::test::idrefs2 idrefs2_type;
    typedef ::xsd::cxx::tree::traits< idrefs2_type, char > idrefs2_traits;

    const idrefs2_type&
    idrefs2 () const;

    idrefs2_type&
    idrefs2 ();

    void
    idrefs2 (const idrefs2_type& x);

    void
    idrefs2 (::std::auto_ptr< idrefs2_type > p);

    // Constructors.
    //
    model ();

    model (const ids_type&,
           const idrefs1_type&,
           const idrefs2_type&);

    model (::std::auto_ptr< ids_type >,
           ::std::auto_ptr< idrefs1_type >,
           ::std::auto_ptr< idrefs2_type >);

    model (const ::xercesc::DOMElement& e,
           ::xml_schema::flags f = 0,
           ::xml_schema::container* c = 0);

    model (const model& x,
           ::xml_schema::flags f = 0,
           ::xml_schema::container* c = 0);

    virtual model*
    _clone (::xml_schema::flags f = 0,
            ::xml_schema::container* c = 0) const;

    model&
    operator= (const model& x);

    virtual 
    ~model ();

    // Implementation.
    //
    protected:
    void
    parse (::xsd::cxx::xml::dom::parser< char >&,
           ::xml_schema::flags);

    protected:
    ::xsd::cxx::tree::one< ids_type > ids_;
    ::xsd::cxx::tree::one< idrefs1_type > idrefs1_;
    ::xsd::cxx::tree::one< idrefs2_type > idrefs2_;
  };
}

#ifndef XSD_DONT_INCLUDE_INLINE

#endif // XSD_DONT_INCLUDE_INLINE

#include <iosfwd>

#include <xercesc/sax/InputSource.hpp>
#include <xercesc/dom/DOMDocument.hpp>
#include <xercesc/dom/DOMErrorHandler.hpp>

namespace test
{
}

#ifndef XSD_DONT_INCLUDE_INLINE
#include "test.ixx"
#endif // XSD_DONT_INCLUDE_INLINE

#include <xsd/cxx/post.hxx>

// Begin epilogue.
//
//
// End epilogue.

#endif // CXX_WORK_XSD_4_0_0_XSD_TESTS_CXX_TREE_CONTAINMENT_TEST_HXX
