C++ Sample : Cardinality
Schema Summary This sample shows how to deal with mandatory, optional and collections of elements. Schema Details Sample Description The sample demonstrates how to read and write from optional, mandatory and collections of elements, when data is included in the XML document. |
Sample XML File
Sample1.xml |
<?xml version="1.0" encoding="UTF-8"?> <MyRootObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="..\Schema\Cardinality.xsd"> <ASimpleStringMandatoryElement>Some Required Data</ASimpleStringMandatoryElement> <ASimpleDateMandatoryElement>2003-11-23</ASimpleDateMandatoryElement> <AComplexMandatoryElement> <ChildItem>Some More Required Data</ChildItem> </AComplexMandatoryElement> <ASimpleStringOptionalElement>Some Optional Data</ASimpleStringOptionalElement> <ASimpleDateOptionalElement>2001-05-06</ASimpleDateOptionalElement> <AComplexOptionalElement> <ChildItem>Some More Optional Data</ChildItem> </AComplexOptionalElement> <ASimpleStringCollectionElement>First Data Item</ASimpleStringCollectionElement> <ASimpleStringCollectionElement>Second Data Item</ASimpleStringCollectionElement> <ASimpleDateCollectionElement>2003-01-01</ASimpleDateCollectionElement> <ASimpleDateCollectionElement>2003-01-02</ASimpleDateCollectionElement> <ASimpleDateCollectionElement>2003-01-03</ASimpleDateCollectionElement> <AComplexCollectionElement> <ChildItem>First Complex Data Item</ChildItem> </AComplexCollectionElement> <AComplexCollectionElement> <ChildItem>Second Complex Data Item</ChildItem> </AComplexCollectionElement> </MyRootObject> |
Read Sample | |
#include "..\..\..\Samples\Cardinality\Generated\CPP\SourceCodeCPP\CardinalityLib.h" #include "..\..\..\Samples\Cardinality\Generated\CPP\SourceCodeCPP\CardinalityLib\MyRootObject.h" #include "..\..\..\Samples\Cardinality\Generated\CPP\SourceCodeCPP\CardinalityLib\AComplexOptionalElement.h" std::string FilePath = SAMPLE_PATH + "Cardinality\\Samples\\Sample1.xml"; SampleRead(FilePath); void SampleRead(std::tstring FilePath) { // Create DVD object CardinalityLib::CMyRootObjectPtr root = CardinalityLib::CMyRootObject::CreateInstance(); // Load data into the object from a file root->FromXmlFile(FilePath.c_str()); // Now we can look at the mandatory elements // These are simple they are always there, // and can be accessed without checking they exist first printf("A Simple String Mandatory Element = %s\n", root->GetASimpleStringMandatoryElement().c_str()); printf("A Simple Date Mandatory Element = %s\n", root->GetASimpleDateMandatoryElement().ToString("s").c_str()); printf("A Complex Mandatory Element = %s\n", root->GetAComplexMandatoryElement()->GetChildItem().c_str()); // Now we can look at the optional elements. // Because these may be missing in the xml document // we need to check that they exist before accessing them. // For primitives (string, LtXmlLib20::CDateTime, Binary etc we have to use the // IsValidXXX mthods. // Note // ASimpleDateOptionalElement returns a DateTime object but // querying it when root->IsValidASimpleDateOptionalElement() is false will // raise an exception. // GetAComplexMandatoryElement returns an object CMyRootObject_AComplexOptionalElement // this will be null if item is not present in the xml, there is not // IsValid method for it. if (root->IsValidASimpleStringOptionalElement()) printf("A Simple String Optional Element = %s\n", root->GetASimpleStringOptionalElement().c_str()); if (root->IsValidASimpleDateOptionalElement()) printf("A Simple Date Optional Element = %s\n", root->GetASimpleDateOptionalElement().ToString("s").c_str()); if (root->GetAComplexOptionalElement() != NULL) printf("A Complex Optional Element = %s\n", root->GetAComplexOptionalElement()->GetChildItem().c_str()); // Now we can look at the collections of elements. // A collections object is always provided within the parent object // even if no of objects are always present in the xml document. for (int i = 0; i < root->GetASimpleStringCollectionElement()->GetCount(); i++) printf("A Simple String Collection Element = %s\n", root->GetASimpleStringCollectionElement()->Item(i).c_str()); for (int i = 0; i < root->GetASimpleDateCollectionElement()->GetCount(); i++) printf("A Simple Date Collection Element = %s\n", root->GetASimpleDateCollectionElement()->Item(i).ToString("s").c_str()); for (int i = 0; i < root->GetAComplexCollectionElement()->GetCount(); i++) printf("A Simple String Collection Element = %s\n", root->GetAComplexCollectionElement()->Item(i)->GetChildItem().c_str());
|
Write Sample | |
#include "..\..\..\Samples\Cardinality\Generated\CPP\SourceCodeCPP\CardinalityLib.h" #include "..\..\..\Samples\Cardinality\Generated\CPP\SourceCodeCPP\CardinalityLib\MyRootObject.h" #include "..\..\..\Samples\Cardinality\Generated\CPP\SourceCodeCPP\CardinalityLib\AComplexOptionalElement.h" // Create DVD object CardinalityLib::CMyRootObjectPtr root = CardinalityLib::CMyRootObject::CreateInstance(); // Mandatory items can just be set root->SetASimpleStringMandatoryElement("Some Required Data"); root->GetASimpleDateMandatoryElement().SetDate(2003, 11, 23); root->GetAComplexMandatoryElement()->SetChildItem("Some More Required Data"); // Optional primitives can also be set, but pay attention to objects // like XmlDateTime & BinaryData. They can be set but require the object // to be assigned, doing something like // root->ASimpleDateOptionalElement->SetDate(2003, 11, 23); // will cause ASimpleDateOptionalElement to be read first, it is unassigned // and will raise an exception. // There are 2 ways around this, explicity make it valid // root->IsValidASimpleDateOptionalElement(true); // root->GetASimpleDateOptionalElement().SetDate(2003, 11, 23); // or assign a valid object // root->SetASimpleDateOptionalElement(LtXmlLib20::CDateTime(2003, 11, 23)); // Also Note: if you have an existing primitive that you have set, and you no longre want it // to appear in the xml doxument, you can remove it using. // root->SetValidASimpleDateOptionalElement(false); // We will demonstrate both techniques. root->SetASimpleStringOptionalElement("Some Optional Data"); root->SetASimpleDateOptionalElement(LtXmlLib20::CDateTime(2003, 11, 23)); // root->GetASimpleDateOptionalElement() is now include in the xml document root->SetValidASimpleDateOptionalElement(false); // root->GetASimpleDateOptionalElement() is no longer include in the xml document // (as it was before we started messing with it.) root->SetValidASimpleDateOptionalElement(true); root->GetASimpleDateOptionalElement().SetDate(2003, 11, 23); // root->GetASimpleDateOptionalElement() is now include in the xml document again // Optional complex elements are more simple, they are either present or // they NULL. To start with optional complex elements are always null, so // we must assign one before we can use it. root->SetAComplexOptionalElement(CardinalityLib::CAComplexOptionalElement::CreateInstance()); root->GetAComplexOptionalElement()->SetChildItem("Some More Optional Data"); // Collections are easy, as we said previously there is always a collection // created in the parent object, so we just need to add objects to it-> root->GetASimpleStringCollectionElement()->Add("First Data Item"); root->GetASimpleStringCollectionElement()->Add("Second Data Item"); root->GetASimpleDateCollectionElement()->Add(LtXmlLib20::CDateTime(2003, 1, 1)); root->GetASimpleDateCollectionElement()->Add(LtXmlLib20::CDateTime(2003, 1, 2)); root->GetASimpleDateCollectionElement()->Add(LtXmlLib20::CDateTime(2003, 1, 3)); // For collections of Complexelements there are 2 ways to do // this we will demonstrate both. CardinalityLib::CAComplexCollectionElementPtr elm; // this creates a new object and adds it to the collection elm = root->GetAComplexCollectionElement()->Add(); elm->SetChildItem("First Complex Data Item"); // or we can explicity create the object then add it elm = CardinalityLib::CAComplexCollectionElement::CreateInstance(); elm->SetChildItem("Second Complex Data Item"); root->GetAComplexCollectionElement()->Add(elm); // Now we can look at the XML from this object printf(root->ToXml().c_str());
|
Cardinality.xsd |
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="MyRootObject"> <xs:complexType> <xs:sequence> <xs:element name="ASimpleStringMandatoryElement" type="xs:string"/> <xs:element name="ASimpleDateMandatoryElement" type="xs:date"/> <xs:element name="AComplexMandatoryElement"> <xs:complexType> <xs:sequence> <xs:element name="ChildItem" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="ASimpleStringOptionalElement" type="xs:string" minOccurs="0"/> <xs:element name="ASimpleDateOptionalElement" type="xs:date" minOccurs="0"/> <xs:element name="AComplexOptionalElement" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element name="ChildItem" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="ASimpleStringCollectionElement" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="ASimpleDateCollectionElement" type="xs:date" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="AComplexCollectionElement" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="ChildItem" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> |
Schema Diagrams |
|
MyRootObject.cpp |
/********************************************************************************************** * Copyright (c) 2001-2023 Liquid Technologies Limited. All rights reserved. * See www.liquid-technologies.com for product details. * * Please see products End User License Agreement for distribution permissions. * * WARNING: THIS FILE IS GENERATED * Changes made outside of ##HAND_CODED_BLOCK_START blocks will be overwritten * * Generation : by Liquid XML Data Binder 19.0.14.11049 * Using Schema: Cardinality.xsd **********************************************************************************************/ #include "StdAfx.h" #pragma warning (push) #pragma warning (disable:4251) // template export warning #pragma warning (disable:4786) // long debug names #include "../CardinalityLib.h" #include "../CardinalityLib/MyRootObject.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 : MyRootObject // Long Name : MyRootObject // Element Name : MyRootObject // Class Namespace : CardinalityLib // Namespace Alias : // Schema Namespace : // Mapped Class Name : CMyRootObject // Mapped Class Full Name : CardinalityLib::CMyRootObject // Mapped Class File Name : CMyRootObject // IsAbstract : False // IsElement : True // IsComplexType : False namespace CardinalityLib { LtXmlLib20Data::CParentElementInfo* CMyRootObject::ms_pParentElementInfo = NULL; LtXmlLib20Data::CAttributeInfo** CMyRootObject::ms_ppAttributeInfo = NULL; LtXmlLib20Data::CElementInfo** CMyRootObject::ms_ppElementInfo = NULL; CMyRootObjectPtr CMyRootObject::CreateInstance(LPCTSTR lpctElementName/*=_T("MyRootObject")*/) { return new CardinalityLib::CMyRootObject(lpctElementName); } /* * Constructor for CMyRootObject * * 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 Cardinality.xsd */ CMyRootObject::CMyRootObject(LPCTSTR lpctElementName/*=_T("MyRootObject")*/) : CInstanceMonitor(_T("CMyRootObject")) , m_ASimpleDateMandatoryElement(LtXmlLib20::CDateTime::dt_date) , m_ASimpleDateOptionalElement(LtXmlLib20::CDateTime::dt_date) { m_elementName = lpctElementName; Init(); } CMyRootObject::~CMyRootObject() { Cleanup(); } void CMyRootObject::Cleanup() { // unregister for any events we have asked for // cos there'll be no one left to hear soon this->m_ASimpleStringCollectionElement = NULL; this->m_ASimpleDateCollectionElement = NULL; this->m_AComplexCollectionElement = NULL; } void CMyRootObject::OnEvent(LtXmlLib20::CXmlObjectBase* pMsgSource, LtXmlLib20::IEventSink::MsgType eMsgType, void* pData) { if (eMsgType == LtXmlLib20::IEventSink::MT_CollectionChangeEvent) { } } /* * Initializes the class * * The Creates all the mandatory fields (populated with the default data) * All Collection object are created. * However any 1-n relationships (these are represented as collections) are * empty. To comply with the schema these must be populated before the xml * obtained from ToXml is valid against the schema Cardinality.xsd. */ void CMyRootObject::Init() { Cleanup(); this->m_ASimpleStringMandatoryElement = _T(""); this->m_ASimpleDateMandatoryElement = LtXmlLib20::CDateTime(LtXmlLib20::CDateTime::dt_date); this->m_AComplexMandatoryElement = dynamic_cast<CardinalityLib::CAComplexMandatoryElement*>(CardinalityLib::CClassFactory::CreateClass(CardinalityLib::CClassFactory::ClsName_CAComplexMandatoryElement, _T("AComplexMandatoryElement")).Ptr()); this->m_ASimpleStringOptionalElement = _T(""); this->m_IsValidASimpleStringOptionalElement = false; this->m_ASimpleDateOptionalElement = LtXmlLib20::CDateTime(LtXmlLib20::CDateTime::dt_date); this->m_IsValidASimpleDateOptionalElement = false; this->m_AComplexOptionalElement = NULL; this->m_ASimpleStringCollectionElement = new LtXmlLib20::CstringCol(_T("ASimpleStringCollectionElement"), _T(""), 0, -1, _T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, NULL); this->m_ASimpleDateCollectionElement = new LtXmlLib20::CdateCol(_T("ASimpleDateCollectionElement"), _T(""), 0, -1, _T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Collapse, NULL); this->m_AComplexCollectionElement = dynamic_cast<CardinalityLib::CAComplexCollectionElementCol*>(CardinalityLib::CClassFactory::CreateClassCollection(CardinalityLib::CClassFactory::ClsName_CAComplexCollectionElementCol, _T("AComplexCollectionElement"), _T(""), 0, -1).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 CMyRootObject::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib20::LtVariant& rValue) { if (bRead) { switch(iPropertyIndex) { case 1: rValue.SetString(GetASimpleStringMandatoryElement()); break; case 2: rValue.SetDate(GetASimpleDateMandatoryElement()); break; case 3: rValue.SetXmlObject(GetAComplexMandatoryElement().Ptr()); break; case 4: if (IsValidASimpleStringOptionalElement()) rValue.SetString(GetASimpleStringOptionalElement()); else rValue.SetInvalid(); break; case 5: if (IsValidASimpleDateOptionalElement()) rValue.SetDate(GetASimpleDateOptionalElement()); else rValue.SetInvalid(); break; case 6: rValue.SetXmlObject(GetAComplexOptionalElement().Ptr()); break; case 7: rValue.SetXmlCollection(GetASimpleStringCollectionElement()); break; case 8: rValue.SetXmlCollection(GetASimpleDateCollectionElement()); break; case 9: rValue.SetXmlCollection(GetAComplexCollectionElement().Ptr()); break; default: throw LtXmlLib20::CLtException(_T("Unknown Property Index")); }; } else { switch(iPropertyIndex) { case 1: SetASimpleStringMandatoryElement(rValue.GetString()); break; case 2: SetASimpleDateMandatoryElement(rValue.GetDate()); break; case 3: SetAComplexMandatoryElement(dynamic_cast<CardinalityLib::CAComplexMandatoryElement*>(rValue.GetXmlObject().Ptr())); break; case 4: if (rValue.IsValid()) SetASimpleStringOptionalElement(rValue.GetString()); else SetValidASimpleStringOptionalElement(false); break; case 5: if (rValue.IsValid()) SetASimpleDateOptionalElement(rValue.GetDate()); else SetValidASimpleDateOptionalElement(false); break; case 6: SetAComplexOptionalElement(dynamic_cast<CardinalityLib::CAComplexOptionalElement*>(rValue.GetXmlObject().Ptr())); break; case 7: throw LtXmlLib20::CLtException(_T("Collections can not be set")); break; case 8: throw LtXmlLib20::CLtException(_T("Collections can not be set")); break; case 9: throw LtXmlLib20::CLtException(_T("Collections can not be set")); break; default: throw LtXmlLib20::CLtException(_T("Unknown Property Index")); } } } /* * Represents a mandatory Element in the XML document * * * This property is represented as an Element in the XML. * It is mandatory and therefore must be populated within the XML. * It is defaulted to _T(""). */ std::tstring CMyRootObject::GetASimpleStringMandatoryElement() const { return this->m_ASimpleStringMandatoryElement; } void CMyRootObject::SetASimpleStringMandatoryElement(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); this->m_ASimpleStringMandatoryElement = 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 LtXmlLib20::CDateTime(LtXmlLib20::CDateTime::dt_date). */ LtXmlLib20::CDateTime CMyRootObject::GetASimpleDateMandatoryElement() const { return this->m_ASimpleDateMandatoryElement; } void CMyRootObject::SetASimpleDateMandatoryElement(LtXmlLib20::CDateTime value) { this->m_ASimpleDateMandatoryElement.SetDateTime(value, this->m_ASimpleDateMandatoryElement.GetType()); } /* * 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. */ CardinalityLib::CAComplexMandatoryElementPtr CMyRootObject::GetAComplexMandatoryElement() const { return this->m_AComplexMandatoryElement; } void CMyRootObject::SetAComplexMandatoryElement(CardinalityLib::CAComplexMandatoryElement* value) { Throw_IfPropertyIsNull(value, _T("AComplexMandatoryElement")); if (value != NULL) SetElementName(value, _T("AComplexMandatoryElement")); this->m_AComplexMandatoryElement = 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 CMyRootObject::GetASimpleStringOptionalElement() const { if (m_IsValidASimpleStringOptionalElement == false) throw LtXmlLib20::CLtInvalidStateException(_T("The Property GetASimpleStringOptionalElement is not valid. SetASimpleStringOptionalElement must be called first")); return this->m_ASimpleStringOptionalElement; } void CMyRootObject::SetASimpleStringOptionalElement(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); this->m_IsValidASimpleStringOptionalElement = true; this->m_ASimpleStringOptionalElement = value; } /* * Indicates if GetASimpleStringOptionalElement contains a valid value. * * true if the value for GetASimpleStringOptionalElement 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 GetASimpleStringOptionalElement * will raise an exception. */ bool CMyRootObject::IsValidASimpleStringOptionalElement() const { return m_IsValidASimpleStringOptionalElement; } void CMyRootObject::SetValidASimpleStringOptionalElement(bool value) { if (value != m_IsValidASimpleStringOptionalElement) { this->m_ASimpleStringOptionalElement = _T(""); m_IsValidASimpleStringOptionalElement = 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. */ LtXmlLib20::CDateTime CMyRootObject::GetASimpleDateOptionalElement() const { if (m_IsValidASimpleDateOptionalElement == false) throw LtXmlLib20::CLtInvalidStateException(_T("The Property GetASimpleDateOptionalElement is not valid. SetASimpleDateOptionalElement must be called first")); return this->m_ASimpleDateOptionalElement; } void CMyRootObject::SetASimpleDateOptionalElement(LtXmlLib20::CDateTime value) { this->m_IsValidASimpleDateOptionalElement = true; this->m_ASimpleDateOptionalElement.SetDateTime(value, m_ASimpleDateOptionalElement.GetType()); } /* * Indicates if GetASimpleDateOptionalElement contains a valid value. * * true if the value for GetASimpleDateOptionalElement is valid, false if not. * If this is set to true then the property is considered valid, and assigned its * default value (LtXmlLib20::CDateTime(LtXmlLib20::CDateTime::dt_date)). * If its set to false then its made invalid, and subsequent calls to GetASimpleDateOptionalElement * will raise an exception. */ bool CMyRootObject::IsValidASimpleDateOptionalElement() const { return m_IsValidASimpleDateOptionalElement; } void CMyRootObject::SetValidASimpleDateOptionalElement(bool value) { if (value != m_IsValidASimpleDateOptionalElement) { this->m_ASimpleDateOptionalElement = LtXmlLib20::CDateTime(LtXmlLib20::CDateTime::dt_date); m_IsValidASimpleDateOptionalElement = 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. */ CardinalityLib::CAComplexOptionalElementPtr CMyRootObject::GetAComplexOptionalElement() const { return this->m_AComplexOptionalElement; } void CMyRootObject::SetAComplexOptionalElement(CardinalityLib::CAComplexOptionalElement* value) { if (value == NULL) this->m_AComplexOptionalElement = NULL; else { SetElementName(value, _T("AComplexOptionalElement")); this->m_AComplexOptionalElement = value; } } /* * A collection of tstrings * * * This property is represented as an Element in the XML. * This collection may contain 0 to Many tstrings. */ LtXmlLib20::CstringColPtr CMyRootObject::GetASimpleStringCollectionElement() const { return this->m_ASimpleStringCollectionElement; } /* * A collection of CDateTimes * * * This property is represented as an Element in the XML. * This collection may contain 0 to Many CDateTimes. */ LtXmlLib20::CdateColPtr CMyRootObject::GetASimpleDateCollectionElement() const { return this->m_ASimpleDateCollectionElement; } /* * A collection of CMyRootObjects * * * This property is represented as an Element in the XML. * This collection may contain 0 to Many objects. */ CardinalityLib::CAComplexCollectionElementColPtr CMyRootObject::GetAComplexCollectionElement() const { return this->m_AComplexCollectionElement; } /* * Allows the class to be copied * Performs a 'deep copy' of all the data in the class (and its children) */ CardinalityLib::CMyRootObjectPtr CMyRootObject::Clone() const { CardinalityLib::CMyRootObjectPtr newObject = CreateInstance(m_elementName.c_str()); int index = 0; newObject->m_ASimpleStringMandatoryElement = m_ASimpleStringMandatoryElement; newObject->m_ASimpleDateMandatoryElement = m_ASimpleDateMandatoryElement; newObject->m_AComplexMandatoryElement = NULL; if (m_AComplexMandatoryElement != NULL) newObject->m_AComplexMandatoryElement = dynamic_cast<CardinalityLib::CAComplexMandatoryElement*>(m_AComplexMandatoryElement->Clone().Ptr()); newObject->m_ASimpleStringOptionalElement = m_ASimpleStringOptionalElement; newObject->m_IsValidASimpleStringOptionalElement = m_IsValidASimpleStringOptionalElement; newObject->m_ASimpleDateOptionalElement = m_ASimpleDateOptionalElement; newObject->m_IsValidASimpleDateOptionalElement = m_IsValidASimpleDateOptionalElement; newObject->m_AComplexOptionalElement = NULL; if (m_AComplexOptionalElement != NULL) newObject->m_AComplexOptionalElement = dynamic_cast<CardinalityLib::CAComplexOptionalElement*>(m_AComplexOptionalElement->Clone().Ptr()); for (index = 0; index < m_ASimpleStringCollectionElement->GetCount(); index++) newObject->m_ASimpleStringCollectionElement->Add(m_ASimpleStringCollectionElement->Item(index)); for (index = 0; index < m_ASimpleDateCollectionElement->GetCount(); index++) newObject->m_ASimpleDateCollectionElement->Add(m_ASimpleDateCollectionElement->Item(index)); for (index = 0; index < m_AComplexCollectionElement->GetCount(); index++) newObject->m_AComplexCollectionElement->Add(dynamic_cast<CardinalityLib::CAComplexCollectionElement*>(m_AComplexCollectionElement->Item(index)->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 CMyRootObject::GetTargetNamespace() const { return _T(""); } std::tstring CMyRootObject::GetNamespace() const { return _T(""); } LtXmlLib20::CXmlObjectBase* CMyRootObject::GetBase() { return this; } void CMyRootObject::CleanMetaData() { LtXmlLib20::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo); } LtXmlLib20Data::CParentElementInfo* CMyRootObject::GetClassInfo() const { if (ms_pParentElementInfo == NULL) { m_csInit.Enter(); if (ms_pParentElementInfo == NULL) { ms_pParentElementInfo = new LtXmlLib20Data::CParentElementInfo( LtXmlLib20Data::XmlElementGroupType_SEQUENCE, LtXmlLib20Data::XmlElementType_ELEMENT, _T("MyRootObject"), _T(""), true, false, -1, LtXmlLib20::ItemType_none, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_None, NULL, false); } m_csInit.Leave(); } return ms_pParentElementInfo; } LtXmlLib20Data::CElementInfo** CMyRootObject::GetClassElementInfo() const { if (ms_ppElementInfo == NULL) { m_csInit.Enter(); if (ms_ppElementInfo == NULL) { ms_ppElementInfo = new LtXmlLib20Data::CElementInfo*[10]; ms_ppElementInfo[0] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("ASimpleStringMandatoryElement"), _T(""), 1, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[1] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("ASimpleDateMandatoryElement"), _T(""), 2, false, LtXmlLib20::ItemType_date, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Collapse, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[2] = new LtXmlLib20Data::CElementInfoSeqClsMnd(_T("AComplexMandatoryElement"), _T(""), 3, LtXmlLib20Data::XmlElementType_ELEMENT, (LtXmlLib20Data::pfnCreateClassDef)&CardinalityLib::CClassFactory::CreateClass, CardinalityLib::CClassFactory::ClsName_CAComplexMandatoryElement, true); ms_ppElementInfo[3] = new LtXmlLib20Data::CElementInfoSeqPrimOpt(_T("ASimpleStringOptionalElement"), _T(""), 4, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[4] = new LtXmlLib20Data::CElementInfoSeqPrimOpt(_T("ASimpleDateOptionalElement"), _T(""), 5, false, LtXmlLib20::ItemType_date, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Collapse, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[5] = new LtXmlLib20Data::CElementInfoSeqClsOpt(_T("AComplexOptionalElement"), _T(""), 6, LtXmlLib20Data::XmlElementType_ELEMENT, (LtXmlLib20Data::pfnCreateClassDef)&CardinalityLib::CClassFactory::CreateClass, CardinalityLib::CClassFactory::ClsName_CAComplexOptionalElement); ms_ppElementInfo[6] = new LtXmlLib20Data::CElementInfoSeqPrimCol(_T("ASimpleStringCollectionElement"), _T(""), 7); ms_ppElementInfo[7] = new LtXmlLib20Data::CElementInfoSeqPrimCol(_T("ASimpleDateCollectionElement"), _T(""), 8); ms_ppElementInfo[8] = new LtXmlLib20Data::CElementInfoSeqClsCol(_T("AComplexCollectionElement"), _T(""), 9, LtXmlLib20Data::XmlElementType_ELEMENT); ms_ppElementInfo[9] = NULL; } m_csInit.Leave(); } return ms_ppElementInfo; } LtXmlLib20Data::CAttributeInfo** CMyRootObject::GetClassAttributeInfo() const { if (ms_ppAttributeInfo == NULL) { m_csInit.Enter(); if (ms_ppAttributeInfo == NULL) { ms_ppAttributeInfo = new LtXmlLib20Data::CAttributeInfo*[1]; ms_ppAttributeInfo[0] = NULL; } m_csInit.Leave(); } return ms_ppAttributeInfo; } // ##HAND_CODED_BLOCK_START ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS // Add Additional Methods here... // ##HAND_CODED_BLOCK_END ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS }; // namespace |
MyRootObject.h |
/********************************************************************************************** * Copyright (c) 2001-2023 Liquid Technologies Limited. All rights reserved. * See www.liquid-technologies.com for product details. * * Please see products End User License Agreement for distribution permissions. * * WARNING: THIS FILE IS GENERATED * Changes made outside of ##HAND_CODED_BLOCK_START blocks will be overwritten * * Generation : by Liquid XML Data Binder 19.0.14.11049 * Using Schema: Cardinality.xsd **********************************************************************************************/ #ifndef _CardinalityLib_CardinalityLib_CMyRootObject_h #define _CardinalityLib_CardinalityLib_CMyRootObject_h // Include Base classes #include "../CardinalityLib/AComplexMandatoryElement.h" #include "../CardinalityLib/AComplexOptionalElement.h" #include "../CardinalityLib/AComplexCollectionElementCol.h" #include "../CardinalityLib/AComplexCollectionElement.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 CardinalityLib { class CClassFactory; }; namespace CardinalityLib { /* * CMyRootObject * * This class wraps the element MyRootObject in the schema */ class CardinalityLib_DLL CMyRootObject : public CInstanceMonitor , public virtual CardinalityLib::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 CardinalityLib::CMyRootObjectPtr CreateInstance(LPCTSTR lpctElementName=_T("MyRootObject")); protected: CMyRootObject(LPCTSTR lpctElementName=_T("MyRootObject")); virtual ~CMyRootObject(); friend class CardinalityLib::CClassFactory; virtual void Init(); virtual void AccessProperty(int iPropertyIndex, bool read, LtXmlLib20::LtVariant& rValue); virtual LtXmlLib20Data::CParentElementInfo* GetClassInfo() const; virtual LtXmlLib20Data::CElementInfo** GetClassElementInfo() const; virtual LtXmlLib20Data::CAttributeInfo** GetClassAttributeInfo() const; static void CleanMetaData(); void Cleanup(); virtual void OnEvent(LtXmlLib20::CXmlObjectBase* pMsgSource, LtXmlLib20::IEventSink::MsgType eMsgType, void* pData); public: std::tstring GetASimpleStringMandatoryElement() const; void SetASimpleStringMandatoryElement(std::tstring val); protected: std::tstring m_ASimpleStringMandatoryElement; public: LtXmlLib20::CDateTime GetASimpleDateMandatoryElement() const; void SetASimpleDateMandatoryElement(LtXmlLib20::CDateTime val); protected: LtXmlLib20::CDateTime m_ASimpleDateMandatoryElement; public: CardinalityLib::CAComplexMandatoryElementPtr GetAComplexMandatoryElement() const; void SetAComplexMandatoryElement(CardinalityLib::CAComplexMandatoryElement* value); protected: CardinalityLib::CAComplexMandatoryElementPtr m_AComplexMandatoryElement; public: std::tstring GetASimpleStringOptionalElement() const; void SetASimpleStringOptionalElement(std::tstring val); bool IsValidASimpleStringOptionalElement() const; void SetValidASimpleStringOptionalElement(bool val); protected: bool m_IsValidASimpleStringOptionalElement; std::tstring m_ASimpleStringOptionalElement; public: LtXmlLib20::CDateTime GetASimpleDateOptionalElement() const; void SetASimpleDateOptionalElement(LtXmlLib20::CDateTime val); bool IsValidASimpleDateOptionalElement() const; void SetValidASimpleDateOptionalElement(bool val); protected: bool m_IsValidASimpleDateOptionalElement; LtXmlLib20::CDateTime m_ASimpleDateOptionalElement; public: CardinalityLib::CAComplexOptionalElementPtr GetAComplexOptionalElement() const; void SetAComplexOptionalElement(CardinalityLib::CAComplexOptionalElement* value); protected: CardinalityLib::CAComplexOptionalElementPtr m_AComplexOptionalElement; public: LtXmlLib20::CstringColPtr GetASimpleStringCollectionElement() const; protected: LtXmlLib20::CstringColPtr m_ASimpleStringCollectionElement; public: LtXmlLib20::CdateColPtr GetASimpleDateCollectionElement() const; protected: LtXmlLib20::CdateColPtr m_ASimpleDateCollectionElement; public: CardinalityLib::CAComplexCollectionElementColPtr GetAComplexCollectionElement() const; protected: CardinalityLib::CAComplexCollectionElementColPtr m_AComplexCollectionElement; public: // Performs a 'deep copy' of all the data in the class (and its children) virtual CardinalityLib::CMyRootObjectPtr Clone() const; virtual std::tstring GetTargetNamespace() const; virtual std::tstring GetNamespace() const; virtual LtXmlLib20::CXmlObjectBase* GetBase(); // Internal data for XML serialization private: static LtXmlLib20Data::CParentElementInfo* ms_pParentElementInfo; static LtXmlLib20Data::CElementInfo** ms_ppElementInfo; static LtXmlLib20Data::CAttributeInfo** ms_ppAttributeInfo; // ##HAND_CODED_BLOCK_START ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS // Add Additional Methods here... // ##HAND_CODED_BLOCK_END ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS }; }; // end namespace (CardinalityLib) #endif // _CardinalityLib_CMyRootObject_h |
AComplexCollectionElement.cpp |
/********************************************************************************************** * Copyright (c) 2001-2023 Liquid Technologies Limited. All rights reserved. * See www.liquid-technologies.com for product details. * * Please see products End User License Agreement for distribution permissions. * * WARNING: THIS FILE IS GENERATED * Changes made outside of ##HAND_CODED_BLOCK_START blocks will be overwritten * * Generation : by Liquid XML Data Binder 19.0.14.11049 * Using Schema: Cardinality.xsd **********************************************************************************************/ #include "StdAfx.h" #pragma warning (push) #pragma warning (disable:4251) // template export warning #pragma warning (disable:4786) // long debug names #include "../CardinalityLib.h" #include "../CardinalityLib/AComplexCollectionElement.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 : AComplexCollectionElement // Long Name : AComplexCollectionElement // Element Name : AComplexCollectionElement // Class Namespace : CardinalityLib // Namespace Alias : // Schema Namespace : // Mapped Class Name : CAComplexCollectionElement // Mapped Class Full Name : CardinalityLib::CAComplexCollectionElement // Mapped Class File Name : CAComplexCollectionElement // IsAbstract : False // IsElement : True // IsComplexType : True namespace CardinalityLib { LtXmlLib20Data::CParentElementInfo* CAComplexCollectionElement::ms_pParentElementInfo = NULL; LtXmlLib20Data::CAttributeInfo** CAComplexCollectionElement::ms_ppAttributeInfo = NULL; LtXmlLib20Data::CElementInfo** CAComplexCollectionElement::ms_ppElementInfo = NULL; CAComplexCollectionElementPtr CAComplexCollectionElement::CreateInstance(LPCTSTR lpctElementName/*=_T("AComplexCollectionElement")*/) { return new CardinalityLib::CAComplexCollectionElement(lpctElementName); } /* * Constructor for CAComplexCollectionElement * * 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 Cardinality.xsd */ CAComplexCollectionElement::CAComplexCollectionElement(LPCTSTR lpctElementName/*=_T("AComplexCollectionElement")*/) : CInstanceMonitor(_T("CAComplexCollectionElement")) { m_elementName = lpctElementName; Init(); } CAComplexCollectionElement::~CAComplexCollectionElement() { Cleanup(); } void CAComplexCollectionElement::Cleanup() { // unregister for any events we have asked for // cos there'll be no one left to hear soon } void CAComplexCollectionElement::OnEvent(LtXmlLib20::CXmlObjectBase* pMsgSource, LtXmlLib20::IEventSink::MsgType eMsgType, void* pData) { if (eMsgType == LtXmlLib20::IEventSink::MT_CollectionChangeEvent) { } } /* * Initializes the class * * The Creates all the mandatory fields (populated with the default data) * All Collection object are created. * However any 1-n relationships (these are represented as collections) are * empty. To comply with the schema these must be populated before the xml * obtained from ToXml is valid against the schema Cardinality.xsd. */ void CAComplexCollectionElement::Init() { Cleanup(); this->m_ChildItem = _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 CAComplexCollectionElement::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib20::LtVariant& rValue) { if (bRead) { switch(iPropertyIndex) { case 1: rValue.SetString(GetChildItem()); break; default: throw LtXmlLib20::CLtException(_T("Unknown Property Index")); }; } else { switch(iPropertyIndex) { case 1: SetChildItem(rValue.GetString()); break; default: throw LtXmlLib20::CLtException(_T("Unknown Property Index")); } } } /* * Represents a mandatory Element in the XML document * * * This property is represented as an Element in the XML. * It is mandatory and therefore must be populated within the XML. * It is defaulted to _T(""). */ std::tstring CAComplexCollectionElement::GetChildItem() const { return this->m_ChildItem; } void CAComplexCollectionElement::SetChildItem(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); this->m_ChildItem = value; } /* * Allows the class to be copied * Performs a 'deep copy' of all the data in the class (and its children) */ CardinalityLib::CAComplexCollectionElementPtr CAComplexCollectionElement::Clone() const { CardinalityLib::CAComplexCollectionElementPtr newObject = CreateInstance(m_elementName.c_str()); int index = 0; newObject->m_ChildItem = m_ChildItem; // ##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 CAComplexCollectionElement::GetTargetNamespace() const { return _T(""); } std::tstring CAComplexCollectionElement::GetNamespace() const { return _T(""); } LtXmlLib20::CXmlObjectBase* CAComplexCollectionElement::GetBase() { return this; } void CAComplexCollectionElement::CleanMetaData() { LtXmlLib20::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo); } LtXmlLib20Data::CParentElementInfo* CAComplexCollectionElement::GetClassInfo() const { if (ms_pParentElementInfo == NULL) { m_csInit.Enter(); if (ms_pParentElementInfo == NULL) { ms_pParentElementInfo = new LtXmlLib20Data::CParentElementInfo( LtXmlLib20Data::XmlElementGroupType_SEQUENCE, LtXmlLib20Data::XmlElementType_ELEMENT, _T("AComplexCollectionElement"), _T(""), true, false, -1, LtXmlLib20::ItemType_none, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_None, NULL, false); } m_csInit.Leave(); } return ms_pParentElementInfo; } LtXmlLib20Data::CElementInfo** CAComplexCollectionElement::GetClassElementInfo() const { if (ms_ppElementInfo == NULL) { m_csInit.Enter(); if (ms_ppElementInfo == NULL) { ms_ppElementInfo = new LtXmlLib20Data::CElementInfo*[2]; ms_ppElementInfo[0] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("ChildItem"), _T(""), 1, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[1] = NULL; } m_csInit.Leave(); } return ms_ppElementInfo; } LtXmlLib20Data::CAttributeInfo** CAComplexCollectionElement::GetClassAttributeInfo() const { if (ms_ppAttributeInfo == NULL) { m_csInit.Enter(); if (ms_ppAttributeInfo == NULL) { ms_ppAttributeInfo = new LtXmlLib20Data::CAttributeInfo*[1]; ms_ppAttributeInfo[0] = NULL; } m_csInit.Leave(); } return ms_ppAttributeInfo; } // ##HAND_CODED_BLOCK_START ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS // Add Additional Methods here... // ##HAND_CODED_BLOCK_END ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS }; // namespace |
AComplexCollectionElement.h |
/********************************************************************************************** * Copyright (c) 2001-2023 Liquid Technologies Limited. All rights reserved. * See www.liquid-technologies.com for product details. * * Please see products End User License Agreement for distribution permissions. * * WARNING: THIS FILE IS GENERATED * Changes made outside of ##HAND_CODED_BLOCK_START blocks will be overwritten * * Generation : by Liquid XML Data Binder 19.0.14.11049 * Using Schema: Cardinality.xsd **********************************************************************************************/ #ifndef _CardinalityLib_CardinalityLib_CAComplexCollectionElement_h #define _CardinalityLib_CardinalityLib_CAComplexCollectionElement_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 CardinalityLib { class CClassFactory; }; namespace CardinalityLib { /* * CAComplexCollectionElement * * This class wraps the element AComplexCollectionElement in the schema */ class CardinalityLib_DLL CAComplexCollectionElement : public CInstanceMonitor , public virtual CardinalityLib::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 CardinalityLib::CAComplexCollectionElementPtr CreateInstance(LPCTSTR lpctElementName=_T("AComplexCollectionElement")); protected: CAComplexCollectionElement(LPCTSTR lpctElementName=_T("AComplexCollectionElement")); virtual ~CAComplexCollectionElement(); friend class CardinalityLib::CClassFactory; virtual void Init(); virtual void AccessProperty(int iPropertyIndex, bool read, LtXmlLib20::LtVariant& rValue); virtual LtXmlLib20Data::CParentElementInfo* GetClassInfo() const; virtual LtXmlLib20Data::CElementInfo** GetClassElementInfo() const; virtual LtXmlLib20Data::CAttributeInfo** GetClassAttributeInfo() const; static void CleanMetaData(); void Cleanup(); virtual void OnEvent(LtXmlLib20::CXmlObjectBase* pMsgSource, LtXmlLib20::IEventSink::MsgType eMsgType, void* pData); public: std::tstring GetChildItem() const; void SetChildItem(std::tstring val); protected: std::tstring m_ChildItem; public: // Performs a 'deep copy' of all the data in the class (and its children) virtual CardinalityLib::CAComplexCollectionElementPtr Clone() const; virtual std::tstring GetTargetNamespace() const; virtual std::tstring GetNamespace() const; virtual LtXmlLib20::CXmlObjectBase* GetBase(); // Internal data for XML serialization private: static LtXmlLib20Data::CParentElementInfo* ms_pParentElementInfo; static LtXmlLib20Data::CElementInfo** ms_ppElementInfo; static LtXmlLib20Data::CAttributeInfo** ms_ppAttributeInfo; // ##HAND_CODED_BLOCK_START ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS // Add Additional Methods here... // ##HAND_CODED_BLOCK_END ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS }; }; // end namespace (CardinalityLib) #endif // _CardinalityLib_CAComplexCollectionElement_h |
AComplexCollectionElementCol.cpp |
/********************************************************************************************** * Copyright (c) 2001-2023 Liquid Technologies Limited. All rights reserved. * See www.liquid-technologies.com for product details. * * Please see products End User License Agreement for distribution permissions. * * WARNING: THIS FILE IS GENERATED * Changes made outside of ##HAND_CODED_BLOCK_START blocks will be overwritten * * Generation : by Liquid XML Data Binder 19.0.14.11049 * Using Schema: Cardinality.xsd **********************************************************************************************/ #include "StdAfx.h" #pragma warning( disable : 4786 ) #pragma warning( disable : 4251 ) #include "../CardinalityLib.h" #include "../CardinalityLib/AComplexCollectionElementCol.h" #include "../CardinalityLib/AComplexCollectionElement.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 CardinalityLib { /* * 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. */ CAComplexCollectionElementCol::CAComplexCollectionElementCol(LPCTSTR lpctElementName, LPCTSTR lpctNamespaceUri, int minOccurs, int maxOccurs) : CXmlCollectionCommonBase(lpctElementName, lpctNamespaceUri, minOccurs, maxOccurs), CInstanceMonitor(_T("CAComplexCollectionElementCol")) { } /* * Adds a CardinalityLib::CAComplexCollectionElement to the collection */ void CAComplexCollectionElementCol::Add(CardinalityLib::CAComplexCollectionElement* pCls) { SetElementName(pCls, m_elementName.c_str()); AppendItem(pCls); } void CAComplexCollectionElementCol::AddAt(int index, CardinalityLib::CAComplexCollectionElement* pCls) { SetElementName(pCls, m_elementName.c_str()); AddItemAt(index, pCls); } /* * Create a new CardinalityLib::CAComplexCollectionElement object and adds it the collection */ CardinalityLib::CAComplexCollectionElementPtr CAComplexCollectionElementCol::Add() { CSmartPtr<LtXmlLib20::CXmlObjectBase> spCls = CardinalityLib::CClassFactory::CreateClass(CardinalityLib::CClassFactory::ClsName_CAComplexCollectionElement, m_elementName.c_str()); AppendItem(spCls); return dynamic_cast<CardinalityLib::CAComplexCollectionElement*>(spCls.Ptr()); } /* * Gets a CAComplexCollectionElement object from the collection (0 based) */ CSmartPtr<CardinalityLib::CAComplexCollectionElement> CAComplexCollectionElementCol::Item(int index) const { return dynamic_cast<CardinalityLib::CAComplexCollectionElement*>(GetNodeAtIndex(index)->spObj.Ptr()); } /* * Removes the object from the collection */ void CAComplexCollectionElementCol::Remove(CardinalityLib::CAComplexCollectionElement* pCls) { RemoveNode(GetNodeForItem(pCls)); } /* * Gets a representation of the class as XML - Marshalls Objects to XML */ void CAComplexCollectionElementCol::ToXml_Int(LtXmlLib20::CXmlWriter* xmlOut, bool bRegisterNamespaces, LPCTSTR lpctNamespaceUri, const LtXmlLib20::CSerializationContext& context, bool isOptionalChoice) const { ValidateCount(context); LtXmlLib20::CNode* pNode = m_pHead; while(pNode != NULL) { LtXmlLib20::CXmlObjectBase::ToXml_Int((pNode->spObj)->GetBase(), xmlOut, false, lpctNamespaceUri, context, isOptionalChoice); pNode = pNode->pNext; } } /* * Creates the collection from XML data - Unmarshalls XML to Objects */ LtXmlLib20::CXmlElement* CAComplexCollectionElementCol::FromXml_Int(LtXmlLib20::CXmlElement* pXmlParent, LtXmlLib20::CXmlElement* pXmlChild, const LtXmlLib20::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<LtXmlLib20::CXmlObjectBase> spObj = CardinalityLib::CClassFactory::CreateClass(CardinalityLib::CClassFactory::ClsName_CAComplexCollectionElement, m_elementName.c_str()); LtXmlLib20::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; } CAComplexCollectionElementCol::iterator CAComplexCollectionElementCol::begin() { return m_pHead; } CAComplexCollectionElementCol::iterator CAComplexCollectionElementCol::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 |
AComplexCollectionElementCol.h |
/********************************************************************************************** * Copyright (c) 2001-2023 Liquid Technologies Limited. All rights reserved. * See www.liquid-technologies.com for product details. * * Please see products End User License Agreement for distribution permissions. * * WARNING: THIS FILE IS GENERATED * Changes made outside of ##HAND_CODED_BLOCK_START blocks will be overwritten * * Generation : by Liquid XML Data Binder 19.0.14.11049 * Using Schema: Cardinality.xsd **********************************************************************************************/ #ifndef _CardinalityLib_CardinalityLib_CAComplexCollectionElementCol_h #define _CardinalityLib_CardinalityLib_CAComplexCollectionElementCol_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 CardinalityLib { class CardinalityLib_DLL CAComplexCollectionElementCol : public CardinalityLib::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: CAComplexCollectionElementCol(LPCTSTR lpctElementName, LPCTSTR lpctNamespaceUri, int minOccurs, int maxOccurs); public: CardinalityLib::CAComplexCollectionElementPtr Add(); void Add(CardinalityLib::CAComplexCollectionElement* pCls); void AddAt(int index, CardinalityLib::CAComplexCollectionElement* pCls); CardinalityLib::CAComplexCollectionElementPtr Item(int index) const; void Remove(CardinalityLib::CAComplexCollectionElement* pCls); typedef LtXmlLib20::CLtIterator<CardinalityLib::CAComplexCollectionElement> iterator; typedef LtXmlLib20::CLtConstIterator<CardinalityLib::CAComplexCollectionElement> const_iterator; iterator begin(); iterator end(); protected: virtual void ToXml_Int( LtXmlLib20::CXmlWriter* pXmlOut, bool bRegisterNamespaces, LPCTSTR lpctNamespaceUri, const LtXmlLib20::CSerializationContext& context, bool isOptionalChoice) const; virtual LtXmlLib20::CXmlElement* FromXml_Int( LtXmlLib20::CXmlElement* pXmlParent, LtXmlLib20::CXmlElement* pXmlChild, const LtXmlLib20::CSerializationContext& context, bool isOptionalChoice); friend class CardinalityLib::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 (CardinalityLib) #endif // _CardinalityLib_CAComplexCollectionElementCol_h |
AComplexMandatoryElement.cpp |
/********************************************************************************************** * Copyright (c) 2001-2023 Liquid Technologies Limited. All rights reserved. * See www.liquid-technologies.com for product details. * * Please see products End User License Agreement for distribution permissions. * * WARNING: THIS FILE IS GENERATED * Changes made outside of ##HAND_CODED_BLOCK_START blocks will be overwritten * * Generation : by Liquid XML Data Binder 19.0.14.11049 * Using Schema: Cardinality.xsd **********************************************************************************************/ #include "StdAfx.h" #pragma warning (push) #pragma warning (disable:4251) // template export warning #pragma warning (disable:4786) // long debug names #include "../CardinalityLib.h" #include "../CardinalityLib/AComplexMandatoryElement.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 : AComplexMandatoryElement // Long Name : AComplexMandatoryElement // Element Name : AComplexMandatoryElement // Class Namespace : CardinalityLib // Namespace Alias : // Schema Namespace : // Mapped Class Name : CAComplexMandatoryElement // Mapped Class Full Name : CardinalityLib::CAComplexMandatoryElement // Mapped Class File Name : CAComplexMandatoryElement // IsAbstract : False // IsElement : True // IsComplexType : True namespace CardinalityLib { LtXmlLib20Data::CParentElementInfo* CAComplexMandatoryElement::ms_pParentElementInfo = NULL; LtXmlLib20Data::CAttributeInfo** CAComplexMandatoryElement::ms_ppAttributeInfo = NULL; LtXmlLib20Data::CElementInfo** CAComplexMandatoryElement::ms_ppElementInfo = NULL; CAComplexMandatoryElementPtr CAComplexMandatoryElement::CreateInstance(LPCTSTR lpctElementName/*=_T("AComplexMandatoryElement")*/) { return new CardinalityLib::CAComplexMandatoryElement(lpctElementName); } /* * Constructor for CAComplexMandatoryElement * * 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 Cardinality.xsd */ CAComplexMandatoryElement::CAComplexMandatoryElement(LPCTSTR lpctElementName/*=_T("AComplexMandatoryElement")*/) : CInstanceMonitor(_T("CAComplexMandatoryElement")) { m_elementName = lpctElementName; Init(); } CAComplexMandatoryElement::~CAComplexMandatoryElement() { Cleanup(); } void CAComplexMandatoryElement::Cleanup() { // unregister for any events we have asked for // cos there'll be no one left to hear soon } void CAComplexMandatoryElement::OnEvent(LtXmlLib20::CXmlObjectBase* pMsgSource, LtXmlLib20::IEventSink::MsgType eMsgType, void* pData) { if (eMsgType == LtXmlLib20::IEventSink::MT_CollectionChangeEvent) { } } /* * Initializes the class * * The Creates all the mandatory fields (populated with the default data) * All Collection object are created. * However any 1-n relationships (these are represented as collections) are * empty. To comply with the schema these must be populated before the xml * obtained from ToXml is valid against the schema Cardinality.xsd. */ void CAComplexMandatoryElement::Init() { Cleanup(); this->m_ChildItem = _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 CAComplexMandatoryElement::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib20::LtVariant& rValue) { if (bRead) { switch(iPropertyIndex) { case 1: rValue.SetString(GetChildItem()); break; default: throw LtXmlLib20::CLtException(_T("Unknown Property Index")); }; } else { switch(iPropertyIndex) { case 1: SetChildItem(rValue.GetString()); break; default: throw LtXmlLib20::CLtException(_T("Unknown Property Index")); } } } /* * Represents a mandatory Element in the XML document * * * This property is represented as an Element in the XML. * It is mandatory and therefore must be populated within the XML. * It is defaulted to _T(""). */ std::tstring CAComplexMandatoryElement::GetChildItem() const { return this->m_ChildItem; } void CAComplexMandatoryElement::SetChildItem(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); this->m_ChildItem = value; } /* * Allows the class to be copied * Performs a 'deep copy' of all the data in the class (and its children) */ CardinalityLib::CAComplexMandatoryElementPtr CAComplexMandatoryElement::Clone() const { CardinalityLib::CAComplexMandatoryElementPtr newObject = CreateInstance(m_elementName.c_str()); int index = 0; newObject->m_ChildItem = m_ChildItem; // ##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 CAComplexMandatoryElement::GetTargetNamespace() const { return _T(""); } std::tstring CAComplexMandatoryElement::GetNamespace() const { return _T(""); } LtXmlLib20::CXmlObjectBase* CAComplexMandatoryElement::GetBase() { return this; } void CAComplexMandatoryElement::CleanMetaData() { LtXmlLib20::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo); } LtXmlLib20Data::CParentElementInfo* CAComplexMandatoryElement::GetClassInfo() const { if (ms_pParentElementInfo == NULL) { m_csInit.Enter(); if (ms_pParentElementInfo == NULL) { ms_pParentElementInfo = new LtXmlLib20Data::CParentElementInfo( LtXmlLib20Data::XmlElementGroupType_SEQUENCE, LtXmlLib20Data::XmlElementType_ELEMENT, _T("AComplexMandatoryElement"), _T(""), true, false, -1, LtXmlLib20::ItemType_none, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_None, NULL, false); } m_csInit.Leave(); } return ms_pParentElementInfo; } LtXmlLib20Data::CElementInfo** CAComplexMandatoryElement::GetClassElementInfo() const { if (ms_ppElementInfo == NULL) { m_csInit.Enter(); if (ms_ppElementInfo == NULL) { ms_ppElementInfo = new LtXmlLib20Data::CElementInfo*[2]; ms_ppElementInfo[0] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("ChildItem"), _T(""), 1, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[1] = NULL; } m_csInit.Leave(); } return ms_ppElementInfo; } LtXmlLib20Data::CAttributeInfo** CAComplexMandatoryElement::GetClassAttributeInfo() const { if (ms_ppAttributeInfo == NULL) { m_csInit.Enter(); if (ms_ppAttributeInfo == NULL) { ms_ppAttributeInfo = new LtXmlLib20Data::CAttributeInfo*[1]; ms_ppAttributeInfo[0] = NULL; } m_csInit.Leave(); } return ms_ppAttributeInfo; } // ##HAND_CODED_BLOCK_START ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS // Add Additional Methods here... // ##HAND_CODED_BLOCK_END ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS }; // namespace |
AComplexMandatoryElement.h |
/********************************************************************************************** * Copyright (c) 2001-2023 Liquid Technologies Limited. All rights reserved. * See www.liquid-technologies.com for product details. * * Please see products End User License Agreement for distribution permissions. * * WARNING: THIS FILE IS GENERATED * Changes made outside of ##HAND_CODED_BLOCK_START blocks will be overwritten * * Generation : by Liquid XML Data Binder 19.0.14.11049 * Using Schema: Cardinality.xsd **********************************************************************************************/ #ifndef _CardinalityLib_CardinalityLib_CAComplexMandatoryElement_h #define _CardinalityLib_CardinalityLib_CAComplexMandatoryElement_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 CardinalityLib { class CClassFactory; }; namespace CardinalityLib { /* * CAComplexMandatoryElement * * This class wraps the element AComplexMandatoryElement in the schema */ class CardinalityLib_DLL CAComplexMandatoryElement : public CInstanceMonitor , public virtual CardinalityLib::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 CardinalityLib::CAComplexMandatoryElementPtr CreateInstance(LPCTSTR lpctElementName=_T("AComplexMandatoryElement")); protected: CAComplexMandatoryElement(LPCTSTR lpctElementName=_T("AComplexMandatoryElement")); virtual ~CAComplexMandatoryElement(); friend class CardinalityLib::CClassFactory; virtual void Init(); virtual void AccessProperty(int iPropertyIndex, bool read, LtXmlLib20::LtVariant& rValue); virtual LtXmlLib20Data::CParentElementInfo* GetClassInfo() const; virtual LtXmlLib20Data::CElementInfo** GetClassElementInfo() const; virtual LtXmlLib20Data::CAttributeInfo** GetClassAttributeInfo() const; static void CleanMetaData(); void Cleanup(); virtual void OnEvent(LtXmlLib20::CXmlObjectBase* pMsgSource, LtXmlLib20::IEventSink::MsgType eMsgType, void* pData); public: std::tstring GetChildItem() const; void SetChildItem(std::tstring val); protected: std::tstring m_ChildItem; public: // Performs a 'deep copy' of all the data in the class (and its children) virtual CardinalityLib::CAComplexMandatoryElementPtr Clone() const; virtual std::tstring GetTargetNamespace() const; virtual std::tstring GetNamespace() const; virtual LtXmlLib20::CXmlObjectBase* GetBase(); // Internal data for XML serialization private: static LtXmlLib20Data::CParentElementInfo* ms_pParentElementInfo; static LtXmlLib20Data::CElementInfo** ms_ppElementInfo; static LtXmlLib20Data::CAttributeInfo** ms_ppAttributeInfo; // ##HAND_CODED_BLOCK_START ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS // Add Additional Methods here... // ##HAND_CODED_BLOCK_END ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS }; }; // end namespace (CardinalityLib) #endif // _CardinalityLib_CAComplexMandatoryElement_h |
AComplexOptionalElement.cpp |
/********************************************************************************************** * Copyright (c) 2001-2023 Liquid Technologies Limited. All rights reserved. * See www.liquid-technologies.com for product details. * * Please see products End User License Agreement for distribution permissions. * * WARNING: THIS FILE IS GENERATED * Changes made outside of ##HAND_CODED_BLOCK_START blocks will be overwritten * * Generation : by Liquid XML Data Binder 19.0.14.11049 * Using Schema: Cardinality.xsd **********************************************************************************************/ #include "StdAfx.h" #pragma warning (push) #pragma warning (disable:4251) // template export warning #pragma warning (disable:4786) // long debug names #include "../CardinalityLib.h" #include "../CardinalityLib/AComplexOptionalElement.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 : AComplexOptionalElement // Long Name : AComplexOptionalElement // Element Name : AComplexOptionalElement // Class Namespace : CardinalityLib // Namespace Alias : // Schema Namespace : // Mapped Class Name : CAComplexOptionalElement // Mapped Class Full Name : CardinalityLib::CAComplexOptionalElement // Mapped Class File Name : CAComplexOptionalElement // IsAbstract : False // IsElement : True // IsComplexType : True namespace CardinalityLib { LtXmlLib20Data::CParentElementInfo* CAComplexOptionalElement::ms_pParentElementInfo = NULL; LtXmlLib20Data::CAttributeInfo** CAComplexOptionalElement::ms_ppAttributeInfo = NULL; LtXmlLib20Data::CElementInfo** CAComplexOptionalElement::ms_ppElementInfo = NULL; CAComplexOptionalElementPtr CAComplexOptionalElement::CreateInstance(LPCTSTR lpctElementName/*=_T("AComplexOptionalElement")*/) { return new CardinalityLib::CAComplexOptionalElement(lpctElementName); } /* * Constructor for CAComplexOptionalElement * * 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 Cardinality.xsd */ CAComplexOptionalElement::CAComplexOptionalElement(LPCTSTR lpctElementName/*=_T("AComplexOptionalElement")*/) : CInstanceMonitor(_T("CAComplexOptionalElement")) { m_elementName = lpctElementName; Init(); } CAComplexOptionalElement::~CAComplexOptionalElement() { Cleanup(); } void CAComplexOptionalElement::Cleanup() { // unregister for any events we have asked for // cos there'll be no one left to hear soon } void CAComplexOptionalElement::OnEvent(LtXmlLib20::CXmlObjectBase* pMsgSource, LtXmlLib20::IEventSink::MsgType eMsgType, void* pData) { if (eMsgType == LtXmlLib20::IEventSink::MT_CollectionChangeEvent) { } } /* * Initializes the class * * The Creates all the mandatory fields (populated with the default data) * All Collection object are created. * However any 1-n relationships (these are represented as collections) are * empty. To comply with the schema these must be populated before the xml * obtained from ToXml is valid against the schema Cardinality.xsd. */ void CAComplexOptionalElement::Init() { Cleanup(); this->m_ChildItem = _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 CAComplexOptionalElement::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib20::LtVariant& rValue) { if (bRead) { switch(iPropertyIndex) { case 1: rValue.SetString(GetChildItem()); break; default: throw LtXmlLib20::CLtException(_T("Unknown Property Index")); }; } else { switch(iPropertyIndex) { case 1: SetChildItem(rValue.GetString()); break; default: throw LtXmlLib20::CLtException(_T("Unknown Property Index")); } } } /* * Represents a mandatory Element in the XML document * * * This property is represented as an Element in the XML. * It is mandatory and therefore must be populated within the XML. * It is defaulted to _T(""). */ std::tstring CAComplexOptionalElement::GetChildItem() const { return this->m_ChildItem; } void CAComplexOptionalElement::SetChildItem(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); this->m_ChildItem = value; } /* * Allows the class to be copied * Performs a 'deep copy' of all the data in the class (and its children) */ CardinalityLib::CAComplexOptionalElementPtr CAComplexOptionalElement::Clone() const { CardinalityLib::CAComplexOptionalElementPtr newObject = CreateInstance(m_elementName.c_str()); int index = 0; newObject->m_ChildItem = m_ChildItem; // ##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 CAComplexOptionalElement::GetTargetNamespace() const { return _T(""); } std::tstring CAComplexOptionalElement::GetNamespace() const { return _T(""); } LtXmlLib20::CXmlObjectBase* CAComplexOptionalElement::GetBase() { return this; } void CAComplexOptionalElement::CleanMetaData() { LtXmlLib20::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo); } LtXmlLib20Data::CParentElementInfo* CAComplexOptionalElement::GetClassInfo() const { if (ms_pParentElementInfo == NULL) { m_csInit.Enter(); if (ms_pParentElementInfo == NULL) { ms_pParentElementInfo = new LtXmlLib20Data::CParentElementInfo( LtXmlLib20Data::XmlElementGroupType_SEQUENCE, LtXmlLib20Data::XmlElementType_ELEMENT, _T("AComplexOptionalElement"), _T(""), true, false, -1, LtXmlLib20::ItemType_none, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_None, NULL, false); } m_csInit.Leave(); } return ms_pParentElementInfo; } LtXmlLib20Data::CElementInfo** CAComplexOptionalElement::GetClassElementInfo() const { if (ms_ppElementInfo == NULL) { m_csInit.Enter(); if (ms_ppElementInfo == NULL) { ms_ppElementInfo = new LtXmlLib20Data::CElementInfo*[2]; ms_ppElementInfo[0] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("ChildItem"), _T(""), 1, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[1] = NULL; } m_csInit.Leave(); } return ms_ppElementInfo; } LtXmlLib20Data::CAttributeInfo** CAComplexOptionalElement::GetClassAttributeInfo() const { if (ms_ppAttributeInfo == NULL) { m_csInit.Enter(); if (ms_ppAttributeInfo == NULL) { ms_ppAttributeInfo = new LtXmlLib20Data::CAttributeInfo*[1]; ms_ppAttributeInfo[0] = NULL; } m_csInit.Leave(); } return ms_ppAttributeInfo; } // ##HAND_CODED_BLOCK_START ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS // Add Additional Methods here... // ##HAND_CODED_BLOCK_END ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS }; // namespace |
AComplexOptionalElement.h |
/********************************************************************************************** * Copyright (c) 2001-2023 Liquid Technologies Limited. All rights reserved. * See www.liquid-technologies.com for product details. * * Please see products End User License Agreement for distribution permissions. * * WARNING: THIS FILE IS GENERATED * Changes made outside of ##HAND_CODED_BLOCK_START blocks will be overwritten * * Generation : by Liquid XML Data Binder 19.0.14.11049 * Using Schema: Cardinality.xsd **********************************************************************************************/ #ifndef _CardinalityLib_CardinalityLib_CAComplexOptionalElement_h #define _CardinalityLib_CardinalityLib_CAComplexOptionalElement_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 CardinalityLib { class CClassFactory; }; namespace CardinalityLib { /* * CAComplexOptionalElement * * This class wraps the element AComplexOptionalElement in the schema */ class CardinalityLib_DLL CAComplexOptionalElement : public CInstanceMonitor , public virtual CardinalityLib::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 CardinalityLib::CAComplexOptionalElementPtr CreateInstance(LPCTSTR lpctElementName=_T("AComplexOptionalElement")); protected: CAComplexOptionalElement(LPCTSTR lpctElementName=_T("AComplexOptionalElement")); virtual ~CAComplexOptionalElement(); friend class CardinalityLib::CClassFactory; virtual void Init(); virtual void AccessProperty(int iPropertyIndex, bool read, LtXmlLib20::LtVariant& rValue); virtual LtXmlLib20Data::CParentElementInfo* GetClassInfo() const; virtual LtXmlLib20Data::CElementInfo** GetClassElementInfo() const; virtual LtXmlLib20Data::CAttributeInfo** GetClassAttributeInfo() const; static void CleanMetaData(); void Cleanup(); virtual void OnEvent(LtXmlLib20::CXmlObjectBase* pMsgSource, LtXmlLib20::IEventSink::MsgType eMsgType, void* pData); public: std::tstring GetChildItem() const; void SetChildItem(std::tstring val); protected: std::tstring m_ChildItem; public: // Performs a 'deep copy' of all the data in the class (and its children) virtual CardinalityLib::CAComplexOptionalElementPtr Clone() const; virtual std::tstring GetTargetNamespace() const; virtual std::tstring GetNamespace() const; virtual LtXmlLib20::CXmlObjectBase* GetBase(); // Internal data for XML serialization private: static LtXmlLib20Data::CParentElementInfo* ms_pParentElementInfo; static LtXmlLib20Data::CElementInfo** ms_ppElementInfo; static LtXmlLib20Data::CAttributeInfo** ms_ppAttributeInfo; // ##HAND_CODED_BLOCK_START ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS // Add Additional Methods here... // ##HAND_CODED_BLOCK_END ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS }; }; // end namespace (CardinalityLib) #endif // _CardinalityLib_CAComplexOptionalElement_h |
Main Menu | Samples List |