C++ Sample : Music Store
Schema Summary This sample shows how a to use the generated code to implement a simple request response (client/server) application. Schema Details The Request represents a search request for an album (like the interfaces exposed by Amazon or Play). The response represents the result of the search, in this case either a set of results or an error. If results are returned then this may contain 0-n products (a product being an album), each album has one or more tracks, and a track has a title and length. Sample Description The sample demonstrates how to Create a request document, get the underlying XML. Decode the request, and build a response. Then decode and display the response. In short both side of a very simple client server application. |
Sample XML File
MusicStore_Sample_Response.xml |
<?xml version="1.0" encoding="UTF-8"?> <SearchResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MusicStore.xsd"> <Result> <SearchDate>2003-01-20</SearchDate> <Product Label="Parlophone" ProductCode="0004U94562457MS" RRP="7.99"> <AlbumName>Parachutes</AlbumName> <ArtistName>ColdPlay</ArtistName> <Track> <Title>Don't Panic</Title> <Length>PT2M10S</Length> </Track> <Track> <Title>Shiver</Title> <Length>PT3M10S</Length> </Track> <Track> <Title>Spies</Title> <Length>PT2M12S</Length> </Track> <Track> <Title>Sparks</Title> <Length>PT3M40S</Length> </Track> <Track> <Title>Yellow</Title> <Length>PT6M12S</Length> </Track> <Track> <Title>Trouble</Title> <Length>PT3M12S</Length> </Track> <Track> <Title>Parachutes</Title> <Length>PT3M21S</Length> </Track> <Track> <Title>High Speed</Title> <Length>PT4M10S</Length> </Track> <Track> <Title>We Never Change</Title> <Length>PT4M36S</Length> </Track> <Track> <Title>Everything's Not Lost</Title> <Length>PT2M59S</Length> </Track> </Product> <Product Label="Parlophone" ProductCode="1001542157321SW" RRP="8.59"> <AlbumName>X&Y</AlbumName> <ArtistName>ColdPlay</ArtistName> <Track> <Title>Square One</Title> <Length>PT2M10S</Length> </Track> <Track> <Title>What If</Title> <Length>PT3M01S</Length> </Track> <Track> <Title>White Shadows</Title> <Length>PT3M04S</Length> </Track> <Track> <Title>Fix You</Title> <Length>PT4M36S</Length> </Track> <Track> <Title>Talk</Title> <Length>PT5M42S</Length> </Track> <Track> <Title>X&Y</Title> <Length>PT2M12S</Length> </Track> <Track> <Title>Speed Of Sound</Title> <Length>PT3M58S</Length> </Track> <Track> <Title>A Message</Title> <Length>PT4M15S</Length> </Track> <Track> <Title>Low</Title> <Length>PT3M21S</Length> </Track> <Track> <Title>The Hardest Part</Title> <Length>PT4M24S</Length> </Track> <Track> <Title>Swallowed In The Sea</Title> <Length>PT2M35S</Length> </Track> <Track> <Title>Twisted Logic</Title> <Length>PT5M54S</Length> </Track> <Track> <Title>Till Kingdom Come</Title> <Length>PT10M15S</Length> </Track> </Product> </Result> </SearchResponse> |
Read Sample | ||
try { std::tstring strXmlRequest = CreateSearchRequest(); _tprintf(_T("%s\n"), strXmlRequest.c_str()); std::tstring strXmlResponse = ProcessSearchRequest(strXmlRequest.c_str()); DisplayResults(strXmlResponse.c_str()); _tprintf(_T("%s\n"), strXmlRequest.c_str()); } catch (LtXmlLib20::CLtException& e) { // Note : exceptions are likely to contain inner exceptions // that provide further detail about the error, GetFullMessage // concatantes the messages from them all. _tprintf(_T("Error - %s\n"), e.GetFullMessage().c_str()); } #include "MusicStoreLib.h" #include "ClassFactory.h" #include "MusicStoreLib/SearchRequest.h" #include "MusicStoreLib/AlbumType.h" #include "MusicStoreLib/Error.h" #include "MusicStoreLib/PriceFilter.h" #include "MusicStoreLib/Result.h" #include "MusicStoreLib/SearchResponse.h" #include "MusicStoreLib/TrackType.h" #include "MusicStoreLib/AlbumTypeCol.h" #include "MusicStoreLib/TrackTypeCol.h" static std::tstring CreateSearchRequest() { // create an instance of the class MusicStoreLib::CSearchRequestPtr spRequest = MusicStoreLib::CSearchRequest::CreateInstance(); // setup our search criteria spRequest->SetNameFilter(_T("coldplay")); spRequest->GetPriceFilter()->SetMaxPrice(9.99); // Return the Request XML return spRequest->ToXml(); }
static std::tstring ProcessSearchRequest(LPCTSTR lpctRequestXML) { // create an instance of the class to load the XML file into MusicStoreLib::CSearchRequestPtr spRequest = MusicStoreLib::CSearchRequest::CreateInstance(); // load the request spRequest->FromXml(lpctRequestXML); // use the search criteria in a query std::tstring strXmlResponse = GetSearchResults( spRequest->GetNameFilter().c_str(), (spRequest->GetPriceFilter()->IsValidMinPrice()?spRequest->GetPriceFilter()->GetMinPrice():0), (spRequest->GetPriceFilter()->IsValidMaxPrice()?spRequest->GetPriceFilter()->GetMaxPrice():HUGE_VAL)); return strXmlResponse; } static std::tstring GetSearchResults( LPCTSTR lpctNameFilter, double minValueFilter, double maxValueFilter) { // setup Database query (use your imagination!) std::tstring strSQLAlbum = _T("SELECT * ") \ _T("FROM Album ") \ _T("WHERE ArtistName = @ArtistFilter AND ") \ _T(" Price > @MinPriceFilter AND ") \ _T(" Price < @MaxPriceFilter AND "); std::tstring strSQLTrack = _T("SELECT * ") \ _T("FROM Track ") \ _T("WHERE AlbumID = @AlbumID"); ADODB::_ConnectionPtr spConn; ADODB::_RecordsetPtr spRsTrack; ADODB::_RecordsetPtr spRsAlbum; ADODB::_CommandPtr spCmdTrack; ADODB::_CommandPtr spCmdAlbum; spConn.CreateInstance(__uuidof(ADODB::_Connection)); spCmdAlbum.CreateInstance(__uuidof(ADODB::_Command)); spCmdTrack.CreateInstance(__uuidof(ADODB::_Command)); spConn->Open(_T("..."), _bstr_t(), _bstr_t(), 0); spCmdAlbum->ActiveConnection = spConn; spCmdAlbum->Parameters->Append(spCmdAlbum->CreateParameter(_bstr_t(),ADODB::adBSTR, ADODB::adParamInput, vtMissing,lpctNameFilter)); spCmdAlbum->Parameters->Append(spCmdAlbum->CreateParameter(_bstr_t(),ADODB::adDouble,ADODB::adParamInput, vtMissing,minValueFilter)); spCmdAlbum->Parameters->Append(spCmdAlbum->CreateParameter(_bstr_t(),ADODB::adDouble,ADODB::adParamInput, vtMissing,maxValueFilter)); spCmdTrack->ActiveConnection = spConn; spCmdTrack->Parameters->Append(spCmdAlbum->CreateParameter(_bstr_t(),ADODB::adInteger,ADODB::adParamInput,vtMissing,0)); // query the database spRsAlbum = spCmdAlbum->Execute(NULL, NULL, 0); // create an instance of the class to load the XML file into MusicStoreLib::CSearchResponsePtr spResponse = MusicStoreLib::CSearchResponse::CreateInstance(); MusicStoreLib::CAlbumTypePtr spAlbum; MusicStoreLib::CTrackTypePtr spTrack; spResponse->GetResult()->SetSearchDate(LtXmlLib20::CDateTime::GetCurrentTime()); while (spRsAlbum->adoEOF == false) { // Add a new album to the collection spAlbum = spResponse->GetResult()->GetProduct()->Add(); // populate the album spAlbum->SetAlbumName (_variantToString(spRsAlbum->Fields->Item[_T("AlbumName")]->Value)); spAlbum->SetArtistName (_variantToString(spRsAlbum->Fields->Item[_T("ArtistName")]->Value)); spAlbum->SetLabel (_variantToString(spRsAlbum->Fields->Item[_T("RecordLabel")]->Value)); spAlbum->SetProductCode (_variantToString(spRsAlbum->Fields->Item[_T("ProductCode")]->Value)); if (spRsAlbum->Fields->Item[_T("Price")]->Value.vt == VT_EMPTY) spAlbum->SetRRP (spRsAlbum->Fields->Item[_T("Price")]->Value); // Query the DB for all the tracks in the album spCmdTrack->Parameters->GetItem(1)->Value = spRsAlbum->Fields->Item[_T("AlbumID")]->Value; spRsTrack = spCmdTrack->Execute(NULL, NULL, 0); // add all the tracks while (spRsTrack->adoEOF == false) { // create a track in the XML spTrack = spAlbum->GetTrack()->Add(); // populate the track spTrack->SetTitle(_variantToString(spRsTrack->Fields->Item[_T("Title")]->Value)); spTrack->GetLength().SetSeconds(spRsTrack->Fields->Item[_T("Duration")]->Value); spRsTrack->MoveNext(); } spRsAlbum->MoveNext(); } // always call Close when done reading. spConn->Close(); // return the XML return spResponse->ToXml(); } // Shows a simple example of how the class CSearchRequest // can be used. This class can be used to load documents whose // root (document) element is <SearchRequest>. static void DisplayResults(LPCTSTR lpctXmlResponse) { // create an instance of the class to load the XML file into MusicStoreLib::CSearchResponsePtr spResponse = MusicStoreLib::CSearchResponse::CreateInstance(); // load the xml from a file into the object (the root element in the // xml document must be <SearchResponse>. spResponse->FromXml(lpctXmlResponse); if (spResponse->GetChoiceSelectedElement() == _T("Result")) { _tprintf(_T("Query Was Executes %s\n"), spResponse->GetResult()->GetSearchDate().ToString().c_str()); for (MusicStoreLib::CAlbumTypeCol::iterator itrAlbum = spResponse->GetResult()->GetProduct()->begin(); itrAlbum != spResponse->GetResult()->GetProduct()->end(); itrAlbum++) { // ouput each album that was found MusicStoreLib::CAlbumTypePtr spAlbum = *itrAlbum; _tprintf(_T("Artist Name : %s\n"), spAlbum->GetArtistName().c_str() ); _tprintf(_T("Album Title : %s\n"), spAlbum->GetAlbumName().c_str() ); _tprintf(_T("Product Code : %s\n"), spAlbum->GetProductCode().c_str() ); _tprintf(_T("Record Label : %s\n"), spAlbum->GetLabel().c_str() ); if (spAlbum->IsValidRRP()) _tprintf(_T("Price : %G\n"), spAlbum->GetRRP()); // output the tracks for (MusicStoreLib::CTrackTypeCol::iterator itrTrack = spAlbum->GetTrack()->begin(); itrTrack != spAlbum->GetTrack()->end(); itrTrack++) { MusicStoreLib::CTrackTypePtr spTrack = *itrTrack; _tprintf(_T(" Track Name: %s (%lli:%lli)\n"), spTrack->GetTitle().c_str(), spTrack->GetLength().GetMinutes(), spTrack->GetLength().GetSeconds()); } } } else if (spResponse->GetChoiceSelectedElement() == _T("Error")) { _tprintf(_T("An Error Occured\n")); _tprintf(_T("Error Code : %i\n"), spResponse->GetError()->GetErrorCode()); _tprintf(_T("Descritpion : %s\n"), spResponse->GetError()->GetErrorDescription().c_str()); if (spResponse->GetError()->IsValidHelpFile()) _tprintf(_T("Help File : %s\n"), spResponse->GetError()->GetHelpFile().c_str()); } else { // error - should always have a result or an error } }
|
MusicStore.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="SearchRequest"> <xs:complexType> <xs:sequence> <xs:element name="PriceFilter"> <xs:complexType> <xs:sequence> <xs:element name="MinPrice" type="xs:double" minOccurs="0"/> <xs:element name="MaxPrice" type="xs:double" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="NameFilter" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="SearchResponse"> <xs:complexType> <xs:choice> <xs:element name="Result"> <xs:complexType> <xs:sequence> <xs:element name="SearchDate" type="xs:date"/> <xs:element name="Product" type="AlbumType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="Error"> <xs:complexType> <xs:sequence> <xs:element name="ErrorCode" type="xs:int"/> <xs:element name="ErrorDescription" type="xs:string"/> <xs:element name="HelpFile" type="xs:string" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> </xs:choice> </xs:complexType> </xs:element> <xs:complexType name="AlbumType"> <xs:sequence> <xs:element name="AlbumName" type="xs:string"/> <xs:element name="ArtistName" type="xs:string"/> <xs:element name="Track" type="TrackType" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="Label" type="xs:string" use="required"/> <xs:attribute name="RRP" type="xs:double"/> <xs:attribute name="ProductCode" use="required"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:length value="15"/> </xs:restriction> </xs:simpleType> </xs:attribute> </xs:complexType> <xs:complexType name="CompactDiskType"> <xs:sequence> <xs:element name="Title" type="xs:string" minOccurs="0"/> </xs:sequence> </xs:complexType> <xs:complexType name="TrackType"> <xs:sequence> <xs:element name="Title" type="xs:string"/> <xs:element name="Length" type="xs:duration"/> </xs:sequence> </xs:complexType> </xs:schema> |
Schema Diagrams |
|
AlbumType.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: MusicStore.xsd **********************************************************************************************/ #include "StdAfx.h" #pragma warning (push) #pragma warning (disable:4251) // template export warning #pragma warning (disable:4786) // long debug names #include "../MusicStoreLib.h" #include "../MusicStoreLib/AlbumType.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 : AlbumType // Long Name : AlbumType // Element Name : AlbumType // Class Namespace : MusicStoreLib // Namespace Alias : // Schema Namespace : // Mapped Class Name : CAlbumType // Mapped Class Full Name : MusicStoreLib::CAlbumType // Mapped Class File Name : CAlbumType // IsAbstract : False // IsElement : True // IsComplexType : True namespace MusicStoreLib { LtXmlLib20Data::CParentElementInfo* CAlbumType::ms_pParentElementInfo = NULL; LtXmlLib20Data::CAttributeInfo** CAlbumType::ms_ppAttributeInfo = NULL; LtXmlLib20Data::CElementInfo** CAlbumType::ms_ppElementInfo = NULL; CAlbumTypePtr CAlbumType::CreateInstance(LPCTSTR lpctElementName/*=_T("AlbumType")*/) { return new MusicStoreLib::CAlbumType(lpctElementName); } /* * Constructor for CAlbumType * * 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 MusicStore.xsd */ CAlbumType::CAlbumType(LPCTSTR lpctElementName/*=_T("AlbumType")*/) : CInstanceMonitor(_T("CAlbumType")) { m_elementName = lpctElementName; Init(); } CAlbumType::~CAlbumType() { Cleanup(); } void CAlbumType::Cleanup() { // unregister for any events we have asked for // cos there'll be no one left to hear soon this->m_Track = NULL; } void CAlbumType::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 MusicStore.xsd. */ void CAlbumType::Init() { Cleanup(); this->m_Label = _T(""); this->m_RRP = 0; this->m_IsValidRRP = false; this->m_ProductCode = _T(""); this->m_AlbumName = _T(""); this->m_ArtistName = _T(""); this->m_Track = dynamic_cast<MusicStoreLib::CTrackTypeCol*>(MusicStoreLib::CClassFactory::CreateClassCollection(MusicStoreLib::CClassFactory::ClsName_CTrackTypeCol, _T("Track"), _T(""), 1, -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 CAlbumType::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib20::LtVariant& rValue) { if (bRead) { switch(iPropertyIndex) { case 1: rValue.SetString(GetLabel()); break; case 2: if (IsValidRRP()) rValue.SetR8(GetRRP()); else rValue.SetInvalid(); break; case 3: rValue.SetString(GetProductCode()); break; case 4: rValue.SetString(GetAlbumName()); break; case 5: rValue.SetString(GetArtistName()); break; case 6: rValue.SetXmlCollection(GetTrack().Ptr()); break; default: throw LtXmlLib20::CLtException(_T("Unknown Property Index")); }; } else { switch(iPropertyIndex) { case 1: SetLabel(rValue.GetString()); break; case 2: if (rValue.IsValid()) SetRRP(rValue.GetR8()); else SetValidRRP(false); break; case 3: SetProductCode(rValue.GetString()); break; case 4: SetAlbumName(rValue.GetString()); break; case 5: SetArtistName(rValue.GetString()); break; case 6: throw LtXmlLib20::CLtException(_T("Collections can not be set")); break; default: throw LtXmlLib20::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 CAlbumType::GetLabel() const { return this->m_Label; } void CAlbumType::SetLabel(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); this->m_Label = value; } /* * Represents an optional Attribute in the XML document * * * This property is represented as an Attribute in the XML. * It is optional, initially it is not valid. */ DOUBLE CAlbumType::GetRRP() const { if (m_IsValidRRP == false) throw LtXmlLib20::CLtInvalidStateException(_T("The Property GetRRP is not valid. SetRRP must be called first")); return this->m_RRP; } void CAlbumType::SetRRP(DOUBLE value) { this->m_IsValidRRP = true; this->m_RRP = value; } /* * Indicates if GetRRP contains a valid value. * * true if the value for GetRRP is valid, false if not. * If this is set to true then the property is considered valid, and assigned its * default value (0). * If its set to false then its made invalid, and subsequent calls to GetRRP * will raise an exception. */ bool CAlbumType::IsValidRRP() const { return m_IsValidRRP; } void CAlbumType::SetValidRRP(bool value) { if (value != m_IsValidRRP) { this->m_RRP = 0; m_IsValidRRP = 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 _T(""). */ std::tstring CAlbumType::GetProductCode() const { return this->m_ProductCode; } void CAlbumType::SetProductCode(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); LtXmlLib20::LtVariant var; var.SetString(value); ((LtXmlLib20Data::CAttributeInfoPrimitive*)GetClassAttributeInfo()[2])->CheckRestriction(var); this->m_ProductCode = 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 CAlbumType::GetAlbumName() const { return this->m_AlbumName; } void CAlbumType::SetAlbumName(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); this->m_AlbumName = 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 CAlbumType::GetArtistName() const { return this->m_ArtistName; } void CAlbumType::SetArtistName(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); this->m_ArtistName = value; } /* * A collection of CAlbumTypes * * * This property is represented as an Element in the XML. * This collection may contain 1 to Many objects. */ MusicStoreLib::CTrackTypeColPtr CAlbumType::GetTrack() const { return this->m_Track; } /* * Allows the class to be copied * Performs a 'deep copy' of all the data in the class (and its children) */ MusicStoreLib::CAlbumTypePtr CAlbumType::Clone() const { MusicStoreLib::CAlbumTypePtr newObject = CreateInstance(m_elementName.c_str()); int index = 0; newObject->m_Label = m_Label; newObject->m_RRP = m_RRP; newObject->m_IsValidRRP = m_IsValidRRP; newObject->m_ProductCode = m_ProductCode; newObject->m_AlbumName = m_AlbumName; newObject->m_ArtistName = m_ArtistName; for (index = 0; index < m_Track->GetCount(); index++) newObject->m_Track->Add(dynamic_cast<MusicStoreLib::CTrackType*>(m_Track->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 CAlbumType::GetTargetNamespace() const { return _T(""); } std::tstring CAlbumType::GetNamespace() const { return _T(""); } LtXmlLib20::CXmlObjectBase* CAlbumType::GetBase() { return this; } void CAlbumType::CleanMetaData() { LtXmlLib20::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo); } LtXmlLib20Data::CParentElementInfo* CAlbumType::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("AlbumType"), _T(""), true, false, -1, LtXmlLib20::ItemType_none, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_None, NULL, false); } m_csInit.Leave(); } return ms_pParentElementInfo; } LtXmlLib20Data::CElementInfo** CAlbumType::GetClassElementInfo() const { if (ms_ppElementInfo == NULL) { m_csInit.Enter(); if (ms_ppElementInfo == NULL) { ms_ppElementInfo = new LtXmlLib20Data::CElementInfo*[4]; ms_ppElementInfo[0] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("AlbumName"), _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[1] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("ArtistName"), _T(""), 5, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[2] = new LtXmlLib20Data::CElementInfoSeqClsCol(_T("Track"), _T(""), 6, LtXmlLib20Data::XmlElementType_ELEMENT); ms_ppElementInfo[3] = NULL; } m_csInit.Leave(); } return ms_ppElementInfo; } LtXmlLib20Data::CAttributeInfo** CAlbumType::GetClassAttributeInfo() const { if (ms_ppAttributeInfo == NULL) { m_csInit.Enter(); if (ms_ppAttributeInfo == NULL) { ms_ppAttributeInfo = new LtXmlLib20Data::CAttributeInfo*[4]; ms_ppAttributeInfo[0] = new LtXmlLib20Data::CAttributeInfoPrimitive(_T("Label"), _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_ppAttributeInfo[1] = new LtXmlLib20Data::CAttributeInfoPrimitive(_T("RRP"), _T(""), 2, true, LtXmlLib20::ItemType_r8, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Collapse, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppAttributeInfo[2] = new LtXmlLib20Data::CAttributeInfoPrimitive(_T("ProductCode"), _T(""), 3, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), 15, -1, -1), NULL); ms_ppAttributeInfo[3] = 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 |
AlbumType.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: MusicStore.xsd **********************************************************************************************/ #ifndef _MusicStoreLib_MusicStoreLib_CAlbumType_h #define _MusicStoreLib_MusicStoreLib_CAlbumType_h // Include Base classes #include "../MusicStoreLib/TrackTypeCol.h" #include "../MusicStoreLib/TrackType.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 MusicStoreLib { class CClassFactory; }; namespace MusicStoreLib { /* * CAlbumType * * This class wraps the element AlbumType in the schema */ class MusicStoreLib_DLL CAlbumType : public CInstanceMonitor , public virtual MusicStoreLib::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 MusicStoreLib::CAlbumTypePtr CreateInstance(LPCTSTR lpctElementName=_T("AlbumType")); protected: CAlbumType(LPCTSTR lpctElementName=_T("AlbumType")); virtual ~CAlbumType(); friend class MusicStoreLib::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 GetLabel() const; void SetLabel(std::tstring val); protected: std::tstring m_Label; public: DOUBLE GetRRP() const; void SetRRP(DOUBLE val); bool IsValidRRP() const; void SetValidRRP(bool val); protected: bool m_IsValidRRP; DOUBLE m_RRP; public: std::tstring GetProductCode() const; void SetProductCode(std::tstring val); protected: std::tstring m_ProductCode; public: std::tstring GetAlbumName() const; void SetAlbumName(std::tstring val); protected: std::tstring m_AlbumName; public: std::tstring GetArtistName() const; void SetArtistName(std::tstring val); protected: std::tstring m_ArtistName; public: MusicStoreLib::CTrackTypeColPtr GetTrack() const; protected: MusicStoreLib::CTrackTypeColPtr m_Track; public: // Performs a 'deep copy' of all the data in the class (and its children) virtual MusicStoreLib::CAlbumTypePtr 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 (MusicStoreLib) #endif // _MusicStoreLib_CAlbumType_h |
AlbumTypeCol.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: MusicStore.xsd **********************************************************************************************/ #include "StdAfx.h" #pragma warning( disable : 4786 ) #pragma warning( disable : 4251 ) #include "../MusicStoreLib.h" #include "../MusicStoreLib/AlbumTypeCol.h" #include "../MusicStoreLib/AlbumType.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 MusicStoreLib { /* * 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. */ CAlbumTypeCol::CAlbumTypeCol(LPCTSTR lpctElementName, LPCTSTR lpctNamespaceUri, int minOccurs, int maxOccurs) : CXmlCollectionCommonBase(lpctElementName, lpctNamespaceUri, minOccurs, maxOccurs), CInstanceMonitor(_T("CAlbumTypeCol")) { } /* * Adds a MusicStoreLib::CAlbumType to the collection */ void CAlbumTypeCol::Add(MusicStoreLib::CAlbumType* pCls) { SetElementName(pCls, m_elementName.c_str()); AppendItem(pCls); } void CAlbumTypeCol::AddAt(int index, MusicStoreLib::CAlbumType* pCls) { SetElementName(pCls, m_elementName.c_str()); AddItemAt(index, pCls); } /* * Create a new MusicStoreLib::CAlbumType object and adds it the collection */ MusicStoreLib::CAlbumTypePtr CAlbumTypeCol::Add() { CSmartPtr<LtXmlLib20::CXmlObjectBase> spCls = MusicStoreLib::CClassFactory::CreateClass(MusicStoreLib::CClassFactory::ClsName_CAlbumType, m_elementName.c_str()); AppendItem(spCls); return dynamic_cast<MusicStoreLib::CAlbumType*>(spCls.Ptr()); } /* * Gets a CAlbumType object from the collection (0 based) */ CSmartPtr<MusicStoreLib::CAlbumType> CAlbumTypeCol::Item(int index) const { return dynamic_cast<MusicStoreLib::CAlbumType*>(GetNodeAtIndex(index)->spObj.Ptr()); } /* * Removes the object from the collection */ void CAlbumTypeCol::Remove(MusicStoreLib::CAlbumType* pCls) { RemoveNode(GetNodeForItem(pCls)); } /* * Gets a representation of the class as XML - Marshalls Objects to XML */ void CAlbumTypeCol::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* CAlbumTypeCol::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 = MusicStoreLib::CClassFactory::CreateClass(MusicStoreLib::CClassFactory::ClsName_CAlbumType, 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; } CAlbumTypeCol::iterator CAlbumTypeCol::begin() { return m_pHead; } CAlbumTypeCol::iterator CAlbumTypeCol::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 |
AlbumTypeCol.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: MusicStore.xsd **********************************************************************************************/ #ifndef _MusicStoreLib_MusicStoreLib_CAlbumTypeCol_h #define _MusicStoreLib_MusicStoreLib_CAlbumTypeCol_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 MusicStoreLib { class MusicStoreLib_DLL CAlbumTypeCol : public MusicStoreLib::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: CAlbumTypeCol(LPCTSTR lpctElementName, LPCTSTR lpctNamespaceUri, int minOccurs, int maxOccurs); public: MusicStoreLib::CAlbumTypePtr Add(); void Add(MusicStoreLib::CAlbumType* pCls); void AddAt(int index, MusicStoreLib::CAlbumType* pCls); MusicStoreLib::CAlbumTypePtr Item(int index) const; void Remove(MusicStoreLib::CAlbumType* pCls); typedef LtXmlLib20::CLtIterator<MusicStoreLib::CAlbumType> iterator; typedef LtXmlLib20::CLtConstIterator<MusicStoreLib::CAlbumType> 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 MusicStoreLib::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 (MusicStoreLib) #endif // _MusicStoreLib_CAlbumTypeCol_h |
Error.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: MusicStore.xsd **********************************************************************************************/ #include "StdAfx.h" #pragma warning (push) #pragma warning (disable:4251) // template export warning #pragma warning (disable:4786) // long debug names #include "../MusicStoreLib.h" #include "../MusicStoreLib/Error.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 : Error // Long Name : Error // Element Name : Error // Class Namespace : MusicStoreLib // Namespace Alias : // Schema Namespace : // Mapped Class Name : CError // Mapped Class Full Name : MusicStoreLib::CError // Mapped Class File Name : CError // IsAbstract : False // IsElement : True // IsComplexType : True namespace MusicStoreLib { LtXmlLib20Data::CParentElementInfo* CError::ms_pParentElementInfo = NULL; LtXmlLib20Data::CAttributeInfo** CError::ms_ppAttributeInfo = NULL; LtXmlLib20Data::CElementInfo** CError::ms_ppElementInfo = NULL; CErrorPtr CError::CreateInstance(LPCTSTR lpctElementName/*=_T("Error")*/) { return new MusicStoreLib::CError(lpctElementName); } /* * Constructor for CError * * 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 MusicStore.xsd */ CError::CError(LPCTSTR lpctElementName/*=_T("Error")*/) : CInstanceMonitor(_T("CError")) { m_elementName = lpctElementName; Init(); } CError::~CError() { Cleanup(); } void CError::Cleanup() { // unregister for any events we have asked for // cos there'll be no one left to hear soon } void CError::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 MusicStore.xsd. */ void CError::Init() { Cleanup(); this->m_ErrorCode = 0; this->m_ErrorDescription = _T(""); this->m_HelpFile = _T(""); this->m_IsValidHelpFile = false; // ##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 CError::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib20::LtVariant& rValue) { if (bRead) { switch(iPropertyIndex) { case 1: rValue.SetI4(GetErrorCode()); break; case 2: rValue.SetString(GetErrorDescription()); break; case 3: if (IsValidHelpFile()) rValue.SetString(GetHelpFile()); else rValue.SetInvalid(); break; default: throw LtXmlLib20::CLtException(_T("Unknown Property Index")); }; } else { switch(iPropertyIndex) { case 1: SetErrorCode(rValue.GetI4()); break; case 2: SetErrorDescription(rValue.GetString()); break; case 3: if (rValue.IsValid()) SetHelpFile(rValue.GetString()); else SetValidHelpFile(false); break; default: throw LtXmlLib20::CLtException(_T("Unknown Property Index")); } } } /* * Represents a mandatory Element in the XML document * * * This property is represented as an Element in the XML. * It is mandatory and therefore must be populated within the XML. * It is defaulted to 0. */ LONG CError::GetErrorCode() const { return this->m_ErrorCode; } void CError::SetErrorCode(LONG value) { this->m_ErrorCode = 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 CError::GetErrorDescription() const { return this->m_ErrorDescription; } void CError::SetErrorDescription(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); this->m_ErrorDescription = 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 CError::GetHelpFile() const { if (m_IsValidHelpFile == false) throw LtXmlLib20::CLtInvalidStateException(_T("The Property GetHelpFile is not valid. SetHelpFile must be called first")); return this->m_HelpFile; } void CError::SetHelpFile(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); this->m_IsValidHelpFile = true; this->m_HelpFile = value; } /* * Indicates if GetHelpFile contains a valid value. * * true if the value for GetHelpFile 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 GetHelpFile * will raise an exception. */ bool CError::IsValidHelpFile() const { return m_IsValidHelpFile; } void CError::SetValidHelpFile(bool value) { if (value != m_IsValidHelpFile) { this->m_HelpFile = _T(""); m_IsValidHelpFile = value; } } /* * Allows the class to be copied * Performs a 'deep copy' of all the data in the class (and its children) */ MusicStoreLib::CErrorPtr CError::Clone() const { MusicStoreLib::CErrorPtr newObject = CreateInstance(m_elementName.c_str()); int index = 0; newObject->m_ErrorCode = m_ErrorCode; newObject->m_ErrorDescription = m_ErrorDescription; newObject->m_HelpFile = m_HelpFile; newObject->m_IsValidHelpFile = m_IsValidHelpFile; // ##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 CError::GetTargetNamespace() const { return _T(""); } std::tstring CError::GetNamespace() const { return _T(""); } LtXmlLib20::CXmlObjectBase* CError::GetBase() { return this; } void CError::CleanMetaData() { LtXmlLib20::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo); } LtXmlLib20Data::CParentElementInfo* CError::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("Error"), _T(""), true, false, -1, LtXmlLib20::ItemType_none, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_None, NULL, false); } m_csInit.Leave(); } return ms_pParentElementInfo; } LtXmlLib20Data::CElementInfo** CError::GetClassElementInfo() const { if (ms_ppElementInfo == NULL) { m_csInit.Enter(); if (ms_ppElementInfo == NULL) { ms_ppElementInfo = new LtXmlLib20Data::CElementInfo*[4]; ms_ppElementInfo[0] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("ErrorCode"), _T(""), 1, false, LtXmlLib20::ItemType_i4, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Collapse, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[1] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("ErrorDescription"), _T(""), 2, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[2] = new LtXmlLib20Data::CElementInfoSeqPrimOpt(_T("HelpFile"), _T(""), 3, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[3] = NULL; } m_csInit.Leave(); } return ms_ppElementInfo; } LtXmlLib20Data::CAttributeInfo** CError::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 |
Error.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: MusicStore.xsd **********************************************************************************************/ #ifndef _MusicStoreLib_MusicStoreLib_CError_h #define _MusicStoreLib_MusicStoreLib_CError_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 MusicStoreLib { class CClassFactory; }; namespace MusicStoreLib { /* * CError * * This class wraps the element Error in the schema */ class MusicStoreLib_DLL CError : public CInstanceMonitor , public virtual MusicStoreLib::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 MusicStoreLib::CErrorPtr CreateInstance(LPCTSTR lpctElementName=_T("Error")); protected: CError(LPCTSTR lpctElementName=_T("Error")); virtual ~CError(); friend class MusicStoreLib::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: LONG GetErrorCode() const; void SetErrorCode(LONG val); protected: LONG m_ErrorCode; public: std::tstring GetErrorDescription() const; void SetErrorDescription(std::tstring val); protected: std::tstring m_ErrorDescription; public: std::tstring GetHelpFile() const; void SetHelpFile(std::tstring val); bool IsValidHelpFile() const; void SetValidHelpFile(bool val); protected: bool m_IsValidHelpFile; std::tstring m_HelpFile; public: // Performs a 'deep copy' of all the data in the class (and its children) virtual MusicStoreLib::CErrorPtr 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 (MusicStoreLib) #endif // _MusicStoreLib_CError_h |
PriceFilter.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: MusicStore.xsd **********************************************************************************************/ #include "StdAfx.h" #pragma warning (push) #pragma warning (disable:4251) // template export warning #pragma warning (disable:4786) // long debug names #include "../MusicStoreLib.h" #include "../MusicStoreLib/PriceFilter.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 : PriceFilter // Long Name : PriceFilter // Element Name : PriceFilter // Class Namespace : MusicStoreLib // Namespace Alias : // Schema Namespace : // Mapped Class Name : CPriceFilter // Mapped Class Full Name : MusicStoreLib::CPriceFilter // Mapped Class File Name : CPriceFilter // IsAbstract : False // IsElement : True // IsComplexType : True namespace MusicStoreLib { LtXmlLib20Data::CParentElementInfo* CPriceFilter::ms_pParentElementInfo = NULL; LtXmlLib20Data::CAttributeInfo** CPriceFilter::ms_ppAttributeInfo = NULL; LtXmlLib20Data::CElementInfo** CPriceFilter::ms_ppElementInfo = NULL; CPriceFilterPtr CPriceFilter::CreateInstance(LPCTSTR lpctElementName/*=_T("PriceFilter")*/) { return new MusicStoreLib::CPriceFilter(lpctElementName); } /* * Constructor for CPriceFilter * * 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 MusicStore.xsd */ CPriceFilter::CPriceFilter(LPCTSTR lpctElementName/*=_T("PriceFilter")*/) : CInstanceMonitor(_T("CPriceFilter")) { m_elementName = lpctElementName; Init(); } CPriceFilter::~CPriceFilter() { Cleanup(); } void CPriceFilter::Cleanup() { // unregister for any events we have asked for // cos there'll be no one left to hear soon } void CPriceFilter::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 MusicStore.xsd. */ void CPriceFilter::Init() { Cleanup(); this->m_MinPrice = 0; this->m_IsValidMinPrice = false; this->m_MaxPrice = 0; this->m_IsValidMaxPrice = false; // ##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 CPriceFilter::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib20::LtVariant& rValue) { if (bRead) { switch(iPropertyIndex) { case 1: if (IsValidMinPrice()) rValue.SetR8(GetMinPrice()); else rValue.SetInvalid(); break; case 2: if (IsValidMaxPrice()) rValue.SetR8(GetMaxPrice()); else rValue.SetInvalid(); break; default: throw LtXmlLib20::CLtException(_T("Unknown Property Index")); }; } else { switch(iPropertyIndex) { case 1: if (rValue.IsValid()) SetMinPrice(rValue.GetR8()); else SetValidMinPrice(false); break; case 2: if (rValue.IsValid()) SetMaxPrice(rValue.GetR8()); else SetValidMaxPrice(false); break; default: throw LtXmlLib20::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 not valid. */ DOUBLE CPriceFilter::GetMinPrice() const { if (m_IsValidMinPrice == false) throw LtXmlLib20::CLtInvalidStateException(_T("The Property GetMinPrice is not valid. SetMinPrice must be called first")); return this->m_MinPrice; } void CPriceFilter::SetMinPrice(DOUBLE value) { this->m_IsValidMinPrice = true; this->m_MinPrice = value; } /* * Indicates if GetMinPrice contains a valid value. * * true if the value for GetMinPrice is valid, false if not. * If this is set to true then the property is considered valid, and assigned its * default value (0). * If its set to false then its made invalid, and subsequent calls to GetMinPrice * will raise an exception. */ bool CPriceFilter::IsValidMinPrice() const { return m_IsValidMinPrice; } void CPriceFilter::SetValidMinPrice(bool value) { if (value != m_IsValidMinPrice) { this->m_MinPrice = 0; m_IsValidMinPrice = 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. */ DOUBLE CPriceFilter::GetMaxPrice() const { if (m_IsValidMaxPrice == false) throw LtXmlLib20::CLtInvalidStateException(_T("The Property GetMaxPrice is not valid. SetMaxPrice must be called first")); return this->m_MaxPrice; } void CPriceFilter::SetMaxPrice(DOUBLE value) { this->m_IsValidMaxPrice = true; this->m_MaxPrice = value; } /* * Indicates if GetMaxPrice contains a valid value. * * true if the value for GetMaxPrice is valid, false if not. * If this is set to true then the property is considered valid, and assigned its * default value (0). * If its set to false then its made invalid, and subsequent calls to GetMaxPrice * will raise an exception. */ bool CPriceFilter::IsValidMaxPrice() const { return m_IsValidMaxPrice; } void CPriceFilter::SetValidMaxPrice(bool value) { if (value != m_IsValidMaxPrice) { this->m_MaxPrice = 0; m_IsValidMaxPrice = value; } } /* * Allows the class to be copied * Performs a 'deep copy' of all the data in the class (and its children) */ MusicStoreLib::CPriceFilterPtr CPriceFilter::Clone() const { MusicStoreLib::CPriceFilterPtr newObject = CreateInstance(m_elementName.c_str()); int index = 0; newObject->m_MinPrice = m_MinPrice; newObject->m_IsValidMinPrice = m_IsValidMinPrice; newObject->m_MaxPrice = m_MaxPrice; newObject->m_IsValidMaxPrice = m_IsValidMaxPrice; // ##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 CPriceFilter::GetTargetNamespace() const { return _T(""); } std::tstring CPriceFilter::GetNamespace() const { return _T(""); } LtXmlLib20::CXmlObjectBase* CPriceFilter::GetBase() { return this; } void CPriceFilter::CleanMetaData() { LtXmlLib20::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo); } LtXmlLib20Data::CParentElementInfo* CPriceFilter::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("PriceFilter"), _T(""), true, false, -1, LtXmlLib20::ItemType_none, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_None, NULL, false); } m_csInit.Leave(); } return ms_pParentElementInfo; } LtXmlLib20Data::CElementInfo** CPriceFilter::GetClassElementInfo() const { if (ms_ppElementInfo == NULL) { m_csInit.Enter(); if (ms_ppElementInfo == NULL) { ms_ppElementInfo = new LtXmlLib20Data::CElementInfo*[3]; ms_ppElementInfo[0] = new LtXmlLib20Data::CElementInfoSeqPrimOpt(_T("MinPrice"), _T(""), 1, false, LtXmlLib20::ItemType_r8, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Collapse, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[1] = new LtXmlLib20Data::CElementInfoSeqPrimOpt(_T("MaxPrice"), _T(""), 2, false, LtXmlLib20::ItemType_r8, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Collapse, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[2] = NULL; } m_csInit.Leave(); } return ms_ppElementInfo; } LtXmlLib20Data::CAttributeInfo** CPriceFilter::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 |
PriceFilter.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: MusicStore.xsd **********************************************************************************************/ #ifndef _MusicStoreLib_MusicStoreLib_CPriceFilter_h #define _MusicStoreLib_MusicStoreLib_CPriceFilter_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 MusicStoreLib { class CClassFactory; }; namespace MusicStoreLib { /* * CPriceFilter * * This class wraps the element PriceFilter in the schema */ class MusicStoreLib_DLL CPriceFilter : public CInstanceMonitor , public virtual MusicStoreLib::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 MusicStoreLib::CPriceFilterPtr CreateInstance(LPCTSTR lpctElementName=_T("PriceFilter")); protected: CPriceFilter(LPCTSTR lpctElementName=_T("PriceFilter")); virtual ~CPriceFilter(); friend class MusicStoreLib::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: DOUBLE GetMinPrice() const; void SetMinPrice(DOUBLE val); bool IsValidMinPrice() const; void SetValidMinPrice(bool val); protected: bool m_IsValidMinPrice; DOUBLE m_MinPrice; public: DOUBLE GetMaxPrice() const; void SetMaxPrice(DOUBLE val); bool IsValidMaxPrice() const; void SetValidMaxPrice(bool val); protected: bool m_IsValidMaxPrice; DOUBLE m_MaxPrice; public: // Performs a 'deep copy' of all the data in the class (and its children) virtual MusicStoreLib::CPriceFilterPtr 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 (MusicStoreLib) #endif // _MusicStoreLib_CPriceFilter_h |
Result.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: MusicStore.xsd **********************************************************************************************/ #include "StdAfx.h" #pragma warning (push) #pragma warning (disable:4251) // template export warning #pragma warning (disable:4786) // long debug names #include "../MusicStoreLib.h" #include "../MusicStoreLib/Result.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 : Result // Long Name : Result // Element Name : Result // Class Namespace : MusicStoreLib // Namespace Alias : // Schema Namespace : // Mapped Class Name : CResult // Mapped Class Full Name : MusicStoreLib::CResult // Mapped Class File Name : CResult // IsAbstract : False // IsElement : True // IsComplexType : True namespace MusicStoreLib { LtXmlLib20Data::CParentElementInfo* CResult::ms_pParentElementInfo = NULL; LtXmlLib20Data::CAttributeInfo** CResult::ms_ppAttributeInfo = NULL; LtXmlLib20Data::CElementInfo** CResult::ms_ppElementInfo = NULL; CResultPtr CResult::CreateInstance(LPCTSTR lpctElementName/*=_T("Result")*/) { return new MusicStoreLib::CResult(lpctElementName); } /* * Constructor for CResult * * 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 MusicStore.xsd */ CResult::CResult(LPCTSTR lpctElementName/*=_T("Result")*/) : CInstanceMonitor(_T("CResult")) , m_SearchDate(LtXmlLib20::CDateTime::dt_date) { m_elementName = lpctElementName; Init(); } CResult::~CResult() { Cleanup(); } void CResult::Cleanup() { // unregister for any events we have asked for // cos there'll be no one left to hear soon this->m_Product = NULL; } void CResult::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 MusicStore.xsd. */ void CResult::Init() { Cleanup(); this->m_SearchDate = LtXmlLib20::CDateTime(LtXmlLib20::CDateTime::dt_date); this->m_Product = dynamic_cast<MusicStoreLib::CAlbumTypeCol*>(MusicStoreLib::CClassFactory::CreateClassCollection(MusicStoreLib::CClassFactory::ClsName_CAlbumTypeCol, _T("Product"), _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 CResult::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib20::LtVariant& rValue) { if (bRead) { switch(iPropertyIndex) { case 1: rValue.SetDate(GetSearchDate()); break; case 2: rValue.SetXmlCollection(GetProduct().Ptr()); break; default: throw LtXmlLib20::CLtException(_T("Unknown Property Index")); }; } else { switch(iPropertyIndex) { case 1: SetSearchDate(rValue.GetDate()); break; case 2: 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 LtXmlLib20::CDateTime(LtXmlLib20::CDateTime::dt_date). */ LtXmlLib20::CDateTime CResult::GetSearchDate() const { return this->m_SearchDate; } void CResult::SetSearchDate(LtXmlLib20::CDateTime value) { this->m_SearchDate.SetDateTime(value, this->m_SearchDate.GetType()); } /* * A collection of CResults * * * This property is represented as an Element in the XML. * This collection may contain 0 to Many objects. */ MusicStoreLib::CAlbumTypeColPtr CResult::GetProduct() const { return this->m_Product; } /* * Allows the class to be copied * Performs a 'deep copy' of all the data in the class (and its children) */ MusicStoreLib::CResultPtr CResult::Clone() const { MusicStoreLib::CResultPtr newObject = CreateInstance(m_elementName.c_str()); int index = 0; newObject->m_SearchDate = m_SearchDate; for (index = 0; index < m_Product->GetCount(); index++) newObject->m_Product->Add(dynamic_cast<MusicStoreLib::CAlbumType*>(m_Product->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 CResult::GetTargetNamespace() const { return _T(""); } std::tstring CResult::GetNamespace() const { return _T(""); } LtXmlLib20::CXmlObjectBase* CResult::GetBase() { return this; } void CResult::CleanMetaData() { LtXmlLib20::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo); } LtXmlLib20Data::CParentElementInfo* CResult::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("Result"), _T(""), true, false, -1, LtXmlLib20::ItemType_none, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_None, NULL, false); } m_csInit.Leave(); } return ms_pParentElementInfo; } LtXmlLib20Data::CElementInfo** CResult::GetClassElementInfo() const { if (ms_ppElementInfo == NULL) { m_csInit.Enter(); if (ms_ppElementInfo == NULL) { ms_ppElementInfo = new LtXmlLib20Data::CElementInfo*[3]; ms_ppElementInfo[0] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("SearchDate"), _T(""), 1, false, LtXmlLib20::ItemType_date, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Collapse, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[1] = new LtXmlLib20Data::CElementInfoSeqClsCol(_T("Product"), _T(""), 2, LtXmlLib20Data::XmlElementType_ELEMENT); ms_ppElementInfo[2] = NULL; } m_csInit.Leave(); } return ms_ppElementInfo; } LtXmlLib20Data::CAttributeInfo** CResult::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 |
Result.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: MusicStore.xsd **********************************************************************************************/ #ifndef _MusicStoreLib_MusicStoreLib_CResult_h #define _MusicStoreLib_MusicStoreLib_CResult_h // Include Base classes #include "../MusicStoreLib/AlbumTypeCol.h" #include "../MusicStoreLib/AlbumType.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 MusicStoreLib { class CClassFactory; }; namespace MusicStoreLib { /* * CResult * * This class wraps the element Result in the schema */ class MusicStoreLib_DLL CResult : public CInstanceMonitor , public virtual MusicStoreLib::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 MusicStoreLib::CResultPtr CreateInstance(LPCTSTR lpctElementName=_T("Result")); protected: CResult(LPCTSTR lpctElementName=_T("Result")); virtual ~CResult(); friend class MusicStoreLib::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: LtXmlLib20::CDateTime GetSearchDate() const; void SetSearchDate(LtXmlLib20::CDateTime val); protected: LtXmlLib20::CDateTime m_SearchDate; public: MusicStoreLib::CAlbumTypeColPtr GetProduct() const; protected: MusicStoreLib::CAlbumTypeColPtr m_Product; public: // Performs a 'deep copy' of all the data in the class (and its children) virtual MusicStoreLib::CResultPtr 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 (MusicStoreLib) #endif // _MusicStoreLib_CResult_h |
SearchRequest.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: MusicStore.xsd **********************************************************************************************/ #include "StdAfx.h" #pragma warning (push) #pragma warning (disable:4251) // template export warning #pragma warning (disable:4786) // long debug names #include "../MusicStoreLib.h" #include "../MusicStoreLib/SearchRequest.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 : SearchRequest // Long Name : SearchRequest // Element Name : SearchRequest // Class Namespace : MusicStoreLib // Namespace Alias : // Schema Namespace : // Mapped Class Name : CSearchRequest // Mapped Class Full Name : MusicStoreLib::CSearchRequest // Mapped Class File Name : CSearchRequest // IsAbstract : False // IsElement : True // IsComplexType : False namespace MusicStoreLib { LtXmlLib20Data::CParentElementInfo* CSearchRequest::ms_pParentElementInfo = NULL; LtXmlLib20Data::CAttributeInfo** CSearchRequest::ms_ppAttributeInfo = NULL; LtXmlLib20Data::CElementInfo** CSearchRequest::ms_ppElementInfo = NULL; CSearchRequestPtr CSearchRequest::CreateInstance(LPCTSTR lpctElementName/*=_T("SearchRequest")*/) { return new MusicStoreLib::CSearchRequest(lpctElementName); } /* * Constructor for CSearchRequest * * 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 MusicStore.xsd */ CSearchRequest::CSearchRequest(LPCTSTR lpctElementName/*=_T("SearchRequest")*/) : CInstanceMonitor(_T("CSearchRequest")) { m_elementName = lpctElementName; Init(); } CSearchRequest::~CSearchRequest() { Cleanup(); } void CSearchRequest::Cleanup() { // unregister for any events we have asked for // cos there'll be no one left to hear soon } void CSearchRequest::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 MusicStore.xsd. */ void CSearchRequest::Init() { Cleanup(); this->m_PriceFilter = dynamic_cast<MusicStoreLib::CPriceFilter*>(MusicStoreLib::CClassFactory::CreateClass(MusicStoreLib::CClassFactory::ClsName_CPriceFilter, _T("PriceFilter")).Ptr()); this->m_NameFilter = _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 CSearchRequest::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib20::LtVariant& rValue) { if (bRead) { switch(iPropertyIndex) { case 1: rValue.SetXmlObject(GetPriceFilter().Ptr()); break; case 2: rValue.SetString(GetNameFilter()); break; default: throw LtXmlLib20::CLtException(_T("Unknown Property Index")); }; } else { switch(iPropertyIndex) { case 1: SetPriceFilter(dynamic_cast<MusicStoreLib::CPriceFilter*>(rValue.GetXmlObject().Ptr())); break; case 2: SetNameFilter(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. * If this property is set, then the object will be COPIED. If the property is set to NULL an exception is raised. */ MusicStoreLib::CPriceFilterPtr CSearchRequest::GetPriceFilter() const { return this->m_PriceFilter; } void CSearchRequest::SetPriceFilter(MusicStoreLib::CPriceFilter* value) { Throw_IfPropertyIsNull(value, _T("PriceFilter")); if (value != NULL) SetElementName(value, _T("PriceFilter")); this->m_PriceFilter = 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 CSearchRequest::GetNameFilter() const { return this->m_NameFilter; } void CSearchRequest::SetNameFilter(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); this->m_NameFilter = value; } /* * Allows the class to be copied * Performs a 'deep copy' of all the data in the class (and its children) */ MusicStoreLib::CSearchRequestPtr CSearchRequest::Clone() const { MusicStoreLib::CSearchRequestPtr newObject = CreateInstance(m_elementName.c_str()); int index = 0; newObject->m_PriceFilter = NULL; if (m_PriceFilter != NULL) newObject->m_PriceFilter = dynamic_cast<MusicStoreLib::CPriceFilter*>(m_PriceFilter->Clone().Ptr()); newObject->m_NameFilter = m_NameFilter; // ##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 CSearchRequest::GetTargetNamespace() const { return _T(""); } std::tstring CSearchRequest::GetNamespace() const { return _T(""); } LtXmlLib20::CXmlObjectBase* CSearchRequest::GetBase() { return this; } void CSearchRequest::CleanMetaData() { LtXmlLib20::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo); } LtXmlLib20Data::CParentElementInfo* CSearchRequest::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("SearchRequest"), _T(""), true, false, -1, LtXmlLib20::ItemType_none, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_None, NULL, false); } m_csInit.Leave(); } return ms_pParentElementInfo; } LtXmlLib20Data::CElementInfo** CSearchRequest::GetClassElementInfo() const { if (ms_ppElementInfo == NULL) { m_csInit.Enter(); if (ms_ppElementInfo == NULL) { ms_ppElementInfo = new LtXmlLib20Data::CElementInfo*[3]; ms_ppElementInfo[0] = new LtXmlLib20Data::CElementInfoSeqClsMnd(_T("PriceFilter"), _T(""), 1, LtXmlLib20Data::XmlElementType_ELEMENT, (LtXmlLib20Data::pfnCreateClassDef)&MusicStoreLib::CClassFactory::CreateClass, MusicStoreLib::CClassFactory::ClsName_CPriceFilter, false); ms_ppElementInfo[1] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("NameFilter"), _T(""), 2, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[2] = NULL; } m_csInit.Leave(); } return ms_ppElementInfo; } LtXmlLib20Data::CAttributeInfo** CSearchRequest::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 |
SearchRequest.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: MusicStore.xsd **********************************************************************************************/ #ifndef _MusicStoreLib_MusicStoreLib_CSearchRequest_h #define _MusicStoreLib_MusicStoreLib_CSearchRequest_h // Include Base classes #include "../MusicStoreLib/PriceFilter.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 MusicStoreLib { class CClassFactory; }; namespace MusicStoreLib { /* * CSearchRequest * * This class wraps the element SearchRequest in the schema */ class MusicStoreLib_DLL CSearchRequest : public CInstanceMonitor , public virtual MusicStoreLib::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 MusicStoreLib::CSearchRequestPtr CreateInstance(LPCTSTR lpctElementName=_T("SearchRequest")); protected: CSearchRequest(LPCTSTR lpctElementName=_T("SearchRequest")); virtual ~CSearchRequest(); friend class MusicStoreLib::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: MusicStoreLib::CPriceFilterPtr GetPriceFilter() const; void SetPriceFilter(MusicStoreLib::CPriceFilter* value); protected: MusicStoreLib::CPriceFilterPtr m_PriceFilter; public: std::tstring GetNameFilter() const; void SetNameFilter(std::tstring val); protected: std::tstring m_NameFilter; public: // Performs a 'deep copy' of all the data in the class (and its children) virtual MusicStoreLib::CSearchRequestPtr 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 (MusicStoreLib) #endif // _MusicStoreLib_CSearchRequest_h |
SearchResponse.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: MusicStore.xsd **********************************************************************************************/ #include "StdAfx.h" #pragma warning (push) #pragma warning (disable:4251) // template export warning #pragma warning (disable:4786) // long debug names #include "../MusicStoreLib.h" #include "../MusicStoreLib/SearchResponse.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 : SearchResponse // Long Name : SearchResponse // Element Name : SearchResponse // Class Namespace : MusicStoreLib // Namespace Alias : // Schema Namespace : // Mapped Class Name : CSearchResponse // Mapped Class Full Name : MusicStoreLib::CSearchResponse // Mapped Class File Name : CSearchResponse // IsAbstract : False // IsElement : True // IsComplexType : False namespace MusicStoreLib { LtXmlLib20Data::CParentElementInfo* CSearchResponse::ms_pParentElementInfo = NULL; LtXmlLib20Data::CAttributeInfo** CSearchResponse::ms_ppAttributeInfo = NULL; LtXmlLib20Data::CElementInfo** CSearchResponse::ms_ppElementInfo = NULL; CSearchResponsePtr CSearchResponse::CreateInstance(LPCTSTR lpctElementName/*=_T("SearchResponse")*/) { return new MusicStoreLib::CSearchResponse(lpctElementName); } /* * Constructor for CSearchResponse * * 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 MusicStore.xsd */ CSearchResponse::CSearchResponse(LPCTSTR lpctElementName/*=_T("SearchResponse")*/) : CInstanceMonitor(_T("CSearchResponse")) { m_elementName = lpctElementName; Init(); } CSearchResponse::~CSearchResponse() { Cleanup(); } void CSearchResponse::Cleanup() { // unregister for any events we have asked for // cos there'll be no one left to hear soon } void CSearchResponse::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 MusicStore.xsd. */ void CSearchResponse::Init() { Cleanup(); this->m_Result = NULL; this->m_Error = 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 CSearchResponse::ClearChoice(LPCTSTR lpctSelectedElement) { this->m_Result = NULL; this->m_Error = NULL; m_validElement = lpctSelectedElement; } void CSearchResponse::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib20::LtVariant& rValue) { if (bRead) { switch(iPropertyIndex) { case 1: rValue.SetXmlObject(GetResult().Ptr()); break; case 2: rValue.SetXmlObject(GetError().Ptr()); break; default: throw LtXmlLib20::CLtException(_T("Unknown Property Index")); }; } else { switch(iPropertyIndex) { case 1: SetResult(dynamic_cast<MusicStoreLib::CResult*>(rValue.GetXmlObject().Ptr())); break; case 2: SetError(dynamic_cast<MusicStoreLib::CError*>(rValue.GetXmlObject().Ptr())); break; default: throw LtXmlLib20::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 */ MusicStoreLib::CResultPtr CSearchResponse::GetResult() const { return this->m_Result; } void CSearchResponse::SetResult(MusicStoreLib::CResult* value) { // Ensure only on element is populated at a time ClearChoice(value == NULL?_T(""):_T("Result")); if (value == NULL) this->m_Result = NULL; else { SetElementName(value, _T("Result")); this->m_Result = 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. * 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 */ MusicStoreLib::CErrorPtr CSearchResponse::GetError() const { return this->m_Error; } void CSearchResponse::SetError(MusicStoreLib::CError* value) { // Ensure only on element is populated at a time ClearChoice(value == NULL?_T(""):_T("Error")); if (value == NULL) this->m_Error = NULL; else { SetElementName(value, _T("Error")); this->m_Error = value; } } std::tstring CSearchResponse::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) */ MusicStoreLib::CSearchResponsePtr CSearchResponse::Clone() const { MusicStoreLib::CSearchResponsePtr newObject = CreateInstance(m_elementName.c_str()); int index = 0; newObject->m_Result = NULL; if (m_Result != NULL) newObject->m_Result = dynamic_cast<MusicStoreLib::CResult*>(m_Result->Clone().Ptr()); newObject->m_Error = NULL; if (m_Error != NULL) newObject->m_Error = dynamic_cast<MusicStoreLib::CError*>(m_Error->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 CSearchResponse::GetTargetNamespace() const { return _T(""); } std::tstring CSearchResponse::GetNamespace() const { return _T(""); } LtXmlLib20::CXmlObjectBase* CSearchResponse::GetBase() { return this; } void CSearchResponse::CleanMetaData() { LtXmlLib20::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo); } LtXmlLib20Data::CParentElementInfo* CSearchResponse::GetClassInfo() const { if (ms_pParentElementInfo == NULL) { m_csInit.Enter(); if (ms_pParentElementInfo == NULL) { ms_pParentElementInfo = new LtXmlLib20Data::CParentElementInfo( LtXmlLib20Data::XmlElementGroupType_CHOICE, LtXmlLib20Data::XmlElementType_ELEMENT, _T("SearchResponse"), _T(""), true, false, -1, LtXmlLib20::ItemType_none, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_None, NULL, false); } m_csInit.Leave(); } return ms_pParentElementInfo; } LtXmlLib20Data::CElementInfo** CSearchResponse::GetClassElementInfo() const { if (ms_ppElementInfo == NULL) { m_csInit.Enter(); if (ms_ppElementInfo == NULL) { ms_ppElementInfo = new LtXmlLib20Data::CElementInfo*[3]; ms_ppElementInfo[0] = new LtXmlLib20Data::CElementInfoChoiceClsOpt(_T("Result"), _T(""), 1, LtXmlLib20Data::XmlElementType_ELEMENT, (LtXmlLib20Data::pfnCreateClassDef)MusicStoreLib::CClassFactory::CreateClass, MusicStoreLib::CClassFactory::ClsName_CResult); ms_ppElementInfo[1] = new LtXmlLib20Data::CElementInfoChoiceClsOpt(_T("Error"), _T(""), 2, LtXmlLib20Data::XmlElementType_ELEMENT, (LtXmlLib20Data::pfnCreateClassDef)MusicStoreLib::CClassFactory::CreateClass, MusicStoreLib::CClassFactory::ClsName_CError); ms_ppElementInfo[2] = NULL; } m_csInit.Leave(); } return ms_ppElementInfo; } LtXmlLib20Data::CAttributeInfo** CSearchResponse::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 |
SearchResponse.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: MusicStore.xsd **********************************************************************************************/ #ifndef _MusicStoreLib_MusicStoreLib_CSearchResponse_h #define _MusicStoreLib_MusicStoreLib_CSearchResponse_h // Include Base classes #include "../MusicStoreLib/Result.h" #include "../MusicStoreLib/Error.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 MusicStoreLib { class CClassFactory; }; namespace MusicStoreLib { /* * CSearchResponse * * This class wraps the element SearchResponse in the schema */ class MusicStoreLib_DLL CSearchResponse : public CInstanceMonitor , public virtual MusicStoreLib::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 MusicStoreLib::CSearchResponsePtr CreateInstance(LPCTSTR lpctElementName=_T("SearchResponse")); protected: CSearchResponse(LPCTSTR lpctElementName=_T("SearchResponse")); virtual ~CSearchResponse(); friend class MusicStoreLib::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); void ClearChoice(LPCTSTR selectedElement); public: MusicStoreLib::CResultPtr GetResult() const; void SetResult(MusicStoreLib::CResult* value); protected: MusicStoreLib::CResultPtr m_Result; public: MusicStoreLib::CErrorPtr GetError() const; void SetError(MusicStoreLib::CError* value); protected: MusicStoreLib::CErrorPtr m_Error; 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 MusicStoreLib::CSearchResponsePtr 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 (MusicStoreLib) #endif // _MusicStoreLib_CSearchResponse_h |
TrackType.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: MusicStore.xsd **********************************************************************************************/ #include "StdAfx.h" #pragma warning (push) #pragma warning (disable:4251) // template export warning #pragma warning (disable:4786) // long debug names #include "../MusicStoreLib.h" #include "../MusicStoreLib/TrackType.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 : TrackType // Long Name : TrackType // Element Name : TrackType // Class Namespace : MusicStoreLib // Namespace Alias : // Schema Namespace : // Mapped Class Name : CTrackType // Mapped Class Full Name : MusicStoreLib::CTrackType // Mapped Class File Name : CTrackType // IsAbstract : False // IsElement : True // IsComplexType : True namespace MusicStoreLib { LtXmlLib20Data::CParentElementInfo* CTrackType::ms_pParentElementInfo = NULL; LtXmlLib20Data::CAttributeInfo** CTrackType::ms_ppAttributeInfo = NULL; LtXmlLib20Data::CElementInfo** CTrackType::ms_ppElementInfo = NULL; CTrackTypePtr CTrackType::CreateInstance(LPCTSTR lpctElementName/*=_T("TrackType")*/) { return new MusicStoreLib::CTrackType(lpctElementName); } /* * Constructor for CTrackType * * 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 MusicStore.xsd */ CTrackType::CTrackType(LPCTSTR lpctElementName/*=_T("TrackType")*/) : CInstanceMonitor(_T("CTrackType")) { m_elementName = lpctElementName; Init(); } CTrackType::~CTrackType() { Cleanup(); } void CTrackType::Cleanup() { // unregister for any events we have asked for // cos there'll be no one left to hear soon } void CTrackType::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 MusicStore.xsd. */ void CTrackType::Init() { Cleanup(); this->m_Title = _T(""); this->m_Length = LtXmlLib20::CDateTimeSpan(); // ##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 CTrackType::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib20::LtVariant& rValue) { if (bRead) { switch(iPropertyIndex) { case 1: rValue.SetString(GetTitle()); break; case 2: rValue.SetDuration(GetLength()); break; default: throw LtXmlLib20::CLtException(_T("Unknown Property Index")); }; } else { switch(iPropertyIndex) { case 1: SetTitle(rValue.GetString()); break; case 2: SetLength(rValue.GetDuration()); 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 CTrackType::GetTitle() const { return this->m_Title; } void CTrackType::SetTitle(std::tstring value) { // Apply whitespace rules appropriately value = LtXmlLib20::CWhitespaceUtils::Preserve(value); this->m_Title = 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::CDateTimeSpan(). */ LtXmlLib20::CDateTimeSpan CTrackType::GetLength() const { return this->m_Length; } void CTrackType::SetLength(LtXmlLib20::CDateTimeSpan value) { this->m_Length = value; } /* * Allows the class to be copied * Performs a 'deep copy' of all the data in the class (and its children) */ MusicStoreLib::CTrackTypePtr CTrackType::Clone() const { MusicStoreLib::CTrackTypePtr newObject = CreateInstance(m_elementName.c_str()); int index = 0; newObject->m_Title = m_Title; newObject->m_Length = m_Length; // ##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 CTrackType::GetTargetNamespace() const { return _T(""); } std::tstring CTrackType::GetNamespace() const { return _T(""); } LtXmlLib20::CXmlObjectBase* CTrackType::GetBase() { return this; } void CTrackType::CleanMetaData() { LtXmlLib20::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo); } LtXmlLib20Data::CParentElementInfo* CTrackType::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("TrackType"), _T(""), true, false, -1, LtXmlLib20::ItemType_none, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_None, NULL, false); } m_csInit.Leave(); } return ms_pParentElementInfo; } LtXmlLib20Data::CElementInfo** CTrackType::GetClassElementInfo() const { if (ms_ppElementInfo == NULL) { m_csInit.Enter(); if (ms_ppElementInfo == NULL) { ms_ppElementInfo = new LtXmlLib20Data::CElementInfo*[3]; ms_ppElementInfo[0] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("Title"), _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("Length"), _T(""), 2, false, LtXmlLib20::ItemType_duration, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Collapse, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL); ms_ppElementInfo[2] = NULL; } m_csInit.Leave(); } return ms_ppElementInfo; } LtXmlLib20Data::CAttributeInfo** CTrackType::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 |
TrackType.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: MusicStore.xsd **********************************************************************************************/ #ifndef _MusicStoreLib_MusicStoreLib_CTrackType_h #define _MusicStoreLib_MusicStoreLib_CTrackType_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 MusicStoreLib { class CClassFactory; }; namespace MusicStoreLib { /* * CTrackType * * This class wraps the element TrackType in the schema */ class MusicStoreLib_DLL CTrackType : public CInstanceMonitor , public virtual MusicStoreLib::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 MusicStoreLib::CTrackTypePtr CreateInstance(LPCTSTR lpctElementName=_T("TrackType")); protected: CTrackType(LPCTSTR lpctElementName=_T("TrackType")); virtual ~CTrackType(); friend class MusicStoreLib::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 GetTitle() const; void SetTitle(std::tstring val); protected: std::tstring m_Title; public: LtXmlLib20::CDateTimeSpan GetLength() const; void SetLength(LtXmlLib20::CDateTimeSpan val); protected: LtXmlLib20::CDateTimeSpan m_Length; public: // Performs a 'deep copy' of all the data in the class (and its children) virtual MusicStoreLib::CTrackTypePtr 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 (MusicStoreLib) #endif // _MusicStoreLib_CTrackType_h |
TrackTypeCol.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: MusicStore.xsd **********************************************************************************************/ #include "StdAfx.h" #pragma warning( disable : 4786 ) #pragma warning( disable : 4251 ) #include "../MusicStoreLib.h" #include "../MusicStoreLib/TrackTypeCol.h" #include "../MusicStoreLib/TrackType.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 MusicStoreLib { /* * 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. */ CTrackTypeCol::CTrackTypeCol(LPCTSTR lpctElementName, LPCTSTR lpctNamespaceUri, int minOccurs, int maxOccurs) : CXmlCollectionCommonBase(lpctElementName, lpctNamespaceUri, minOccurs, maxOccurs), CInstanceMonitor(_T("CTrackTypeCol")) { } /* * Adds a MusicStoreLib::CTrackType to the collection */ void CTrackTypeCol::Add(MusicStoreLib::CTrackType* pCls) { SetElementName(pCls, m_elementName.c_str()); AppendItem(pCls); } void CTrackTypeCol::AddAt(int index, MusicStoreLib::CTrackType* pCls) { SetElementName(pCls, m_elementName.c_str()); AddItemAt(index, pCls); } /* * Create a new MusicStoreLib::CTrackType object and adds it the collection */ MusicStoreLib::CTrackTypePtr CTrackTypeCol::Add() { CSmartPtr<LtXmlLib20::CXmlObjectBase> spCls = MusicStoreLib::CClassFactory::CreateClass(MusicStoreLib::CClassFactory::ClsName_CTrackType, m_elementName.c_str()); AppendItem(spCls); return dynamic_cast<MusicStoreLib::CTrackType*>(spCls.Ptr()); } /* * Gets a CTrackType object from the collection (0 based) */ CSmartPtr<MusicStoreLib::CTrackType> CTrackTypeCol::Item(int index) const { return dynamic_cast<MusicStoreLib::CTrackType*>(GetNodeAtIndex(index)->spObj.Ptr()); } /* * Removes the object from the collection */ void CTrackTypeCol::Remove(MusicStoreLib::CTrackType* pCls) { RemoveNode(GetNodeForItem(pCls)); } /* * Gets a representation of the class as XML - Marshalls Objects to XML */ void CTrackTypeCol::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* CTrackTypeCol::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 = MusicStoreLib::CClassFactory::CreateClass(MusicStoreLib::CClassFactory::ClsName_CTrackType, 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; } CTrackTypeCol::iterator CTrackTypeCol::begin() { return m_pHead; } CTrackTypeCol::iterator CTrackTypeCol::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 |
TrackTypeCol.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: MusicStore.xsd **********************************************************************************************/ #ifndef _MusicStoreLib_MusicStoreLib_CTrackTypeCol_h #define _MusicStoreLib_MusicStoreLib_CTrackTypeCol_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 MusicStoreLib { class MusicStoreLib_DLL CTrackTypeCol : public MusicStoreLib::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: CTrackTypeCol(LPCTSTR lpctElementName, LPCTSTR lpctNamespaceUri, int minOccurs, int maxOccurs); public: MusicStoreLib::CTrackTypePtr Add(); void Add(MusicStoreLib::CTrackType* pCls); void AddAt(int index, MusicStoreLib::CTrackType* pCls); MusicStoreLib::CTrackTypePtr Item(int index) const; void Remove(MusicStoreLib::CTrackType* pCls); typedef LtXmlLib20::CLtIterator<MusicStoreLib::CTrackType> iterator; typedef LtXmlLib20::CLtConstIterator<MusicStoreLib::CTrackType> 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 MusicStoreLib::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 (MusicStoreLib) #endif // _MusicStoreLib_CTrackTypeCol_h |
Main Menu | Samples List |