In This Topic
    DVD.cpp
    In This Topic
    /**********************************************************************************************
     * Copyright (c) 2001-2025 Liquid Technologies Limited. All rights reserved.
     * See www.liquid-technologies.com for product details.
     *
     * Please see products End User License Agreement for distribution permissions.
     *
     * WARNING: THIS FILE IS GENERATED
     * Changes made outside of ##HAND_CODED_BLOCK_START blocks will be overwritten
     *
     * Generation  :  by Liquid XML Data Binder 19.0.14.11049
     * Using Schema: 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
    {
    
    LtXmlLib21Data::CParentElementInfo* CDVD::ms_pParentElementInfo = NULL;
    LtXmlLib21Data::CAttributeInfo** CDVD::ms_ppAttributeInfo = NULL;
    LtXmlLib21Data::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(LtXmlLib21::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(LtXmlLib21::CXmlObjectBase* pMsgSource, LtXmlLib21::IEventSink::MsgType eMsgType, void* pData)
    {
        if (eMsgType == LtXmlLib21::IEventSink::MT_CollectionChangeEvent)
        {
        }
    }
    
    /*
     * Initializes the class
     *
     * The Creates all the mandatory fields (populated with the default data) 
     * All Collection object are created.
     * However any 1-n relationships (these are represented as collections) are
     * empty. To comply with the schema these must be populated before the xml
     * obtained from ToXml is valid against the schema 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 = LtXmlLib21::CDateTime(LtXmlLib21::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, LtXmlLib21::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 LtXmlLib21::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 LtXmlLib21::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 LtXmlLib21::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 = LtXmlLib21::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 = LtXmlLib21::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 = LtXmlLib21::CWhitespaceUtils::Preserve(value); 
        this->m_Description = value; 
    }
    
    /*
     * Represents a mandatory Element in the XML document
     *
     * 
     * This property is represented as an Element in the XML.
     * It is mandatory and therefore must be populated within the XML.
     * It is defaulted to LtXmlLib21::CDateTime(LtXmlLib21::CDateTime::dt_date).
     */
    LtXmlLib21::CDateTime CDVD::GetReleaseDate() const
    {
        return this->m_ReleaseDate;
    }
    void CDVD::SetReleaseDate(LtXmlLib21::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("");
    }   
    
    LtXmlLib21::CXmlObjectBase* CDVD::GetBase()
    {
        return this;
    }   
    
    void CDVD::CleanMetaData()
    {
        LtXmlLib21::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo);
    }
    
    LtXmlLib21Data::CParentElementInfo* CDVD::GetClassInfo() const
    {
        if (ms_pParentElementInfo == NULL)
        {
            m_csInit.Enter();
            if (ms_pParentElementInfo == NULL)
            {
                ms_pParentElementInfo = new LtXmlLib21Data::CParentElementInfo(
                                                                                LtXmlLib21Data::XmlElementGroupType_SEQUENCE,
                                                                                LtXmlLib21Data::XmlElementType_ELEMENT, 
                                                                                _T("DVD"),                   
                                                                                _T(""), 
                                                                                true,
                                                                                false,
                                                                                -1,
                                                                                LtXmlLib21::ItemType_none,
                                                                                LtXmlLib21::CWhitespaceUtils::WhitespaceRule_None,
                                                                                NULL,
                                                                                false);
            }
            m_csInit.Leave();
        }
        
        return ms_pParentElementInfo;
    }
    
    LtXmlLib21Data::CElementInfo** CDVD::GetClassElementInfo() const
    {
        if (ms_ppElementInfo == NULL)
        {
            m_csInit.Enter();
            if (ms_ppElementInfo == NULL)
            {
                ms_ppElementInfo = new LtXmlLib21Data::CElementInfo*[4];
            
                ms_ppElementInfo[0] = new LtXmlLib21Data::CElementInfoSeqPrimMnd(_T("Title"), _T(""), 3, false, LtXmlLib21::ItemType_string, NULL, LtXmlLib21::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib21::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
                ms_ppElementInfo[1] = new LtXmlLib21Data::CElementInfoSeqPrimMnd(_T("Description"), _T(""), 4, false, LtXmlLib21::ItemType_string, NULL, LtXmlLib21::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib21::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
                ms_ppElementInfo[2] = new LtXmlLib21Data::CElementInfoSeqPrimMnd(_T("ReleaseDate"), _T(""), 5, false, LtXmlLib21::ItemType_date, NULL, LtXmlLib21::CWhitespaceUtils::WhitespaceRule_Collapse, LtXmlLib21::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
                ms_ppElementInfo[3] = NULL;
            }
            m_csInit.Leave();
        }
        return ms_ppElementInfo;
    }
    
    LtXmlLib21Data::CAttributeInfo**    CDVD::GetClassAttributeInfo() const
    {
        if (ms_ppAttributeInfo == NULL)
        {
            m_csInit.Enter();
            if (ms_ppAttributeInfo == NULL)
            {
                ms_ppAttributeInfo = new LtXmlLib21Data::CAttributeInfo*[3];
                ms_ppAttributeInfo[0] = new LtXmlLib21Data::CAttributeInfoPrimitive(_T("Genre"), _T(""), 1, true, LtXmlLib21::ItemType_string, NULL, LtXmlLib21::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib21::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
                ms_ppAttributeInfo[1] = new LtXmlLib21Data::CAttributeInfoPrimitive(_T("Cost"), _T(""), 2, false, LtXmlLib21::ItemType_r8, NULL, LtXmlLib21::CWhitespaceUtils::WhitespaceRule_Collapse, LtXmlLib21::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
                ms_ppAttributeInfo[2] = NULL;
            }
            m_csInit.Leave();
        }
        return ms_ppAttributeInfo;
    }
    
    // ##HAND_CODED_BLOCK_START ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
    
    // Add Additional Methods here...
    
    // ##HAND_CODED_BLOCK_END ID="Additional Methods"## DO NOT MODIFY ANYTHING OUTSIDE OF THESE TAGS
    
    }; // namespace