In This Topic
#include "StdAfx.h"
#pragma warning (push)
#pragma warning (disable:4251)
#pragma warning (disable:4786)
#include "../SimpleChoiceLib.h"
#include "../SimpleChoiceLib/AccountAdminRequest.h"
namespace SimpleChoiceLib
{
LtXmlLib20Data::CParentElementInfo* CAccountAdminRequest::ms_pParentElementInfo = NULL;
LtXmlLib20Data::CAttributeInfo** CAccountAdminRequest::ms_ppAttributeInfo = NULL;
LtXmlLib20Data::CElementInfo** CAccountAdminRequest::ms_ppElementInfo = NULL;
CAccountAdminRequestPtr CAccountAdminRequest::CreateInstance(LPCTSTR lpctElementName)
{
return new SimpleChoiceLib::CAccountAdminRequest(lpctElementName);
}
CAccountAdminRequest::CAccountAdminRequest(LPCTSTR lpctElementName)
: CInstanceMonitor(_T("CAccountAdminRequest"))
{
m_elementName = lpctElementName;
Init();
}
CAccountAdminRequest::~CAccountAdminRequest()
{
Cleanup();
}
void CAccountAdminRequest::Cleanup()
{
// unregister for any events we have asked for
// cos there'll be no one left to hear soon
}
void CAccountAdminRequest::OnEvent(LtXmlLib20::CXmlObjectBase* pMsgSource, LtXmlLib20::IEventSink::MsgType eMsgType, void* pData)
{
if (eMsgType == LtXmlLib20::IEventSink::MT_CollectionChangeEvent)
{
}
}
void CAccountAdminRequest::Init()
{
Cleanup();
this->m_CreateAccount = NULL;
this->m_DeleteAccount = NULL;
this->m_ChangeAccountPassword = NULL;
m_validElement = _T("");
}
void CAccountAdminRequest::ClearChoice(LPCTSTR lpctSelectedElement)
{
this->m_CreateAccount = NULL;
this->m_DeleteAccount = NULL;
this->m_ChangeAccountPassword = NULL;
m_validElement = lpctSelectedElement;
}
void CAccountAdminRequest::AccessProperty(int iPropertyIndex, bool bRead, LtXmlLib20::LtVariant& rValue)
{
if (bRead)
{
switch(iPropertyIndex)
{
case 1:
rValue.SetXmlObject(GetCreateAccount().Ptr());
break;
case 2:
rValue.SetXmlObject(GetDeleteAccount().Ptr());
break;
case 3:
rValue.SetXmlObject(GetChangeAccountPassword().Ptr());
break;
default:
throw LtXmlLib20::CLtException(_T("Unknown Property Index"));
};
}
else
{
switch(iPropertyIndex)
{
case 1:
SetCreateAccount(dynamic_cast<SimpleChoiceLib::CCreateAccount*>(rValue.GetXmlObject().Ptr()));
break;
case 2:
SetDeleteAccount(dynamic_cast<SimpleChoiceLib::CDeleteAccount*>(rValue.GetXmlObject().Ptr()));
break;
case 3:
SetChangeAccountPassword(dynamic_cast<SimpleChoiceLib::CChangeAccountPassword*>(rValue.GetXmlObject().Ptr()));
break;
default:
throw LtXmlLib20::CLtException(_T("Unknown Property Index"));
}
}
}
SimpleChoiceLib::CCreateAccountPtr CAccountAdminRequest::GetCreateAccount() const
{
return this->m_CreateAccount;
}
void CAccountAdminRequest::SetCreateAccount(SimpleChoiceLib::CCreateAccount* value)
{
// Ensure only on element is populated at a time
ClearChoice(value == NULL?_T(""):_T("CreateAccount"));
if (value == NULL)
this->m_CreateAccount = NULL;
else
{
SetElementName(value, _T("CreateAccount"));
this->m_CreateAccount = value;
}
}
SimpleChoiceLib::CDeleteAccountPtr CAccountAdminRequest::GetDeleteAccount() const
{
return this->m_DeleteAccount;
}
void CAccountAdminRequest::SetDeleteAccount(SimpleChoiceLib::CDeleteAccount* value)
{
// Ensure only on element is populated at a time
ClearChoice(value == NULL?_T(""):_T("DeleteAccount"));
if (value == NULL)
this->m_DeleteAccount = NULL;
else
{
SetElementName(value, _T("DeleteAccount"));
this->m_DeleteAccount = value;
}
}
SimpleChoiceLib::CChangeAccountPasswordPtr CAccountAdminRequest::GetChangeAccountPassword() const
{
return this->m_ChangeAccountPassword;
}
void CAccountAdminRequest::SetChangeAccountPassword(SimpleChoiceLib::CChangeAccountPassword* value)
{
// Ensure only on element is populated at a time
ClearChoice(value == NULL?_T(""):_T("ChangeAccountPassword"));
if (value == NULL)
this->m_ChangeAccountPassword = NULL;
else
{
SetElementName(value, _T("ChangeAccountPassword"));
this->m_ChangeAccountPassword = value;
}
}
std::tstring CAccountAdminRequest::GetChoiceSelectedElement() const
{
return m_validElement;
}
SimpleChoiceLib::CAccountAdminRequestPtr CAccountAdminRequest::Clone() const
{
SimpleChoiceLib::CAccountAdminRequestPtr newObject = CreateInstance(m_elementName.c_str());
int index = 0;
newObject->m_CreateAccount = NULL;
if (m_CreateAccount != NULL)
newObject->m_CreateAccount = dynamic_cast<SimpleChoiceLib::CCreateAccount*>(m_CreateAccount->Clone().Ptr());
newObject->m_DeleteAccount = NULL;
if (m_DeleteAccount != NULL)
newObject->m_DeleteAccount = dynamic_cast<SimpleChoiceLib::CDeleteAccount*>(m_DeleteAccount->Clone().Ptr());
newObject->m_ChangeAccountPassword = NULL;
if (m_ChangeAccountPassword != NULL)
newObject->m_ChangeAccountPassword = dynamic_cast<SimpleChoiceLib::CChangeAccountPassword*>(m_ChangeAccountPassword->Clone().Ptr());
newObject->m_validElement = m_validElement;
return newObject.Ptr();
}
std::tstring CAccountAdminRequest::GetTargetNamespace() const
{
return _T("");
}
std::tstring CAccountAdminRequest::GetNamespace() const
{
return _T("");
}
LtXmlLib20::CXmlObjectBase* CAccountAdminRequest::GetBase()
{
return this;
}
void CAccountAdminRequest::CleanMetaData()
{
LtXmlLib20::CXmlGeneratedClass::CleanMetaData(ms_pParentElementInfo, ms_ppElementInfo, ms_ppAttributeInfo);
}
LtXmlLib20Data::CParentElementInfo* CAccountAdminRequest::GetClassInfo() const
{
if (ms_pParentElementInfo == NULL)
{
m_csInit.Enter();
if (ms_pParentElementInfo == NULL)
{
ms_pParentElementInfo = new LtXmlLib20Data::CParentElementInfo(
LtXmlLib20Data::XmlElementGroupType_CHOICE,
LtXmlLib20Data::XmlElementType_ELEMENT,
_T("AccountAdminRequest"),
_T(""),
true,
false,
-1,
LtXmlLib20::ItemType_none,
LtXmlLib20::CWhitespaceUtils::WhitespaceRule_None,
NULL,
false);
}
m_csInit.Leave();
}
return ms_pParentElementInfo;
}
LtXmlLib20Data::CElementInfo** CAccountAdminRequest::GetClassElementInfo() const
{
if (ms_ppElementInfo == NULL)
{
m_csInit.Enter();
if (ms_ppElementInfo == NULL)
{
ms_ppElementInfo = new LtXmlLib20Data::CElementInfo*[4];
ms_ppElementInfo[0] = new LtXmlLib20Data::CElementInfoChoiceClsOpt(_T("CreateAccount"), _T(""), 1, LtXmlLib20Data::XmlElementType_ELEMENT, (LtXmlLib20Data::pfnCreateClassDef)SimpleChoiceLib::CClassFactory::CreateClass, SimpleChoiceLib::CClassFactory::ClsName_CCreateAccount);
ms_ppElementInfo[1] = new LtXmlLib20Data::CElementInfoChoiceClsOpt(_T("DeleteAccount"), _T(""), 2, LtXmlLib20Data::XmlElementType_ELEMENT, (LtXmlLib20Data::pfnCreateClassDef)SimpleChoiceLib::CClassFactory::CreateClass, SimpleChoiceLib::CClassFactory::ClsName_CDeleteAccount);
ms_ppElementInfo[2] = new LtXmlLib20Data::CElementInfoChoiceClsOpt(_T("ChangeAccountPassword"), _T(""), 3, LtXmlLib20Data::XmlElementType_ELEMENT, (LtXmlLib20Data::pfnCreateClassDef)SimpleChoiceLib::CClassFactory::CreateClass, SimpleChoiceLib::CClassFactory::ClsName_CChangeAccountPassword);
ms_ppElementInfo[3] = NULL;
}
m_csInit.Leave();
}
return ms_ppElementInfo;
}
LtXmlLib20Data::CAttributeInfo** CAccountAdminRequest::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;
}
};