1 //+-------------------------------------------------------------------------
2 //
3 //  For conditions of distribution and use, see copyright notice
4 //  in Flashpix.h
5 //
6 //  Copyright (c) 1999 Digital Imaging Group, Inc.
7 //
8 //  Contents:   Multistream inline functions
9 //
10 //  Classes:    None.
11 //
12 //--------------------------------------------------------------------------
13 
14 #ifndef __MSFFUNC_HXX__
15 #define __MSFFUNC_HXX__
16 
17 #include "msf.hxx"
18 #include "dir.hxx"
19 #include "dirfunc.hxx"
20 
21 //+-------------------------------------------------------------------------
22 //
23 //  Member:     CMStream::RenameEntry, public
24 //
25 //  Synposis:   Rename an entry.
26 //
27 //  Arguments:  [sidParent] - Parent SID
28 //    [pdfn] - Old name
29 //              [pdfnNew] -- New name
30 //
31 //  Returns:    S_OK otherwise
32 //
33 //  Algorithm:  Call through to CDirectory::RenameEntry
34 //
35 //  Notes:
36 //
37 //---------------------------------------------------------------------------
38 
39 
RenameEntry(SID const sidParent,CDfName const * pdfn,CDfName const * pdfnNew)40 inline SCODE CMStream::RenameEntry(
41         SID const sidParent,
42         CDfName const *pdfn,
43         CDfName const *pdfnNew)
44 {
45     return _dir.RenameEntry(sidParent, pdfn, pdfnNew);
46 }
47 
48 //+-------------------------------------------------------------------------
49 //
50 //  Member:     CMStream::IsEntry, public
51 //
52 //  Synposis:   Determine if a given entry is present in a multistream
53 //
54 //  Arguments:  [sidParent] - Parent SID
55 //              [pdfn] -- Name of entry to be located
56 //    [peb] - Entry block to fill in
57 //
58 //  Returns:    S_OK if entry exists.
59 //              STG_E_FILENOTFOUND if it doesn't.
60 //
61 //---------------------------------------------------------------------------
62 
63 
IsEntry(SID const sidParent,CDfName const * pdfn,SEntryBuffer * peb)64 inline SCODE CMStream::IsEntry(
65         SID const sidParent,
66         CDfName const *pdfn,
67         SEntryBuffer *peb)
68 {
69     return _dir.IsEntry(sidParent, pdfn, peb);
70 }
71 
72 
73 //+-------------------------------------------------------------------------
74 //
75 //  Member:     CMStream::CreateEntry, public
76 //
77 //  Synposis:   Allows creation of new entries
78 //
79 //  Arguments:  [sidParent] -- SID of parent entry
80 //              [pdfn] -- Name of new entry
81 //              [mefFlags] -- Flags to be set on new entry
82 //              [psid] -- Location for return SID
83 //
84 //  Returns:    S_OK if call completed OK.
85 //              STG_E_FILEALREADYEXISTS if stream already exists
86 //
87 //---------------------------------------------------------------------------
88 
89 
CreateEntry(SID const sidParent,CDfName const * pdfn,MSENTRYFLAGS const mefFlags,SID * psid)90 inline SCODE CMStream::CreateEntry(
91         SID const sidParent,
92         CDfName const *pdfn,
93         MSENTRYFLAGS const mefFlags,
94         SID *psid)
95 {
96     return _dir.CreateEntry(sidParent, pdfn, mefFlags, psid);
97 }
98 
99 //+-------------------------------------------------------------------------
100 //
101 //  Method:     CMStream::GetTime, public
102 //
103 //  Synopsis:   Get the time for a given handle
104 //
105 //  Arguments:  [sid] -- SID to retrieve time for
106 //              [tt] -- Timestamp requested (WT_CREATION, WT_MODIFICATION,
107 //                          WT_ACCESS)
108 //              [pnt] -- Pointer to return location
109 //
110 //  Returns:    S_OK if call completed OK.
111 //
112 //--------------------------------------------------------------------------
113 
114 
GetTime(SID const sid,WHICHTIME const tt,TIME_T * pnt)115 inline SCODE CMStream::GetTime(SID const sid,
116         WHICHTIME const tt,
117         TIME_T *pnt)
118 {
119     return _dir.GetTime(sid, tt, pnt);
120 }
121 
122 
123 //+-------------------------------------------------------------------------
124 //
125 //  Method:     CMStream::SetTime, public
126 //
127 //  Synopsis:   Set the time for a given handle
128 //
129 //  Arguments:  [sid] -- SID to retrieve time for
130 //              [tt] -- Timestamp requested (WT_CREATION, WT_MODIFICATION,
131 //                          WT_ACCESS)
132 //              [nt] -- New timestamp
133 //
134 //  Returns:    S_OK if call completed OK.
135 //
136 //  Algorithm:  Call through to directory
137 //
138 //--------------------------------------------------------------------------
139 
SetTime(SID const sid,WHICHTIME const tt,TIME_T nt)140 inline SCODE CMStream::SetTime(SID const sid,
141         WHICHTIME const tt,
142         TIME_T nt)
143 {
144     return _dir.SetTime(sid, tt, nt);
145 }
146 
147 //+---------------------------------------------------------------------------
148 //
149 //  Member: CMStream::GetClass, public
150 //
151 //  Synopsis: Gets the class ID
152 //
153 //  Arguments:  [pclsid] - Class ID return
154 //
155 //  Returns:  Appropriate status code
156 //
157 //  Modifies: [pclsid]
158 //
159 //----------------------------------------------------------------------------
160 
GetClass(SID const sid,CLSID * pclsid)161 inline SCODE CMStream::GetClass(SID const sid,
162                                 CLSID *pclsid)
163 {
164     return _dir.GetClassId(sid, pclsid);
165 }
166 
167 //+---------------------------------------------------------------------------
168 //
169 //  Member: CMStream::SetClass, public
170 //
171 //  Synopsis: Sets the class ID
172 //
173 //  Arguments:  [clsid] - Class ID
174 //
175 //  Returns:  Appropriate status code
176 //
177 //----------------------------------------------------------------------------
178 
SetClass(SID const sid,REFCLSID clsid)179 inline SCODE CMStream::SetClass(SID const sid,
180                                 REFCLSID clsid)
181 {
182     return _dir.SetClassId(sid, clsid);
183 }
184 
185 //+---------------------------------------------------------------------------
186 //
187 //  Member: CMStream::GetStateBits, public
188 //
189 //  Synopsis: Gets state bits
190 //
191 //  Arguments:  [pgrfStateBits] - State bits return
192 //
193 //  Returns:  Appropriate status code
194 //
195 //  Modifies: [pgrfStateBits]
196 //
197 //----------------------------------------------------------------------------
198 
GetStateBits(SID const sid,DWORD * pgrfStateBits)199 inline SCODE CMStream::GetStateBits(SID const sid,
200                                     DWORD *pgrfStateBits)
201 {
202     return _dir.GetUserFlags(sid, pgrfStateBits);
203 }
204 
205 //+---------------------------------------------------------------------------
206 //
207 //  Member: CMStream::SetStateBits, public
208 //
209 //  Synopsis: Sets state bits
210 //
211 //  Arguments:  [grfStateBits] - State bits
212 //
213 //  Returns:  Appropriate status code
214 //
215 //----------------------------------------------------------------------------
216 
SetStateBits(SID const sid,DWORD grfStateBits,DWORD grfMask)217 inline SCODE CMStream::SetStateBits(SID const sid,
218                                     DWORD grfStateBits,
219                                     DWORD grfMask)
220 {
221     return _dir.SetUserFlags(sid, grfStateBits, grfMask);
222 }
223 
224 
225 //+-------------------------------------------------------------------------
226 //
227 //  Method:     CMStream::GetEntrySize, public
228 //
229 //  Synopsis:   Return the size of an entry
230 //
231 //  Arguments:  [sid] - SID of entry
232 //              [pcbSize] -- Location for return of size
233 //
234 //  Returns:    S_OK if call completed OK.
235 //
236 //  Algorithm:  Ask directory for size
237 //
238 //--------------------------------------------------------------------------
239 
GetEntrySize(SID const sid,ULONG * pcbSize)240 inline SCODE CMStream::GetEntrySize(SID const sid,
241         ULONG *pcbSize)
242 {
243     return _dir.GetSize(sid, pcbSize);
244 }
245 
246 
247 //+-------------------------------------------------------------------------
248 //
249 //  Member:     CMStream::DestroyEntry
250 //
251 //  Synposis:   Delete a directory entry from a multi-stream.
252 //
253 //  Effects:    Modifies directory.
254 //
255 //  Arguments:  [sidParent] - Parent SID
256 //    [pdfn] - Name of entry
257 //
258 //  Returns:    S_OK if operation completed successfully.
259 //
260 //  Algorithm:  Set information on entry to default "free" case.
261 //              Return S_OK
262 //
263 //  Notes:
264 //
265 //---------------------------------------------------------------------------
266 
267 
DestroyEntry(SID const sidParent,CDfName const * pdfn)268 inline SCODE CMStream::DestroyEntry(SID const sidParent,
269         CDfName const *pdfn)
270 {
271     SCODE sc;
272 
273     msfDebugOut((DEB_TRACE,"In CMStream::DestroyEntry()\n"));
274 
275     //  Two cases:
276     //  pdfn == NULL - destroy all children of sidParent
277     //  pdfn != NULL - destroy the named child of sidParent
278 
279     if (pdfn == NULL)
280         sc = _dir.DestroyAllChildren(sidParent);
281     else
282         sc = _dir.DestroyChild(sidParent, pdfn);
283 
284     msfDebugOut((DEB_TRACE,"Leaving CMStream::DestroyEntry()\n"));
285 
286     return sc;
287 }
288 
289 
290 #endif //__MSFFUNC_HXX__
291