#ifndef __TCStrings_h__ #define __TCStrings_h__ ///////////////////////////////////////////////////////////////////////////// // TCStrings.h | Declaration of the CTCStrings, which implements the // CLSID_TCStrings component object. #include #include "resource.h" ///////////////////////////////////////////////////////////////////////////// // CTCStrings class ATL_NO_VTABLE CTCStrings : public IDispatchImpl, public IDispatchImpl, public TCPersistPropertyBagImpl, public IPersistStorageImpl, public TCPersistStreamInitImpl, public TCComPropertyClass, public AGCObjectSafetyImpl, public CComCoClass, public CComObjectRoot { // Declarations public: DECLARE_REGISTRY_RESOURCEID(IDR_TCStrings) DECLARE_GET_CONTROLLING_UNKNOWN() // Category Map public: BEGIN_CATEGORY_MAP(CTCStrings) IMPLEMENTED_CATEGORY(CATID_AGC) IMPLEMENTED_CATEGORY(CATID_SafeForScripting) IMPLEMENTED_CATEGORY(CATID_SafeForInitializing) END_CATEGORY_MAP() // Interface Map public: BEGIN_COM_MAP(CTCStrings) COM_INTERFACE_ENTRY(ITCStrings) COM_INTERFACE_ENTRY2(IDispatch, ITCStrings) COM_INTERFACE_ENTRY(ITCCollection) COM_INTERFACE_ENTRY(ITCCollectionPersistHelper) COM_INTERFACE_ENTRY2(IPersist, TCPersistPropertyBagImpl) COM_INTERFACE_ENTRY(IPersistPropertyBag) COM_INTERFACE_ENTRY(IPersistStorage) COM_INTERFACE_ENTRY(IPersistStreamInit) COM_INTERFACE_ENTRY2(IPersistStream, TCPersistStreamInitImplBase) COM_INTERFACE_ENTRY(IObjectSafety) COM_INTERFACE_ENTRY_AUTOAGGREGATE(IID_IMarshal, m_punkMBV.p, CLSID_TCMarshalByValue) END_COM_MAP() // Property Map public: BEGIN_PROP_MAP(CTCStrings) PROP_ENTRY_EX("Strings", dispid_Collection1, CLSID_NULL, IID_ITCCollectionPersistHelper) END_PROP_MAP() // Construction / Destruction public: CTCStrings(); // IAGCCollection Interface Methods public: STDMETHODIMP get_Count(long* pnCount); STDMETHODIMP get__NewEnum(IUnknown** ppunkEnum); // ITCStrings Interface Methods public: STDMETHODIMP get_Item(VARIANT* pvIndex, BSTR* pbstr); STDMETHODIMP Add(BSTR bstr); STDMETHODIMP Remove(VARIANT* pvIndex); STDMETHODIMP RemoveAll(); STDMETHODIMP AddDelimited(BSTR bstrDelimiter, BSTR bstrStrings); STDMETHODIMP get_DelimitedItems(BSTR bstrDelimiter, BSTR* pbstrStrings); STDMETHODIMP AddStrings(ITCStrings* pStrings); // ITCCollectionPersistHelper Interface Methods public: STDMETHODIMP put_Collection1(VARIANT* pvarSafeArray); STDMETHODIMP get_Collection1(VARIANT* pvarSafeArray); // Types protected: typedef std::vector CStringVector; typedef CStringVector::iterator CStringIterator; // Data Members public: CComPtr m_punkMBV; protected: CStringVector m_vecStrings; }; ///////////////////////////////////////////////////////////////////////////// #endif // !__TCStrings_h__