C++ Sample : Derived By Extension
Schema Summary This sample shows how a complex type may be extended, and how the base and extended types can be manipulated in code. Schema Details The Schema A global base type Address is defined (all base types must be global). The elements CAN_Address and GBR_Address then extended Address in order to add additional elements. The Person element contains a child element HomeAddress of type Address. In place of Address any type that is based on Address (including Address itself) can be used (CAN_Address and GBR_Address). If an element is added to Person:HomeAddress of a type other than the Address, then we need to identify the type of the element used (for validation purposes), this means placing a xs:type="" attribute against the element. This is automatically done for you by the generated classes. Generated Code The element Address is a base element to CAN_Address and GBR_Address, and Address can be created as an element in its own right. This means that where ever Address can be used CAN_Address and GBR_Address can be used in its place. In order to implement this in the generated code, an abstract base class IAddress is introduced. All of the classes generated from Address, CAN_Address and GBR_Address implement this IAddress interface. Sample Description The sample demonstrates the use of the derived type GBR_Address. Note the type specified in Person is 'Address' however any element deriving from it may used in its place. |
Sample XML File
Sample2.xml |
<?xml version="1.0" encoding="UTF-8"?> <Person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="..\Schema\DerivedByExtension.xsd" > <Age>32</Age> <HomeAddress xsi:type="GBR_Address"> <Name>Joe Bloggs</Name> <Street>The Head row</Street> <City>Leeds</City> <County>West Yorkshire</County> <PostCode>LS8 4BD</PostCode> </HomeAddress> </Person> |
Read Sample | |
#include "..\..\..\Samples\DerivedByExtension\Generated\CPP\SourceCodeCPP\DerivedByExtensionLib.h" #include "..\..\..\Samples\DerivedByExtension\Generated\CPP\SourceCodeCPP\DerivedByExtensionLib\Person.h" #include "..\..\..\Samples\DerivedByExtension\Generated\CPP\SourceCodeCPP\DerivedByExtensionLib\Address.h" #include "..\..\..\Samples\DerivedByExtension\Generated\CPP\SourceCodeCPP\DerivedByExtensionLib\CAN_Address.h" #include "..\..\..\Samples\DerivedByExtension\Generated\CPP\SourceCodeCPP\DerivedByExtensionLib\GBR_Address.h" SampleRead(SAMPLE_PATH + "DerivedByExtension\\Samples\\Sample2.xml"); // Create Name object DerivedByExtensionLib::CPersonPtr per = DerivedByExtensionLib::CPerson::CreateInstance(); // Load data into the object from a file per->FromXmlFile(FilePath.c_str()); // Now we can look at the data printf("Age = %d\n", per->GetAge()); printf("Address\n"); printf(" Name = %s\n", per->GetHomeAddress()->GetName().c_str() ); printf(" Street = %s\n", per->GetHomeAddress()->GetStreet().c_str() ); printf(" City = %s\n", per->GetHomeAddress()->GetCity().c_str() ); if (dynamic_cast<DerivedByExtensionLib::CAddress*>(per->GetHomeAddress().Ptr()) != NULL) { // The HomeAddress is an Address object, there is no more data to display } else if (dynamic_cast<DerivedByExtensionLib::CCAN_Address*>(per->GetHomeAddress().Ptr()) != NULL) { // The HomeAddress is an CAN_Address object // We will cast it, and store the reference in a smart pointer (Note the CCAN_AddressPtr) DerivedByExtensionLib::CCAN_AddressPtr CAdd = dynamic_cast<DerivedByExtensionLib::CCAN_Address*>(per->GetHomeAddress().Ptr()); printf(" City = %s\n", CAdd->GetProvince().c_str() ); printf(" PostalCode = %s\n", CAdd->GetPostalCode().c_str() ); } else if (dynamic_cast<DerivedByExtensionLib::CGBR_Address*>(per->GetHomeAddress().Ptr()) != NULL) { // The HomeAddress is an GBR_Address object. // We will cast it, and store the reference in a smart pointer (Note the CGBR_AddressPtr) DerivedByExtensionLib::CGBR_AddressPtr GAdd = dynamic_cast<DerivedByExtensionLib::CGBR_Address*>(per->GetHomeAddress().Ptr()); printf(" County = %s\n", GAdd->GetCounty().c_str() ); printf(" PostCode = %s\n", GAdd->GetPostCode().c_str() ); } else { // The HomeAddress is an unknown type printf("The Home address is an unknown type \n"); }
|
Write Sample | |
#include "..\..\..\Samples\DerivedByExtension\Generated\CPP\SourceCodeCPP\DerivedByExtensionLib.h" #include "..\..\..\Samples\DerivedByExtension\Generated\CPP\SourceCodeCPP\DerivedByExtensionLib\Person.h" #include "..\..\..\Samples\DerivedByExtension\Generated\CPP\SourceCodeCPP\DerivedByExtensionLib\Address.h" #include "..\..\..\Samples\DerivedByExtension\Generated\CPP\SourceCodeCPP\DerivedByExtensionLib\CAN_Address.h" #include "..\..\..\Samples\DerivedByExtension\Generated\CPP\SourceCodeCPP\DerivedByExtensionLib\GBR_Address.h" // Create Name object DerivedByExtensionLib::CPersonPtr per = DerivedByExtensionLib::CPerson::CreateInstance(); // populate the person object per->SetAge(32); // Create the right kind of address object DerivedByExtensionLib::CGBR_AddressPtr GbrAddress = DerivedByExtensionLib::CGBR_Address::CreateInstance(); per->SetHomeAddress(GbrAddress); GbrAddress->SetName("Joe Bloggs"); GbrAddress->SetStreet("The Head row"); GbrAddress->SetCity("Leeds"); GbrAddress->SetCounty("West Yorkshire"); GbrAddress->SetPostCode("LS8 4BD"); // Now we can look at the XML from this object printf(per->ToXml().c_str());
|
DerivedByExtension.xsd |
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:complexType name="Address"> <xs:sequence> <xs:element name="Name" type="xs:string"/> <xs:element name="Street" type="xs:string"/> <xs:element name="City" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:complexType name="CAN_Address"> <xs:complexContent> <xs:extension base="Address"> <xs:sequence> <xs:element name="Province" type="xs:string"/> <xs:element name="PostalCode" type="xs:string"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name="GBR_Address"> <xs:complexContent> <xs:extension base="Address"> <xs:sequence> <xs:element name="County" type="xs:string"/> <xs:element name="PostCode" type="xs:string"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> <xs:element name="Person"> <xs:complexType> <xs:sequence> <xs:element name="Age" type="xs:unsignedByte"/> <xs:element name="HomeAddress" type="Address"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> |
Schema Diagrams |
|
Address.cpp |
/********************************************************************************************** * Copyright (c) 2001-2023 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/Address.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 : Address // Long Name : Address // Element Name : Address // Class Namespace : DerivedByExtensionLib // Namespace Alias : // Schema Namespace : // Mapped Class Name : CAddress // Mapped Class Full Name : DerivedByExtensionLib::CAddress // Mapped Class File Name : CAddress // IsAbstract : False // IsElement : True // IsComplexType : True namespace DerivedByExtensionLib { LtXmlLib20Data::CParentElementInfo* CAddress::ms_pParentElementInfo = NULL; LtXmlLib20Data::CAttributeInfo** CAddress::ms_ppAttributeInfo = NULL; LtXmlLib20Data::CElementInfo** CAddress::ms_ppElementInfo = NULL; CAddressPtr CAddress::CreateInstance(LPCTSTR lpctElementName/*=_T("Address")*/) { return new DerivedByExtensionLib::CAddress(lpctElementName); } /* * Constructor for CAddress * * 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 */ CAddress::CAddress(LPCTSTR lpctElementName/*=_T("Address")*/) : CInstanceMonitor(_T("CAddress")) { m_elementName = lpctElementName; Init(); } CAddress::~CAddress() { Cleanup(); } void CAddress::Cleanup() { // unregister for any events we have asked for // cos there'll be no one left to hear soon } void CAddress::OnEvent(LtXmlLib20::CXmlObjectBase* pMsgSource, LtXmlLib20::IEventSink::MsgType eMsgType, void* pData) { if (eMsgType == LtXmlLib20::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 CAddress::Init() { Cleanup(); this->m_Name = _T(""); this->m_Street = _T(""); this->m_City = _T(""); // ##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 CAddress::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib20::LtVariant& rValue) { if (bRead) { switch(iPropertyIndex) { case 1: rValue.SetString(GetName()); break; case 2: rValue.SetString(GetStreet()); break; case 3: rValue.SetString(GetCity()); break; default: throw LtXmlLib20::CLtException(_T("Unknown Property Index")); }; } else { switch(iPropertyIndex) { case 1: SetName(rValue.GetString()); break; case 2: SetStreet(rValue.GetString()); break; case 3: SetCity(rValue.GetString()); break; default: throw LtXmlLib20::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 _T(""). */ std::tstring CAddress::GetName() const { return this->m_Name; } void CAddress::SetName(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); this->m_Name = 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. * It is defaulted to _T(""). */ std::tstring CAddress::GetStreet() const { return this->m_Street; } void CAddress::SetStreet(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); this->m_Street = 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. * It is defaulted to _T(""). */ std::tstring CAddress::GetCity() const { return this->m_City; } void CAddress::SetCity(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); this->m_City = value; } /* * Allows the class to be copied * Performs a 'deep copy' of all the data in the class (and its children) */ DerivedByExtensionLib::IAddressPtr CAddress::Clone() const { DerivedByExtensionLib::CAddressPtr newObject = CreateInstance(m_elementName.c_str()); int index = 0; newObject->m_Name = m_Name; newObject->m_Street = m_Street; newObject->m_City = m_City; // ##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 CAddress::GetTargetNamespace() const { return _T(""); } std::tstring CAddress::GetNamespace() const { return _T(""); } LtXmlLib20::CXmlObjectBase* CAddress::GetBase() { return this; } void CAddress::CleanMetaData() { LtXmlLib20::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo); } LtXmlLib20Data::CParentElementInfo* CAddress::GetClassInfo() const { if (ms_pParentElementInfo == NULL) { m_csInit.Enter(); if (ms_pParentElementInfo == NULL) { ms_pParentElementInfo = new LtXmlLib20Data::CParentElementInfo( LtXmlLib20Data::XmlElementGroupType_SEQUENCE, LtXmlLib20Data::XmlElementType_ELEMENT, _T("Address"), _T(""), true, true, -1, LtXmlLib20::ItemType_none, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_None, NULL, false); } m_csInit.Leave(); } return ms_pParentElementInfo; } LtXmlLib20Data::CElementInfo** CAddress::GetClassElementInfo() const { if (ms_ppElementInfo == NULL) { m_csInit.Enter(); if (ms_ppElementInfo == NULL) { ms_ppElementInfo = new LtXmlLib20Data::CElementInfo*[4]; ms_ppElementInfo[0] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("Name"), _T(""), 1, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[1] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("Street"), _T(""), 2, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[2] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("City"), _T(""), 3, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[3] = NULL; } m_csInit.Leave(); } return ms_ppElementInfo; } LtXmlLib20Data::CAttributeInfo** CAddress::GetClassAttributeInfo() const { if (ms_ppAttributeInfo == NULL) { m_csInit.Enter(); if (ms_ppAttributeInfo == NULL) { ms_ppAttributeInfo = new LtXmlLib20Data::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 |
Address.h |
/********************************************************************************************** * Copyright (c) 2001-2023 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 **********************************************************************************************/ #ifndef _DerivedByExtensionLib_DerivedByExtensionLib_CAddress_h #define _DerivedByExtensionLib_DerivedByExtensionLib_CAddress_h // Include Base classes #include "../DerivedByExtensionLib/IAddress.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 // Forward declarations - done like this to keep the intellisense happy namespace DerivedByExtensionLib { class CClassFactory; }; namespace DerivedByExtensionLib { /* * CAddress * * This class wraps the element Address in the schema */ class DerivedByExtensionLib_DLL CAddress : public CInstanceMonitor , public virtual DerivedByExtensionLib::CXmlCommonBase , public virtual DerivedByExtensionLib::IAddress // ##HAND_CODED_BLOCK_START ID="Additional Base Classes"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS // Add Additional base classes here... // ##HAND_CODED_BLOCK_END ID="Additional Base Classes"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS { public: static DerivedByExtensionLib::CAddressPtr CreateInstance(LPCTSTR lpctElementName=_T("Address")); protected: CAddress(LPCTSTR lpctElementName=_T("Address")); virtual ~CAddress(); friend class DerivedByExtensionLib::CClassFactory; virtual void Init(); virtual void AccessProperty(int iPropertyIndex, bool read, LtXmlLib20::LtVariant& rValue); virtual LtXmlLib20Data::CParentElementInfo* GetClassInfo() const; virtual LtXmlLib20Data::CElementInfo** GetClassElementInfo() const; virtual LtXmlLib20Data::CAttributeInfo** GetClassAttributeInfo() const; static void CleanMetaData(); void Cleanup(); virtual void OnEvent(LtXmlLib20::CXmlObjectBase* pMsgSource, LtXmlLib20::IEventSink::MsgType eMsgType, void* pData); public: std::tstring GetName() const; void SetName(std::tstring val); protected: std::tstring m_Name; public: std::tstring GetStreet() const; void SetStreet(std::tstring val); protected: std::tstring m_Street; public: std::tstring GetCity() const; void SetCity(std::tstring val); protected: std::tstring m_City; public: // Performs a 'deep copy' of all the data in the class (and its children) virtual DerivedByExtensionLib::IAddressPtr Clone() const; virtual std::tstring GetTargetNamespace() const; virtual std::tstring GetNamespace() const; virtual LtXmlLib20::CXmlObjectBase* GetBase(); // Internal data for XML serialization private: static LtXmlLib20Data::CParentElementInfo* ms_pParentElementInfo; static LtXmlLib20Data::CElementInfo** ms_ppElementInfo; static LtXmlLib20Data::CAttributeInfo** 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 }; }; // end namespace (DerivedByExtensionLib) #endif // _DerivedByExtensionLib_CAddress_h |
CAN_Address.cpp |
/********************************************************************************************** * Copyright (c) 2001-2023 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/CAN_Address.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 : CAN_Address // Long Name : CAN_Address // Element Name : CAN_Address // Class Namespace : DerivedByExtensionLib // Namespace Alias : // Schema Namespace : // Mapped Class Name : CCAN_Address // Mapped Class Full Name : DerivedByExtensionLib::CCAN_Address // Mapped Class File Name : CCAN_Address // IsAbstract : False // IsElement : True // IsComplexType : True namespace DerivedByExtensionLib { LtXmlLib20Data::CParentElementInfo* CCAN_Address::ms_pParentElementInfo = NULL; LtXmlLib20Data::CAttributeInfo** CCAN_Address::ms_ppAttributeInfo = NULL; LtXmlLib20Data::CElementInfo** CCAN_Address::ms_ppElementInfo = NULL; CCAN_AddressPtr CCAN_Address::CreateInstance(LPCTSTR lpctElementName/*=_T("CAN_Address")*/) { return new DerivedByExtensionLib::CCAN_Address(lpctElementName); } /* * Constructor for CCAN_Address * * 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 */ CCAN_Address::CCAN_Address(LPCTSTR lpctElementName/*=_T("CAN_Address")*/) : CInstanceMonitor(_T("CCAN_Address")) { m_elementName = lpctElementName; Init(); } CCAN_Address::~CCAN_Address() { Cleanup(); } void CCAN_Address::Cleanup() { // unregister for any events we have asked for // cos there'll be no one left to hear soon } void CCAN_Address::OnEvent(LtXmlLib20::CXmlObjectBase* pMsgSource, LtXmlLib20::IEventSink::MsgType eMsgType, void* pData) { if (eMsgType == LtXmlLib20::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 CCAN_Address::Init() { Cleanup(); this->m_Name = _T(""); this->m_Street = _T(""); this->m_City = _T(""); this->m_Province = _T(""); this->m_PostalCode = _T(""); // ##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 CCAN_Address::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib20::LtVariant& rValue) { if (bRead) { switch(iPropertyIndex) { case 1: rValue.SetString(GetName()); break; case 2: rValue.SetString(GetStreet()); break; case 3: rValue.SetString(GetCity()); break; case 4: rValue.SetString(GetProvince()); break; case 5: rValue.SetString(GetPostalCode()); break; default: throw LtXmlLib20::CLtException(_T("Unknown Property Index")); }; } else { switch(iPropertyIndex) { case 1: SetName(rValue.GetString()); break; case 2: SetStreet(rValue.GetString()); break; case 3: SetCity(rValue.GetString()); break; case 4: SetProvince(rValue.GetString()); break; case 5: SetPostalCode(rValue.GetString()); break; default: throw LtXmlLib20::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 _T(""). */ std::tstring CCAN_Address::GetName() const { return this->m_Name; } void CCAN_Address::SetName(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); this->m_Name = 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. * It is defaulted to _T(""). */ std::tstring CCAN_Address::GetStreet() const { return this->m_Street; } void CCAN_Address::SetStreet(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); this->m_Street = 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. * It is defaulted to _T(""). */ std::tstring CCAN_Address::GetCity() const { return this->m_City; } void CCAN_Address::SetCity(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); this->m_City = 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. * It is defaulted to _T(""). */ std::tstring CCAN_Address::GetProvince() const { return this->m_Province; } void CCAN_Address::SetProvince(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); this->m_Province = 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. * It is defaulted to _T(""). */ std::tstring CCAN_Address::GetPostalCode() const { return this->m_PostalCode; } void CCAN_Address::SetPostalCode(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); this->m_PostalCode = value; } /* * Allows the class to be copied * Performs a 'deep copy' of all the data in the class (and its children) */ DerivedByExtensionLib::IAddressPtr CCAN_Address::Clone() const { DerivedByExtensionLib::CCAN_AddressPtr newObject = CreateInstance(m_elementName.c_str()); int index = 0; newObject->m_Name = m_Name; newObject->m_Street = m_Street; newObject->m_City = m_City; newObject->m_Province = m_Province; newObject->m_PostalCode = m_PostalCode; // ##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 CCAN_Address::GetTargetNamespace() const { return _T(""); } std::tstring CCAN_Address::GetNamespace() const { return _T(""); } LtXmlLib20::CXmlObjectBase* CCAN_Address::GetBase() { return this; } void CCAN_Address::CleanMetaData() { LtXmlLib20::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo); } LtXmlLib20Data::CParentElementInfo* CCAN_Address::GetClassInfo() const { if (ms_pParentElementInfo == NULL) { m_csInit.Enter(); if (ms_pParentElementInfo == NULL) { ms_pParentElementInfo = new LtXmlLib20Data::CParentElementInfo( LtXmlLib20Data::XmlElementGroupType_SEQUENCE, LtXmlLib20Data::XmlElementType_ELEMENT, _T("CAN_Address"), _T(""), true, true, -1, LtXmlLib20::ItemType_none, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_None, NULL, false); } m_csInit.Leave(); } return ms_pParentElementInfo; } LtXmlLib20Data::CElementInfo** CCAN_Address::GetClassElementInfo() const { if (ms_ppElementInfo == NULL) { m_csInit.Enter(); if (ms_ppElementInfo == NULL) { ms_ppElementInfo = new LtXmlLib20Data::CElementInfo*[6]; ms_ppElementInfo[0] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("Name"), _T(""), 1, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[1] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("Street"), _T(""), 2, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[2] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("City"), _T(""), 3, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[3] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("Province"), _T(""), 4, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[4] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("PostalCode"), _T(""), 5, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[5] = NULL; } m_csInit.Leave(); } return ms_ppElementInfo; } LtXmlLib20Data::CAttributeInfo** CCAN_Address::GetClassAttributeInfo() const { if (ms_ppAttributeInfo == NULL) { m_csInit.Enter(); if (ms_ppAttributeInfo == NULL) { ms_ppAttributeInfo = new LtXmlLib20Data::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 |
CAN_Address.h |
/********************************************************************************************** * Copyright (c) 2001-2023 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 **********************************************************************************************/ #ifndef _DerivedByExtensionLib_DerivedByExtensionLib_CCAN_Address_h #define _DerivedByExtensionLib_DerivedByExtensionLib_CCAN_Address_h // Include Base classes #include "../DerivedByExtensionLib/IAddress.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 // Forward declarations - done like this to keep the intellisense happy namespace DerivedByExtensionLib { class CClassFactory; }; namespace DerivedByExtensionLib { /* * CCAN_Address * * This class wraps the element CAN_Address in the schema */ class DerivedByExtensionLib_DLL CCAN_Address : public CInstanceMonitor , public virtual DerivedByExtensionLib::CXmlCommonBase , public virtual DerivedByExtensionLib::IAddress // ##HAND_CODED_BLOCK_START ID="Additional Base Classes"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS // Add Additional base classes here... // ##HAND_CODED_BLOCK_END ID="Additional Base Classes"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS { public: static DerivedByExtensionLib::CCAN_AddressPtr CreateInstance(LPCTSTR lpctElementName=_T("CAN_Address")); protected: CCAN_Address(LPCTSTR lpctElementName=_T("CAN_Address")); virtual ~CCAN_Address(); friend class DerivedByExtensionLib::CClassFactory; virtual void Init(); virtual void AccessProperty(int iPropertyIndex, bool read, LtXmlLib20::LtVariant& rValue); virtual LtXmlLib20Data::CParentElementInfo* GetClassInfo() const; virtual LtXmlLib20Data::CElementInfo** GetClassElementInfo() const; virtual LtXmlLib20Data::CAttributeInfo** GetClassAttributeInfo() const; static void CleanMetaData(); void Cleanup(); virtual void OnEvent(LtXmlLib20::CXmlObjectBase* pMsgSource, LtXmlLib20::IEventSink::MsgType eMsgType, void* pData); public: std::tstring GetName() const; void SetName(std::tstring val); protected: std::tstring m_Name; public: std::tstring GetStreet() const; void SetStreet(std::tstring val); protected: std::tstring m_Street; public: std::tstring GetCity() const; void SetCity(std::tstring val); protected: std::tstring m_City; public: std::tstring GetProvince() const; void SetProvince(std::tstring val); protected: std::tstring m_Province; public: std::tstring GetPostalCode() const; void SetPostalCode(std::tstring val); protected: std::tstring m_PostalCode; public: // Performs a 'deep copy' of all the data in the class (and its children) virtual DerivedByExtensionLib::IAddressPtr Clone() const; virtual std::tstring GetTargetNamespace() const; virtual std::tstring GetNamespace() const; virtual LtXmlLib20::CXmlObjectBase* GetBase(); // Internal data for XML serialization private: static LtXmlLib20Data::CParentElementInfo* ms_pParentElementInfo; static LtXmlLib20Data::CElementInfo** ms_ppElementInfo; static LtXmlLib20Data::CAttributeInfo** 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 }; }; // end namespace (DerivedByExtensionLib) #endif // _DerivedByExtensionLib_CCAN_Address_h |
GBR_Address.cpp |
/********************************************************************************************** * Copyright (c) 2001-2023 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/GBR_Address.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 : GBR_Address // Long Name : GBR_Address // Element Name : GBR_Address // Class Namespace : DerivedByExtensionLib // Namespace Alias : // Schema Namespace : // Mapped Class Name : CGBR_Address // Mapped Class Full Name : DerivedByExtensionLib::CGBR_Address // Mapped Class File Name : CGBR_Address // IsAbstract : False // IsElement : True // IsComplexType : True namespace DerivedByExtensionLib { LtXmlLib20Data::CParentElementInfo* CGBR_Address::ms_pParentElementInfo = NULL; LtXmlLib20Data::CAttributeInfo** CGBR_Address::ms_ppAttributeInfo = NULL; LtXmlLib20Data::CElementInfo** CGBR_Address::ms_ppElementInfo = NULL; CGBR_AddressPtr CGBR_Address::CreateInstance(LPCTSTR lpctElementName/*=_T("GBR_Address")*/) { return new DerivedByExtensionLib::CGBR_Address(lpctElementName); } /* * Constructor for CGBR_Address * * 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 */ CGBR_Address::CGBR_Address(LPCTSTR lpctElementName/*=_T("GBR_Address")*/) : CInstanceMonitor(_T("CGBR_Address")) { m_elementName = lpctElementName; Init(); } CGBR_Address::~CGBR_Address() { Cleanup(); } void CGBR_Address::Cleanup() { // unregister for any events we have asked for // cos there'll be no one left to hear soon } void CGBR_Address::OnEvent(LtXmlLib20::CXmlObjectBase* pMsgSource, LtXmlLib20::IEventSink::MsgType eMsgType, void* pData) { if (eMsgType == LtXmlLib20::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 CGBR_Address::Init() { Cleanup(); this->m_Name = _T(""); this->m_Street = _T(""); this->m_City = _T(""); this->m_County = _T(""); this->m_PostCode = _T(""); // ##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 CGBR_Address::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib20::LtVariant& rValue) { if (bRead) { switch(iPropertyIndex) { case 1: rValue.SetString(GetName()); break; case 2: rValue.SetString(GetStreet()); break; case 3: rValue.SetString(GetCity()); break; case 4: rValue.SetString(GetCounty()); break; case 5: rValue.SetString(GetPostCode()); break; default: throw LtXmlLib20::CLtException(_T("Unknown Property Index")); }; } else { switch(iPropertyIndex) { case 1: SetName(rValue.GetString()); break; case 2: SetStreet(rValue.GetString()); break; case 3: SetCity(rValue.GetString()); break; case 4: SetCounty(rValue.GetString()); break; case 5: SetPostCode(rValue.GetString()); break; default: throw LtXmlLib20::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 _T(""). */ std::tstring CGBR_Address::GetName() const { return this->m_Name; } void CGBR_Address::SetName(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); this->m_Name = 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. * It is defaulted to _T(""). */ std::tstring CGBR_Address::GetStreet() const { return this->m_Street; } void CGBR_Address::SetStreet(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); this->m_Street = 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. * It is defaulted to _T(""). */ std::tstring CGBR_Address::GetCity() const { return this->m_City; } void CGBR_Address::SetCity(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); this->m_City = 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. * It is defaulted to _T(""). */ std::tstring CGBR_Address::GetCounty() const { return this->m_County; } void CGBR_Address::SetCounty(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); this->m_County = 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. * It is defaulted to _T(""). */ std::tstring CGBR_Address::GetPostCode() const { return this->m_PostCode; } void CGBR_Address::SetPostCode(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); this->m_PostCode = value; } /* * Allows the class to be copied * Performs a 'deep copy' of all the data in the class (and its children) */ DerivedByExtensionLib::IAddressPtr CGBR_Address::Clone() const { DerivedByExtensionLib::CGBR_AddressPtr newObject = CreateInstance(m_elementName.c_str()); int index = 0; newObject->m_Name = m_Name; newObject->m_Street = m_Street; newObject->m_City = m_City; newObject->m_County = m_County; newObject->m_PostCode = m_PostCode; // ##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 CGBR_Address::GetTargetNamespace() const { return _T(""); } std::tstring CGBR_Address::GetNamespace() const { return _T(""); } LtXmlLib20::CXmlObjectBase* CGBR_Address::GetBase() { return this; } void CGBR_Address::CleanMetaData() { LtXmlLib20::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo); } LtXmlLib20Data::CParentElementInfo* CGBR_Address::GetClassInfo() const { if (ms_pParentElementInfo == NULL) { m_csInit.Enter(); if (ms_pParentElementInfo == NULL) { ms_pParentElementInfo = new LtXmlLib20Data::CParentElementInfo( LtXmlLib20Data::XmlElementGroupType_SEQUENCE, LtXmlLib20Data::XmlElementType_ELEMENT, _T("GBR_Address"), _T(""), true, true, -1, LtXmlLib20::ItemType_none, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_None, NULL, false); } m_csInit.Leave(); } return ms_pParentElementInfo; } LtXmlLib20Data::CElementInfo** CGBR_Address::GetClassElementInfo() const { if (ms_ppElementInfo == NULL) { m_csInit.Enter(); if (ms_ppElementInfo == NULL) { ms_ppElementInfo = new LtXmlLib20Data::CElementInfo*[6]; ms_ppElementInfo[0] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("Name"), _T(""), 1, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[1] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("Street"), _T(""), 2, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[2] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("City"), _T(""), 3, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[3] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("County"), _T(""), 4, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[4] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("PostCode"), _T(""), 5, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[5] = NULL; } m_csInit.Leave(); } return ms_ppElementInfo; } LtXmlLib20Data::CAttributeInfo** CGBR_Address::GetClassAttributeInfo() const { if (ms_ppAttributeInfo == NULL) { m_csInit.Enter(); if (ms_ppAttributeInfo == NULL) { ms_ppAttributeInfo = new LtXmlLib20Data::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 |
GBR_Address.h |
/********************************************************************************************** * Copyright (c) 2001-2023 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 **********************************************************************************************/ #ifndef _DerivedByExtensionLib_DerivedByExtensionLib_CGBR_Address_h #define _DerivedByExtensionLib_DerivedByExtensionLib_CGBR_Address_h // Include Base classes #include "../DerivedByExtensionLib/IAddress.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 // Forward declarations - done like this to keep the intellisense happy namespace DerivedByExtensionLib { class CClassFactory; }; namespace DerivedByExtensionLib { /* * CGBR_Address * * This class wraps the element GBR_Address in the schema */ class DerivedByExtensionLib_DLL CGBR_Address : public CInstanceMonitor , public virtual DerivedByExtensionLib::CXmlCommonBase , public virtual DerivedByExtensionLib::IAddress // ##HAND_CODED_BLOCK_START ID="Additional Base Classes"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS // Add Additional base classes here... // ##HAND_CODED_BLOCK_END ID="Additional Base Classes"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS { public: static DerivedByExtensionLib::CGBR_AddressPtr CreateInstance(LPCTSTR lpctElementName=_T("GBR_Address")); protected: CGBR_Address(LPCTSTR lpctElementName=_T("GBR_Address")); virtual ~CGBR_Address(); friend class DerivedByExtensionLib::CClassFactory; virtual void Init(); virtual void AccessProperty(int iPropertyIndex, bool read, LtXmlLib20::LtVariant& rValue); virtual LtXmlLib20Data::CParentElementInfo* GetClassInfo() const; virtual LtXmlLib20Data::CElementInfo** GetClassElementInfo() const; virtual LtXmlLib20Data::CAttributeInfo** GetClassAttributeInfo() const; static void CleanMetaData(); void Cleanup(); virtual void OnEvent(LtXmlLib20::CXmlObjectBase* pMsgSource, LtXmlLib20::IEventSink::MsgType eMsgType, void* pData); public: std::tstring GetName() const; void SetName(std::tstring val); protected: std::tstring m_Name; public: std::tstring GetStreet() const; void SetStreet(std::tstring val); protected: std::tstring m_Street; public: std::tstring GetCity() const; void SetCity(std::tstring val); protected: std::tstring m_City; public: std::tstring GetCounty() const; void SetCounty(std::tstring val); protected: std::tstring m_County; public: std::tstring GetPostCode() const; void SetPostCode(std::tstring val); protected: std::tstring m_PostCode; public: // Performs a 'deep copy' of all the data in the class (and its children) virtual DerivedByExtensionLib::IAddressPtr Clone() const; virtual std::tstring GetTargetNamespace() const; virtual std::tstring GetNamespace() const; virtual LtXmlLib20::CXmlObjectBase* GetBase(); // Internal data for XML serialization private: static LtXmlLib20Data::CParentElementInfo* ms_pParentElementInfo; static LtXmlLib20Data::CElementInfo** ms_ppElementInfo; static LtXmlLib20Data::CAttributeInfo** 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 }; }; // end namespace (DerivedByExtensionLib) #endif // _DerivedByExtensionLib_CGBR_Address_h |
Person.cpp |
/********************************************************************************************** * Copyright (c) 2001-2023 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 { LtXmlLib20Data::CParentElementInfo* CPerson::ms_pParentElementInfo = NULL; LtXmlLib20Data::CAttributeInfo** CPerson::ms_ppAttributeInfo = NULL; LtXmlLib20Data::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(LtXmlLib20::CXmlObjectBase* pMsgSource, LtXmlLib20::IEventSink::MsgType eMsgType, void* pData) { if (eMsgType == LtXmlLib20::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, LtXmlLib20::LtVariant& rValue) { if (bRead) { switch(iPropertyIndex) { case 1: rValue.SetUI1(GetAge()); break; case 2: rValue.SetXmlObject(GetHomeAddress().Ptr()); break; default: throw LtXmlLib20::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 LtXmlLib20::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(""); } LtXmlLib20::CXmlObjectBase* CPerson::GetBase() { return this; } void CPerson::CleanMetaData() { LtXmlLib20::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo); } LtXmlLib20Data::CParentElementInfo* CPerson::GetClassInfo() const { if (ms_pParentElementInfo == NULL) { m_csInit.Enter(); if (ms_pParentElementInfo == NULL) { ms_pParentElementInfo = new LtXmlLib20Data::CParentElementInfo( LtXmlLib20Data::XmlElementGroupType_SEQUENCE, LtXmlLib20Data::XmlElementType_ELEMENT, _T("Person"), _T(""), true, false, -1, LtXmlLib20::ItemType_none, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_None, NULL, false); } m_csInit.Leave(); } return ms_pParentElementInfo; } LtXmlLib20Data::CElementInfo** CPerson::GetClassElementInfo() const { if (ms_ppElementInfo == NULL) { m_csInit.Enter(); if (ms_ppElementInfo == NULL) { ms_ppElementInfo = new LtXmlLib20Data::CElementInfo*[3]; ms_ppElementInfo[0] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("Age"), _T(""), 1, false, LtXmlLib20::ItemType_ui1, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Collapse, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[1] = new LtXmlLib20Data::CElementInfoSeqAbsClsMnd(_T("HomeAddress"), _T(""), 2, LtXmlLib20Data::XmlElementType_ELEMENT, DerivedByExtensionLib::CClassFactory::IAddressCreateObject); ms_ppElementInfo[2] = NULL; } m_csInit.Leave(); } return ms_ppElementInfo; } LtXmlLib20Data::CAttributeInfo** CPerson::GetClassAttributeInfo() const { if (ms_ppAttributeInfo == NULL) { m_csInit.Enter(); if (ms_ppAttributeInfo == NULL) { ms_ppAttributeInfo = new LtXmlLib20Data::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 |
Person.h |
/********************************************************************************************** * Copyright (c) 2001-2023 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 **********************************************************************************************/ #ifndef _DerivedByExtensionLib_DerivedByExtensionLib_CPerson_h #define _DerivedByExtensionLib_DerivedByExtensionLib_CPerson_h // Include Base classes #include "../DerivedByExtensionLib/IAddress.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 // Forward declarations - done like this to keep the intellisense happy namespace DerivedByExtensionLib { class CClassFactory; }; namespace DerivedByExtensionLib { /* * CPerson * * This class wraps the element Person in the schema */ class DerivedByExtensionLib_DLL CPerson : public CInstanceMonitor , public virtual DerivedByExtensionLib::CXmlCommonBase // ##HAND_CODED_BLOCK_START ID="Additional Base Classes"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS // Add Additional base classes here... // ##HAND_CODED_BLOCK_END ID="Additional Base Classes"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS { public: static DerivedByExtensionLib::CPersonPtr CreateInstance(LPCTSTR lpctElementName=_T("Person")); protected: CPerson(LPCTSTR lpctElementName=_T("Person")); virtual ~CPerson(); friend class DerivedByExtensionLib::CClassFactory; virtual void Init(); virtual void AccessProperty(int iPropertyIndex, bool read, LtXmlLib20::LtVariant& rValue); virtual LtXmlLib20Data::CParentElementInfo* GetClassInfo() const; virtual LtXmlLib20Data::CElementInfo** GetClassElementInfo() const; virtual LtXmlLib20Data::CAttributeInfo** GetClassAttributeInfo() const; static void CleanMetaData(); void Cleanup(); virtual void OnEvent(LtXmlLib20::CXmlObjectBase* pMsgSource, LtXmlLib20::IEventSink::MsgType eMsgType, void* pData); public: BYTE GetAge() const; void SetAge(BYTE val); protected: BYTE m_Age; public: DerivedByExtensionLib::IAddressPtr GetHomeAddress() const; void SetHomeAddress(DerivedByExtensionLib::IAddress* value); protected: DerivedByExtensionLib::IAddressPtr m_HomeAddress; public: // Performs a 'deep copy' of all the data in the class (and its children) virtual DerivedByExtensionLib::CPersonPtr Clone() const; virtual std::tstring GetTargetNamespace() const; virtual std::tstring GetNamespace() const; virtual LtXmlLib20::CXmlObjectBase* GetBase(); // Internal data for XML serialization private: static LtXmlLib20Data::CParentElementInfo* ms_pParentElementInfo; static LtXmlLib20Data::CElementInfo** ms_ppElementInfo; static LtXmlLib20Data::CAttributeInfo** 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 }; }; // end namespace (DerivedByExtensionLib) #endif // _DerivedByExtensionLib_CPerson_h |
IAddress.h |
/********************************************************************************************** * Copyright (c) 2001-2023 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 **********************************************************************************************/ #ifndef _DerivedByExtensionLib_DerivedByExtensionLib_IAddress_h #define _DerivedByExtensionLib_DerivedByExtensionLib_IAddress_h // Include Base classes // ##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 namespace DerivedByExtensionLib { /* * IAddress * * This class wraps the element IAddress in the schema */ class DerivedByExtensionLib_DLL IAddress : public virtual DerivedByExtensionLib::CXmlCommonBase // ##HAND_CODED_BLOCK_START ID="Additional Base Classes"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS // Add Additional base classes here... // ##HAND_CODED_BLOCK_END ID="Additional Base Classes"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS { public: virtual DerivedByExtensionLib::IAddressPtr Clone() const = 0; virtual std::tstring GetName() const = 0; virtual void SetName(std::tstring val) = 0; virtual std::tstring GetStreet() const = 0; virtual void SetStreet(std::tstring val) = 0; virtual std::tstring GetCity() const = 0; virtual void SetCity(std::tstring val) = 0; // ##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 }; }; // end namespace (DerivedByExtensionLib) #endif // _DerivedByExtensionLib_IAddress_h |
Main Menu | Samples List |