1 ////////////////////////////////////////////////////////////////////////////
3 // $Header: x:/prj/tech/libsrc/namedres/RCS/resbase.h 1.11 1970/01/01 00:00:00 TOML Exp $
5 // Template for creating resource types from.
20 //////////////////////////////////////////////////////////////////////////
22 // @NOTE: It is *essential* that INTERFACE be IRes or a descendent thereof.
23 // Strange and mysterious things may happen otherwise...
28 template <class INTERFACE
, const GUID
* pIID_INTERFACE
>
29 class cResourceBase
: public IResHack
,
34 cResourceBase(IStore
*pStore
,
37 virtual ~cResourceBase();
39 virtual void OnFinalRelease()
43 STDMETHODIMP_(ULONG
) AddRef()
45 return __m_ulRefs
.AddRef();
48 STDMETHODIMP_(ULONG
) Release()
50 if (__m_ulRefs
.Release())
60 STDMETHOD (QueryInterface
)(REFIID id
, void ** ppI
);
66 STDMETHOD_(void *, Lock
) ();
67 STDMETHOD_(void, Unlock
) ();
68 STDMETHOD_(unsigned, GetLockCount
)();
70 STDMETHOD_(IResType
*, GetType
) ();
71 STDMETHOD_(const char *, GetName
) ();
72 STDMETHOD_(void, GetCanonPath
) (char **ppPath
);
73 STDMETHOD_(void, GetCanonPathName
) (char **ppPathname
);
74 STDMETHOD_(IStore
*, GetCanonStore
) ();
75 STDMETHOD_(void, GetVariant
) (char **ppVariantPath
);
76 STDMETHOD_(void, GetStreamName
) (BOOL bFullpath
, char **ppPathname
);
78 STDMETHOD_(void *, DataPeek
) ();
79 STDMETHOD_(BOOL
, Drop
) ();
80 STDMETHOD_(long, GetSize
) ();
81 STDMETHOD_(void *, Extract
) (void *pBuf
);
82 STDMETHOD_(void *, PreLoad
) ();
83 // Grab data from file; no memory management. Return number of bytes read.
84 STDMETHOD_(int, ExtractPartial
) (const long nStart
,
87 STDMETHOD_(void, ExtractBlocks
) (void *pBuf
,
92 STDMETHOD_(BOOL
, AsyncLock
) (const int nPriority
);
93 STDMETHOD_(BOOL
, AsyncExtract
) (const int nPriority
,
96 STDMETHOD_(BOOL
, AsyncPreload
) ();
97 STDMETHOD_(BOOL
, IsAsyncFulfilled
) ();
98 STDMETHOD(AsyncKill
) ();
99 STDMETHOD(GetAsyncResult
) (void **ppResult
);
101 STDMETHOD_(void, SetAppData
) (DWORD AppData
);
102 STDMETHOD_(DWORD
, GetAppData
) ();
108 STDMETHOD_(void, SetData
) (void *pNewData
);
109 STDMETHOD_(BOOL
, HasSetData
) ();
113 // IResControl methods
115 STDMETHOD_(BOOL
, SetStore
) (IStore
*pStore
);
116 STDMETHOD_(IStore
*, GetStore
) ();
117 STDMETHOD_(void, SetName
) (const char *pNewName
);
118 STDMETHOD_(void, AllowStorageReset
) (BOOL
);
119 STDMETHOD_(void, SetCanonStore
) (IStore
*pCanonStore
);
121 STDMETHOD_(void *, LoadData
) (ulong
* pSize
,
123 IResMemOverride
* pResMem
);
124 STDMETHOD_(BOOL
, FreeData
) (void *pData
,
126 IResMemOverride
*pResMem
);
127 STDMETHOD_(IStoreStream
*, OpenStream
) ();
129 STDMETHOD_(char **, GetTranslatableTypes
)(/* OUT */ int *pnTypes
);
130 STDMETHOD_(void *, LoadTranslation
)(void *pOldData
,
132 const char *pOldTypeName
,
133 /* OUT */ BOOL
*pAllocated
,
134 /* OUT */ ulong
*pSize
,
135 IResMemOverride
*pResMem
);
137 STDMETHOD_(void, SetManData
) (DWORD ManData
);
138 STDMETHOD_(DWORD
, GetManData
) ();
145 unsigned long m_ulRefs
;
147 // @TBD (toml 04-21-98): should these be ordered so most commonly used is first for efficiency?
148 // @TBD (toml 04-21-98): again, probably better served by consolodating all flags into an unsigned "flags" field
149 BOOL m_bAllowStorageReset
;
151 IResManHelper
*m_pResMan
;// @TBD (toml 04-21-98): this could be a static?
153 IStore
* m_pCanonStore
;
162 // Set by the application, if desired.
165 // Set by the Resource Manager, if desired.
168 // Used for multiple calls to ExtractPartial so that streams don't have to
169 // be reopened each time.
170 IStoreStream
*m_pStream
;
173 // This is set only when the app told the resource to replace its real
174 // data with something app-controlled:
175 void * m_pAssignedData
;
176 int m_nAssignedCount
;
179 cCTRefCount __m_ulRefs
;
182 ///////////////////////////////////////////////////////////////////////////////
186 #endif /* !__RESBASE_H */