Liquid XML Data Binder 2021
In This Topic
    DVD.cpp
    In This Topic
    /**********************************************************************************************
     * Copyright (c) 2001-2021 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 17.0.1.9233
     * Using Schema: SimpleSequence.xsd
     **********************************************************************************************/
    #include "StdAfx.h" 
    #pragma warning (push) 
    #pragma warning (disable:4251)  // template export warning 
    #pragma warning (disable:4786)  // long debug names 
    #include "../SimpleSequenceLib.h" 
    #include "../SimpleSequenceLib/DVD.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                    : DVD
    // Long Name               : DVD
    // Element Name            : DVD
    // Class Namespace         : SimpleSequenceLib
    // Namespace Alias         : 
    // Schema Namespace        : 
    // Mapped Class Name       : CDVD
    // Mapped Class Full Name  : SimpleSequenceLib::CDVD
    // Mapped Class File Name  : CDVD
    // IsAbstract              : False
    // IsElement               : True
    // IsComplexType           : False
    
    namespace SimpleSequenceLib
    {
    
    LtXmlLib19Data::CParentElementInfo* CDVD::ms_pParentElementInfo = NULL;
    LtXmlLib19Data::CAttributeInfo** CDVD::ms_ppAttributeInfo = NULL;
    LtXmlLib19Data::CElementInfo** CDVD::ms_ppElementInfo = NULL;
    
    CDVDPtr CDVD::CreateInstance(LPCTSTR lpctElementName/*=_T("DVD")*/)
    {
        return new SimpleSequenceLib::CDVD(lpctElementName);
    }
    
    /*  
     * Constructor for CDVD
     *
     * 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 SimpleSequence.xsd
     */
    CDVD::CDVD(LPCTSTR lpctElementName/*=_T("DVD")*/)
     : CInstanceMonitor(_T("CDVD"))
     , m_ReleaseDate(LtXmlLib19::CDateTime::dt_date)
    {
        m_elementName = lpctElementName;
        Init();
    }
    
    CDVD::~CDVD()
    {
        Cleanup();
    }
    
    void CDVD::Cleanup()
    {
        // unregister for any events we have asked for
        // cos there'll be no one left to hear soon
    }
    
    void CDVD::OnEvent(LtXmlLib19::CXmlObjectBase* pMsgSource, LtXmlLib19::IEventSink::MsgType eMsgType, void* pData)
    {
        if (eMsgType == LtXmlLib19::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 SimpleSequence.xsd.
     */
    void CDVD::Init()
    {
        Cleanup();
    
        this->m_Genre = _T("");
        this->m_IsValidGenre = false;
        this->m_Cost = 0;
        this->m_Title = _T("");
        this->m_Description = _T("");
        this->m_ReleaseDate = LtXmlLib19::CDateTime(LtXmlLib19::CDateTime::dt_date);
        
    
    
    // ##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 CDVD::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib19::LtVariant& rValue)
    {
        if (bRead)
        {
            switch(iPropertyIndex)
            {
            case 1:
                if (IsValidGenre())
                    rValue.SetString(GetGenre());
                else
                    rValue.SetInvalid();
                break;
            case 2:
                    rValue.SetR8(GetCost());
                break;
            case 3:
                    rValue.SetString(GetTitle());
                break;
            case 4:
                    rValue.SetString(GetDescription());
                break;
            case 5:
                    rValue.SetDate(GetReleaseDate());
                break;
            default:
                throw LtXmlLib19::CLtException(_T("Unknown Property Index"));
            };
        }
        else
        {
            switch(iPropertyIndex)
            {
            case 1:
                if (rValue.IsValid())
                    SetGenre(rValue.GetString());
                else
                    SetValidGenre(false);
                break;
            case 2:
                SetCost(rValue.GetR8());
                break;
            case 3:
                SetTitle(rValue.GetString());
                break;
            case 4:
                SetDescription(rValue.GetString());
                break;
            case 5:
                SetReleaseDate(rValue.GetDate());
                break;
            default:
                throw LtXmlLib19::CLtException(_T("Unknown Property Index"));
            }
        }
    }
    
    /*
     * 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.
     */
    std::tstring CDVD::GetGenre() const
    {
        if (m_IsValidGenre == false)
            throw LtXmlLib19::CLtInvalidStateException(_T("The Property GetGenre is not valid. SetGenre must be called first"));
        return this->m_Genre;
    }
    void CDVD::SetGenre(std::tstring value)
    { 
        // Apply whitespace rules appropriately
        value = LtXmlLib19::CWhitespaceUtils::Preserve(value); 
        this->m_IsValidGenre = true;
    
        this->m_Genre = value; 
    }
    
    /*
     * Indicates if GetGenre contains a valid value.
     *
     * true if the value for GetGenre 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 GetGenre
     * will raise an exception.
     */
    bool CDVD::IsValidGenre() const
    { 
        return m_IsValidGenre;
    }
    void CDVD::SetValidGenre(bool value)
    { 
        if (value != m_IsValidGenre)
        {
            this->m_Genre = _T("");
            m_IsValidGenre = value;
        }
    }
    
    /*
     * Represents a mandatory Attribute in the XML document
     *
     * 
     * This property is represented as an Attribute in the XML.
     * It is mandatory and therefore must be populated within the XML.
     * It is defaulted to 0.
     */
    DOUBLE CDVD::GetCost() const
    {
        return this->m_Cost;
    }
    void CDVD::SetCost(DOUBLE value)
    { 
        this->m_Cost = 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 CDVD::GetTitle() const
    {
        return this->m_Title;
    }
    void CDVD::SetTitle(std::tstring value)
    { 
        // Apply whitespace rules appropriately
        value = LtXmlLib19::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 _T("").
     */
    std::tstring CDVD::GetDescription() const
    {
        return this->m_Description;
    }
    void CDVD::SetDescription(std::tstring value)
    { 
        // Apply whitespace rules appropriately
        value = LtXmlLib19::CWhitespaceUtils::Preserve(value); 
        this->m_Description = value; 
    }
    
    /*
     * Represents a mandatory Element in the XML document
     *
     * 
     * This property is represented as an Element in the XML.
     * It is mandatory and therefore must be populated within the XML.
     * It is defaulted to LtXmlLib19::CDateTime(LtXmlLib19::CDateTime::dt_date).
     */
    LtXmlLib19::CDateTime CDVD::GetReleaseDate() const
    {
        return this->m_ReleaseDate;
    }
    void CDVD::SetReleaseDate(LtXmlLib19::CDateTime value)
    { 
        this->m_ReleaseDate.SetDateTime(value, this->m_ReleaseDate.GetType()); 
    }
    
    /*
     * Allows the class to be copied
     * Performs a 'deep copy' of all the data in the class (and its children)
     */
    SimpleSequenceLib::CDVDPtr CDVD::Clone() const
    {
        SimpleSequenceLib::CDVDPtr newObject = CreateInstance(m_elementName.c_str());
    
        int index = 0;
        newObject->m_Genre = m_Genre;
        newObject->m_IsValidGenre = m_IsValidGenre;
        newObject->m_Cost = m_Cost;
        newObject->m_Title = m_Title;
        newObject->m_Description = m_Description;
        newObject->m_ReleaseDate = m_ReleaseDate;
    
    
    // ##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 CDVD::GetTargetNamespace() const
    {
        return _T("");
    }   
    
    std::tstring CDVD::GetNamespace() const
    {
        return _T("");
    }   
    
    LtXmlLib19::CXmlObjectBase* CDVD::GetBase()
    {
        return this;
    }   
    
    void CDVD::CleanMetaData()
    {
        LtXmlLib19::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo);
    }
    
    LtXmlLib19Data::CParentElementInfo* CDVD::GetClassInfo() const
    {
        if (ms_pParentElementInfo == NULL)
        {
            m_csInit.Enter();
            if (ms_pParentElementInfo == NULL)
            {
                ms_pParentElementInfo = new LtXmlLib19Data::CParentElementInfo(
                                                                                LtXmlLib19Data::XmlElementGroupType_SEQUENCE,
                                                                                LtXmlLib19Data::XmlElementType_ELEMENT, 
                                                                                _T("DVD"),                   
                                                                                _T(""), 
                                                                                true,
                                                                                false,
                                                                                -1,
                                                                                LtXmlLib19::ItemType_none,
                                                                                NULL,
                                                                                false);
            }
            m_csInit.Leave();
        }
        
        return ms_pParentElementInfo;
    }
    
    LtXmlLib19Data::CElementInfo** CDVD::GetClassElementInfo() const
    {
        if (ms_ppElementInfo == NULL)
        {
            m_csInit.Enter();
            if (ms_ppElementInfo == NULL)
            {
                ms_ppElementInfo = new LtXmlLib19Data::CElementInfo*[4];
            
                ms_ppElementInfo[0] = new LtXmlLib19Data::CElementInfoSeqPrimMnd(_T("Title"), _T(""), 3, false, LtXmlLib19::ItemType_string, NULL, LtXmlLib19::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib19::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
                ms_ppElementInfo[1] = new LtXmlLib19Data::CElementInfoSeqPrimMnd(_T("Description"), _T(""), 4, false, LtXmlLib19::ItemType_string, NULL, LtXmlLib19::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib19::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
                ms_ppElementInfo[2] = new LtXmlLib19Data::CElementInfoSeqPrimMnd(_T("ReleaseDate"), _T(""), 5, false, LtXmlLib19::ItemType_date, NULL, LtXmlLib19::CWhitespaceUtils::WhitespaceRule_Collapse, LtXmlLib19::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
                ms_ppElementInfo[3] = NULL;
            }
            m_csInit.Leave();
        }
        return ms_ppElementInfo;
    }
    
    LtXmlLib19Data::CAttributeInfo**    CDVD::GetClassAttributeInfo() const
    {
        if (ms_ppAttributeInfo == NULL)
        {
            m_csInit.Enter();
            if (ms_ppAttributeInfo == NULL)
            {
                ms_ppAttributeInfo = new LtXmlLib19Data::CAttributeInfo*[3];
                ms_ppAttributeInfo[0] = new LtXmlLib19Data::CAttributeInfoPrimitive(_T("Genre"), _T(""), 1, true, LtXmlLib19::ItemType_string, NULL, LtXmlLib19::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib19::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
                ms_ppAttributeInfo[1] = new LtXmlLib19Data::CAttributeInfoPrimitive(_T("Cost"), _T(""), 2, false, LtXmlLib19::ItemType_r8, NULL, LtXmlLib19::CWhitespaceUtils::WhitespaceRule_Collapse, LtXmlLib19::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
                ms_ppAttributeInfo[2] = NULL;
            }
            m_csInit.Leave();
        }
        return ms_ppAttributeInfo;
    }
    
    // ##HAND_CODED_BLOCK_START ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
    
    // Add Additional Methods here...
    
    // ##HAND_CODED_BLOCK_END ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
    
    }; // namespace