/**********************************************************************************************
* Copyright (c) 2001-2025 Liquid Technologies Limited. All rights reserved.
* See www.liquid-technologies.com for product details.
*
* Please see products End User License Agreement for distribution permissions.
*
* WARNING: THIS FILE IS GENERATED
* Changes made outside of ##HAND_CODED_BLOCK_START blocks will be overwritten
*
* Generation : by Liquid XML Data Binder 19.0.14.11049
* Using Schema: DerivedByExtension.xsd
**********************************************************************************************/
#include "StdAfx.h"
#pragma warning (push)
#pragma warning (disable:4251) // template export warning
#pragma warning (disable:4786) // long debug names
#include "../DerivedByExtensionLib.h"
#include "../DerivedByExtensionLib/Person.h"
// ##HAND_CODED_BLOCK_START ID="Additional Includes"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
// Add Additional Includes here...
// ##HAND_CODED_BLOCK_END ID="Additional Includes"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
// Name : Person
// Long Name : Person
// Element Name : Person
// Class Namespace : DerivedByExtensionLib
// Namespace Alias :
// Schema Namespace :
// Mapped Class Name : CPerson
// Mapped Class Full Name : DerivedByExtensionLib::CPerson
// Mapped Class File Name : CPerson
// IsAbstract : False
// IsElement : True
// IsComplexType : False
namespace DerivedByExtensionLib
{
LtXmlLib21Data::CParentElementInfo* CPerson::ms_pParentElementInfo = NULL;
LtXmlLib21Data::CAttributeInfo** CPerson::ms_ppAttributeInfo = NULL;
LtXmlLib21Data::CElementInfo** CPerson::ms_ppElementInfo = NULL;
CPersonPtr CPerson::CreateInstance(LPCTSTR lpctElementName/*=_T("Person")*/)
{
return new DerivedByExtensionLib::CPerson(lpctElementName);
}
/*
* Constructor for CPerson
*
* The class is created with all the mandatory fields populated with the
* default data.
* All Collection objects are created.
* However any 1-n relationships (these are represented as collections) are
* empty. To comply with the schema these must be populated before the xml
* obtained from ToXml is valid against the schema DerivedByExtension.xsd
*/
CPerson::CPerson(LPCTSTR lpctElementName/*=_T("Person")*/)
: CInstanceMonitor(_T("CPerson"))
{
m_elementName = lpctElementName;
Init();
}
CPerson::~CPerson()
{
Cleanup();
}
void CPerson::Cleanup()
{
// unregister for any events we have asked for
// cos there'll be no one left to hear soon
}
void CPerson::OnEvent(LtXmlLib21::CXmlObjectBase* pMsgSource, LtXmlLib21::IEventSink::MsgType eMsgType, void* pData)
{
if (eMsgType == LtXmlLib21::IEventSink::MT_CollectionChangeEvent)
{
}
}
/*
* Initializes the class
*
* The Creates all the mandatory fields (populated with the default data)
* All Collection object are created.
* However any 1-n relationships (these are represented as collections) are
* empty. To comply with the schema these must be populated before the xml
* obtained from ToXml is valid against the schema DerivedByExtension.xsd.
*/
void CPerson::Init()
{
Cleanup();
this->m_Age = 0;
this->m_HomeAddress = NULL;
// ##HAND_CODED_BLOCK_START ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
// Add Additional Init Settings...
// ##HAND_CODED_BLOCK_END ID="Additional Inits"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
}
void CPerson::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib21::LtVariant& rValue)
{
if (bRead)
{
switch(iPropertyIndex)
{
case 1:
rValue.SetUI1(GetAge());
break;
case 2:
rValue.SetXmlObject(GetHomeAddress().Ptr());
break;
default:
throw LtXmlLib21::CLtException(_T("Unknown Property Index"));
};
}
else
{
switch(iPropertyIndex)
{
case 1:
SetAge(rValue.GetUI1());
break;
case 2:
SetHomeAddress(dynamic_cast<DerivedByExtensionLib::IAddress*>(rValue.GetXmlObject().Ptr()));
break;
default:
throw LtXmlLib21::CLtException(_T("Unknown Property Index"));
}
}
}
/*
* Represents a mandatory Element in the XML document
*
*
* This property is represented as an Element in the XML.
* It is mandatory and therefore must be populated within the XML.
* It is defaulted to 0.
*/
BYTE CPerson::GetAge() const
{
return this->m_Age;
}
void CPerson::SetAge(BYTE value)
{
this->m_Age = value;
}
/*
* Represents a mandatory Element in the XML document
*
*
* This property is represented as an Element in the XML.
* It is mandatory and therefore must be populated within the XML.
* If this property is set, then the object will be COPIED. If the property is set to NULL an exception is raised.
*/
DerivedByExtensionLib::IAddressPtr CPerson::GetHomeAddress() const
{
return this->m_HomeAddress;
}
void CPerson::SetHomeAddress(DerivedByExtensionLib::IAddress* value)
{
Throw_IfPropertyIsNull(value, _T("HomeAddress"));
if (value != NULL)
{
// The object being set needs to take the element name from the class (the type="" attribute will then be set in the XML)
SetElementName(value, _T("HomeAddress"));
}
this->m_HomeAddress = value;
}
/*
* Allows the class to be copied
* Performs a 'deep copy' of all the data in the class (and its children)
*/
DerivedByExtensionLib::CPersonPtr CPerson::Clone() const
{
DerivedByExtensionLib::CPersonPtr newObject = CreateInstance(m_elementName.c_str());
int index = 0;
newObject->m_Age = m_Age;
newObject->m_HomeAddress = NULL;
if (m_HomeAddress != NULL)
newObject->m_HomeAddress = dynamic_cast<DerivedByExtensionLib::IAddress*>(m_HomeAddress->Clone().Ptr());
// ##HAND_CODED_BLOCK_START ID="Additional clone"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
// Add Additional clone code here...
// ##HAND_CODED_BLOCK_END ID="Additional clone"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
return newObject.Ptr();
}
std::tstring CPerson::GetTargetNamespace() const
{
return _T("");
}
std::tstring CPerson::GetNamespace() const
{
return _T("");
}
LtXmlLib21::CXmlObjectBase* CPerson::GetBase()
{
return this;
}
void CPerson::CleanMetaData()
{
LtXmlLib21::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo);
}
LtXmlLib21Data::CParentElementInfo* CPerson::GetClassInfo() const
{
if (ms_pParentElementInfo == NULL)
{
m_csInit.Enter();
if (ms_pParentElementInfo == NULL)
{
ms_pParentElementInfo = new LtXmlLib21Data::CParentElementInfo(
LtXmlLib21Data::XmlElementGroupType_SEQUENCE,
LtXmlLib21Data::XmlElementType_ELEMENT,
_T("Person"),
_T(""),
true,
false,
-1,
LtXmlLib21::ItemType_none,
LtXmlLib21::CWhitespaceUtils::WhitespaceRule_None,
NULL,
false);
}
m_csInit.Leave();
}
return ms_pParentElementInfo;
}
LtXmlLib21Data::CElementInfo** CPerson::GetClassElementInfo() const
{
if (ms_ppElementInfo == NULL)
{
m_csInit.Enter();
if (ms_ppElementInfo == NULL)
{
ms_ppElementInfo = new LtXmlLib21Data::CElementInfo*[3];
ms_ppElementInfo[0] = new LtXmlLib21Data::CElementInfoSeqPrimMnd(_T("Age"), _T(""), 1, false, LtXmlLib21::ItemType_ui1, NULL, LtXmlLib21::CWhitespaceUtils::WhitespaceRule_Collapse, LtXmlLib21::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
ms_ppElementInfo[1] = new LtXmlLib21Data::CElementInfoSeqAbsClsMnd(_T("HomeAddress"), _T(""), 2, LtXmlLib21Data::XmlElementType_ELEMENT, DerivedByExtensionLib::CClassFactory::IAddressCreateObject);
ms_ppElementInfo[2] = NULL;
}
m_csInit.Leave();
}
return ms_ppElementInfo;
}
LtXmlLib21Data::CAttributeInfo** CPerson::GetClassAttributeInfo() const
{
if (ms_ppAttributeInfo == NULL)
{
m_csInit.Enter();
if (ms_ppAttributeInfo == NULL)
{
ms_ppAttributeInfo = new LtXmlLib21Data::CAttributeInfo*[1];
ms_ppAttributeInfo[0] = NULL;
}
m_csInit.Leave();
}
return ms_ppAttributeInfo;
}
// ##HAND_CODED_BLOCK_START ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
// Add Additional Methods here...
// ##HAND_CODED_BLOCK_END ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
}; // namespace