home *** CD-ROM | disk | FTP | other *** search
- #ifndef __CPROPBAG_HPP__
- #define __CPROPBAG_HPP__
-
- #include <olectl.h>
-
- #ifdef __cplusplus // class definition should be invisible to C sources...
-
-
- typedef struct tagProperty
- {
- // BSTR pwcName; // BUGBUG we'll need to move this into unicode
- // at some point (after PDC)
- char *pszName;
- VARIANT *pvarValue;
- }PROPERTY;
-
- typedef struct tagPropertyList
- {
- PROPERTY *pProperty;
- VOID *pNext;
- VOID *pPrev;
- }PROPERTYLIST;
-
- class CPropertyBag : public IPropertyBag
- {
- // public interface
- public:
- // CPropertyBag methods
- CPropertyBag();
- virtual ~CPropertyBag();
- void AddParam(const char *name, const char *value );
- void setExtents(ULONG, ULONG);
-
- // IUnknown
- STDMETHODIMP QueryInterface(REFIID, LPVOID *);
- STDMETHODIMP_(ULONG) AddRef(void);
- STDMETHODIMP_(ULONG) Release(void);
-
- // IPropertyBag methods
-
- // Asks the property bag to read the property named with pszPropName
- // into the caller-initialized VARIANT in pVar.
- //
- STDMETHODIMP_(HRESULT) Read(LPCOLESTR, VARIANT *, IErrorLog *);
-
- // Asks the property bag to save the property named with
- // pszPropName using the type and value in the
- // caller-initialized VARIANT in pVar.
- //
- STDMETHODIMP_(HRESULT) Write(LPCOLESTR, VARIANT *);
-
-
- // internal helpers
- private:
-
- // The internal non Unicode version of Write
- HRESULT lpstrWrite(const char *, VARIANT *);
- // The internal non Unicode version of Read
- HRESULT lpstrRead(const char *, VARIANT *, IErrorLog *pErrorLog);
-
- BOOL addToPropertyList(PROPERTY *pProperty);
- BOOL deletePropertyList();
- BOOL find(const char *, PROPERTY * *ppProperty);
- HRESULT GetPropertyBagContents( VARIANT *pVar, IErrorLog *pErrorLog);
-
-
- // class data
- DWORD m_cRef; // reference count of object
- PROPERTYLIST *m_pProperties;
- PROPERTYLIST *m_pPropertiesHead;
- PROPERTYLIST *m_pPropertiesTail;
- UINT m_cProperties;
- char far * *m_pbContents;
-
- };
-
-
-
- typedef CPropertyBag * LPCPropertyBag;
- DECLARE_STANDARD_TYPES(CPropertyBag);
-
- #endif //__cplusplus
-
-
-
-
- #endif // __CPROPBAG_HPP__
-