Skip to content
This repository has been archived by the owner on Jan 22, 2019. It is now read-only.

Commit

Permalink
Added and optional model name attribute.
Browse files Browse the repository at this point in the history
Test fail is intended, serialiser just ignores name.
  • Loading branch information
Randall Britten committed Mar 31, 2015
1 parent b95c119 commit 7ba287a
Show file tree
Hide file tree
Showing 7 changed files with 451 additions and 8 deletions.
184 changes: 180 additions & 4 deletions src/cellml_1_2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,49 @@
//
// End prologue.

#include "cellml_1_2.h"

#include <xsd/cxx/pre.hxx>

#include "cellml_1_2.h"

namespace cellml12
{
// Model
//

const Model::NameOptional& Model::
getName () const
{
return this->name_;
}

Model::NameOptional& Model::
getName ()
{
return this->name_;
}

void Model::
setName (const NameType& x)
{
this->name_.set (x);
}

void Model::
setName (const NameOptional& x)
{
this->name_ = x;
}

void Model::
setName (::std::unique_ptr< NameType > x)
{
this->name_.set (std::move (x));
}


// CellMLIdentifier
//
}

#include <xsd/cxx/xml/dom/parsing-source.hxx>
Expand All @@ -55,24 +90,50 @@ namespace cellml12

Model::
Model ()
: ::xml_schema::Type ()
: ::xml_schema::Type (),
name_ (this)
{
}

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

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

void Model::
parse (::xsd::cxx::xml::dom::parser< wchar_t >& p,
::xml_schema::Flags f)
{
while (p.more_attributes ())
{
const ::xercesc::DOMAttr& i (p.next_attribute ());
const ::xsd::cxx::xml::qualified_name< wchar_t > n (
::xsd::cxx::xml::dom::name< wchar_t > (i));

if (n.name () == L"name" && n.namespace_ ().empty ())
{
this->name_.set (NameTraits::create (i, f, this));
continue;
}
}
}

Model* Model::
Expand All @@ -82,10 +143,94 @@ namespace cellml12
return new class Model (*this, f, c);
}

Model& Model::
operator= (const Model& x)
{
if (this != &x)
{
static_cast< ::xml_schema::Type& > (*this) = x;
this->name_ = x.name_;
}

return *this;
}

Model::
~Model ()
{
}

// CellMLIdentifier
//

CellMLIdentifier::
CellMLIdentifier ()
: ::xml_schema::String ()
{
}

CellMLIdentifier::
CellMLIdentifier (const wchar_t* _xsd_String_base)
: ::xml_schema::String (_xsd_String_base)
{
}

CellMLIdentifier::
CellMLIdentifier (const ::std::wstring& _xsd_String_base)
: ::xml_schema::String (_xsd_String_base)
{
}

CellMLIdentifier::
CellMLIdentifier (const ::xml_schema::String& _xsd_String_base)
: ::xml_schema::String (_xsd_String_base)
{
}

CellMLIdentifier::
CellMLIdentifier (const CellMLIdentifier& x,
::xml_schema::Flags f,
::xml_schema::Container* c)
: ::xml_schema::String (x, f, c)
{
}

CellMLIdentifier::
CellMLIdentifier (const ::xercesc::DOMElement& e,
::xml_schema::Flags f,
::xml_schema::Container* c)
: ::xml_schema::String (e, f, c)
{
}

CellMLIdentifier::
CellMLIdentifier (const ::xercesc::DOMAttr& a,
::xml_schema::Flags f,
::xml_schema::Container* c)
: ::xml_schema::String (a, f, c)
{
}

CellMLIdentifier::
CellMLIdentifier (const ::std::wstring& s,
const ::xercesc::DOMElement* e,
::xml_schema::Flags f,
::xml_schema::Container* c)
: ::xml_schema::String (s, e, f, c)
{
}

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

CellMLIdentifier::
~CellMLIdentifier ()
{
}
}

#include <istream>
Expand Down Expand Up @@ -519,6 +664,37 @@ namespace cellml12
operator<< (::xercesc::DOMElement& e, const Model& i)
{
e << static_cast< const ::xml_schema::Type& > (i);

// name
//
if (i.getName ())
{
::xercesc::DOMAttr& a (
::xsd::cxx::xml::dom::create_attribute (
L"name",
e));

a << *i.getName ();
}
}

void
operator<< (::xercesc::DOMElement& e, const CellMLIdentifier& i)
{
e << static_cast< const ::xml_schema::String& > (i);
}

void
operator<< (::xercesc::DOMAttr& a, const CellMLIdentifier& i)
{
a << static_cast< const ::xml_schema::String& > (i);
}

void
operator<< (::xml_schema::ListStream& l,
const CellMLIdentifier& i)
{
l << static_cast< const ::xml_schema::String& > (i);
}
}

Expand Down
Loading

0 comments on commit 7ba287a

Please sign in to comment.