Back to index

lightning-sunbird  0.9+nobinonly
XMLElement.h
Go to the documentation of this file.
00001 // XMLElement.h : Declaration of the CXMLElement
00002 
00003 #ifndef __XMLELEMENT_H_
00004 #define __XMLELEMENT_H_
00005 
00006 #include "resource.h"       // main symbols
00007 
00008 #include <vector>
00009 #include <string>
00010 #include <map>
00011 
00012 typedef std::map<std::string, std::string> StringMap;
00013 typedef std::vector< CComQIPtr<IXMLElement, &IID_IXMLElement> > ElementList;
00014 
00016 // CXMLElement
00017 class ATL_NO_VTABLE CXMLElement : 
00018        public CComObjectRootEx<CComSingleThreadModel>,
00019        public CComCoClass<CXMLElement, &CLSID_MozXMLElement>,
00020        public IDispatchImpl<IXMLElement, &IID_IXMLElement, &LIBID_MozActiveXMLLib>
00021 {
00022        // Pointer to parent
00023        IXMLElement *m_pParent;
00024        // List of children
00025        ElementList m_cChildren;
00026        // Tag name
00027        std::string m_szTagName;
00028        // Text
00029        std::string m_szText;
00030        // Type
00031        long m_nType;
00032        // Attribute list
00033        StringMap m_cAttributes;
00034 
00035 public:
00036        CXMLElement();
00037        virtual ~CXMLElement();
00038 
00039        virtual HRESULT SetParent(IXMLElement *pParent);
00040        virtual HRESULT PutType(long nType);
00041        virtual HRESULT ReleaseAll();
00042 
00043 DECLARE_REGISTRY_RESOURCEID(IDR_XMLELEMENT)
00044 
00045 DECLARE_PROTECT_FINAL_CONSTRUCT()
00046 
00047 BEGIN_COM_MAP(CXMLElement)
00048        COM_INTERFACE_ENTRY(IXMLElement)
00049        COM_INTERFACE_ENTRY(IDispatch)
00050 END_COM_MAP()
00051 
00052 // IXMLElement
00053        virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_tagName(/* [out][retval] */ BSTR __RPC_FAR *p);
00054        virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_tagName(/* [in] */ BSTR p);
00055        virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_parent(/* [out][retval] */ IXMLElement __RPC_FAR *__RPC_FAR *ppParent);
00056        virtual /* [id] */ HRESULT STDMETHODCALLTYPE setAttribute(/* [in] */ BSTR strPropertyName, /* [in] */ VARIANT PropertyValue);
00057        virtual /* [id] */ HRESULT STDMETHODCALLTYPE getAttribute(/* [in] */ BSTR strPropertyName, /* [out][retval] */ VARIANT __RPC_FAR *PropertyValue);
00058        virtual /* [id] */ HRESULT STDMETHODCALLTYPE removeAttribute(/* [in] */ BSTR strPropertyName);
00059        virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_children(/* [out][retval] */ IXMLElementCollection __RPC_FAR *__RPC_FAR *pp);
00060        virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_type(/* [out][retval] */ long __RPC_FAR *plType);
00061        virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_text(/* [out][retval] */ BSTR __RPC_FAR *p);
00062        virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_text(/* [in] */ BSTR p);
00063        virtual /* [id] */ HRESULT STDMETHODCALLTYPE addChild(/* [in] */ IXMLElement __RPC_FAR *pChildElem, long lIndex, long lReserved);
00064        virtual /* [id] */ HRESULT STDMETHODCALLTYPE removeChild(/* [in] */ IXMLElement __RPC_FAR *pChildElem);
00065 
00066 public:
00067 };
00068 
00069 typedef CComObject<CXMLElement> CXMLElementInstance;
00070 
00071 #endif //__XMLELEMENT_H_