#include "StdAfx.h"
#pragma warning (push)
#pragma warning (disable:4251)
#pragma warning (disable:4786)
#include "../SimpleHierarchyLib.h"
#include "../SimpleHierarchyLib/AddressType.h"
namespace SimpleHierarchyLib
{
LtXmlLib20Data::CParentElementInfo* CAddressType::ms_pParentElementInfo = NULL;
LtXmlLib20Data::CAttributeInfo** CAddressType::ms_ppAttributeInfo = NULL;
LtXmlLib20Data::CElementInfo** CAddressType::ms_ppElementInfo = NULL;
CAddressTypePtr CAddressType::CreateInstance(LPCTSTR lpctElementName)
{
return new SimpleHierarchyLib::CAddressType(lpctElementName);
}
CAddressType::CAddressType(LPCTSTR lpctElementName)
: CInstanceMonitor(_T("CAddressType"))
{
m_elementName = lpctElementName;
Init();
}
CAddressType::~CAddressType()
{
Cleanup();
}
void CAddressType::Cleanup()
{
// unregister for any events we have asked for
// cos there'll be no one left to hear soon
}
void CAddressType::OnEvent(LtXmlLib20::CXmlObjectBase* pMsgSource, LtXmlLib20::IEventSink::MsgType eMsgType, void* pData)
{
if (eMsgType == LtXmlLib20::IEventSink::MT_CollectionChangeEvent)
{
}
}
void CAddressType::Init()
{
Cleanup();
this->m_Forename = _T("");
this->m_Surname = _T("");
this->m_AddresLine1 = _T("");
this->m_AddresLine2 = _T("");
this->m_AddresLine3 = _T("");
this->m_IsValidAddresLine3 = false;
this->m_AddresLine4 = _T("");
this->m_IsValidAddresLine4 = false;
this->m_AddresLine5 = _T("");
this->m_PostCode = _T("");
}
void CAddressType::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib20::LtVariant& rValue)
{
if (bRead)
{
switch(iPropertyIndex)
{
case 1:
rValue.SetString(GetForename());
break;
case 2:
rValue.SetString(GetSurname());
break;
case 3:
rValue.SetString(GetAddresLine1());
break;
case 4:
rValue.SetString(GetAddresLine2());
break;
case 5:
if (IsValidAddresLine3())
rValue.SetString(GetAddresLine3());
else
rValue.SetInvalid();
break;
case 6:
if (IsValidAddresLine4())
rValue.SetString(GetAddresLine4());
else
rValue.SetInvalid();
break;
case 7:
rValue.SetString(GetAddresLine5());
break;
case 8:
rValue.SetString(GetPostCode());
break;
default:
throw LtXmlLib20::CLtException(_T("Unknown Property Index"));
};
}
else
{
switch(iPropertyIndex)
{
case 1:
SetForename(rValue.GetString());
break;
case 2:
SetSurname(rValue.GetString());
break;
case 3:
SetAddresLine1(rValue.GetString());
break;
case 4:
SetAddresLine2(rValue.GetString());
break;
case 5:
if (rValue.IsValid())
SetAddresLine3(rValue.GetString());
else
SetValidAddresLine3(false);
break;
case 6:
if (rValue.IsValid())
SetAddresLine4(rValue.GetString());
else
SetValidAddresLine4(false);
break;
case 7:
SetAddresLine5(rValue.GetString());
break;
case 8:
SetPostCode(rValue.GetString());
break;
default:
throw LtXmlLib20::CLtException(_T("Unknown Property Index"));
}
}
}
std::tstring CAddressType::GetForename() const
{
return this->m_Forename;
}
void CAddressType::SetForename(std::tstring value)
{
// Apply whitespace rules appropriately
value = LtXmlLib20::CWhitespaceUtils::Preserve(value);
this->m_Forename = value;
}
std::tstring CAddressType::GetSurname() const
{
return this->m_Surname;
}
void CAddressType::SetSurname(std::tstring value)
{
// Apply whitespace rules appropriately
value = LtXmlLib20::CWhitespaceUtils::Preserve(value);
this->m_Surname = value;
}
std::tstring CAddressType::GetAddresLine1() const
{
return this->m_AddresLine1;
}
void CAddressType::SetAddresLine1(std::tstring value)
{
// Apply whitespace rules appropriately
value = LtXmlLib20::CWhitespaceUtils::Preserve(value);
this->m_AddresLine1 = value;
}
std::tstring CAddressType::GetAddresLine2() const
{
return this->m_AddresLine2;
}
void CAddressType::SetAddresLine2(std::tstring value)
{
// Apply whitespace rules appropriately
value = LtXmlLib20::CWhitespaceUtils::Preserve(value);
this->m_AddresLine2 = value;
}
std::tstring CAddressType::GetAddresLine3() const
{
if (m_IsValidAddresLine3 == false)
throw LtXmlLib20::CLtInvalidStateException(_T("The Property GetAddresLine3 is not valid. SetAddresLine3 must be called first"));
return this->m_AddresLine3;
}
void CAddressType::SetAddresLine3(std::tstring value)
{
// Apply whitespace rules appropriately
value = LtXmlLib20::CWhitespaceUtils::Preserve(value);
this->m_IsValidAddresLine3 = true;
this->m_AddresLine3 = value;
}
bool CAddressType::IsValidAddresLine3() const
{
return m_IsValidAddresLine3;
}
void CAddressType::SetValidAddresLine3(bool value)
{
if (value != m_IsValidAddresLine3)
{
this->m_AddresLine3 = _T("");
m_IsValidAddresLine3 = value;
}
}
std::tstring CAddressType::GetAddresLine4() const
{
if (m_IsValidAddresLine4 == false)
throw LtXmlLib20::CLtInvalidStateException(_T("The Property GetAddresLine4 is not valid. SetAddresLine4 must be called first"));
return this->m_AddresLine4;
}
void CAddressType::SetAddresLine4(std::tstring value)
{
// Apply whitespace rules appropriately
value = LtXmlLib20::CWhitespaceUtils::Preserve(value);
this->m_IsValidAddresLine4 = true;
this->m_AddresLine4 = value;
}
bool CAddressType::IsValidAddresLine4() const
{
return m_IsValidAddresLine4;
}
void CAddressType::SetValidAddresLine4(bool value)
{
if (value != m_IsValidAddresLine4)
{
this->m_AddresLine4 = _T("");
m_IsValidAddresLine4 = value;
}
}
std::tstring CAddressType::GetAddresLine5() const
{
return this->m_AddresLine5;
}
void CAddressType::SetAddresLine5(std::tstring value)
{
// Apply whitespace rules appropriately
value = LtXmlLib20::CWhitespaceUtils::Preserve(value);
this->m_AddresLine5 = value;
}
std::tstring CAddressType::GetPostCode() const
{
return this->m_PostCode;
}
void CAddressType::SetPostCode(std::tstring value)
{
// Apply whitespace rules appropriately
value = LtXmlLib20::CWhitespaceUtils::Preserve(value);
this->m_PostCode = value;
}
SimpleHierarchyLib::CAddressTypePtr CAddressType::Clone() const
{
SimpleHierarchyLib::CAddressTypePtr newObject = CreateInstance(m_elementName.c_str());
int index = 0;
newObject->m_Forename = m_Forename;
newObject->m_Surname = m_Surname;
newObject->m_AddresLine1 = m_AddresLine1;
newObject->m_AddresLine2 = m_AddresLine2;
newObject->m_AddresLine3 = m_AddresLine3;
newObject->m_IsValidAddresLine3 = m_IsValidAddresLine3;
newObject->m_AddresLine4 = m_AddresLine4;
newObject->m_IsValidAddresLine4 = m_IsValidAddresLine4;
newObject->m_AddresLine5 = m_AddresLine5;
newObject->m_PostCode = m_PostCode;
return newObject.Ptr();
}
std::tstring CAddressType::GetTargetNamespace() const
{
return _T("");
}
std::tstring CAddressType::GetNamespace() const
{
return _T("");
}
LtXmlLib20::CXmlObjectBase* CAddressType::GetBase()
{
return this;
}
void CAddressType::CleanMetaData()
{
LtXmlLib20::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo);
}
LtXmlLib20Data::CParentElementInfo* CAddressType::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("AddressType"),
_T(""),
true,
false,
-1,
LtXmlLib20::ItemType_none,
LtXmlLib20::CWhitespaceUtils::WhitespaceRule_None,
NULL,
false);
}
m_csInit.Leave();
}
return ms_pParentElementInfo;
}
LtXmlLib20Data::CElementInfo** CAddressType::GetClassElementInfo() const
{
if (ms_ppElementInfo == NULL)
{
m_csInit.Enter();
if (ms_ppElementInfo == NULL)
{
ms_ppElementInfo = new LtXmlLib20Data::CElementInfo*[9];
ms_ppElementInfo[0] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("Forename"), _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("Surname"), _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("AddresLine1"), _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] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("AddresLine2"), _T(""), 4, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
ms_ppElementInfo[4] = new LtXmlLib20Data::CElementInfoSeqPrimOpt(_T("AddresLine3"), _T(""), 5, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
ms_ppElementInfo[5] = new LtXmlLib20Data::CElementInfoSeqPrimOpt(_T("AddresLine4"), _T(""), 6, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
ms_ppElementInfo[6] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("AddresLine5"), _T(""), 7, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
ms_ppElementInfo[7] = new LtXmlLib20Data::CElementInfoSeqPrimMnd(_T("PostCode"), _T(""), 8, false, LtXmlLib20::ItemType_string, NULL, LtXmlLib20::CWhitespaceUtils::WhitespaceRule_Preserve, LtXmlLib20::CPrimitiveRestrictions(_T(""), -1, -1, _T(""), _T(""), _T(""), _T(""), -1, -1, -1), NULL);
ms_ppElementInfo[8] = NULL;
}
m_csInit.Leave();
}
return ms_ppElementInfo;
}
LtXmlLib20Data::CAttributeInfo** CAddressType::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;
}
};