Liquid XML Data Binder 2020
In This Topic
    CAN_Address.cpp
    In This Topic
    /**********************************************************************************************
     * Copyright (c) 2001-2020 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: DerivedByExtension.xsd
     **********************************************************************************************/
    #include "StdAfx.h" 
    #pragma warning (push) 
    #pragma warning (disable:4251)  // template export warning 
    #pragma warning (disable:4786)  // long debug names 
    #include "../DerivedByExtensionLib.h" 
    #include "../DerivedByExtensionLib/CAN_Address.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                    : CAN_Address
    // Long Name               : CAN_Address
    // Element Name            : CAN_Address
    // Class Namespace         : DerivedByExtensionLib
    // Namespace Alias         : 
    // Schema Namespace        : 
    // Mapped Class Name       : CCAN_Address
    // Mapped Class Full Name  : DerivedByExtensionLib::CCAN_Address
    // Mapped Class File Name  : CCAN_Address
    // IsAbstract              : False
    // IsElement               : True
    // IsComplexType           : True
    
    namespace DerivedByExtensionLib
    {
    
    LtXmlLib18Data::CParentElementInfo* CCAN_Address::ms_pParentElementInfo = NULL;
    LtXmlLib18Data::CAttributeInfo** CCAN_Address::ms_ppAttributeInfo = NULL;
    LtXmlLib18Data::CElementInfo** CCAN_Address::ms_ppElementInfo = NULL;
    
    CCAN_AddressPtr CCAN_Address::CreateInstance(LPCTSTR lpctElementName/*=_T("CAN_Address")*/)
    {
        return new DerivedByExtensionLib::CCAN_Address(lpctElementName);
    }
    
    /*  
     * Constructor for CCAN_Address
     *
     * 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 DerivedByExtension.xsd
     */
    CCAN_Address::CCAN_Address(LPCTSTR lpctElementName/*=_T("CAN_Address")*/)
     : CInstanceMonitor(_T("CCAN_Address"))
    {
        m_elementName = lpctElementName;
        Init();
    }
    
    CCAN_Address::~CCAN_Address()
    {
        Cleanup();
    }
    
    void CCAN_Address::Cleanup()
    {
        // unregister for any events we have asked for
        // cos there'll be no one left to hear soon
    }
    
    void CCAN_Address::OnEvent(LtXmlLib18::CXmlObjectBase* pMsgSource, LtXmlLib18::IEventSink::MsgType eMsgType, void* pData)
    {
        if (eMsgType == LtXmlLib18::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 DerivedByExtension.xsd.
     */
    void CCAN_Address::Init()
    {
        Cleanup();
    
        this->m_Name = _T("");
        this->m_Street = _T("");
        this->m_City = _T("");
        this->m_Province = _T("");
        this->m_PostalCode = _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 CCAN_Address::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib18::LtVariant& rValue)
    {
        if (bRead)
        {
            switch(iPropertyIndex)
            {
            case 1:
                    rValue.SetString(GetName());
                break;
            case 2:
                    rValue.SetString(GetStreet());
                break;
            case 3:
                    rValue.SetString(GetCity());
                break;
            case 4:
                    rValue.SetString(GetProvince());
                break;
            case 5:
                    rValue.SetString(GetPostalCode());
                break;
            default:
                throw LtXmlLib18::CLtException(_T("Unknown Property Index"));
            };
        }
        else
        {
            switch(iPropertyIndex)
            {
            case 1:
                SetName(rValue.GetString());
                break;
            case 2:
                SetStreet(rValue.GetString());
                break;
            case 3:
                SetCity(rValue.GetString());
                break;
            case 4:
                SetProvince(rValue.GetString());
                break;
            case 5:
                SetPostalCode(rValue.GetString());
                break;
            default:
                throw LtXmlLib18::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 CCAN_Address::GetName() const
    {
        return this->m_Name;
    }
    void CCAN_Address::SetName(std::tstring value)
    { 
        // Apply whitespace rules appropriately
        value = LtXmlLib18::CWhitespaceUtils::Preserve(value); 
        this->m_Name = 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 CCAN_Address::GetStreet() const
    {
        return this->m_Street;
    }
    void CCAN_Address::SetStreet(std::tstring value)
    { 
        // Apply whitespace rules appropriately
        value = LtXmlLib18::CWhitespaceUtils::Preserve(value); 
        this->m_Street = 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 CCAN_Address::GetCity() const
    {
        return this->m_City;
    }
    void CCAN_Address::SetCity(std::tstring value)
    { 
        // Apply whitespace rules appropriately
        value = LtXmlLib18::CWhitespaceUtils::Preserve(value); 
        this->m_City = 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 CCAN_Address::GetProvince() const
    {
        return this->m_Province;
    }
    void CCAN_Address::SetProvince(std::tstring value)
    { 
        // Apply whitespace rules appropriately
        value = LtXmlLib18::CWhitespaceUtils::Preserve(value); 
        this->m_Province = 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 CCAN_Address::GetPostalCode() const
    {
        return this->m_PostalCode;
    }
    void CCAN_Address::SetPostalCode(std::tstring value)
    { 
        // Apply whitespace rules appropriately
        value = LtXmlLib18::CWhitespaceUtils::Preserve(value); 
        this->m_PostalCode = value; 
    }
    
    /*
     * Allows the class to be copied
     * Performs a 'deep copy' of all the data in the class (and its children)
     */
    DerivedByExtensionLib::IAddressPtr CCAN_Address::Clone() const
    {
        DerivedByExtensionLib::CCAN_AddressPtr newObject = CreateInstance(m_elementName.c_str());
    
        int index = 0;
        newObject->m_Name = m_Name;
        newObject->m_Street = m_Street;
        newObject->m_City = m_City;
        newObject->m_Province = m_Province;
        newObject->m_PostalCode = m_PostalCode;
    
    
    // ##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 CCAN_Address::GetTargetNamespace() const
    {
        return _T("");
    }   
    
    std::tstring CCAN_Address::GetNamespace() const
    {
        return _T("");
    }   
    
    LtXmlLib18::CXmlObjectBase* CCAN_Address::GetBase()
    {
        return this;
    }   
    
    void CCAN_Address::CleanMetaData()
    {
        LtXmlLib18::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo);
    }
    
    LtXmlLib18Data::CParentElementInfo* CCAN_Address::GetClassInfo() const
    {
        if (ms_pParentElementInfo == NULL)
        {
            m_csInit.Enter();
            if (ms_pParentElementInfo == NULL)
            {
                ms_pParentElementInfo = new LtXmlLib18Data::CParentElementInfo(
                                                                                LtXmlLib18Data::XmlElementGroupType_SEQUENCE,
                                                                                LtXmlLib18Data::XmlElementType_ELEMENT, 
                                                                                _T("CAN_Address"),                   
                                                                                _T(""), 
                                                                                true,
                                                                                true,
                                                                                -1,
                                                                                LtXmlLib18::ItemType_none,
                                                                                NULL,
                                                                                false);
            }
            m_csInit.Leave();
        }
        
        return ms_pParentElementInfo;
    }
    
    LtXmlLib18Data::CElementInfo** CCAN_Address::GetClassElementInfo() const
    {
        if (ms_ppElementInfo == NULL)
        {
            m_csInit.Enter();
            if (ms_ppElementInfo == NULL)
            {
                ms_ppElementInfo = new LtXmlLib18Data::CElementInfo*[6];
            
                ms_ppElementInfo[0] = new LtXmlLib18Data::CElementInfoSeqPrimMnd(_T("Name"), _T(""), 1, false, LtXmlLib18::ItemType_string, NULL, LtXmlLib18::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib18::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
                ms_ppElementInfo[1] = new LtXmlLib18Data::CElementInfoSeqPrimMnd(_T("Street"), _T(""), 2, false, LtXmlLib18::ItemType_string, NULL, LtXmlLib18::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib18::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
                ms_ppElementInfo[2] = new LtXmlLib18Data::CElementInfoSeqPrimMnd(_T("City"), _T(""), 3, false, LtXmlLib18::ItemType_string, NULL, LtXmlLib18::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib18::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
                ms_ppElementInfo[3] = new LtXmlLib18Data::CElementInfoSeqPrimMnd(_T("Province"), _T(""), 4, false, LtXmlLib18::ItemType_string, NULL, LtXmlLib18::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib18::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
                ms_ppElementInfo[4] = new LtXmlLib18Data::CElementInfoSeqPrimMnd(_T("PostalCode"), _T(""), 5, false, LtXmlLib18::ItemType_string, NULL, LtXmlLib18::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib18::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
                ms_ppElementInfo[5] = NULL;
            }
            m_csInit.Leave();
        }
        return ms_ppElementInfo;
    }
    
    LtXmlLib18Data::CAttributeInfo**    CCAN_Address::GetClassAttributeInfo() const
    {
        if (ms_ppAttributeInfo == NULL)
        {
            m_csInit.Enter();
            if (ms_ppAttributeInfo == NULL)
            {
                ms_ppAttributeInfo = new LtXmlLib18Data::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