In This Topic
    Result.cpp
    In This Topic
    /**********************************************************************************************
     * 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