propset.h
上传用户:szled88
上传日期:2015-04-09
资源大小:43957k
文件大小:6k
- // propset.h : interface of the CProperty, CPropertySection, and CPropertSet classes
- //
- // This file is a part of the XTREME TOOLKIT PRO MFC class library.
- // (c)1998-2008 Codejock Software, All Rights Reserved.
- //
- // THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE
- // RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN
- // CONSENT OF CODEJOCK SOFTWARE.
- //
- // THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED
- // IN THE XTREME TOOLKIT PRO LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO
- // YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A
- // SINGLE COMPUTER.
- //
- // CONTACT INFORMATION:
- // support@codejock.com
- // http://www.codejock.com
- //
- /////////////////////////////////////////////////////////////////////////////
- // Property setting
- typedef struct tagSECTIONHEADER
- {
- DWORD cbSection ;
- DWORD cProperties ; // Number of props.
- } SECTIONHEADER, *LPSECTIONHEADER ;
- typedef struct tagPROPERTYIDOFFSET
- {
- DWORD propertyID;
- DWORD dwOffset;
- } PROPERTYIDOFFSET, *LPPROPERTYIDOFFSET;
- typedef struct tagPROPHEADER
- {
- WORD wByteOrder ; // Always 0xFFFE
- WORD wFormat ; // Always 0
- DWORD dwOSVer ; // System version
- CLSID clsID ; // Application CLSID
- DWORD cSections ; // Number of sections (must be at least 1)
- } PROPHEADER, *LPPROPHEADER ;
- typedef struct tagFORMATIDOFFSET
- {
- GUID formatID;
- DWORD dwOffset;
- } FORMATIDOFFSET, *LPFORMATIDOFFSET;
- /////////////////////////////////////////////////////////////////////////////
- // CProperty
- class CProperty : public CObject
- {
- friend class CPropertySet ;
- friend class CPropertySection ;
- public:
- // Construction
- CProperty( void ) ;
- CProperty( DWORD dwID, const LPVOID pValue, DWORD dwType ) ;
- // Attributes
- BOOL Set( DWORD dwID, const LPVOID pValue, DWORD dwType ) ;
- BOOL Set( const LPVOID pValue, DWORD dwType ) ;
- BOOL Set( const LPVOID pValue ) ;
- LPVOID Get( DWORD* pcb ) ; // Returns pointer to actual value
- LPVOID Get( void ) ; // Returns pointer to actual value
- DWORD GetType( void ) ; // Returns property type
- void SetType( DWORD dwType ) ;
- DWORD GetID( void ) ;
- void SetID( DWORD dwPropID ) ;
- LPVOID GetRawValue( void ) ; // Returns pointer internal value (may
- // include size information)
- // Operations
- BOOL WriteToStream( IStream* pIStream ) ;
- BOOL ReadFromStream( IStream* pIStream ) ;
- private:
- DWORD m_dwPropID ;
- DWORD m_dwType ;
- LPVOID m_pValue ;
- LPVOID AllocValue(ULONG cb);
- void FreeValue();
- public:
- ~CProperty() ;
- } ;
- /////////////////////////////////////////////////////////////////////////////
- // CPropertySection
- class CPropertySection : public CObject
- {
- friend class CPropertySet ;
- friend class CProperty ;
- public:
- // Construction
- CPropertySection( void ) ;
- CPropertySection( CLSID FormatID ) ;
- // Attributes
- CLSID GetFormatID( void ) ;
- void SetFormatID( CLSID FormatID ) ;
- BOOL Set( DWORD dwPropID, LPVOID pValue, DWORD dwType ) ;
- BOOL Set( DWORD dwPropID, LPVOID pValue ) ;
- LPVOID Get( DWORD dwPropID, DWORD* pcb ) ;
- LPVOID Get( DWORD dwPropID ) ;
- void Remove( DWORD dwPropID ) ;
- void RemoveAll() ;
- CProperty* GetProperty( DWORD dwPropID ) ;
- void AddProperty( CProperty* pProp ) ;
- DWORD GetSize( void ) ;
- DWORD GetCount( void ) ;
- CObList* GetList( void ) ;
- BOOL GetID( LPCTSTR pszName, DWORD* pdwPropID ) ;
- BOOL SetName( DWORD dwPropID, LPCTSTR pszName ) ;
- BOOL SetSectionName( LPCTSTR pszName );
- LPCTSTR GetSectionName( void );
- // Operations
- BOOL WriteToStream( IStream* pIStream ) ;
- BOOL ReadFromStream( IStream* pIStream, LARGE_INTEGER liPropSet ) ;
- BOOL WriteNameDictToStream( IStream* pIStream ) ;
- BOOL ReadNameDictFromStream( IStream* pIStream ) ;
- private:
- // Implementation
- CLSID m_FormatID ;
- SECTIONHEADER m_SH ;
- // List of properties (CProperty)
- CObList m_PropList ;
- // Dictionary of property names
- CMapStringToPtr m_NameDict ;
- CString m_strSectionName;
- public:
- ~CPropertySection();
- } ;
- /////////////////////////////////////////////////////////////////////////////
- // CPropertySet
- class CPropertySet : public CObject
- {
- friend class CPropertySection ;
- friend class CProperty ;
- public:
- // Construction
- CPropertySet( void ) ;
- CPropertySet( CLSID clsID ) ;
- // Attributes
- BOOL Set( CLSID FormatID, DWORD dwPropID, LPVOID pValue, DWORD dwType ) ;
- BOOL Set( CLSID FormatID, DWORD dwPropID, LPVOID pValue ) ;
- LPVOID Get( CLSID FormatID, DWORD dwPropID, DWORD* pcb ) ;
- LPVOID Get( CLSID FormatID, DWORD dwPropID ) ;
- void Remove( CLSID FormatID, DWORD dwPropID ) ;
- void Remove( CLSID FormatID ) ;
- void RemoveAll( ) ;
- CProperty* GetProperty( CLSID FormatID, DWORD dwPropID ) ;
- void AddProperty( CLSID FormatID, CProperty* pProp ) ;
- CPropertySection* GetSection( CLSID FormatID ) ;
- CPropertySection* AddSection( CLSID FormatID ) ;
- void AddSection( CPropertySection* psect ) ;
- WORD GetByteOrder( void ) ;
- WORD GetFormatVersion( void ) ;
- void SetFormatVersion( WORD wFmtVersion ) ;
- DWORD GetOSVersion( void ) ;
- void SetOSVersion( DWORD dwOSVer ) ;
- CLSID GetClassID( void ) ;
- void SetClassID( CLSID clsid ) ;
- DWORD GetCount( void ) ;
- CObList* GetList( void ) ;
- // Operations
- BOOL WriteToStream( IStream* pIStream ) ;
- BOOL ReadFromStream( IStream* pIStream ) ;
- // Implementation
- private:
- PROPHEADER m_PH ;
- CObList m_SectionList ;
- public:
- ~CPropertySet();
- } ;