// Copyright (C) 2005-2010 Code Synthesis Tools CC
//
// This program was generated by CodeSynthesis XSD, an XML Schema
// to C++ data binding compiler, in the Proprietary License mode.
// You should have received a proprietary license from Code Synthesis
// Tools CC prior to generating this code. See the license text for
// conditions.
//

// Begin prologue.
//


#define AOSLCPP_SOURCE 



//
// End prologue.

#include <xsd/cxx/pre.hxx>

#include "aosl/property.hpp"

#include <xsd/cxx/xml/dom/wildcard-source.hxx>

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

#include <xsd/cxx/tree/type-factory-map.hxx>

#include <xsd/cxx/tree/comparison-map.hxx>

namespace _xsd
{
  static
  const ::xsd::cxx::tree::type_factory_plate< 0, char >
  type_factory_plate_init;

  static
  const ::xsd::cxx::tree::comparison_plate< 0, char >
  comparison_plate_init;
}

namespace aosl
{
  // Property
  //

  Property::
  Property (const NameType& name)
  : ::xml_schema::Type (),
    property1_ (::xml_schema::Flags (), this),
    name_ (name, ::xml_schema::Flags (), this)
  {
  }

  Property::
  Property (const Property& x,
            ::xml_schema::Flags f,
            ::xml_schema::Container* c)
  : ::xml_schema::Type (x, f, c),
    property1_ (x.property1_, f, this),
    name_ (x.name_, f, this)
  {
  }

  Property::
  Property (const ::xercesc::DOMElement& e,
            ::xml_schema::Flags f,
            ::xml_schema::Container* c)
  : ::xml_schema::Type (e, f | ::xml_schema::Flags::base, c),
    property1_ (f, this),
    name_ (f, this)
  {
    if ((f & ::xml_schema::Flags::base) == 0)
    {
      ::xsd::cxx::xml::dom::parser< char > p (e, true, true);
      this->parse (p, f);
    }
  }

  void Property::
  parse (::xsd::cxx::xml::dom::parser< char >& p,
         ::xml_schema::Flags f)
  {
    for (; p.more_elements (); p.next_element ())
    {
      const ::xercesc::DOMElement& i (p.cur_element ());
      const ::xsd::cxx::xml::qualified_name< char > n (
        ::xsd::cxx::xml::dom::name< char > (i));

      // property
      //
      if (n.name () == "property" && n.namespace_ () == "artofsequence.org/aosl/1.0")
      {
        ::std::auto_ptr< Property1Type > r (
          Property1Traits::create (i, f, this));

        this->property1_.push_back (r);
        continue;
      }

      break;
    }

    while (p.more_attributes ())
    {
      const ::xercesc::DOMAttr& i (p.next_attribute ());
      const ::xsd::cxx::xml::qualified_name< char > n (
        ::xsd::cxx::xml::dom::name< char > (i));

      if (n.name () == "name" && n.namespace_ ().empty ())
      {
        ::std::auto_ptr< NameType > r (
          NameTraits::create (i, f, this));

        this->name_.set (r);
        continue;
      }
    }

    if (!name_.present ())
    {
      throw ::xsd::cxx::tree::expected_attribute< char > (
        "name",
        "");
    }
  }

  Property* Property::
  _clone (::xml_schema::Flags f,
          ::xml_schema::Container* c) const
  {
    return new class Property (*this, f, c);
  }

  Property::
  ~Property ()
  {
  }

  bool
  operator== (const Property& x, const Property& y)
  {
    if (!(x.property1 () == y.property1 ()))
      return false;

    if (!(x.name () == y.name ()))
      return false;

    return true;
  }

  bool
  operator!= (const Property& x, const Property& y)
  {
    return !(x == y);
  }
}

#include <ostream>

#include <xsd/cxx/tree/std-ostream-map.hxx>

namespace _xsd
{
  static
  const ::xsd::cxx::tree::std_ostream_plate< 0, char >
  std_ostream_plate_init;
}

namespace aosl
{
  ::std::ostream&
  operator<< (::std::ostream& o, const Property& i)
  {
    for (Property::Property1ConstIterator
         b (i.property1 ().begin ()), e (i.property1 ().end ());
         b != e; ++b)
    {
      o << ::std::endl << "property: " << *b;
    }

    o << ::std::endl << "name: " << i.name ();
    return o;
  }
}

#include <istream>
#include <xsd/cxx/xml/sax/std-input-source.hxx>
#include <xsd/cxx/tree/error-handler.hxx>

namespace aosl
{
}

#include <ostream>
#include <xsd/cxx/tree/error-handler.hxx>
#include <xsd/cxx/xml/dom/serialization-source.hxx>

#include <xsd/cxx/tree/type-serializer-map.hxx>

namespace _xsd
{
  static
  const ::xsd::cxx::tree::type_serializer_plate< 0, char >
  type_serializer_plate_init;
}

namespace aosl
{
  void
  operator<< (::xercesc::DOMElement& e, const Property& i)
  {
    e << static_cast< const ::xml_schema::Type& > (i);

    // property
    //
    for (Property::Property1ConstIterator
         b (i.property1 ().begin ()), n (i.property1 ().end ());
         b != n; ++b)
    {
      ::xercesc::DOMElement& s (
        ::xsd::cxx::xml::dom::create_element (
          "property",
          "artofsequence.org/aosl/1.0",
          e));

      s << *b;
    }

    // name
    //
    {
      ::xercesc::DOMAttr& a (
        ::xsd::cxx::xml::dom::create_attribute (
          "name",
          e));

      a << i.name ();
    }
  }
}

#include <xsd/cxx/post.hxx>

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

