In This Topic
#include "StdAfx.h"
#pragma warning (push)
#pragma warning (disable:4251)
#pragma warning (disable:4786)
#include "../DerivedByExtensionLib.h"
#include "../DerivedByExtensionLib/Address.h"
namespace DerivedByExtensionLib
{
LtXmlLib20Data::CParentElementInfo* CAddress::ms_pParentElementInfo = NULL;
LtXmlLib20Data::CAttributeInfo** CAddress::ms_ppAttributeInfo = NULL;
LtXmlLib20Data::CElementInfo** CAddress::ms_ppElementInfo = NULL;
CAddressPtr CAddress::CreateInstance(LPCTSTR lpctElementName)
{
return new DerivedByExtensionLib::CAddress(lpctElementName);
}
CAddress::CAddress(LPCTSTR lpctElementName)
: CInstanceMonitor(_T("CAddress"))
{
m_elementName = lpctElementName;
Init();
}
CAddress::~CAddress()
{
Cleanup();
}
void CAddress::Cleanup()
{
// unregister for any events we have asked for
// cos there'll be no one left to hear soon
}
void CAddress::OnEvent(LtXmlLib20::CXmlObjectBase* pMsgSource, LtXmlLib20::IEventSink::MsgType eMsgType, void* pData)
{
if (eMsgType == LtXmlLib20::IEventSink::MT_CollectionChangeEvent)
{
}
}
void CAddress::Init()
{
Cleanup();
this->m_Name = _T("");
this->m_Street = _T("");
this->m_City = _T("");
}
void CAddress::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib20::LtVariant& rValue)
{
if (bRead)
{
switch(iPropertyIndex)
{
case 1:
rValue.SetString(GetName());
break;
case 2:
rValue.SetString(GetStreet());
break;
case 3:
rValue.SetString(GetCity());
break;
default:
throw LtXmlLib20::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;
default:
throw LtXmlLib20::CLtException(_T("Unknown Property Index"));
}
}
}
std::tstring CAddress::GetName() const
{
return this->m_Name;
}
void CAddress::SetName(std::tstring value)
{
// Apply whitespace rules appropriately
value = LtXmlLib20::CWhitespaceUtils::Preserve(value);
this->m_Name = value;
}
std::tstring CAddress::GetStreet() const
{
return this->m_Street;
}
void CAddress::SetStreet(std::tstring value)
{
// Apply whitespace rules appropriately
value = LtXmlLib20::CWhitespaceUtils::Preserve(value);
this->m_Street = value;
}
std::tstring CAddress::GetCity() const
{
return this->m_City;
}
void CAddress::SetCity(std::tstring value)
{
// Apply whitespace rules appropriately
value = LtXmlLib20::CWhitespaceUtils::Preserve(value);
this->m_City = value;
}
DerivedByExtensionLib::IAddressPtr CAddress::Clone() const
{
DerivedByExtensionLib::CAddressPtr newObject = CreateInstance(m_elementName.c_str());
int index = 0;
newObject->m_Name = m_Name;
newObject->m_Street = m_Street;
newObject->m_City = m_City;
return newObject.Ptr();
}
std::tstring CAddress::GetTargetNamespace() const
{
return _T("");
}
std::tstring CAddress::GetNamespace() const
{
return _T("");
}
LtXmlLib20::CXmlObjectBase* CAddress::GetBase()
{
return this;
}
void CAddress::CleanMetaData()
{
LtXmlLib20::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo);
}
LtXmlLib20Data::CParentElementInfo* CAddress::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("Address"),
_T(""),
true,
true,
-1,
LtXmlLib20::ItemType_none,
LtXmlLib20::CWhitespaceUtils::WhitespaceRule_None,
NULL,
false);
}
m_csInit.Leave();
}
return ms_pParentElementInfo;
}
LtXmlLib20Data::CElementInfo** CAddress::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("Name"), _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("Street"), _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::CElementInfoSeqPrimMnd(_T("City"), _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** CAddress::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;
}
};