// Copyright (c) 2005-2011 Code Synthesis Tools CC
//
// This program was generated by CodeSynthesis XSD/e, an XML Schema
// to C++ data binding compiler for embedded systems.
//
// 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
//
//

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

#include "WeaponDescription-pimpl.h"

#include <xsde/cxx/parser/validating/string-common.hxx>

// WeaponTypeEnum_pimpl
//

WeaponTypeEnum_pimpl::
WeaponTypeEnum_pimpl ()
: WeaponTypeEnum_pskel (0)
{
}

void WeaponTypeEnum_pimpl::
pre ()
{
  this->WeaponTypeEnum_pimpl_state_.str_.clear ();
}

void WeaponTypeEnum_pimpl::
_characters (const ::xsde::cxx::ro_string& s)
{
  if (this->_facets ().whitespace_ == 2 &&
      this->WeaponTypeEnum_pimpl_state_.str_.size () == 0)
  {
    ::xsde::cxx::ro_string tmp (s.data (), s.size ());

    if (::xsde::cxx::trim_left (tmp) != 0)
    {
      this->WeaponTypeEnum_pimpl_state_.str_ += tmp;
    }
  }
  else
    this->WeaponTypeEnum_pimpl_state_.str_ += s;
}

void WeaponTypeEnum_pimpl::
_post ()
{
  ::xsde::cxx::parser::validating::string_common::validate_facets (
    this->WeaponTypeEnum_pimpl_state_.str_,
    this->_facets (),
    this->_context ());
}

::WeaponTypeEnum WeaponTypeEnum_pimpl::
post_WeaponTypeEnum ()
{
  ::WeaponTypeEnum::value_type v =
  static_cast< ::WeaponTypeEnum::value_type > (0);
  const char* s = this->WeaponTypeEnum_pimpl_state_.str_.c_str ();

  if (strcmp (s, "PROJECTILE") == 0)
    v = ::WeaponTypeEnum::PROJECTILE;

  ::WeaponTypeEnum r (v);
  return r;
}

// RangeType_pimpl
//

void RangeType_pimpl::
pre ()
{
  this->RangeType_pimpl_state_.RangeType_ = ::RangeType ();
}

void RangeType_pimpl::
Initial (float x)
{
  this->RangeType_pimpl_state_.RangeType_.Initial (x);
}

void RangeType_pimpl::
Up (float x)
{
  this->RangeType_pimpl_state_.RangeType_.Up (x);
}

void RangeType_pimpl::
Down (float x)
{
  this->RangeType_pimpl_state_.RangeType_.Down (x);
}

::RangeType RangeType_pimpl::
post_RangeType ()
{
  return this->RangeType_pimpl_state_.RangeType_;
}

// WeaponDescriptionType_pimpl
//

void WeaponDescriptionType_pimpl::
pre ()
{
  this->WeaponDescriptionType_pimpl_state_.WeaponDescriptionType_ = ::WeaponDescriptionType ();
}

void WeaponDescriptionType_pimpl::
WeaponType (const ::WeaponTypeEnum& x)
{
  this->WeaponDescriptionType_pimpl_state_.WeaponDescriptionType_.WeaponType (x);
}

void WeaponDescriptionType_pimpl::
Icon (const ::std::string& x)
{
  this->WeaponDescriptionType_pimpl_state_.WeaponDescriptionType_.Icon (x);
}

void WeaponDescriptionType_pimpl::
Mass (const ::RangeType& x)
{
  this->WeaponDescriptionType_pimpl_state_.WeaponDescriptionType_.Mass (x);
}

void WeaponDescriptionType_pimpl::
Speed (const ::RangeType& x)
{
  this->WeaponDescriptionType_pimpl_state_.WeaponDescriptionType_.Speed (x);
}

void WeaponDescriptionType_pimpl::
ProjectileCount (const ::RangeType& x)
{
  this->WeaponDescriptionType_pimpl_state_.WeaponDescriptionType_.ProjectileCount (x);
}

::WeaponDescriptionType WeaponDescriptionType_pimpl::
post_WeaponDescriptionType ()
{
  return this->WeaponDescriptionType_pimpl_state_.WeaponDescriptionType_;
}

// WeaponDescription_paggr
//

WeaponDescription_paggr::
WeaponDescription_paggr ()
{
  this->RangeType_p_.parsers (this->float_p_,
                              this->float_p_,
                              this->float_p_);

  this->WeaponDescriptionType_p_.parsers (this->WeaponTypeEnum_p_,
                                          this->string_p_,
                                          this->RangeType_p_,
                                          this->RangeType_p_,
                                          this->RangeType_p_);
}

const char* WeaponDescription_paggr::
root_name ()
{
  return "WeaponDescription";
}

const char* WeaponDescription_paggr::
root_namespace ()
{
  return "";
}

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

