// wmsoapstructObj.h : Declaration of the CwmsoapstructObj
//
// Copyright (c) 2002 Robert Cunnings. All rights reserved.
//
// You may copy, modify, distribute or publish this code free of charge.
//
// NO WARRANTY: This software is provided AS IS, without warranty of any kind.
//
//////////////////////////////////////////////////////////////////////
//
// wmsoapstructobj class - implementation of SOAP Struct type.
// 
//////////////////////////////////////////////////////////////////////

#pragma once
#include "resource.h"       // main symbols

#include "wmsoapstruct.h"
#include "wmsoapstructtype.h"

// CwmsoapstructObj

class ATL_NO_VTABLE CwmsoapstructObj : 
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CwmsoapstructObj, &CLSID_wmsoapstruct>,
	public IDispatchImpl<Iwmsoapstruct, &IID_Iwmsoapstruct, &LIBID_wmsoapstructLib, /*wMajor =*/ 1, /*wMinor =*/ 0>
{
public:
	CwmsoapstructObj()
	{
        m_pSOAPStruct = NULL;
	}

DECLARE_REGISTRY_RESOURCEID(IDR_WMSOAPSTRUCTOBJ)


BEGIN_COM_MAP(CwmsoapstructObj)
	COM_INTERFACE_ENTRY(Iwmsoapstruct)
	COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()


	DECLARE_PROTECT_FINAL_CONSTRUCT()

	HRESULT FinalConstruct()
	{
		m_pSOAPStruct = new WMSOAPStructType;
        if (m_pSOAPStruct == NULL)
            return E_FAIL;
		return S_OK;
	}
	
	void FinalRelease() 
	{
		if (m_pSOAPStruct != NULL)
			delete m_pSOAPStruct;
	}

public:
	STDMETHOD(GetNextMemberQN)(/*[out]*/ BSTR *pbstrName, /*[out]*/ BSTR *pbstrNS,  /*[out]*/ VARIANT *pvarValue,  /*[in, out]*/ long *plPosition, /*[out, retval]*/ VARIANT_BOOL *pResult);
	STDMETHOD(GetFirstMemberQN)(/*[out]*/ BSTR *pbstrName, /*[out]*/ BSTR *pbstrNS, /*[out]*/ VARIANT *pvarValue,  /*[out]*/ long *plPosition, /*[out, retval]*/ VARIANT_BOOL *pResult);
	STDMETHOD(SetMemberQN)(/*[in]*/ BSTR bstrName, /*[in]*/ BSTR bstrNS, /*[in]*/ VARIANT varValue, /*[out, retval]*/ VARIANT_BOOL *pResult);
	STDMETHOD(GetMemberQN)(/*[in]*/ BSTR bstrName, /*[in]*/ BSTR bstrNS, /*[out]*/ VARIANT *pvarValue, /*[out, retval]*/ VARIANT_BOOL *pResult);
	STDMETHOD(GetNextMember)(/*[out]*/ BSTR *pbstrName, /*[out]*/ VARIANT *pvarValue,  /*[out]*/ long *plPosition, /*[out, retval]*/ VARIANT_BOOL *pResult);
	STDMETHOD(GetFirstMember)(/*[out]*/ BSTR *pbstrName, /*[out]*/ VARIANT *pvarValue,  /*[out]*/ long *plPosition, /*[out, retval]*/ VARIANT_BOOL *pResult);
	STDMETHOD(SetMember)(/*[in]*/ BSTR bstrName, /*[in]*/ VARIANT varValue, /*[out, retval]*/ VARIANT_BOOL *pResult);
	STDMETHOD(GetMember)(/*[in]*/ BSTR bstrName, /*[out]*/ VARIANT *pvarValue, /*[out, retval]*/ VARIANT_BOOL *pResult);

private:
	WMSOAPStructType	*m_pSOAPStruct;
};

OBJECT_ENTRY_AUTO(__uuidof(wmsoapstruct), CwmsoapstructObj)
