C++ Sample : Simple Hierarchy
| Schema Summary This sample shows a number of elements within a Hierarchy. It includes local (anonymous) & global complex types. It also shows how collections are manipulated within sequences & choices. Schema Details This schema contains 2 globally defined elements AddressType, ItemType and Invoice. All of these objects can be used as the documentElement (root element) in a valid XML document. The Invoice object also contains a sequence, the sequence contains a number of child elements; InvoiceNo is a primitive DeliveryAddress is a element that conforms to the global element AddressType. BillingAddress is an optional (the corresponding property on the Invoice object may contain a null because of this) element that conforms to the global element AddressType. Item is a collection of elements conforming to the global element ItemType. Payment is a locally defined element, it in turn contains a choice of; an element 'VISA' or a collection of 'Vouchers' elements or an element 'Cash' which is untyped within the schema, and represented as a string within the generated code. Sample Description The sample demonstrates how to navigate a simple Hierarchy of elements, including optional elements, choices, and collections. The sample shows the Invoice as the root element, it contains the optional element BillingAddress. It also contains 2 Item elements, showing how collections of elements can be manipulated. The Payment element contains a VISA element, this can be determined by checking the value of invoice->GetPayment()->GetChoiceSelectedElement(), this will determine which of the 3 possible elements are selected. |
Sample XML File
<?xml version="1.0" encoding="UTF-8"?>
<Invoice xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="..\Schema\SimpleHierarchy.xsd">
<InvoiceNo>564</InvoiceNo>
<DeliveryAddress>
<Forename>Joe</Forename>
<Surname>Bloggs</Surname>
<AddresLine1>23 Summers lane</AddresLine1>
<AddresLine2>Wintersville</AddresLine2>
<AddresLine5>Stoke</AddresLine5>
<PostCode>SK4 8LS</PostCode>
</DeliveryAddress>
<BillingAddress>
<Forename>Jane</Forename>
<Surname>Doe</Surname>
<AddresLine1>Acme Account</AddresLine1>
<AddresLine2>Acme House</AddresLine2>
<AddresLine3>523 Hogarth Lane</AddresLine3>
<AddresLine5>Collegeville</AddresLine5>
<PostCode>CL5 4UT</PostCode>
</BillingAddress>
<Item>
<StockCode>6896</StockCode>
<Description>A4 Paper (white)</Description>
<UnitCost>495</UnitCost>
<Quantity>15</Quantity>
</Item>
<Item>
<StockCode>5161</StockCode>
<Description>Paper Clips (Large)</Description>
<UnitCost>54</UnitCost>
<Quantity>10</Quantity>
</Item>
<Payment>
<VISA CardNo="4565589655425468" Expiry="2005-06"/>
</Payment>
</Invoice>
|
#include "..\..\..\Samples\SimpleHierarchy\Generated\CPP\SourceCodeCPP\SimpleHierarchyLib.h" #include "..\..\..\Samples\SimpleHierarchy\Generated\CPP\SourceCodeCPP\SimpleHierarchyLib\Invoice.h"
char lpCnvBuf[64];
std::string FilePath = SAMPLE_PATH + "SimpleHierarchy\\Samples\\Sample1.xml";
// Create DVD object
SimpleHierarchyLib::CInvoicePtr invoice = SimpleHierarchyLib::CInvoice::CreateInstance();
// Load data into the object from a file
invoice->FromXmlFile(FilePath.c_str());
// We can now look at the data
printf("Invoice No = %d\n", invoice->GetInvoiceNo());
// look at the billing address
// The billing address is optional, so we need to check it has been provided
if (invoice->GetBillingAddress() != NULL)
{
printf("Billing Addresss\n");
printf(" Forename = %s\n", invoice->GetBillingAddress()->GetForename().c_str());
printf(" Surname = %s\n", invoice->GetBillingAddress()->GetSurname().c_str());
printf(" Address Line 1 = %s\n", invoice->GetBillingAddress()->GetAddresLine1().c_str());
printf(" Address Line 2 = %s\n", invoice->GetBillingAddress()->GetAddresLine2().c_str());
// AddresLine3 & AddresLine4 are optional, so check they are valid before using them
if (invoice->GetBillingAddress()->IsValidAddresLine3())
printf(" Address Line 3 = %s\n", invoice->GetBillingAddress()->GetAddresLine3().c_str());
if (invoice->GetBillingAddress()->IsValidAddresLine4())
printf(" Address Line 4 = %s\n", invoice->GetBillingAddress()->GetAddresLine4().c_str());
printf(" Address Line 5 = %s\n", invoice->GetBillingAddress()->GetAddresLine5().c_str());
printf(" Postcode = %s\n", invoice->GetBillingAddress()->GetPostCode().c_str());
}
// look at the Shipping address
printf("Billing Addresss\n");
printf(" Forename = %s\n", invoice->GetDeliveryAddress()->GetForename().c_str());
printf(" Surname = %s\n", invoice->GetDeliveryAddress()->GetSurname().c_str());
printf(" Address Line 1 = %s\n", invoice->GetDeliveryAddress()->GetAddresLine1().c_str());
printf(" Address Line 2 = %s\n", invoice->GetDeliveryAddress()->GetAddresLine2().c_str());
// AddresLine3 & AddresLine4 are optional, so check they are valid before using them
if (invoice->GetDeliveryAddress()->IsValidAddresLine3())
printf(" Address Line 3 = %s\n", invoice->GetDeliveryAddress()->GetAddresLine3().c_str());
if (invoice->GetDeliveryAddress()->IsValidAddresLine4())
printf(" Address Line 4 = %s\n", invoice->GetDeliveryAddress()->GetAddresLine4().c_str());
printf(" Address Line 5 = %s\n", invoice->GetDeliveryAddress()->GetAddresLine5().c_str());
printf(" Postcode = %s\n", invoice->GetDeliveryAddress()->GetPostCode().c_str());
// look at all the items in the invoice
printf("There are %d items in the order\n", invoice->GetItem()->GetCount());
// Collections of objects work the same ways as stl.
for (SimpleHierarchyLib::CItemTypeCol::iterator itr = invoice->GetItem()->begin();
itr != invoice->GetItem()->end();
itr++)
{
SimpleHierarchyLib::CItemTypePtr itm = *itr;
printf("Item\n");
// Note we have to use _ui64toa to convert the DWORDLONG to a string as printf can't
// cope directly with the DWORDLONG datatype
printf(" StockCode = %s\n", _ui64toa(itm->GetStockCode(), lpCnvBuf, 10));
printf(" Description = %s\n", itm->GetDescription().c_str());
printf(" UnitCost = %s\n", _i64toa(itm->GetUnitCost(), lpCnvBuf, 10));
printf(" Quantity = %d\n", itm->GetQuantity());
}
// now look at the Payment method, this is a choice in the schema,
// so only one option is posible
if (invoice->GetPayment()->GetChoiceSelectedElement() == "Cash")
{
printf("The invoice was paid in Cash\n");
}
else if (invoice->GetPayment()->GetChoiceSelectedElement() == "VISA")
{
printf("The invoice was paid with a VISA Card\n");
printf(" Card Number = %s\n", invoice->GetPayment()->GetVISA()->GetCardNo().c_str());
printf(" Card Expiry = %s\n", invoice->GetPayment()->GetVISA()->GetExpiry().ToString().c_str());
}
else if (invoice->GetPayment()->GetChoiceSelectedElement() == "Vouchers")
{
printf("The invoice was paid with Vouchers\n");
for (SimpleHierarchyLib::CVouchersCol::iterator itr = invoice->GetPayment()->GetVouchers()->begin();
itr != invoice->GetPayment()->GetVouchers()->begin();
itr++)
{
SimpleHierarchyLib::CVouchersPtr v = *itr;
printf("Voucher\n");
printf(" Number = %s\n", _ui64toa(v->GetVoucherNo(), lpCnvBuf, 10));
printf(" Value = %s\n", _ui64toa(v->GetVoucherValue(), lpCnvBuf, 10));
}
}
else
{
printf("Unknown selected element %s\n", invoice->GetPayment()->GetChoiceSelectedElement().c_str());
}
|
#include "..\..\..\Samples\SimpleHierarchy\Generated\CPP\SourceCodeCPP\SimpleHierarchyLib.h" #include "..\..\..\Samples\SimpleHierarchy\Generated\CPP\SourceCodeCPP\SimpleHierarchyLib\Invoice.h"
// Create Invoice object
SimpleHierarchyLib::CInvoicePtr invoice = SimpleHierarchyLib::CInvoice::CreateInstance();
// We can now set some data into the object model
invoice->SetInvoiceNo(564);
// because the BillingAddress is optional, we need to populate
// this property before using it->Get
invoice->SetBillingAddress(SimpleHierarchyLib::CAddressType::CreateInstance());
invoice->GetBillingAddress()->SetForename ("Joe");
invoice->GetBillingAddress()->SetSurname ("Bloggs");
invoice->GetBillingAddress()->SetAddresLine1 ("23 Summers lane");
invoice->GetBillingAddress()->SetAddresLine2 ("Wintersville");
invoice->GetBillingAddress()->SetAddresLine5 ("Stoke");
invoice->GetBillingAddress()->SetPostCode ("SK4 8LS");
invoice->SetDeliveryAddress(SimpleHierarchyLib::CAddressType::CreateInstance());
invoice->GetDeliveryAddress()->SetForename ("Jane");
invoice->GetDeliveryAddress()->SetSurname ("Doe");
invoice->GetDeliveryAddress()->SetAddresLine1 ("Acme Account");
invoice->GetDeliveryAddress()->SetAddresLine2 ("Acme House");
// This is an optional field, setting it makes it appear in the output xml
invoice->GetDeliveryAddress()->SetAddresLine3 ("523 Hogarth Lane");
invoice->GetDeliveryAddress()->SetAddresLine5 ("Collegeville");
invoice->GetDeliveryAddress()->SetPostCode ("CL5 4UT");
// We will add 2 items of the collection we will add each one
// in a different ways, for demonstration purposes->Get
// Ask the collection to add an item->Get This creates a new item
// and adds it to the collection in one step->Get The new object is returned->Get
SimpleHierarchyLib::CItemTypePtr itm1 = invoice->GetItem()->Add();
itm1->SetStockCode (6896);
itm1->SetDescription ("A4 Paper (white)");
itm1->SetUnitCost (495);
itm1->SetQuantity (15);
// Create an new item and add it to the collection
SimpleHierarchyLib::CItemTypePtr itm2 = SimpleHierarchyLib::CItemType::CreateInstance();
invoice->GetItem()->Add(itm2);
itm2->SetStockCode (5161);
itm2->SetDescription ("Paper Clips (Large)");
itm2->SetUnitCost (54);
itm2->SetQuantity (10);
invoice->GetPayment()->SetVISA(SimpleHierarchyLib::CVISA::CreateInstance());
invoice->GetPayment()->GetVISA()->SetCardNo("4565589655425468");
invoice->GetPayment()->GetVISA()->GetExpiry().SetGYearMonth(2005, 6);
// We can now look at the XML from this object
printf(invoice->ToXml().c_str());
|
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="AddressType">
<xs:sequence>
<xs:element name="Forename" type="xs:string"/>
<xs:element name="Surname" type="xs:string"/>
<xs:element name="AddresLine1" type="xs:string"/>
<xs:element name="AddresLine2" type="xs:string"/>
<xs:element name="AddresLine3" type="xs:string" minOccurs="0"/>
<xs:element name="AddresLine4" type="xs:string" minOccurs="0"/>
<xs:element name="AddresLine5" type="xs:string"/>
<xs:element name="PostCode" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ItemType">
<xs:sequence>
<xs:element name="StockCode" type="xs:unsignedLong"/>
<xs:element name="Description" type="xs:string"/>
<xs:element name="UnitCost" type="xs:long"/>
<xs:element name="Quantity" type="xs:unsignedInt"/>
</xs:sequence>
</xs:complexType>
<xs:element name="Invoice">
<xs:complexType>
<xs:sequence>
<xs:element name="InvoiceNo" type="xs:unsignedInt"/>
<xs:element name="DeliveryAddress" type="AddressType"/>
<xs:element name="BillingAddress" type="AddressType" minOccurs="0"/>
<xs:element name="Item" type="ItemType" maxOccurs="unbounded"/>
<xs:element name="Payment">
<xs:complexType>
<xs:choice>
<xs:element name="VISA">
<xs:complexType>
<xs:attribute name="CardNo" type="xs:string" use="required"/>
<xs:attribute name="Expiry" type="xs:gYearMonth" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="Vouchers" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="VoucherNo" type="xs:unsignedLong" use="required"/>
<xs:attribute name="VoucherValue" type="xs:unsignedLong" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="Cash"/>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
|
![]() |
/**********************************************************************************************
* 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: SimpleHierarchy.xsd
**********************************************************************************************/
#include "StdAfx.h"
#pragma warning (push)
#pragma warning (disable:4251) // template export warning
#pragma warning (disable:4786) // long debug names
#include "../SimpleHierarchyLib.h"
#include "../SimpleHierarchyLib/AddressType.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 : AddressType
// Long Name : AddressType
// Element Name : AddressType
// Class Namespace : SimpleHierarchyLib
// Namespace Alias :
// Schema Namespace :
// Mapped Class Name : CAddressType
// Mapped Class Full Name : SimpleHierarchyLib::CAddressType
// Mapped Class File Name : CAddressType
// IsAbstract : False
// IsElement : True
// IsComplexType : True
namespace SimpleHierarchyLib
{
LtXmlLib21Data::CParentElementInfo* CAddressType::ms_pParentElementInfo = NULL;
LtXmlLib21Data::CAttributeInfo** CAddressType::ms_ppAttributeInfo = NULL;
LtXmlLib21Data::CElementInfo** CAddressType::ms_ppElementInfo = NULL;
CAddressTypePtr CAddressType::CreateInstance(LPCTSTR lpctElementName/*=_T("AddressType")*/)
{
return new SimpleHierarchyLib::CAddressType(lpctElementName);
}
/*
* Constructor for CAddressType
*
* 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 SimpleHierarchy.xsd
*/
CAddressType::CAddressType(LPCTSTR lpctElementName/*=_T("AddressType")*/)
: CInstanceMonitor(_T("CAddressType"))
{
m_elementName = lpctElementName;
Init();
}
CAddressType::~CAddressType()
{
Cleanup();
}
void CAddressType::Cleanup()
{
// unregister for any events we have asked for
// cos there'll be no one left to hear soon
}
void CAddressType::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 SimpleHierarchy.xsd.
*/
void CAddressType::Init()
{
Cleanup();
this->m_Forename = _T("");
this->m_Surname = _T("");
this->m_AddresLine1 = _T("");
this->m_AddresLine2 = _T("");
this->m_AddresLine3 = _T("");
this->m_IsValidAddresLine3 = false;
this->m_AddresLine4 = _T("");
this->m_IsValidAddresLine4 = false;
this->m_AddresLine5 = _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 CAddressType::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib21::LtVariant& rValue)
{
if (bRead)
{
switch(iPropertyIndex)
{
case 1:
rValue.SetString(GetForename());
break;
case 2:
rValue.SetString(GetSurname());
break;
case 3:
rValue.SetString(GetAddresLine1());
break;
case 4:
rValue.SetString(GetAddresLine2());
break;
case 5:
if (IsValidAddresLine3())
rValue.SetString(GetAddresLine3());
else
rValue.SetInvalid();
break;
case 6:
if (IsValidAddresLine4())
rValue.SetString(GetAddresLine4());
else
rValue.SetInvalid();
break;
case 7:
rValue.SetString(GetAddresLine5());
break;
case 8:
rValue.SetString(GetPostCode());
break;
default:
throw LtXmlLib21::CLtException(_T("Unknown Property Index"));
};
}
else
{
switch(iPropertyIndex)
{
case 1:
SetForename(rValue.GetString());
break;
case 2:
SetSurname(rValue.GetString());
break;
case 3:
SetAddresLine1(rValue.GetString());
break;
case 4:
SetAddresLine2(rValue.GetString());
break;
case 5:
if (rValue.IsValid())
SetAddresLine3(rValue.GetString());
else
SetValidAddresLine3(false);
break;
case 6:
if (rValue.IsValid())
SetAddresLine4(rValue.GetString());
else
SetValidAddresLine4(false);
break;
case 7:
SetAddresLine5(rValue.GetString());
break;
case 8:
SetPostCode(rValue.GetString());
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 _T("").
*/
std::tstring CAddressType::GetForename() const
{
return this->m_Forename;
}
void CAddressType::SetForename(std::tstring value)
{
// Apply whitespace rules appropriately
value = LtXmlLib21::CWhitespaceUtils::Preserve(value);
this->m_Forename = 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 CAddressType::GetSurname() const
{
return this->m_Surname;
}
void CAddressType::SetSurname(std::tstring value)
{
// Apply whitespace rules appropriately
value = LtXmlLib21::CWhitespaceUtils::Preserve(value);
this->m_Surname = 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 CAddressType::GetAddresLine1() const
{
return this->m_AddresLine1;
}
void CAddressType::SetAddresLine1(std::tstring value)
{
// Apply whitespace rules appropriately
value = LtXmlLib21::CWhitespaceUtils::Preserve(value);
this->m_AddresLine1 = 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 CAddressType::GetAddresLine2() const
{
return this->m_AddresLine2;
}
void CAddressType::SetAddresLine2(std::tstring value)
{
// Apply whitespace rules appropriately
value = LtXmlLib21::CWhitespaceUtils::Preserve(value);
this->m_AddresLine2 = value;
}
/*
* Represents an optional Element in the XML document
*
*
* This property is represented as an Element in the XML.
* It is optional, initially it is not valid.
*/
std::tstring CAddressType::GetAddresLine3() const
{
if (m_IsValidAddresLine3 == false)
throw LtXmlLib21::CLtInvalidStateException(_T("The Property GetAddresLine3 is not valid. SetAddresLine3 must be called first"));
return this->m_AddresLine3;
}
void CAddressType::SetAddresLine3(std::tstring value)
{
// Apply whitespace rules appropriately
value = LtXmlLib21::CWhitespaceUtils::Preserve(value);
this->m_IsValidAddresLine3 = true;
this->m_AddresLine3 = value;
}
/*
* Indicates if GetAddresLine3 contains a valid value.
*
* true if the value for GetAddresLine3 is valid, false if not.
* If this is set to true then the property is considered valid, and assigned its
* default value (_T("")).
* If its set to false then its made invalid, and subsequent calls to GetAddresLine3
* will raise an exception.
*/
bool CAddressType::IsValidAddresLine3() const
{
return m_IsValidAddresLine3;
}
void CAddressType::SetValidAddresLine3(bool value)
{
if (value != m_IsValidAddresLine3)
{
this->m_AddresLine3 = _T("");
m_IsValidAddresLine3 = value;
}
}
/*
* Represents an optional Element in the XML document
*
*
* This property is represented as an Element in the XML.
* It is optional, initially it is not valid.
*/
std::tstring CAddressType::GetAddresLine4() const
{
if (m_IsValidAddresLine4 == false)
throw LtXmlLib21::CLtInvalidStateException(_T("The Property GetAddresLine4 is not valid. SetAddresLine4 must be called first"));
return this->m_AddresLine4;
}
void CAddressType::SetAddresLine4(std::tstring value)
{
// Apply whitespace rules appropriately
value = LtXmlLib21::CWhitespaceUtils::Preserve(value);
this->m_IsValidAddresLine4 = true;
this->m_AddresLine4 = value;
}
/*
* Indicates if GetAddresLine4 contains a valid value.
*
* true if the value for GetAddresLine4 is valid, false if not.
* If this is set to true then the property is considered valid, and assigned its
* default value (_T("")).
* If its set to false then its made invalid, and subsequent calls to GetAddresLine4
* will raise an exception.
*/
bool CAddressType::IsValidAddresLine4() const
{
return m_IsValidAddresLine4;
}
void CAddressType::SetValidAddresLine4(bool value)
{
if (value != m_IsValidAddresLine4)
{
this->m_AddresLine4 = _T("");
m_IsValidAddresLine4 = 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 CAddressType::GetAddresLine5() const
{
return this->m_AddresLine5;
}
void CAddressType::SetAddresLine5(std::tstring value)
{
// Apply whitespace rules appropriately
value = LtXmlLib21::CWhitespaceUtils::Preserve(value);
this->m_AddresLine5 = 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 CAddressType::GetPostCode() const
{
return this->m_PostCode;
}
void CAddressType::SetPostCode(std::tstring value)
{
// Apply whitespace rules appropriately
value = LtXmlLib21::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)
*/
SimpleHierarchyLib::CAddressTypePtr CAddressType::Clone() const
{
SimpleHierarchyLib::CAddressTypePtr newObject = CreateInstance(m_elementName.c_str());
int index = 0;
newObject->m_Forename = m_Forename;
newObject->m_Surname = m_Surname;
newObject->m_AddresLine1 = m_AddresLine1;
newObject->m_AddresLine2 = m_AddresLine2;
newObject->m_AddresLine3 = m_AddresLine3;
newObject->m_IsValidAddresLine3 = m_IsValidAddresLine3;
newObject->m_AddresLine4 = m_AddresLine4;
newObject->m_IsValidAddresLine4 = m_IsValidAddresLine4;
newObject->m_AddresLine5 = m_AddresLine5;
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 CAddressType::GetTargetNamespace() const
{
return _T("");
}
std::tstring CAddressType::GetNamespace() const
{
return _T("");
}
LtXmlLib21::CXmlObjectBase* CAddressType::GetBase()
{
return this;
}
void CAddressType::CleanMetaData()
{
LtXmlLib21::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo);
}
LtXmlLib21Data::CParentElementInfo* CAddressType::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("AddressType"),
_T(""),
true,
false,
-1,
LtXmlLib21::ItemType_none,
LtXmlLib21::CWhitespaceUtils::WhitespaceRule_None,
NULL,
false);
}
m_csInit.Leave();
}
return ms_pParentElementInfo;
}
LtXmlLib21Data::CElementInfo** CAddressType::GetClassElementInfo() const
{
if (ms_ppElementInfo == NULL)
{
m_csInit.Enter();
if (ms_ppElementInfo == NULL)
{
ms_ppElementInfo = new LtXmlLib21Data::CElementInfo*[9];
ms_ppElementInfo[0] = new LtXmlLib21Data::CElementInfoSeqPrimMnd(_T("Forename"), _T(""), 1, false, LtXmlLib21::ItemType_string, NULL, LtXmlLib21::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib21::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
ms_ppElementInfo[1] = new LtXmlLib21Data::CElementInfoSeqPrimMnd(_T("Surname"), _T(""), 2, false, LtXmlLib21::ItemType_string, NULL, LtXmlLib21::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib21::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
ms_ppElementInfo[2] = new LtXmlLib21Data::CElementInfoSeqPrimMnd(_T("AddresLine1"), _T(""), 3, false, LtXmlLib21::ItemType_string, NULL, LtXmlLib21::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib21::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
ms_ppElementInfo[3] = new LtXmlLib21Data::CElementInfoSeqPrimMnd(_T("AddresLine2"), _T(""), 4, false, LtXmlLib21::ItemType_string, NULL, LtXmlLib21::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib21::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
ms_ppElementInfo[4] = new LtXmlLib21Data::CElementInfoSeqPrimOpt(_T("AddresLine3"), _T(""), 5, false, LtXmlLib21::ItemType_string, NULL, LtXmlLib21::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib21::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
ms_ppElementInfo[5] = new LtXmlLib21Data::CElementInfoSeqPrimOpt(_T("AddresLine4"), _T(""), 6, false, LtXmlLib21::ItemType_string, NULL, LtXmlLib21::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib21::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
ms_ppElementInfo[6] = new LtXmlLib21Data::CElementInfoSeqPrimMnd(_T("AddresLine5"), _T(""), 7, false, LtXmlLib21::ItemType_string, NULL, LtXmlLib21::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib21::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
ms_ppElementInfo[7] = new LtXmlLib21Data::CElementInfoSeqPrimMnd(_T("PostCode"), _T(""), 8, false, LtXmlLib21::ItemType_string, NULL, LtXmlLib21::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib21::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
ms_ppElementInfo[8] = NULL;
}
m_csInit.Leave();
}
return ms_ppElementInfo;
}
LtXmlLib21Data::CAttributeInfo** CAddressType::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
|
/**********************************************************************************************
* 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: SimpleHierarchy.xsd
**********************************************************************************************/
#ifndef _SimpleHierarchyLib_SimpleHierarchyLib_CAddressType_h
#define _SimpleHierarchyLib_SimpleHierarchyLib_CAddressType_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
// Forward declarations - done like this to keep the intellisense happy
namespace SimpleHierarchyLib { class CClassFactory; };
namespace SimpleHierarchyLib
{
/*
* CAddressType
*
* This class wraps the element AddressType in the schema
*/
class SimpleHierarchyLib_DLL CAddressType : public CInstanceMonitor
, public virtual SimpleHierarchyLib::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 SimpleHierarchyLib::CAddressTypePtr CreateInstance(LPCTSTR lpctElementName=_T("AddressType"));
protected:
CAddressType(LPCTSTR lpctElementName=_T("AddressType"));
virtual ~CAddressType();
friend class SimpleHierarchyLib::CClassFactory;
virtual void Init();
virtual void AccessProperty(int iPropertyIndex, bool read, LtXmlLib21::LtVariant& rValue);
virtual LtXmlLib21Data::CParentElementInfo* GetClassInfo() const;
virtual LtXmlLib21Data::CElementInfo** GetClassElementInfo() const;
virtual LtXmlLib21Data::CAttributeInfo** GetClassAttributeInfo() const;
static void CleanMetaData();
void Cleanup();
virtual void OnEvent(LtXmlLib21::CXmlObjectBase* pMsgSource, LtXmlLib21::IEventSink::MsgType eMsgType, void* pData);
public:
std::tstring GetForename() const;
void SetForename(std::tstring val);
protected:
std::tstring m_Forename;
public:
std::tstring GetSurname() const;
void SetSurname(std::tstring val);
protected:
std::tstring m_Surname;
public:
std::tstring GetAddresLine1() const;
void SetAddresLine1(std::tstring val);
protected:
std::tstring m_AddresLine1;
public:
std::tstring GetAddresLine2() const;
void SetAddresLine2(std::tstring val);
protected:
std::tstring m_AddresLine2;
public:
std::tstring GetAddresLine3() const;
void SetAddresLine3(std::tstring val);
bool IsValidAddresLine3() const;
void SetValidAddresLine3(bool val);
protected:
bool m_IsValidAddresLine3;
std::tstring m_AddresLine3;
public:
std::tstring GetAddresLine4() const;
void SetAddresLine4(std::tstring val);
bool IsValidAddresLine4() const;
void SetValidAddresLine4(bool val);
protected:
bool m_IsValidAddresLine4;
std::tstring m_AddresLine4;
public:
std::tstring GetAddresLine5() const;
void SetAddresLine5(std::tstring val);
protected:
std::tstring m_AddresLine5;
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 SimpleHierarchyLib::CAddressTypePtr Clone() const;
virtual std::tstring GetTargetNamespace() const;
virtual std::tstring GetNamespace() const;
virtual LtXmlLib21::CXmlObjectBase* GetBase();
// Internal data for XML serialization
private:
static LtXmlLib21Data::CParentElementInfo* ms_pParentElementInfo;
static LtXmlLib21Data::CElementInfo** ms_ppElementInfo;
static LtXmlLib21Data::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 (SimpleHierarchyLib)
#endif // _SimpleHierarchyLib_CAddressType_h
|
/**********************************************************************************************
* 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: SimpleHierarchy.xsd
**********************************************************************************************/
#include "StdAfx.h"
#pragma warning (push)
#pragma warning (disable:4251) // template export warning
#pragma warning (disable:4786) // long debug names
#include "../SimpleHierarchyLib.h"
#include "../SimpleHierarchyLib/Invoice.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 : Invoice
// Long Name : Invoice
// Element Name : Invoice
// Class Namespace : SimpleHierarchyLib
// Namespace Alias :
// Schema Namespace :
// Mapped Class Name : CInvoice
// Mapped Class Full Name : SimpleHierarchyLib::CInvoice
// Mapped Class File Name : CInvoice
// IsAbstract : False
// IsElement : True
// IsComplexType : False
namespace SimpleHierarchyLib
{
LtXmlLib21Data::CParentElementInfo* CInvoice::ms_pParentElementInfo = NULL;
LtXmlLib21Data::CAttributeInfo** CInvoice::ms_ppAttributeInfo = NULL;
LtXmlLib21Data::CElementInfo** CInvoice::ms_ppElementInfo = NULL;
CInvoicePtr CInvoice::CreateInstance(LPCTSTR lpctElementName/*=_T("Invoice")*/)
{
return new SimpleHierarchyLib::CInvoice(lpctElementName);
}
/*
* Constructor for CInvoice
*
* 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 SimpleHierarchy.xsd
*/
CInvoice::CInvoice(LPCTSTR lpctElementName/*=_T("Invoice")*/)
: CInstanceMonitor(_T("CInvoice"))
{
m_elementName = lpctElementName;
Init();
}
CInvoice::~CInvoice()
{
Cleanup();
}
void CInvoice::Cleanup()
{
// unregister for any events we have asked for
// cos there'll be no one left to hear soon
this->m_Item = NULL;
}
void CInvoice::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 SimpleHierarchy.xsd.
*/
void CInvoice::Init()
{
Cleanup();
this->m_InvoiceNo = 0;
this->m_DeliveryAddress = dynamic_cast<SimpleHierarchyLib::CAddressType*>(SimpleHierarchyLib::CClassFactory::CreateClass(SimpleHierarchyLib::CClassFactory::ClsName_CAddressType, _T("DeliveryAddress")).Ptr());
this->m_BillingAddress = NULL;
this->m_Item = dynamic_cast<SimpleHierarchyLib::CItemTypeCol*>(SimpleHierarchyLib::CClassFactory::CreateClassCollection(SimpleHierarchyLib::CClassFactory::ClsName_CItemTypeCol, _T("Item"), _T(""), 1, -1).Ptr());
this->m_Payment = dynamic_cast<SimpleHierarchyLib::CPayment*>(SimpleHierarchyLib::CClassFactory::CreateClass(SimpleHierarchyLib::CClassFactory::ClsName_CPayment, _T("Payment")).Ptr());
// ##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 CInvoice::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib21::LtVariant& rValue)
{
if (bRead)
{
switch(iPropertyIndex)
{
case 1:
rValue.SetUI4(GetInvoiceNo());
break;
case 2:
rValue.SetXmlObject(GetDeliveryAddress().Ptr());
break;
case 3:
rValue.SetXmlObject(GetBillingAddress().Ptr());
break;
case 4:
rValue.SetXmlCollection(GetItem().Ptr());
break;
case 5:
rValue.SetXmlObject(GetPayment().Ptr());
break;
default:
throw LtXmlLib21::CLtException(_T("Unknown Property Index"));
};
}
else
{
switch(iPropertyIndex)
{
case 1:
SetInvoiceNo(rValue.GetUI4());
break;
case 2:
SetDeliveryAddress(dynamic_cast<SimpleHierarchyLib::CAddressType*>(rValue.GetXmlObject().Ptr()));
break;
case 3:
SetBillingAddress(dynamic_cast<SimpleHierarchyLib::CAddressType*>(rValue.GetXmlObject().Ptr()));
break;
case 4:
throw LtXmlLib21::CLtException(_T("Collections can not be set"));
break;
case 5:
SetPayment(dynamic_cast<SimpleHierarchyLib::CPayment*>(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.
*/
DWORD CInvoice::GetInvoiceNo() const
{
return this->m_InvoiceNo;
}
void CInvoice::SetInvoiceNo(DWORD value)
{
this->m_InvoiceNo = 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.
*/
SimpleHierarchyLib::CAddressTypePtr CInvoice::GetDeliveryAddress() const
{
return this->m_DeliveryAddress;
}
void CInvoice::SetDeliveryAddress(SimpleHierarchyLib::CAddressType* value)
{
Throw_IfPropertyIsNull(value, _T("DeliveryAddress"));
if (value != NULL)
SetElementName(value, _T("DeliveryAddress"));
this->m_DeliveryAddress = value;
}
/*
* Represents an optional Element in the XML document
*
*
* This property is represented as an Element in the XML.
* It is optional, initially it is NULL.
*/
SimpleHierarchyLib::CAddressTypePtr CInvoice::GetBillingAddress() const
{
return this->m_BillingAddress;
}
void CInvoice::SetBillingAddress(SimpleHierarchyLib::CAddressType* value)
{
if (value == NULL)
this->m_BillingAddress = NULL;
else
{
SetElementName(value, _T("BillingAddress"));
this->m_BillingAddress = value;
}
}
/*
* A collection of CInvoices
*
*
* This property is represented as an Element in the XML.
* This collection may contain 1 to Many objects.
*/
SimpleHierarchyLib::CItemTypeColPtr CInvoice::GetItem() const
{
return this->m_Item;
}
/*
* 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.
*/
SimpleHierarchyLib::CPaymentPtr CInvoice::GetPayment() const
{
return this->m_Payment;
}
void CInvoice::SetPayment(SimpleHierarchyLib::CPayment* value)
{
Throw_IfPropertyIsNull(value, _T("Payment"));
if (value != NULL)
SetElementName(value, _T("Payment"));
this->m_Payment = value;
}
/*
* Allows the class to be copied
* Performs a 'deep copy' of all the data in the class (and its children)
*/
SimpleHierarchyLib::CInvoicePtr CInvoice::Clone() const
{
SimpleHierarchyLib::CInvoicePtr newObject = CreateInstance(m_elementName.c_str());
int index = 0;
newObject->m_InvoiceNo = m_InvoiceNo;
newObject->m_DeliveryAddress = NULL;
if (m_DeliveryAddress != NULL)
newObject->m_DeliveryAddress = dynamic_cast<SimpleHierarchyLib::CAddressType*>(m_DeliveryAddress->Clone().Ptr());
newObject->m_BillingAddress = NULL;
if (m_BillingAddress != NULL)
newObject->m_BillingAddress = dynamic_cast<SimpleHierarchyLib::CAddressType*>(m_BillingAddress->Clone().Ptr());
for (index = 0; index < m_Item->GetCount(); index++)
newObject->m_Item->Add(dynamic_cast<SimpleHierarchyLib::CItemType*>(m_Item->Item(index)->Clone().Ptr()));
newObject->m_Payment = NULL;
if (m_Payment != NULL)
newObject->m_Payment = dynamic_cast<SimpleHierarchyLib::CPayment*>(m_Payment->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 CInvoice::GetTargetNamespace() const
{
return _T("");
}
std::tstring CInvoice::GetNamespace() const
{
return _T("");
}
LtXmlLib21::CXmlObjectBase* CInvoice::GetBase()
{
return this;
}
void CInvoice::CleanMetaData()
{
LtXmlLib21::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo);
}
LtXmlLib21Data::CParentElementInfo* CInvoice::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("Invoice"),
_T(""),
true,
false,
-1,
LtXmlLib21::ItemType_none,
LtXmlLib21::CWhitespaceUtils::WhitespaceRule_None,
NULL,
false);
}
m_csInit.Leave();
}
return ms_pParentElementInfo;
}
LtXmlLib21Data::CElementInfo** CInvoice::GetClassElementInfo() const
{
if (ms_ppElementInfo == NULL)
{
m_csInit.Enter();
if (ms_ppElementInfo == NULL)
{
ms_ppElementInfo = new LtXmlLib21Data::CElementInfo*[6];
ms_ppElementInfo[0] = new LtXmlLib21Data::CElementInfoSeqPrimMnd(_T("InvoiceNo"), _T(""), 1, false, LtXmlLib21::ItemType_ui4, NULL, LtXmlLib21::CWhitespaceUtils::WhitespaceRule_Collapse, LtXmlLib21::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
ms_ppElementInfo[1] = new LtXmlLib21Data::CElementInfoSeqClsMnd(_T("DeliveryAddress"), _T(""), 2, LtXmlLib21Data::XmlElementType_ELEMENT, (LtXmlLib21Data::pfnCreateClassDef)&SimpleHierarchyLib::CClassFactory::CreateClass, SimpleHierarchyLib::CClassFactory::ClsName_CAddressType, true);
ms_ppElementInfo[2] = new LtXmlLib21Data::CElementInfoSeqClsOpt(_T("BillingAddress"), _T(""), 3, LtXmlLib21Data::XmlElementType_ELEMENT, (LtXmlLib21Data::pfnCreateClassDef)&SimpleHierarchyLib::CClassFactory::CreateClass, SimpleHierarchyLib::CClassFactory::ClsName_CAddressType);
ms_ppElementInfo[3] = new LtXmlLib21Data::CElementInfoSeqClsCol(_T("Item"), _T(""), 4, LtXmlLib21Data::XmlElementType_ELEMENT);
ms_ppElementInfo[4] = new LtXmlLib21Data::CElementInfoSeqClsMnd(_T("Payment"), _T(""), 5, LtXmlLib21Data::XmlElementType_ELEMENT, (LtXmlLib21Data::pfnCreateClassDef)&SimpleHierarchyLib::CClassFactory::CreateClass, SimpleHierarchyLib::CClassFactory::ClsName_CPayment, true);
ms_ppElementInfo[5] = NULL;
}
m_csInit.Leave();
}
return ms_ppElementInfo;
}
LtXmlLib21Data::CAttributeInfo** CInvoice::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
|
/**********************************************************************************************
* 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: SimpleHierarchy.xsd
**********************************************************************************************/
#ifndef _SimpleHierarchyLib_SimpleHierarchyLib_CInvoice_h
#define _SimpleHierarchyLib_SimpleHierarchyLib_CInvoice_h
// Include Base classes
#include "../SimpleHierarchyLib/AddressType.h"
#include "../SimpleHierarchyLib/AddressType.h"
#include "../SimpleHierarchyLib/ItemTypeCol.h"
#include "../SimpleHierarchyLib/ItemType.h"
#include "../SimpleHierarchyLib/Payment.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 SimpleHierarchyLib { class CClassFactory; };
namespace SimpleHierarchyLib
{
/*
* CInvoice
*
* This class wraps the element Invoice in the schema
*/
class SimpleHierarchyLib_DLL CInvoice : public CInstanceMonitor
, public virtual SimpleHierarchyLib::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 SimpleHierarchyLib::CInvoicePtr CreateInstance(LPCTSTR lpctElementName=_T("Invoice"));
protected:
CInvoice(LPCTSTR lpctElementName=_T("Invoice"));
virtual ~CInvoice();
friend class SimpleHierarchyLib::CClassFactory;
virtual void Init();
virtual void AccessProperty(int iPropertyIndex, bool read, LtXmlLib21::LtVariant& rValue);
virtual LtXmlLib21Data::CParentElementInfo* GetClassInfo() const;
virtual LtXmlLib21Data::CElementInfo** GetClassElementInfo() const;
virtual LtXmlLib21Data::CAttributeInfo** GetClassAttributeInfo() const;
static void CleanMetaData();
void Cleanup();
virtual void OnEvent(LtXmlLib21::CXmlObjectBase* pMsgSource, LtXmlLib21::IEventSink::MsgType eMsgType, void* pData);
public:
DWORD GetInvoiceNo() const;
void SetInvoiceNo(DWORD val);
protected:
DWORD m_InvoiceNo;
public:
SimpleHierarchyLib::CAddressTypePtr GetDeliveryAddress() const;
void SetDeliveryAddress(SimpleHierarchyLib::CAddressType* value);
protected:
SimpleHierarchyLib::CAddressTypePtr m_DeliveryAddress;
public:
SimpleHierarchyLib::CAddressTypePtr GetBillingAddress() const;
void SetBillingAddress(SimpleHierarchyLib::CAddressType* value);
protected:
SimpleHierarchyLib::CAddressTypePtr m_BillingAddress;
public:
SimpleHierarchyLib::CItemTypeColPtr GetItem() const;
protected:
SimpleHierarchyLib::CItemTypeColPtr m_Item;
public:
SimpleHierarchyLib::CPaymentPtr GetPayment() const;
void SetPayment(SimpleHierarchyLib::CPayment* value);
protected:
SimpleHierarchyLib::CPaymentPtr m_Payment;
public:
// Performs a 'deep copy' of all the data in the class (and its children)
virtual SimpleHierarchyLib::CInvoicePtr Clone() const;
virtual std::tstring GetTargetNamespace() const;
virtual std::tstring GetNamespace() const;
virtual LtXmlLib21::CXmlObjectBase* GetBase();
// Internal data for XML serialization
private:
static LtXmlLib21Data::CParentElementInfo* ms_pParentElementInfo;
static LtXmlLib21Data::CElementInfo** ms_ppElementInfo;
static LtXmlLib21Data::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 (SimpleHierarchyLib)
#endif // _SimpleHierarchyLib_CInvoice_h
|
/**********************************************************************************************
* 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: SimpleHierarchy.xsd
**********************************************************************************************/
#include "StdAfx.h"
#pragma warning (push)
#pragma warning (disable:4251) // template export warning
#pragma warning (disable:4786) // long debug names
#include "../SimpleHierarchyLib.h"
#include "../SimpleHierarchyLib/Payment.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 : Payment
// Long Name : Payment
// Element Name : Payment
// Class Namespace : SimpleHierarchyLib
// Namespace Alias :
// Schema Namespace :
// Mapped Class Name : CPayment
// Mapped Class Full Name : SimpleHierarchyLib::CPayment
// Mapped Class File Name : CPayment
// IsAbstract : False
// IsElement : True
// IsComplexType : True
namespace SimpleHierarchyLib
{
LtXmlLib21Data::CParentElementInfo* CPayment::ms_pParentElementInfo = NULL;
LtXmlLib21Data::CAttributeInfo** CPayment::ms_ppAttributeInfo = NULL;
LtXmlLib21Data::CElementInfo** CPayment::ms_ppElementInfo = NULL;
CPaymentPtr CPayment::CreateInstance(LPCTSTR lpctElementName/*=_T("Payment")*/)
{
return new SimpleHierarchyLib::CPayment(lpctElementName);
}
/*
* Constructor for CPayment
*
* 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 SimpleHierarchy.xsd
*/
CPayment::CPayment(LPCTSTR lpctElementName/*=_T("Payment")*/)
: CInstanceMonitor(_T("CPayment"))
{
m_elementName = lpctElementName;
Init();
}
CPayment::~CPayment()
{
Cleanup();
}
void CPayment::Cleanup()
{
// unregister for any events we have asked for
// cos there'll be no one left to hear soon
if (this->m_Vouchers != NULL)
this->m_Vouchers->RemoveEventListener(this);
this->m_Vouchers = NULL;
}
void CPayment::OnEvent(LtXmlLib21::CXmlObjectBase* pMsgSource, LtXmlLib21::IEventSink::MsgType eMsgType, void* pData)
{
if (eMsgType == LtXmlLib21::IEventSink::MT_CollectionChangeEvent)
{
if (this->m_Vouchers != NULL && this->m_Vouchers->GetBase() == pMsgSource)
{
// The class represents a choice, so prevent more than one element from being selected
ClearChoice(this->m_Vouchers->GetCount()==0?_T(""):_T("Vouchers"));
}
}
}
/*
* 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 SimpleHierarchy.xsd.
*/
void CPayment::Init()
{
Cleanup();
this->m_VISA = NULL;
this->m_Vouchers = dynamic_cast<SimpleHierarchyLib::CVouchersCol*>(SimpleHierarchyLib::CClassFactory::CreateClassCollection(SimpleHierarchyLib::CClassFactory::ClsName_CVouchersCol, _T("Vouchers"), _T(""), 1, -1).Ptr());
this->m_Vouchers->AddEventListener(this);
this->m_Cash = NULL;
m_validElement = _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 CPayment::ClearChoice(LPCTSTR lpctSelectedElement)
{
this->m_VISA = NULL;
if (this->m_Vouchers != NULL)
{
if (_tcscmp(_T("Vouchers"), lpctSelectedElement) != 0)
this->m_Vouchers->Clear();
}
this->m_Cash = NULL;
m_validElement = lpctSelectedElement;
}
void CPayment::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib21::LtVariant& rValue)
{
if (bRead)
{
switch(iPropertyIndex)
{
case 1:
rValue.SetXmlObject(GetVISA().Ptr());
break;
case 2:
rValue.SetXmlCollection(GetVouchers().Ptr());
break;
case 3:
rValue.SetXmlObject(GetCash().Ptr());
break;
default:
throw LtXmlLib21::CLtException(_T("Unknown Property Index"));
};
}
else
{
switch(iPropertyIndex)
{
case 1:
SetVISA(dynamic_cast<SimpleHierarchyLib::CVISA*>(rValue.GetXmlObject().Ptr()));
break;
case 2:
throw LtXmlLib21::CLtException(_T("Collections can not be set"));
break;
case 3:
SetCash(dynamic_cast<LtXmlLib21::CElement*>(rValue.GetXmlObject().Ptr()));
break;
default:
throw LtXmlLib21::CLtException(_T("Unknown Property Index"));
}
}
}
/*
* Represents an optional Element in the XML document
*
*
* This property is represented as an Element in the XML.
* It is optional, initially it is NULL.
* Only one Element within this class may be set at a time, setting this property when another element is already set will raise an exception. setting this property to NULL will allow another element to be selected
*/
SimpleHierarchyLib::CVISAPtr CPayment::GetVISA() const
{
return this->m_VISA;
}
void CPayment::SetVISA(SimpleHierarchyLib::CVISA* value)
{
// Ensure only on element is populated at a time
ClearChoice(value == NULL?_T(""):_T("VISA"));
if (value == NULL)
this->m_VISA = NULL;
else
{
SetElementName(value, _T("VISA"));
this->m_VISA = value;
}
}
/*
* A collection of CPayments
*
*
* This property is represented as an Element in the XML.
* This collection may contain 1 to Many objects.
* Only one Element within this class may be set at a time. This collection (as a whole is counted as an element) may contain 0 or 1 to Many entries. Emptying the collection allows a different element to be the selected one. If there is already a selected element, and an item is added to this collection then an exception will be raised
*/
SimpleHierarchyLib::CVouchersColPtr CPayment::GetVouchers() const
{
return this->m_Vouchers;
}
/*
* Represents an optional untyped element in the XML document
*
*
* It is optional, initially it is null.
* Only one Element within this class may be set at a time, setting this property when another element is already set will raise an exception. setting this property to null will allow another element to be selected
*/
LtXmlLib21::CElementPtr CPayment::GetCash() const
{
return this->m_Cash;
}
void CPayment::SetCash(LtXmlLib21::CElement* value)
{
if (value != NULL)
TestNamespace(value->GetNamespace().c_str(), _T("##any"), _T(""));
ClearChoice(value==NULL?_T(""):_T("Cash"));
this->m_Cash = value;
}
std::tstring CPayment::GetChoiceSelectedElement() const
{
return m_validElement;
}
/*
* Allows the class to be copied
* Performs a 'deep copy' of all the data in the class (and its children)
*/
SimpleHierarchyLib::CPaymentPtr CPayment::Clone() const
{
SimpleHierarchyLib::CPaymentPtr newObject = CreateInstance(m_elementName.c_str());
int index = 0;
newObject->m_VISA = NULL;
if (m_VISA != NULL)
newObject->m_VISA = dynamic_cast<SimpleHierarchyLib::CVISA*>(m_VISA->Clone().Ptr());
for (index = 0; index < m_Vouchers->GetCount(); index++)
newObject->m_Vouchers->Add(dynamic_cast<SimpleHierarchyLib::CVouchers*>(m_Vouchers->Item(index)->Clone().Ptr()));
newObject->m_Cash = NULL;
if (m_Cash != NULL)
newObject->m_Cash = dynamic_cast<LtXmlLib21::CElement*>(m_Cash->Clone().Ptr());
newObject->m_validElement = m_validElement;
// ##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 CPayment::GetTargetNamespace() const
{
return _T("");
}
std::tstring CPayment::GetNamespace() const
{
return _T("");
}
LtXmlLib21::CXmlObjectBase* CPayment::GetBase()
{
return this;
}
void CPayment::CleanMetaData()
{
LtXmlLib21::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo);
}
LtXmlLib21Data::CParentElementInfo* CPayment::GetClassInfo() const
{
if (ms_pParentElementInfo == NULL)
{
m_csInit.Enter();
if (ms_pParentElementInfo == NULL)
{
ms_pParentElementInfo = new LtXmlLib21Data::CParentElementInfo(
LtXmlLib21Data::XmlElementGroupType_CHOICE,
LtXmlLib21Data::XmlElementType_ELEMENT,
_T("Payment"),
_T(""),
true,
false,
-1,
LtXmlLib21::ItemType_none,
LtXmlLib21::CWhitespaceUtils::WhitespaceRule_None,
NULL,
false);
}
m_csInit.Leave();
}
return ms_pParentElementInfo;
}
LtXmlLib21Data::CElementInfo** CPayment::GetClassElementInfo() const
{
if (ms_ppElementInfo == NULL)
{
m_csInit.Enter();
if (ms_ppElementInfo == NULL)
{
ms_ppElementInfo = new LtXmlLib21Data::CElementInfo*[4];
ms_ppElementInfo[0] = new LtXmlLib21Data::CElementInfoChoiceClsOpt(_T("VISA"), _T(""), 1, LtXmlLib21Data::XmlElementType_ELEMENT, (LtXmlLib21Data::pfnCreateClassDef)SimpleHierarchyLib::CClassFactory::CreateClass, SimpleHierarchyLib::CClassFactory::ClsName_CVISA);
ms_ppElementInfo[1] = new LtXmlLib21Data::CElementInfoChoiceClsCol(_T("Vouchers"), _T(""), 2, LtXmlLib21Data::XmlElementType_ELEMENT);
ms_ppElementInfo[2] = new LtXmlLib21Data::CElementInfoChoiceUntpdOpt(_T("Cash"), _T(""), 3, _T("##any"), _T(""));
ms_ppElementInfo[3] = NULL;
}
m_csInit.Leave();
}
return ms_ppElementInfo;
}
LtXmlLib21Data::CAttributeInfo** CPayment::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
|
/**********************************************************************************************
* 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: SimpleHierarchy.xsd
**********************************************************************************************/
#ifndef _SimpleHierarchyLib_SimpleHierarchyLib_CPayment_h
#define _SimpleHierarchyLib_SimpleHierarchyLib_CPayment_h
// Include Base classes
#include "../SimpleHierarchyLib/VISA.h"
#include "../SimpleHierarchyLib/VouchersCol.h"
#include "../SimpleHierarchyLib/Vouchers.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 SimpleHierarchyLib { class CClassFactory; };
namespace SimpleHierarchyLib
{
/*
* CPayment
*
* This class wraps the element Payment in the schema
*/
class SimpleHierarchyLib_DLL CPayment : public CInstanceMonitor
, public virtual SimpleHierarchyLib::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 SimpleHierarchyLib::CPaymentPtr CreateInstance(LPCTSTR lpctElementName=_T("Payment"));
protected:
CPayment(LPCTSTR lpctElementName=_T("Payment"));
virtual ~CPayment();
friend class SimpleHierarchyLib::CClassFactory;
virtual void Init();
virtual void AccessProperty(int iPropertyIndex, bool read, LtXmlLib21::LtVariant& rValue);
virtual LtXmlLib21Data::CParentElementInfo* GetClassInfo() const;
virtual LtXmlLib21Data::CElementInfo** GetClassElementInfo() const;
virtual LtXmlLib21Data::CAttributeInfo** GetClassAttributeInfo() const;
static void CleanMetaData();
void Cleanup();
virtual void OnEvent(LtXmlLib21::CXmlObjectBase* pMsgSource, LtXmlLib21::IEventSink::MsgType eMsgType, void* pData);
void ClearChoice(LPCTSTR selectedElement);
public:
SimpleHierarchyLib::CVISAPtr GetVISA() const;
void SetVISA(SimpleHierarchyLib::CVISA* value);
protected:
SimpleHierarchyLib::CVISAPtr m_VISA;
public:
SimpleHierarchyLib::CVouchersColPtr GetVouchers() const;
protected:
SimpleHierarchyLib::CVouchersColPtr m_Vouchers;
public:
LtXmlLib21::CElementPtr GetCash() const;
void SetCash(LtXmlLib21::CElement* val);
protected:
LtXmlLib21::CElementPtr m_Cash;
public:
std::tstring GetChoiceSelectedElement() const;
protected:
std::tstring m_validElement;
public:
// Performs a 'deep copy' of all the data in the class (and its children)
virtual SimpleHierarchyLib::CPaymentPtr Clone() const;
virtual std::tstring GetTargetNamespace() const;
virtual std::tstring GetNamespace() const;
virtual LtXmlLib21::CXmlObjectBase* GetBase();
// Internal data for XML serialization
private:
static LtXmlLib21Data::CParentElementInfo* ms_pParentElementInfo;
static LtXmlLib21Data::CElementInfo** ms_ppElementInfo;
static LtXmlLib21Data::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 (SimpleHierarchyLib)
#endif // _SimpleHierarchyLib_CPayment_h
|
/**********************************************************************************************
* 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: SimpleHierarchy.xsd
**********************************************************************************************/
#include "StdAfx.h"
#pragma warning (push)
#pragma warning (disable:4251) // template export warning
#pragma warning (disable:4786) // long debug names
#include "../SimpleHierarchyLib.h"
#include "../SimpleHierarchyLib/VISA.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 : VISA
// Long Name : VISA
// Element Name : VISA
// Class Namespace : SimpleHierarchyLib
// Namespace Alias :
// Schema Namespace :
// Mapped Class Name : CVISA
// Mapped Class Full Name : SimpleHierarchyLib::CVISA
// Mapped Class File Name : CVISA
// IsAbstract : False
// IsElement : True
// IsComplexType : True
namespace SimpleHierarchyLib
{
LtXmlLib21Data::CParentElementInfo* CVISA::ms_pParentElementInfo = NULL;
LtXmlLib21Data::CAttributeInfo** CVISA::ms_ppAttributeInfo = NULL;
LtXmlLib21Data::CElementInfo** CVISA::ms_ppElementInfo = NULL;
CVISAPtr CVISA::CreateInstance(LPCTSTR lpctElementName/*=_T("VISA")*/)
{
return new SimpleHierarchyLib::CVISA(lpctElementName);
}
/*
* Constructor for CVISA
*
* 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 SimpleHierarchy.xsd
*/
CVISA::CVISA(LPCTSTR lpctElementName/*=_T("VISA")*/)
: CInstanceMonitor(_T("CVISA"))
, m_Expiry(LtXmlLib21::CDateTime::dt_gYearMonth)
{
m_elementName = lpctElementName;
Init();
}
CVISA::~CVISA()
{
Cleanup();
}
void CVISA::Cleanup()
{
// unregister for any events we have asked for
// cos there'll be no one left to hear soon
}
void CVISA::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 SimpleHierarchy.xsd.
*/
void CVISA::Init()
{
Cleanup();
this->m_CardNo = _T("");
this->m_Expiry = LtXmlLib21::CDateTime(LtXmlLib21::CDateTime::dt_gYearMonth);
// ##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 CVISA::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib21::LtVariant& rValue)
{
if (bRead)
{
switch(iPropertyIndex)
{
case 1:
rValue.SetString(GetCardNo());
break;
case 2:
rValue.SetYearMonth(GetExpiry());
break;
default:
throw LtXmlLib21::CLtException(_T("Unknown Property Index"));
};
}
else
{
switch(iPropertyIndex)
{
case 1:
SetCardNo(rValue.GetString());
break;
case 2:
SetExpiry(rValue.GetYearMonth());
break;
default:
throw LtXmlLib21::CLtException(_T("Unknown Property Index"));
}
}
}
/*
* Represents a mandatory Attribute in the XML document
*
*
* This property is represented as an Attribute in the XML.
* It is mandatory and therefore must be populated within the XML.
* It is defaulted to _T("").
*/
std::tstring CVISA::GetCardNo() const
{
return this->m_CardNo;
}
void CVISA::SetCardNo(std::tstring value)
{
// Apply whitespace rules appropriately
value = LtXmlLib21::CWhitespaceUtils::Preserve(value);
this->m_CardNo = value;
}
/*
* Represents a mandatory Attribute in the XML document
*
*
* This property is represented as an Attribute in the XML.
* It is mandatory and therefore must be populated within the XML.
* It is defaulted to LtXmlLib21::CDateTime(LtXmlLib21::CDateTime::dt_gYearMonth).
*/
LtXmlLib21::CDateTime CVISA::GetExpiry() const
{
return this->m_Expiry;
}
void CVISA::SetExpiry(LtXmlLib21::CDateTime value)
{
this->m_Expiry.SetDateTime(value, this->m_Expiry.GetType());
}
/*
* Allows the class to be copied
* Performs a 'deep copy' of all the data in the class (and its children)
*/
SimpleHierarchyLib::CVISAPtr CVISA::Clone() const
{
SimpleHierarchyLib::CVISAPtr newObject = CreateInstance(m_elementName.c_str());
int index = 0;
newObject->m_CardNo = m_CardNo;
newObject->m_Expiry = m_Expiry;
// ##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 CVISA::GetTargetNamespace() const
{
return _T("");
}
std::tstring CVISA::GetNamespace() const
{
return _T("");
}
LtXmlLib21::CXmlObjectBase* CVISA::GetBase()
{
return this;
}
void CVISA::CleanMetaData()
{
LtXmlLib21::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo);
}
LtXmlLib21Data::CParentElementInfo* CVISA::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("VISA"),
_T(""),
true,
false,
-1,
LtXmlLib21::ItemType_none,
LtXmlLib21::CWhitespaceUtils::WhitespaceRule_None,
NULL,
false);
}
m_csInit.Leave();
}
return ms_pParentElementInfo;
}
LtXmlLib21Data::CElementInfo** CVISA::GetClassElementInfo() const
{
if (ms_ppElementInfo == NULL)
{
m_csInit.Enter();
if (ms_ppElementInfo == NULL)
{
ms_ppElementInfo = new LtXmlLib21Data::CElementInfo*[1];
ms_ppElementInfo[0] = NULL;
}
m_csInit.Leave();
}
return ms_ppElementInfo;
}
LtXmlLib21Data::CAttributeInfo** CVISA::GetClassAttributeInfo() const
{
if (ms_ppAttributeInfo == NULL)
{
m_csInit.Enter();
if (ms_ppAttributeInfo == NULL)
{
ms_ppAttributeInfo = new LtXmlLib21Data::CAttributeInfo*[3];
ms_ppAttributeInfo[0] = new LtXmlLib21Data::CAttributeInfoPrimitive(_T("CardNo"), _T(""), 1, false, LtXmlLib21::ItemType_string, NULL, LtXmlLib21::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib21::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
ms_ppAttributeInfo[1] = new LtXmlLib21Data::CAttributeInfoPrimitive(_T("Expiry"), _T(""), 2, false, LtXmlLib21::ItemType_yearMonth, NULL, LtXmlLib21::CWhitespaceUtils::WhitespaceRule_Collapse, LtXmlLib21::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
ms_ppAttributeInfo[2] = 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
|
/**********************************************************************************************
* 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: SimpleHierarchy.xsd
**********************************************************************************************/
#ifndef _SimpleHierarchyLib_SimpleHierarchyLib_CVISA_h
#define _SimpleHierarchyLib_SimpleHierarchyLib_CVISA_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
// Forward declarations - done like this to keep the intellisense happy
namespace SimpleHierarchyLib { class CClassFactory; };
namespace SimpleHierarchyLib
{
/*
* CVISA
*
* This class wraps the element VISA in the schema
*/
class SimpleHierarchyLib_DLL CVISA : public CInstanceMonitor
, public virtual SimpleHierarchyLib::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 SimpleHierarchyLib::CVISAPtr CreateInstance(LPCTSTR lpctElementName=_T("VISA"));
protected:
CVISA(LPCTSTR lpctElementName=_T("VISA"));
virtual ~CVISA();
friend class SimpleHierarchyLib::CClassFactory;
virtual void Init();
virtual void AccessProperty(int iPropertyIndex, bool read, LtXmlLib21::LtVariant& rValue);
virtual LtXmlLib21Data::CParentElementInfo* GetClassInfo() const;
virtual LtXmlLib21Data::CElementInfo** GetClassElementInfo() const;
virtual LtXmlLib21Data::CAttributeInfo** GetClassAttributeInfo() const;
static void CleanMetaData();
void Cleanup();
virtual void OnEvent(LtXmlLib21::CXmlObjectBase* pMsgSource, LtXmlLib21::IEventSink::MsgType eMsgType, void* pData);
public:
std::tstring GetCardNo() const;
void SetCardNo(std::tstring val);
protected:
std::tstring m_CardNo;
public:
LtXmlLib21::CDateTime GetExpiry() const;
void SetExpiry(LtXmlLib21::CDateTime val);
protected:
LtXmlLib21::CDateTime m_Expiry;
public:
// Performs a 'deep copy' of all the data in the class (and its children)
virtual SimpleHierarchyLib::CVISAPtr Clone() const;
virtual std::tstring GetTargetNamespace() const;
virtual std::tstring GetNamespace() const;
virtual LtXmlLib21::CXmlObjectBase* GetBase();
// Internal data for XML serialization
private:
static LtXmlLib21Data::CParentElementInfo* ms_pParentElementInfo;
static LtXmlLib21Data::CElementInfo** ms_ppElementInfo;
static LtXmlLib21Data::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 (SimpleHierarchyLib)
#endif // _SimpleHierarchyLib_CVISA_h
|
/**********************************************************************************************
* 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: SimpleHierarchy.xsd
**********************************************************************************************/
#include "StdAfx.h"
#pragma warning (push)
#pragma warning (disable:4251) // template export warning
#pragma warning (disable:4786) // long debug names
#include "../SimpleHierarchyLib.h"
#include "../SimpleHierarchyLib/Vouchers.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 : Vouchers
// Long Name : Vouchers
// Element Name : Vouchers
// Class Namespace : SimpleHierarchyLib
// Namespace Alias :
// Schema Namespace :
// Mapped Class Name : CVouchers
// Mapped Class Full Name : SimpleHierarchyLib::CVouchers
// Mapped Class File Name : CVouchers
// IsAbstract : False
// IsElement : True
// IsComplexType : True
namespace SimpleHierarchyLib
{
LtXmlLib21Data::CParentElementInfo* CVouchers::ms_pParentElementInfo = NULL;
LtXmlLib21Data::CAttributeInfo** CVouchers::ms_ppAttributeInfo = NULL;
LtXmlLib21Data::CElementInfo** CVouchers::ms_ppElementInfo = NULL;
CVouchersPtr CVouchers::CreateInstance(LPCTSTR lpctElementName/*=_T("Vouchers")*/)
{
return new SimpleHierarchyLib::CVouchers(lpctElementName);
}
/*
* Constructor for CVouchers
*
* 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 SimpleHierarchy.xsd
*/
CVouchers::CVouchers(LPCTSTR lpctElementName/*=_T("Vouchers")*/)
: CInstanceMonitor(_T("CVouchers"))
{
m_elementName = lpctElementName;
Init();
}
CVouchers::~CVouchers()
{
Cleanup();
}
void CVouchers::Cleanup()
{
// unregister for any events we have asked for
// cos there'll be no one left to hear soon
}
void CVouchers::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 SimpleHierarchy.xsd.
*/
void CVouchers::Init()
{
Cleanup();
this->m_VoucherNo = 0;
this->m_VoucherValue = 0;
// ##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 CVouchers::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib21::LtVariant& rValue)
{
if (bRead)
{
switch(iPropertyIndex)
{
case 1:
rValue.SetUI8(GetVoucherNo());
break;
case 2:
rValue.SetUI8(GetVoucherValue());
break;
default:
throw LtXmlLib21::CLtException(_T("Unknown Property Index"));
};
}
else
{
switch(iPropertyIndex)
{
case 1:
SetVoucherNo(rValue.GetUI8());
break;
case 2:
SetVoucherValue(rValue.GetUI8());
break;
default:
throw LtXmlLib21::CLtException(_T("Unknown Property Index"));
}
}
}
/*
* Represents a mandatory Attribute in the XML document
*
*
* This property is represented as an Attribute in the XML.
* It is mandatory and therefore must be populated within the XML.
* It is defaulted to 0.
*/
DWORDLONG CVouchers::GetVoucherNo() const
{
return this->m_VoucherNo;
}
void CVouchers::SetVoucherNo(DWORDLONG value)
{
this->m_VoucherNo = value;
}
/*
* Represents a mandatory Attribute in the XML document
*
*
* This property is represented as an Attribute in the XML.
* It is mandatory and therefore must be populated within the XML.
* It is defaulted to 0.
*/
DWORDLONG CVouchers::GetVoucherValue() const
{
return this->m_VoucherValue;
}
void CVouchers::SetVoucherValue(DWORDLONG value)
{
this->m_VoucherValue = value;
}
/*
* Allows the class to be copied
* Performs a 'deep copy' of all the data in the class (and its children)
*/
SimpleHierarchyLib::CVouchersPtr CVouchers::Clone() const
{
SimpleHierarchyLib::CVouchersPtr newObject = CreateInstance(m_elementName.c_str());
int index = 0;
newObject->m_VoucherNo = m_VoucherNo;
newObject->m_VoucherValue = m_VoucherValue;
// ##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 CVouchers::GetTargetNamespace() const
{
return _T("");
}
std::tstring CVouchers::GetNamespace() const
{
return _T("");
}
LtXmlLib21::CXmlObjectBase* CVouchers::GetBase()
{
return this;
}
void CVouchers::CleanMetaData()
{
LtXmlLib21::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo);
}
LtXmlLib21Data::CParentElementInfo* CVouchers::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("Vouchers"),
_T(""),
true,
false,
-1,
LtXmlLib21::ItemType_none,
LtXmlLib21::CWhitespaceUtils::WhitespaceRule_None,
NULL,
false);
}
m_csInit.Leave();
}
return ms_pParentElementInfo;
}
LtXmlLib21Data::CElementInfo** CVouchers::GetClassElementInfo() const
{
if (ms_ppElementInfo == NULL)
{
m_csInit.Enter();
if (ms_ppElementInfo == NULL)
{
ms_ppElementInfo = new LtXmlLib21Data::CElementInfo*[1];
ms_ppElementInfo[0] = NULL;
}
m_csInit.Leave();
}
return ms_ppElementInfo;
}
LtXmlLib21Data::CAttributeInfo** CVouchers::GetClassAttributeInfo() const
{
if (ms_ppAttributeInfo == NULL)
{
m_csInit.Enter();
if (ms_ppAttributeInfo == NULL)
{
ms_ppAttributeInfo = new LtXmlLib21Data::CAttributeInfo*[3];
ms_ppAttributeInfo[0] = new LtXmlLib21Data::CAttributeInfoPrimitive(_T("VoucherNo"), _T(""), 1, false, LtXmlLib21::ItemType_ui8, NULL, LtXmlLib21::CWhitespaceUtils::WhitespaceRule_Collapse, LtXmlLib21::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
ms_ppAttributeInfo[1] = new LtXmlLib21Data::CAttributeInfoPrimitive(_T("VoucherValue"), _T(""), 2, false, LtXmlLib21::ItemType_ui8, NULL, LtXmlLib21::CWhitespaceUtils::WhitespaceRule_Collapse, LtXmlLib21::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
ms_ppAttributeInfo[2] = 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
|
/**********************************************************************************************
* 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: SimpleHierarchy.xsd
**********************************************************************************************/
#ifndef _SimpleHierarchyLib_SimpleHierarchyLib_CVouchers_h
#define _SimpleHierarchyLib_SimpleHierarchyLib_CVouchers_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
// Forward declarations - done like this to keep the intellisense happy
namespace SimpleHierarchyLib { class CClassFactory; };
namespace SimpleHierarchyLib
{
/*
* CVouchers
*
* This class wraps the element Vouchers in the schema
*/
class SimpleHierarchyLib_DLL CVouchers : public CInstanceMonitor
, public virtual SimpleHierarchyLib::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 SimpleHierarchyLib::CVouchersPtr CreateInstance(LPCTSTR lpctElementName=_T("Vouchers"));
protected:
CVouchers(LPCTSTR lpctElementName=_T("Vouchers"));
virtual ~CVouchers();
friend class SimpleHierarchyLib::CClassFactory;
virtual void Init();
virtual void AccessProperty(int iPropertyIndex, bool read, LtXmlLib21::LtVariant& rValue);
virtual LtXmlLib21Data::CParentElementInfo* GetClassInfo() const;
virtual LtXmlLib21Data::CElementInfo** GetClassElementInfo() const;
virtual LtXmlLib21Data::CAttributeInfo** GetClassAttributeInfo() const;
static void CleanMetaData();
void Cleanup();
virtual void OnEvent(LtXmlLib21::CXmlObjectBase* pMsgSource, LtXmlLib21::IEventSink::MsgType eMsgType, void* pData);
public:
DWORDLONG GetVoucherNo() const;
void SetVoucherNo(DWORDLONG val);
protected:
DWORDLONG m_VoucherNo;
public:
DWORDLONG GetVoucherValue() const;
void SetVoucherValue(DWORDLONG val);
protected:
DWORDLONG m_VoucherValue;
public:
// Performs a 'deep copy' of all the data in the class (and its children)
virtual SimpleHierarchyLib::CVouchersPtr Clone() const;
virtual std::tstring GetTargetNamespace() const;
virtual std::tstring GetNamespace() const;
virtual LtXmlLib21::CXmlObjectBase* GetBase();
// Internal data for XML serialization
private:
static LtXmlLib21Data::CParentElementInfo* ms_pParentElementInfo;
static LtXmlLib21Data::CElementInfo** ms_ppElementInfo;
static LtXmlLib21Data::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 (SimpleHierarchyLib)
#endif // _SimpleHierarchyLib_CVouchers_h
|
/**********************************************************************************************
* 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: SimpleHierarchy.xsd
**********************************************************************************************/
#include "StdAfx.h"
#pragma warning( disable : 4786 )
#pragma warning( disable : 4251 )
#include "../SimpleHierarchyLib.h"
#include "../SimpleHierarchyLib/VouchersCol.h"
#include "../SimpleHierarchyLib/Vouchers.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
namespace SimpleHierarchyLib
{
/*
* we don't want the users just creating these. They need to
* be initialize with the name of the element that they are
* going to represent in the XML document. This information
* requires knowledge of the schema, we are trying to
* prevent the user from having to know anything about that.
*/
CVouchersCol::CVouchersCol(LPCTSTR lpctElementName, LPCTSTR lpctNamespaceUri, int minOccurs, int maxOccurs)
: CXmlCollectionCommonBase(lpctElementName, lpctNamespaceUri, minOccurs, maxOccurs), CInstanceMonitor(_T("CVouchersCol"))
{
}
/*
* Adds a SimpleHierarchyLib::CVouchers to the collection
*/
void CVouchersCol::Add(SimpleHierarchyLib::CVouchers* pCls)
{
SetElementName(pCls, m_elementName.c_str());
AppendItem(pCls);
}
void CVouchersCol::AddAt(int index, SimpleHierarchyLib::CVouchers* pCls)
{
SetElementName(pCls, m_elementName.c_str());
AddItemAt(index, pCls);
}
/*
* Create a new SimpleHierarchyLib::CVouchers object and adds it the collection
*/
SimpleHierarchyLib::CVouchersPtr CVouchersCol::Add()
{
CSmartPtr<LtXmlLib21::CXmlObjectBase> spCls = SimpleHierarchyLib::CClassFactory::CreateClass(SimpleHierarchyLib::CClassFactory::ClsName_CVouchers, m_elementName.c_str());
AppendItem(spCls);
return dynamic_cast<SimpleHierarchyLib::CVouchers*>(spCls.Ptr());
}
/*
* Gets a CVouchers object from the collection (0 based)
*/
CSmartPtr<SimpleHierarchyLib::CVouchers> CVouchersCol::Item(int index) const
{
return dynamic_cast<SimpleHierarchyLib::CVouchers*>(GetNodeAtIndex(index)->spObj.Ptr());
}
/*
* Removes the object from the collection
*/
void CVouchersCol::Remove(SimpleHierarchyLib::CVouchers* pCls)
{
RemoveNode(GetNodeForItem(pCls));
}
/*
* Gets a representation of the class as XML - Marshalls Objects to XML
*/
void CVouchersCol::ToXml_Int(LtXmlLib21::CXmlWriter* xmlOut, bool bRegisterNamespaces, LPCTSTR lpctNamespaceUri, const LtXmlLib21::CSerializationContext& context, bool isOptionalChoice) const
{
ValidateCount(context);
LtXmlLib21::CNode* pNode = m_pHead;
while(pNode != NULL)
{
LtXmlLib21::CXmlObjectBase::ToXml_Int((pNode->spObj)->GetBase(), xmlOut, false, lpctNamespaceUri, context, isOptionalChoice);
pNode = pNode->pNext;
}
}
/*
* Creates the collection from XML data - Unmarshalls XML to Objects
*/
LtXmlLib21::CXmlElement* CVouchersCol::FromXml_Int(LtXmlLib21::CXmlElement* pXmlParent, LtXmlLib21::CXmlElement* pXmlChild, const LtXmlLib21::CSerializationContext& context, bool isOptionalChoice)
{
// go through the nodes until we run out of ones that match
while (pXmlChild != NULL)
{
// Stop reading when we hit an element we cant deal with
if (!DoesElementNameMatch(context, pXmlChild, m_elementName.c_str(), GetNamespace().c_str()))
break;
CSmartPtr<LtXmlLib21::CXmlObjectBase> spObj = SimpleHierarchyLib::CClassFactory::CreateClass(SimpleHierarchyLib::CClassFactory::ClsName_CVouchers, m_elementName.c_str());
LtXmlLib21::CXmlObjectBase::FromXml_Int(spObj->GetBase(), pXmlChild, pXmlChild->GetFirstElement(), context);
// Add new item to the collection
AppendItem(spObj.Ptr());
// Move to next node
pXmlChild = pXmlChild->GetNextSiblingElement();
}
return pXmlChild;
}
CVouchersCol::iterator CVouchersCol::begin()
{
return m_pHead;
}
CVouchersCol::iterator CVouchersCol::end()
{
return NULL;
}
// ##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
|
/**********************************************************************************************
* 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: SimpleHierarchy.xsd
**********************************************************************************************/
#ifndef _SimpleHierarchyLib_SimpleHierarchyLib_CVouchersCol_h
#define _SimpleHierarchyLib_SimpleHierarchyLib_CVouchersCol_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
namespace SimpleHierarchyLib
{
class SimpleHierarchyLib_DLL CVouchersCol : public SimpleHierarchyLib::CXmlCollectionCommonBase, CInstanceMonitor
// ##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
{
protected:
CVouchersCol(LPCTSTR lpctElementName, LPCTSTR lpctNamespaceUri, int minOccurs, int maxOccurs);
public:
SimpleHierarchyLib::CVouchersPtr Add();
void Add(SimpleHierarchyLib::CVouchers* pCls);
void AddAt(int index, SimpleHierarchyLib::CVouchers* pCls);
SimpleHierarchyLib::CVouchersPtr Item(int index) const;
void Remove(SimpleHierarchyLib::CVouchers* pCls);
typedef LtXmlLib21::CLtIterator<SimpleHierarchyLib::CVouchers> iterator;
typedef LtXmlLib21::CLtConstIterator<SimpleHierarchyLib::CVouchers> const_iterator;
iterator begin();
iterator end();
protected:
virtual void ToXml_Int( LtXmlLib21::CXmlWriter* pXmlOut, bool bRegisterNamespaces, LPCTSTR lpctNamespaceUri, const LtXmlLib21::CSerializationContext& context, bool isOptionalChoice) const;
virtual LtXmlLib21::CXmlElement* FromXml_Int( LtXmlLib21::CXmlElement* pXmlParent, LtXmlLib21::CXmlElement* pXmlChild, const LtXmlLib21::CSerializationContext& context, bool isOptionalChoice);
friend class SimpleHierarchyLib::CClassFactory;
// ##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 (SimpleHierarchyLib)
#endif // _SimpleHierarchyLib_CVouchersCol_h
|
/**********************************************************************************************
* 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: SimpleHierarchy.xsd
**********************************************************************************************/
#include "StdAfx.h"
#pragma warning (push)
#pragma warning (disable:4251) // template export warning
#pragma warning (disable:4786) // long debug names
#include "../SimpleHierarchyLib.h"
#include "../SimpleHierarchyLib/ItemType.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 : ItemType
// Long Name : ItemType
// Element Name : ItemType
// Class Namespace : SimpleHierarchyLib
// Namespace Alias :
// Schema Namespace :
// Mapped Class Name : CItemType
// Mapped Class Full Name : SimpleHierarchyLib::CItemType
// Mapped Class File Name : CItemType
// IsAbstract : False
// IsElement : True
// IsComplexType : True
namespace SimpleHierarchyLib
{
LtXmlLib21Data::CParentElementInfo* CItemType::ms_pParentElementInfo = NULL;
LtXmlLib21Data::CAttributeInfo** CItemType::ms_ppAttributeInfo = NULL;
LtXmlLib21Data::CElementInfo** CItemType::ms_ppElementInfo = NULL;
CItemTypePtr CItemType::CreateInstance(LPCTSTR lpctElementName/*=_T("ItemType")*/)
{
return new SimpleHierarchyLib::CItemType(lpctElementName);
}
/*
* Constructor for CItemType
*
* 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 SimpleHierarchy.xsd
*/
CItemType::CItemType(LPCTSTR lpctElementName/*=_T("ItemType")*/)
: CInstanceMonitor(_T("CItemType"))
{
m_elementName = lpctElementName;
Init();
}
CItemType::~CItemType()
{
Cleanup();
}
void CItemType::Cleanup()
{
// unregister for any events we have asked for
// cos there'll be no one left to hear soon
}
void CItemType::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 SimpleHierarchy.xsd.
*/
void CItemType::Init()
{
Cleanup();
this->m_StockCode = 0;
this->m_Description = _T("");
this->m_UnitCost = 0;
this->m_Quantity = 0;
// ##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 CItemType::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib21::LtVariant& rValue)
{
if (bRead)
{
switch(iPropertyIndex)
{
case 1:
rValue.SetUI8(GetStockCode());
break;
case 2:
rValue.SetString(GetDescription());
break;
case 3:
rValue.SetI8(GetUnitCost());
break;
case 4:
rValue.SetUI4(GetQuantity());
break;
default:
throw LtXmlLib21::CLtException(_T("Unknown Property Index"));
};
}
else
{
switch(iPropertyIndex)
{
case 1:
SetStockCode(rValue.GetUI8());
break;
case 2:
SetDescription(rValue.GetString());
break;
case 3:
SetUnitCost(rValue.GetI8());
break;
case 4:
SetQuantity(rValue.GetUI4());
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.
*/
DWORDLONG CItemType::GetStockCode() const
{
return this->m_StockCode;
}
void CItemType::SetStockCode(DWORDLONG value)
{
this->m_StockCode = 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 CItemType::GetDescription() const
{
return this->m_Description;
}
void CItemType::SetDescription(std::tstring value)
{
// Apply whitespace rules appropriately
value = LtXmlLib21::CWhitespaceUtils::Preserve(value);
this->m_Description = 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 0.
*/
LONGLONG CItemType::GetUnitCost() const
{
return this->m_UnitCost;
}
void CItemType::SetUnitCost(LONGLONG value)
{
this->m_UnitCost = 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 0.
*/
DWORD CItemType::GetQuantity() const
{
return this->m_Quantity;
}
void CItemType::SetQuantity(DWORD value)
{
this->m_Quantity = value;
}
/*
* Allows the class to be copied
* Performs a 'deep copy' of all the data in the class (and its children)
*/
SimpleHierarchyLib::CItemTypePtr CItemType::Clone() const
{
SimpleHierarchyLib::CItemTypePtr newObject = CreateInstance(m_elementName.c_str());
int index = 0;
newObject->m_StockCode = m_StockCode;
newObject->m_Description = m_Description;
newObject->m_UnitCost = m_UnitCost;
newObject->m_Quantity = m_Quantity;
// ##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 CItemType::GetTargetNamespace() const
{
return _T("");
}
std::tstring CItemType::GetNamespace() const
{
return _T("");
}
LtXmlLib21::CXmlObjectBase* CItemType::GetBase()
{
return this;
}
void CItemType::CleanMetaData()
{
LtXmlLib21::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo);
}
LtXmlLib21Data::CParentElementInfo* CItemType::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("ItemType"),
_T(""),
true,
false,
-1,
LtXmlLib21::ItemType_none,
LtXmlLib21::CWhitespaceUtils::WhitespaceRule_None,
NULL,
false);
}
m_csInit.Leave();
}
return ms_pParentElementInfo;
}
LtXmlLib21Data::CElementInfo** CItemType::GetClassElementInfo() const
{
if (ms_ppElementInfo == NULL)
{
m_csInit.Enter();
if (ms_ppElementInfo == NULL)
{
ms_ppElementInfo = new LtXmlLib21Data::CElementInfo*[5];
ms_ppElementInfo[0] = new LtXmlLib21Data::CElementInfoSeqPrimMnd(_T("StockCode"), _T(""), 1, false, LtXmlLib21::ItemType_ui8, NULL, LtXmlLib21::CWhitespaceUtils::WhitespaceRule_Collapse, LtXmlLib21::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
ms_ppElementInfo[1] = new LtXmlLib21Data::CElementInfoSeqPrimMnd(_T("Description"), _T(""), 2, false, LtXmlLib21::ItemType_string, NULL, LtXmlLib21::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib21::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
ms_ppElementInfo[2] = new LtXmlLib21Data::CElementInfoSeqPrimMnd(_T("UnitCost"), _T(""), 3, false, LtXmlLib21::ItemType_i8, NULL, LtXmlLib21::CWhitespaceUtils::WhitespaceRule_Collapse, LtXmlLib21::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
ms_ppElementInfo[3] = new LtXmlLib21Data::CElementInfoSeqPrimMnd(_T("Quantity"), _T(""), 4, false, LtXmlLib21::ItemType_ui4, NULL, LtXmlLib21::CWhitespaceUtils::WhitespaceRule_Collapse, LtXmlLib21::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
ms_ppElementInfo[4] = NULL;
}
m_csInit.Leave();
}
return ms_ppElementInfo;
}
LtXmlLib21Data::CAttributeInfo** CItemType::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
|
/**********************************************************************************************
* 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: SimpleHierarchy.xsd
**********************************************************************************************/
#ifndef _SimpleHierarchyLib_SimpleHierarchyLib_CItemType_h
#define _SimpleHierarchyLib_SimpleHierarchyLib_CItemType_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
// Forward declarations - done like this to keep the intellisense happy
namespace SimpleHierarchyLib { class CClassFactory; };
namespace SimpleHierarchyLib
{
/*
* CItemType
*
* This class wraps the element ItemType in the schema
*/
class SimpleHierarchyLib_DLL CItemType : public CInstanceMonitor
, public virtual SimpleHierarchyLib::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 SimpleHierarchyLib::CItemTypePtr CreateInstance(LPCTSTR lpctElementName=_T("ItemType"));
protected:
CItemType(LPCTSTR lpctElementName=_T("ItemType"));
virtual ~CItemType();
friend class SimpleHierarchyLib::CClassFactory;
virtual void Init();
virtual void AccessProperty(int iPropertyIndex, bool read, LtXmlLib21::LtVariant& rValue);
virtual LtXmlLib21Data::CParentElementInfo* GetClassInfo() const;
virtual LtXmlLib21Data::CElementInfo** GetClassElementInfo() const;
virtual LtXmlLib21Data::CAttributeInfo** GetClassAttributeInfo() const;
static void CleanMetaData();
void Cleanup();
virtual void OnEvent(LtXmlLib21::CXmlObjectBase* pMsgSource, LtXmlLib21::IEventSink::MsgType eMsgType, void* pData);
public:
DWORDLONG GetStockCode() const;
void SetStockCode(DWORDLONG val);
protected:
DWORDLONG m_StockCode;
public:
std::tstring GetDescription() const;
void SetDescription(std::tstring val);
protected:
std::tstring m_Description;
public:
LONGLONG GetUnitCost() const;
void SetUnitCost(LONGLONG val);
protected:
LONGLONG m_UnitCost;
public:
DWORD GetQuantity() const;
void SetQuantity(DWORD val);
protected:
DWORD m_Quantity;
public:
// Performs a 'deep copy' of all the data in the class (and its children)
virtual SimpleHierarchyLib::CItemTypePtr Clone() const;
virtual std::tstring GetTargetNamespace() const;
virtual std::tstring GetNamespace() const;
virtual LtXmlLib21::CXmlObjectBase* GetBase();
// Internal data for XML serialization
private:
static LtXmlLib21Data::CParentElementInfo* ms_pParentElementInfo;
static LtXmlLib21Data::CElementInfo** ms_ppElementInfo;
static LtXmlLib21Data::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 (SimpleHierarchyLib)
#endif // _SimpleHierarchyLib_CItemType_h
|
/**********************************************************************************************
* 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: SimpleHierarchy.xsd
**********************************************************************************************/
#include "StdAfx.h"
#pragma warning( disable : 4786 )
#pragma warning( disable : 4251 )
#include "../SimpleHierarchyLib.h"
#include "../SimpleHierarchyLib/ItemTypeCol.h"
#include "../SimpleHierarchyLib/ItemType.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
namespace SimpleHierarchyLib
{
/*
* we don't want the users just creating these. They need to
* be initialize with the name of the element that they are
* going to represent in the XML document. This information
* requires knowledge of the schema, we are trying to
* prevent the user from having to know anything about that.
*/
CItemTypeCol::CItemTypeCol(LPCTSTR lpctElementName, LPCTSTR lpctNamespaceUri, int minOccurs, int maxOccurs)
: CXmlCollectionCommonBase(lpctElementName, lpctNamespaceUri, minOccurs, maxOccurs), CInstanceMonitor(_T("CItemTypeCol"))
{
}
/*
* Adds a SimpleHierarchyLib::CItemType to the collection
*/
void CItemTypeCol::Add(SimpleHierarchyLib::CItemType* pCls)
{
SetElementName(pCls, m_elementName.c_str());
AppendItem(pCls);
}
void CItemTypeCol::AddAt(int index, SimpleHierarchyLib::CItemType* pCls)
{
SetElementName(pCls, m_elementName.c_str());
AddItemAt(index, pCls);
}
/*
* Create a new SimpleHierarchyLib::CItemType object and adds it the collection
*/
SimpleHierarchyLib::CItemTypePtr CItemTypeCol::Add()
{
CSmartPtr<LtXmlLib21::CXmlObjectBase> spCls = SimpleHierarchyLib::CClassFactory::CreateClass(SimpleHierarchyLib::CClassFactory::ClsName_CItemType, m_elementName.c_str());
AppendItem(spCls);
return dynamic_cast<SimpleHierarchyLib::CItemType*>(spCls.Ptr());
}
/*
* Gets a CItemType object from the collection (0 based)
*/
CSmartPtr<SimpleHierarchyLib::CItemType> CItemTypeCol::Item(int index) const
{
return dynamic_cast<SimpleHierarchyLib::CItemType*>(GetNodeAtIndex(index)->spObj.Ptr());
}
/*
* Removes the object from the collection
*/
void CItemTypeCol::Remove(SimpleHierarchyLib::CItemType* pCls)
{
RemoveNode(GetNodeForItem(pCls));
}
/*
* Gets a representation of the class as XML - Marshalls Objects to XML
*/
void CItemTypeCol::ToXml_Int(LtXmlLib21::CXmlWriter* xmlOut, bool bRegisterNamespaces, LPCTSTR lpctNamespaceUri, const LtXmlLib21::CSerializationContext& context, bool isOptionalChoice) const
{
ValidateCount(context);
LtXmlLib21::CNode* pNode = m_pHead;
while(pNode != NULL)
{
LtXmlLib21::CXmlObjectBase::ToXml_Int((pNode->spObj)->GetBase(), xmlOut, false, lpctNamespaceUri, context, isOptionalChoice);
pNode = pNode->pNext;
}
}
/*
* Creates the collection from XML data - Unmarshalls XML to Objects
*/
LtXmlLib21::CXmlElement* CItemTypeCol::FromXml_Int(LtXmlLib21::CXmlElement* pXmlParent, LtXmlLib21::CXmlElement* pXmlChild, const LtXmlLib21::CSerializationContext& context, bool isOptionalChoice)
{
// go through the nodes until we run out of ones that match
while (pXmlChild != NULL)
{
// Stop reading when we hit an element we cant deal with
if (!DoesElementNameMatch(context, pXmlChild, m_elementName.c_str(), GetNamespace().c_str()))
break;
CSmartPtr<LtXmlLib21::CXmlObjectBase> spObj = SimpleHierarchyLib::CClassFactory::CreateClass(SimpleHierarchyLib::CClassFactory::ClsName_CItemType, m_elementName.c_str());
LtXmlLib21::CXmlObjectBase::FromXml_Int(spObj->GetBase(), pXmlChild, pXmlChild->GetFirstElement(), context);
// Add new item to the collection
AppendItem(spObj.Ptr());
// Move to next node
pXmlChild = pXmlChild->GetNextSiblingElement();
}
return pXmlChild;
}
CItemTypeCol::iterator CItemTypeCol::begin()
{
return m_pHead;
}
CItemTypeCol::iterator CItemTypeCol::end()
{
return NULL;
}
// ##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
|
/**********************************************************************************************
* 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: SimpleHierarchy.xsd
**********************************************************************************************/
#ifndef _SimpleHierarchyLib_SimpleHierarchyLib_CItemTypeCol_h
#define _SimpleHierarchyLib_SimpleHierarchyLib_CItemTypeCol_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
namespace SimpleHierarchyLib
{
class SimpleHierarchyLib_DLL CItemTypeCol : public SimpleHierarchyLib::CXmlCollectionCommonBase, CInstanceMonitor
// ##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
{
protected:
CItemTypeCol(LPCTSTR lpctElementName, LPCTSTR lpctNamespaceUri, int minOccurs, int maxOccurs);
public:
SimpleHierarchyLib::CItemTypePtr Add();
void Add(SimpleHierarchyLib::CItemType* pCls);
void AddAt(int index, SimpleHierarchyLib::CItemType* pCls);
SimpleHierarchyLib::CItemTypePtr Item(int index) const;
void Remove(SimpleHierarchyLib::CItemType* pCls);
typedef LtXmlLib21::CLtIterator<SimpleHierarchyLib::CItemType> iterator;
typedef LtXmlLib21::CLtConstIterator<SimpleHierarchyLib::CItemType> const_iterator;
iterator begin();
iterator end();
protected:
virtual void ToXml_Int( LtXmlLib21::CXmlWriter* pXmlOut, bool bRegisterNamespaces, LPCTSTR lpctNamespaceUri, const LtXmlLib21::CSerializationContext& context, bool isOptionalChoice) const;
virtual LtXmlLib21::CXmlElement* FromXml_Int( LtXmlLib21::CXmlElement* pXmlParent, LtXmlLib21::CXmlElement* pXmlChild, const LtXmlLib21::CSerializationContext& context, bool isOptionalChoice);
friend class SimpleHierarchyLib::CClassFactory;
// ##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 (SimpleHierarchyLib)
#endif // _SimpleHierarchyLib_CItemTypeCol_h
|
| Main Menu | Samples List |