williamr@2
|
1 |
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@2
|
4 |
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@2
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
// Class RFileBuf
|
williamr@2
|
17 |
inline void RFileBuf::Reset(TInt aSize)
|
williamr@2
|
18 |
/** Frees the intermediate buffer and changes the size of any future intermediate
|
williamr@2
|
19 |
buffer to the specified value.
|
williamr@2
|
20 |
|
williamr@2
|
21 |
The intermediate buffer must not contain any outstanding write data, otherwise
|
williamr@2
|
22 |
the function raises a STORE-File 6 panic.
|
williamr@2
|
23 |
|
williamr@2
|
24 |
@param aSize The size of any future intermediate buffer. */
|
williamr@2
|
25 |
{Reset();iSize=aSize;}
|
williamr@2
|
26 |
inline void RFileBuf::Detach()
|
williamr@2
|
27 |
/** Detaches the file from this stream buffer.
|
williamr@2
|
28 |
|
williamr@2
|
29 |
The intermediate buffer's read and write marks are not changed, and the stream
|
williamr@2
|
30 |
positions are not changed. This means that the contents of the file should
|
williamr@2
|
31 |
not change while it is detached.
|
williamr@2
|
32 |
|
williamr@2
|
33 |
@see Attach()
|
williamr@2
|
34 |
@see Reattach() */
|
williamr@2
|
35 |
{iFile=RFile();}
|
williamr@2
|
36 |
inline void RFileBuf::Reattach(RFile& aFile)
|
williamr@2
|
37 |
/** Re-attaches the specified file to this stream buffer.
|
williamr@2
|
38 |
|
williamr@2
|
39 |
The intermediate buffer's read and write marks are not changed, and the stream
|
williamr@2
|
40 |
positions are not changed.
|
williamr@2
|
41 |
|
williamr@2
|
42 |
The file should be the one that was detached using the Detach() function.
|
williamr@2
|
43 |
|
williamr@2
|
44 |
@param aFile The file to be re-attached.
|
williamr@2
|
45 |
@see Attach()
|
williamr@2
|
46 |
@see Detach() */
|
williamr@2
|
47 |
{iFile=aFile;}
|
williamr@2
|
48 |
inline RFile& RFileBuf::File() const
|
williamr@2
|
49 |
/** Gets a reference to the file attached to this stream buffer.
|
williamr@2
|
50 |
|
williamr@2
|
51 |
@return The file attached to this stream buffer. */
|
williamr@2
|
52 |
{return MUTABLE_CAST(RFile&,iFile);}
|
williamr@2
|
53 |
|
williamr@2
|
54 |
// Class RFileWriteStream
|
williamr@2
|
55 |
inline RFileWriteStream::RFileWriteStream(const MExternalizer<TStreamRef>& anExter)
|
williamr@2
|
56 |
: RWriteStream(anExter)
|
williamr@2
|
57 |
{}
|
williamr@2
|
58 |
|
williamr@2
|
59 |
// Class CFileStore
|
williamr@2
|
60 |
inline const TUidType& CFileStore::Type() const
|
williamr@2
|
61 |
/** Gets the UID type of the file store.
|
williamr@2
|
62 |
|
williamr@2
|
63 |
@return The UID type object containing the file store type.
|
williamr@2
|
64 |
@see TUid */
|
williamr@2
|
65 |
{return iType;}
|
williamr@2
|
66 |
inline void CFileStore::Reset()
|
williamr@2
|
67 |
/** Frees the file store’s buffer space.
|
williamr@2
|
68 |
|
williamr@2
|
69 |
The buffer space is automatically re-allocated when needed.
|
williamr@2
|
70 |
|
williamr@2
|
71 |
This function should only be used immediately after a successful call to CommitL()
|
williamr@2
|
72 |
or RevertL().
|
williamr@2
|
73 |
|
williamr@2
|
74 |
@see CStreamStore::CommitL()
|
williamr@2
|
75 |
@see CStreamStore::RevertL() */
|
williamr@2
|
76 |
{iBuf.Reset();}
|
williamr@2
|
77 |
inline void CFileStore::Reset(TInt aSize)
|
williamr@2
|
78 |
/** Frees the file store’s buffer space and changes the size of future buffer
|
williamr@2
|
79 |
space allocations.
|
williamr@2
|
80 |
|
williamr@2
|
81 |
The buffer space is automatically re-allocated when needed, using the new
|
williamr@2
|
82 |
size value.
|
williamr@2
|
83 |
|
williamr@2
|
84 |
This function should only be used immediately after a successful call to CommitL()
|
williamr@2
|
85 |
or RevertL().
|
williamr@2
|
86 |
|
williamr@2
|
87 |
@param aSize The size of future buffer space allocations.
|
williamr@2
|
88 |
@see CStreamStore::CommitL()
|
williamr@2
|
89 |
@see CStreamStore::RevertL() */
|
williamr@2
|
90 |
{iBuf.Reset(aSize);}
|
williamr@2
|
91 |
inline void CFileStore::Detach()
|
williamr@2
|
92 |
/** Detaches the file store from its associated file.
|
williamr@2
|
93 |
|
williamr@2
|
94 |
In effect, the file store gives up ownership of the file.
|
williamr@2
|
95 |
|
williamr@2
|
96 |
Detaching is useful in cases where a file needs to be closed and later re-opened;
|
williamr@2
|
97 |
for example, to give up a write lock for backup purposes.
|
williamr@2
|
98 |
|
williamr@2
|
99 |
It is very important that the contents of the file should not change while
|
williamr@2
|
100 |
it is detached.
|
williamr@2
|
101 |
|
williamr@2
|
102 |
@see File()
|
williamr@2
|
103 |
@see Reattach() */
|
williamr@2
|
104 |
{iBuf.Detach();}
|
williamr@2
|
105 |
inline void CFileStore::Reattach(RFile& aFile)
|
williamr@2
|
106 |
/** Reattaches a file to the file store. The file should be the one that was detached
|
williamr@2
|
107 |
using the Detach() function.
|
williamr@2
|
108 |
|
williamr@2
|
109 |
@param aFile The file to be associated with this file store.
|
williamr@2
|
110 |
@see File() */
|
williamr@2
|
111 |
{iBuf.Reattach(aFile);}
|
williamr@2
|
112 |
inline RFile& CFileStore::File() const
|
williamr@2
|
113 |
/** Gets a reference to the file associated with this file store.
|
williamr@2
|
114 |
|
williamr@2
|
115 |
This function is called prior to detaching the file store.
|
williamr@2
|
116 |
|
williamr@2
|
117 |
@return A reference to the associated file.
|
williamr@2
|
118 |
@see Detach() */
|
williamr@2
|
119 |
{return iBuf.File();}
|
williamr@2
|
120 |
inline TStreamExchange& CFileStore::Host() const
|
williamr@2
|
121 |
{return MUTABLE_CAST(TStreamExchange&,iHost);}
|
williamr@2
|
122 |
inline TBool CFileStore::IsHost(const MStreamBuf* aBuf) const
|
williamr@2
|
123 |
{return aBuf==&iBuf;}
|
williamr@2
|
124 |
inline void CFileStore::SetSizeL(TInt aSize)
|
williamr@2
|
125 |
{iBuf.SetSizeL(aSize);}
|
williamr@2
|
126 |
|
williamr@2
|
127 |
// Class CDirectFileStore
|
williamr@2
|
128 |
inline CDirectFileStore* CDirectFileStore::OpenL(RFs& aFs,const TDesC& aName,TUint aFileMode)
|
williamr@2
|
129 |
/** Opens a file containing a direct file store, and constructs a direct file store
|
williamr@2
|
130 |
object.
|
williamr@2
|
131 |
|
williamr@2
|
132 |
@param aFs Handle to a file server session.
|
williamr@2
|
133 |
@param aName The full path name of the file containing the store.
|
williamr@2
|
134 |
@param aFileMode The mode in which the file is to be accessed. The mode is
|
williamr@2
|
135 |
defined by the TFileMode type.
|
williamr@2
|
136 |
@return A pointer to the new direct file store object.
|
williamr@2
|
137 |
@see TFileMode */
|
williamr@2
|
138 |
{return STATIC_CAST(CDirectFileStore*,CFileStore::OpenL(aFs,aName,aFileMode,KDirectFileStoreFactoryFunction));}
|
williamr@2
|
139 |
inline CDirectFileStore* CDirectFileStore::OpenLC(RFs& aFs,const TDesC& aName,TUint aFileMode)
|
williamr@2
|
140 |
/** Opens a file containing a direct file store, constructs a direct file store
|
williamr@2
|
141 |
object, and places the pointer onto the cleanup stack.
|
williamr@2
|
142 |
|
williamr@2
|
143 |
@param aFs Handle to a file server session.
|
williamr@2
|
144 |
@param aName The full path name of the file containing the store.
|
williamr@2
|
145 |
@param aFileMode The mode in which the file is to be accessed. The mode is
|
williamr@2
|
146 |
defined by the TFileMode type.
|
williamr@2
|
147 |
@return A pointer to the new direct file store object.
|
williamr@2
|
148 |
@see TFileMode */
|
williamr@2
|
149 |
{return STATIC_CAST(CDirectFileStore*,CFileStore::OpenLC(aFs,aName,aFileMode,KDirectFileStoreFactoryFunction));}
|
williamr@2
|
150 |
inline CDirectFileStore* CDirectFileStore::CreateL(RFs& aFs,const TDesC& aName,TUint aFileMode)
|
williamr@2
|
151 |
/** Creates a new file and constructs a new direct file store object to be associated
|
williamr@2
|
152 |
with this file.
|
williamr@2
|
153 |
|
williamr@2
|
154 |
@param aFs Handle to a file server session.
|
williamr@2
|
155 |
@param aName The full path name of the new file. A file with this name must
|
williamr@2
|
156 |
not already exist, otherwise the function leaves.
|
williamr@2
|
157 |
@param aFileMode The mode in which the file is to be accessed. The mode is
|
williamr@2
|
158 |
defined by the TFileMode type.
|
williamr@2
|
159 |
@return A pointer to the new direct file store object
|
williamr@2
|
160 |
@see TFileMode */
|
williamr@2
|
161 |
{return STATIC_CAST(CDirectFileStore*,CFileStore::CreateL(aFs,aName,aFileMode,&DoNewL));}
|
williamr@2
|
162 |
inline CDirectFileStore* CDirectFileStore::CreateLC(RFs& aFs,const TDesC& aName,TUint aFileMode)
|
williamr@2
|
163 |
/** Creates a new file and constructs a new direct file store object to be associated
|
williamr@2
|
164 |
with this file, and places the pointer onto the cleanup stack.
|
williamr@2
|
165 |
|
williamr@2
|
166 |
@param aFs Handle to a file server session.
|
williamr@2
|
167 |
@param aName The full path name of the new file. A file with this name must
|
williamr@2
|
168 |
not already exist, otherwise the function leaves.
|
williamr@2
|
169 |
@param aFileMode The mode in which the file is to be accessed. The mode is
|
williamr@2
|
170 |
defined by the TFileMode type.
|
williamr@2
|
171 |
@return A pointer to the new direct file store object
|
williamr@2
|
172 |
@see TFileMode */
|
williamr@2
|
173 |
{return STATIC_CAST(CDirectFileStore*,CFileStore::CreateLC(aFs,aName,aFileMode,&DoNewL));}
|
williamr@2
|
174 |
inline CDirectFileStore* CDirectFileStore::ReplaceL(RFs& aFs,const TDesC& aName,TUint aFileMode)
|
williamr@2
|
175 |
/** Creates a file and constructs a direct file store object to be associated with
|
williamr@2
|
176 |
it.
|
williamr@2
|
177 |
|
williamr@2
|
178 |
The file replaces any existing file of the same name.
|
williamr@2
|
179 |
|
williamr@2
|
180 |
@param aFs Handle to a file server session.
|
williamr@2
|
181 |
@param aName The full path name of the file to be replaced.
|
williamr@2
|
182 |
@param aFileMode The mode in which the file is to be accessed. The mode is
|
williamr@2
|
183 |
defined by the TFileMode type.
|
williamr@2
|
184 |
@return A pointer to the new direct file store object.
|
williamr@2
|
185 |
@see TFileMode */
|
williamr@2
|
186 |
{return STATIC_CAST(CDirectFileStore*,CFileStore::ReplaceL(aFs,aName,aFileMode,&DoNewL));}
|
williamr@2
|
187 |
inline CDirectFileStore* CDirectFileStore::ReplaceLC(RFs& aFs,const TDesC& aName,TUint aFileMode)
|
williamr@2
|
188 |
/** Creates a file, constructs a direct file store object to be associated with
|
williamr@2
|
189 |
it, and places the pointer onto the cleanup stack.
|
williamr@2
|
190 |
|
williamr@2
|
191 |
The file replaces any existing file of the same name.
|
williamr@2
|
192 |
|
williamr@2
|
193 |
@param aFs Handle to a file server session.
|
williamr@2
|
194 |
@param aName The full path name of the file to be replaced.
|
williamr@2
|
195 |
@param aFileMode The mode in which the file is to be accessed. The mode is
|
williamr@2
|
196 |
defined by the TFileMode type.
|
williamr@2
|
197 |
@return A pointer to the new direct file store object.
|
williamr@2
|
198 |
@see TFileMode */
|
williamr@2
|
199 |
{return STATIC_CAST(CDirectFileStore*,CFileStore::ReplaceLC(aFs,aName,aFileMode,&DoNewL));}
|
williamr@2
|
200 |
inline CDirectFileStore* CDirectFileStore::TempL(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode)
|
williamr@2
|
201 |
/** Creates a temporary file and constructs a direct file store object to be associated
|
williamr@2
|
202 |
with it.
|
williamr@2
|
203 |
|
williamr@2
|
204 |
The new file is created in the specified path and a unique file name is generated
|
williamr@2
|
205 |
by the file server.
|
williamr@2
|
206 |
|
williamr@2
|
207 |
Note that the store framework does not delete a temporary file after it is
|
williamr@2
|
208 |
closed.
|
williamr@2
|
209 |
|
williamr@2
|
210 |
@param aFs Handle to a file server session.
|
williamr@2
|
211 |
@param aPath The path where the new file is to be created.
|
williamr@2
|
212 |
@param aName On return, contains the full path name of the new file.
|
williamr@2
|
213 |
@param aFileMode The mode in which the new file is to be accessed. The mode
|
williamr@2
|
214 |
is defined by the TFileMode type.
|
williamr@2
|
215 |
@return A pointer to the new direct file store object.
|
williamr@2
|
216 |
@see TFileMode */
|
williamr@2
|
217 |
{return STATIC_CAST(CDirectFileStore*,CFileStore::TempL(aFs,aPath,aName,aFileMode,&DoNewL));}
|
williamr@2
|
218 |
inline CDirectFileStore* CDirectFileStore::TempLC(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode)
|
williamr@2
|
219 |
/** Creates a temporary file, constructs a direct file store object to be associated
|
williamr@2
|
220 |
with it, and places the pointer onto the cleanup stack.
|
williamr@2
|
221 |
|
williamr@2
|
222 |
The new file is created in the specified path and a unique file name is generated
|
williamr@2
|
223 |
by the file server.
|
williamr@2
|
224 |
|
williamr@2
|
225 |
Note that the store framework does not delete a temporary file after it is
|
williamr@2
|
226 |
closed.
|
williamr@2
|
227 |
|
williamr@2
|
228 |
@param aFs Handle to a file server session.
|
williamr@2
|
229 |
@param aPath The path where the new file is to be created.
|
williamr@2
|
230 |
@param aName On return, contains the full path name of the new file.
|
williamr@2
|
231 |
@param aFileMode The mode in which the new file is to be accessed. The mode
|
williamr@2
|
232 |
is defined by the TFileMode type.
|
williamr@2
|
233 |
@return A pointer to the new direct file store object.
|
williamr@2
|
234 |
@see TFileMode */
|
williamr@2
|
235 |
{return STATIC_CAST(CDirectFileStore*,CFileStore::TempLC(aFs,aPath,aName,aFileMode,&DoNewL));}
|
williamr@2
|
236 |
inline CDirectFileStore* CDirectFileStore::FromL(RFile& aFile)
|
williamr@2
|
237 |
/** Constructs a direct file store object from an already opened file.
|
williamr@2
|
238 |
|
williamr@2
|
239 |
The file must already be open before calling this function.
|
williamr@2
|
240 |
|
williamr@2
|
241 |
Note that ownership of the file passes to the store. The referenced RFile
|
williamr@2
|
242 |
is cleared and is no longer valid.
|
williamr@2
|
243 |
|
williamr@2
|
244 |
@param aFile A reference to the opened file.
|
williamr@2
|
245 |
@return A pointer to the new direct file store object. */
|
williamr@2
|
246 |
{return STATIC_CAST(CDirectFileStore*,CFileStore::FromL(aFile,KDirectFileStoreFactoryFunction));}
|
williamr@2
|
247 |
inline CDirectFileStore* CDirectFileStore::FromLC(RFile& aFile)
|
williamr@2
|
248 |
/** Constructs a direct file store object from an already opened file, and places
|
williamr@2
|
249 |
the pointer onto the cleanup stack.
|
williamr@2
|
250 |
|
williamr@2
|
251 |
The file must already be open before calling this function.
|
williamr@2
|
252 |
|
williamr@2
|
253 |
Note that ownership of the file passes to the store. The referenced RFile
|
williamr@2
|
254 |
is cleared and is no longer valid.
|
williamr@2
|
255 |
|
williamr@2
|
256 |
@param aFile A reference to the opened file.
|
williamr@2
|
257 |
@return A pointer to the new direct file store object. */
|
williamr@2
|
258 |
{return STATIC_CAST(CDirectFileStore*,CFileStore::FromLC(aFile,KDirectFileStoreFactoryFunction));}
|
williamr@2
|
259 |
inline CDirectFileStore* CDirectFileStore::NewL(RFile& aFile)
|
williamr@2
|
260 |
/** Constructs a new direct file store object in an already opened file.
|
williamr@2
|
261 |
|
williamr@2
|
262 |
The file must already be open before calling the function. The existing content
|
williamr@2
|
263 |
of the file is discarded.
|
williamr@2
|
264 |
|
williamr@2
|
265 |
Note that ownership of the file passes to the store. The referenced RFile
|
williamr@2
|
266 |
is cleared and is no longer valid:
|
williamr@2
|
267 |
|
williamr@2
|
268 |
@param aFile A reference to the opened file.
|
williamr@2
|
269 |
@return A pointer to the new direct file store object. */
|
williamr@2
|
270 |
{return STATIC_CAST(CDirectFileStore*,CFileStore::NewL(aFile,&DoNewL));}
|
williamr@2
|
271 |
inline CDirectFileStore* CDirectFileStore::NewLC(RFile& aFile)
|
williamr@2
|
272 |
/** Constructs a new direct file store object in an already opened file and places
|
williamr@2
|
273 |
the pointer onto the cleanup stack.
|
williamr@2
|
274 |
|
williamr@2
|
275 |
The file must already be open before calling the function. The existing content
|
williamr@2
|
276 |
of the file is discarded.
|
williamr@2
|
277 |
|
williamr@2
|
278 |
Note that ownership of the file passes to the store. The referenced RFile
|
williamr@2
|
279 |
is cleared and is no longer valid:
|
williamr@2
|
280 |
|
williamr@2
|
281 |
@param aFile A reference to the opened file.
|
williamr@2
|
282 |
@return A pointer to the new direct file store object. */
|
williamr@2
|
283 |
{return STATIC_CAST(CDirectFileStore*,CFileStore::NewLC(aFile,&DoNewL));}
|
williamr@2
|
284 |
|
williamr@2
|
285 |
// Class CPermanentFileStore
|
williamr@2
|
286 |
inline CPermanentFileStore* CPermanentFileStore::OpenL(RFs& aFs,const TDesC& aName,TUint aFileMode)
|
williamr@2
|
287 |
/** Opens a file containing a permanent file store, and constructs a permanent
|
williamr@2
|
288 |
file store object.
|
williamr@2
|
289 |
|
williamr@2
|
290 |
@param aFs Handle to a file server session.
|
williamr@2
|
291 |
@param aName The full path name of the file containing the store.
|
williamr@2
|
292 |
@param aFileMode The mode in which the file is to be accessed. The mode is
|
williamr@2
|
293 |
defined by the TFileMode type.
|
williamr@2
|
294 |
@return A pointer to the new permanent file store object.
|
williamr@2
|
295 |
@see TFileMode */
|
williamr@2
|
296 |
{return STATIC_CAST(CPermanentFileStore*,CFileStore::OpenL(aFs,aName,aFileMode,KPermanentFileStoreFactoryFunction));}
|
williamr@2
|
297 |
inline CPermanentFileStore* CPermanentFileStore::OpenLC(RFs& aFs,const TDesC& aName,TUint aFileMode)
|
williamr@2
|
298 |
/** Opens a file containing a permanent file store, constructs a permanent file
|
williamr@2
|
299 |
store object, and places the pointer onto the cleanup stack.
|
williamr@2
|
300 |
|
williamr@2
|
301 |
@param aFs Handle to a file server session.
|
williamr@2
|
302 |
@param aName The full path name of the file containing the store.
|
williamr@2
|
303 |
@param aFileMode The mode in which the file is to be accessed. The mode is
|
williamr@2
|
304 |
defined by the TFileMode type.
|
williamr@2
|
305 |
@return A pointer to the new permanent file store object.
|
williamr@2
|
306 |
@see TFileMode */
|
williamr@2
|
307 |
{return STATIC_CAST(CPermanentFileStore*,CFileStore::OpenLC(aFs,aName,aFileMode,KPermanentFileStoreFactoryFunction));}
|
williamr@2
|
308 |
inline CPermanentFileStore* CPermanentFileStore::CreateL(RFs& aFs,const TDesC& aName,TUint aFileMode)
|
williamr@2
|
309 |
/** Creates a new file and constructs a new permanent file store object to be associated
|
williamr@2
|
310 |
with this file.
|
williamr@2
|
311 |
|
williamr@2
|
312 |
@param aFs Handle to a file server session.
|
williamr@2
|
313 |
@param aName The full path name of the new file. A file with this name must
|
williamr@2
|
314 |
not already exist, otherwise the function leaves.
|
williamr@2
|
315 |
@param aFileMode The mode in which the new file is to be accessed. This mode
|
williamr@2
|
316 |
is defined by the TFileMode type.
|
williamr@2
|
317 |
@return A pointer to the new permanent file store object.
|
williamr@2
|
318 |
@see TFileMode */
|
williamr@2
|
319 |
{return STATIC_CAST(CPermanentFileStore*,CFileStore::CreateL(aFs,aName,aFileMode,&DoNewL));}
|
williamr@2
|
320 |
inline CPermanentFileStore* CPermanentFileStore::CreateLC(RFs& aFs,const TDesC& aName,TUint aFileMode)
|
williamr@2
|
321 |
/** Creates a new file and constructs a new permanent file store object to be associated
|
williamr@2
|
322 |
with this file, and places the pointer onto the cleanup stack.
|
williamr@2
|
323 |
|
williamr@2
|
324 |
@param aFs Handle to a file server session.
|
williamr@2
|
325 |
@param aName The full path name of the new file. A file with this name must
|
williamr@2
|
326 |
not already exist, otherwise the function leaves.
|
williamr@2
|
327 |
@param aFileMode The mode in which the new file is to be accessed. This mode
|
williamr@2
|
328 |
is defined by the TFileMode type.
|
williamr@2
|
329 |
@return A pointer to the new permanent file store object.
|
williamr@2
|
330 |
@see TFileMode */
|
williamr@2
|
331 |
{return STATIC_CAST(CPermanentFileStore*,CFileStore::CreateLC(aFs,aName,aFileMode,&DoNewL));}
|
williamr@2
|
332 |
inline CPermanentFileStore* CPermanentFileStore::ReplaceL(RFs& aFs,const TDesC& aName,TUint aFileMode)
|
williamr@2
|
333 |
/** Creates a file, constructs a permanent file store object to be associated with
|
williamr@2
|
334 |
it.
|
williamr@2
|
335 |
|
williamr@2
|
336 |
This file replaces any existing file of the same name.
|
williamr@2
|
337 |
|
williamr@2
|
338 |
@param aFs Handle to a file server session.
|
williamr@2
|
339 |
@param aName The full path name of the file to be replaced.
|
williamr@2
|
340 |
@param aFileMode The mode in which the file is to be accessed. The mode is
|
williamr@2
|
341 |
defined by the TFileMode type.
|
williamr@2
|
342 |
@return A pointer to the new permanent file store object.
|
williamr@2
|
343 |
@see TFileMode */
|
williamr@2
|
344 |
{return STATIC_CAST(CPermanentFileStore*,CFileStore::ReplaceL(aFs,aName,aFileMode,&DoNewL));}
|
williamr@2
|
345 |
inline CPermanentFileStore* CPermanentFileStore::ReplaceLC(RFs& aFs,const TDesC& aName,TUint aFileMode)
|
williamr@2
|
346 |
/** Creates a file, constructs a permanent file store object to be associated with
|
williamr@2
|
347 |
it, and places the pointer onto the cleanup stack.
|
williamr@2
|
348 |
|
williamr@2
|
349 |
This file replaces any existing file of the same name.
|
williamr@2
|
350 |
|
williamr@2
|
351 |
@param aFs Handle to a file server session.
|
williamr@2
|
352 |
@param aName The full path name of the file to be replaced.
|
williamr@2
|
353 |
@param aFileMode The mode in which the file is to be accessed. The mode is
|
williamr@2
|
354 |
defined by the TFileMode type.
|
williamr@2
|
355 |
@return A pointer to the new permanent file store object.
|
williamr@2
|
356 |
@see TFileMode */
|
williamr@2
|
357 |
{return STATIC_CAST(CPermanentFileStore*,CFileStore::ReplaceLC(aFs,aName,aFileMode,&DoNewL));}
|
williamr@2
|
358 |
inline CPermanentFileStore* CPermanentFileStore::TempL(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode)
|
williamr@2
|
359 |
/** Creates a temporary file and constructs a permanent file store object to be
|
williamr@2
|
360 |
associated with it.
|
williamr@2
|
361 |
|
williamr@2
|
362 |
The new file is created in the specified path and a unique file name is generated
|
williamr@2
|
363 |
by the file server.
|
williamr@2
|
364 |
|
williamr@2
|
365 |
Note that the store framework does not delete a temporary file after it is
|
williamr@2
|
366 |
closed.
|
williamr@2
|
367 |
|
williamr@2
|
368 |
@param aFs Handle to a file server session.
|
williamr@2
|
369 |
@param aPath The path where the new file is to be created.
|
williamr@2
|
370 |
@param aName On return, contains the full path name of the new file.
|
williamr@2
|
371 |
@param aFileMode The mode in which the file is to be accessed. The mode is
|
williamr@2
|
372 |
defined by the TFileMode type.
|
williamr@2
|
373 |
@return A pointer to the new permanent file store object.
|
williamr@2
|
374 |
@see TFileMode */
|
williamr@2
|
375 |
{return STATIC_CAST(CPermanentFileStore*,CFileStore::TempL(aFs,aPath,aName,aFileMode,&DoNewL));}
|
williamr@2
|
376 |
inline CPermanentFileStore* CPermanentFileStore::TempLC(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode)
|
williamr@2
|
377 |
/** Creates a temporary file, constructs a permanent file store object to be associated
|
williamr@2
|
378 |
with it, and places the pointer onto the cleanup stack.
|
williamr@2
|
379 |
|
williamr@2
|
380 |
The new file is created in the specified path and a unique file name is generated
|
williamr@2
|
381 |
by the file server.
|
williamr@2
|
382 |
|
williamr@2
|
383 |
Note that the store framework does not delete a temporary file after it is
|
williamr@2
|
384 |
closed.
|
williamr@2
|
385 |
|
williamr@2
|
386 |
@param aFs Handle to a file server session.
|
williamr@2
|
387 |
@param aPath The path where the new file is to be created.
|
williamr@2
|
388 |
@param aName On return, contains the full path name of the new file.
|
williamr@2
|
389 |
@param aFileMode The mode in which the file is to be accessed. The mode is
|
williamr@2
|
390 |
defined by the TFileMode type.
|
williamr@2
|
391 |
@return A pointer to the new permanent file store object.
|
williamr@2
|
392 |
@see TFileMode */
|
williamr@2
|
393 |
{return STATIC_CAST(CPermanentFileStore*,CFileStore::TempLC(aFs,aPath,aName,aFileMode,&DoNewL));}
|
williamr@2
|
394 |
inline CPermanentFileStore* CPermanentFileStore::FromL(RFile& aFile)
|
williamr@2
|
395 |
/** Constructs a permanent file store object from an already opened file.
|
williamr@2
|
396 |
|
williamr@2
|
397 |
The file must already be open before calling this function.
|
williamr@2
|
398 |
|
williamr@2
|
399 |
Note that ownership of the file passes to the store. The referenced RFile
|
williamr@2
|
400 |
is cleared and is no longer valid.
|
williamr@2
|
401 |
|
williamr@2
|
402 |
@param aFile A reference to the opened file.
|
williamr@2
|
403 |
@return A pointer to the new permanent file store object. */
|
williamr@2
|
404 |
{return STATIC_CAST(CPermanentFileStore*,CFileStore::FromL(aFile,KPermanentFileStoreFactoryFunction));}
|
williamr@2
|
405 |
inline CPermanentFileStore* CPermanentFileStore::FromLC(RFile& aFile)
|
williamr@2
|
406 |
/** Constructs a permanent file store object from an already opened file, and places
|
williamr@2
|
407 |
the pointer onto the cleanup stack.
|
williamr@2
|
408 |
|
williamr@2
|
409 |
The file must already be open before calling this function.
|
williamr@2
|
410 |
|
williamr@2
|
411 |
Note that ownership of the file passes to the store. The referenced RFile
|
williamr@2
|
412 |
is cleared and is no longer valid.
|
williamr@2
|
413 |
|
williamr@2
|
414 |
@param aFile A reference to the opened file.
|
williamr@2
|
415 |
@return A pointer to the new permanent file store object. */
|
williamr@2
|
416 |
{return STATIC_CAST(CPermanentFileStore*,CFileStore::FromLC(aFile,KPermanentFileStoreFactoryFunction));}
|
williamr@2
|
417 |
inline CPermanentFileStore* CPermanentFileStore::NewL(RFile& aFile)
|
williamr@2
|
418 |
/** Constructs a new permanent file store object in an already opened file.
|
williamr@2
|
419 |
|
williamr@2
|
420 |
The file must already be open before calling this function. The existing content
|
williamr@2
|
421 |
of the file is discarded.
|
williamr@2
|
422 |
|
williamr@2
|
423 |
Note that ownership of the file passes to the store. The referenced RFile
|
williamr@2
|
424 |
is cleared and is no longer valid.
|
williamr@2
|
425 |
|
williamr@2
|
426 |
@param aFile A reference to the opened file.
|
williamr@2
|
427 |
@return A pointer to the new permanent file store object. */
|
williamr@2
|
428 |
{return STATIC_CAST(CPermanentFileStore*,CFileStore::NewL(aFile,&DoNewL));}
|
williamr@2
|
429 |
inline CPermanentFileStore* CPermanentFileStore::NewLC(RFile& aFile)
|
williamr@2
|
430 |
/** Constructs a new permanent file store object in an already opened file and
|
williamr@2
|
431 |
places the pointer onto the cleanup stack.
|
williamr@2
|
432 |
|
williamr@2
|
433 |
The file must already be open before calling this function.The existing content
|
williamr@2
|
434 |
of the file is discarded.
|
williamr@2
|
435 |
|
williamr@2
|
436 |
Note that ownership of the file passes to the store. The referenced RFile
|
williamr@2
|
437 |
is cleared and is no longer valid.
|
williamr@2
|
438 |
|
williamr@2
|
439 |
@param aFile A reference to the opened file.
|
williamr@2
|
440 |
@return A pointer to the new permanent file store object. */
|
williamr@2
|
441 |
{return STATIC_CAST(CPermanentFileStore*,CFileStore::NewLC(aFile,&DoNewL));}
|
williamr@2
|
442 |
|
williamr@2
|
443 |
// Class RFilePagePool
|
williamr@2
|
444 |
inline TInt RFilePagePool::Open(RFs& aFs,const TDesC& aName,TUint aFileMode)
|
williamr@2
|
445 |
/** Opens a file to use for the page pool.
|
williamr@2
|
446 |
|
williamr@2
|
447 |
@param aFs A file server session
|
williamr@2
|
448 |
@param aName The name of the file
|
williamr@2
|
449 |
@param aFileMode The mode in which the file is opened. For more information,
|
williamr@2
|
450 |
see the TFileMode enumeration.
|
williamr@2
|
451 |
@return KErrNone if successful, otherwise another of the system-wide error
|
williamr@2
|
452 |
codes.
|
williamr@2
|
453 |
@see TFileMode */
|
williamr@2
|
454 |
{return iFile.Open(aFs,aName,aFileMode);}
|
williamr@2
|
455 |
inline TInt RFilePagePool::Create(RFs& aFs,const TDesC& aName,TUint aFileMode)
|
williamr@2
|
456 |
/** Creates a new file for the page pool.
|
williamr@2
|
457 |
|
williamr@2
|
458 |
@param aFs A file server session
|
williamr@2
|
459 |
@param aName The name of the file. Any path components which are not specified
|
williamr@2
|
460 |
here are taken from the session path.
|
williamr@2
|
461 |
@param aFileMode The mode in which the file is opened. For more information
|
williamr@2
|
462 |
see the TFileMode enumeration.
|
williamr@2
|
463 |
@return KErrNone if successful, otherwise another of the system-wide error
|
williamr@2
|
464 |
codes.
|
williamr@2
|
465 |
@see TFileMode */
|
williamr@2
|
466 |
{return iFile.Create(aFs,aName,aFileMode);}
|
williamr@2
|
467 |
inline TInt RFilePagePool::Replace(RFs& aFs,const TDesC& aName,TUint aFileMode)
|
williamr@2
|
468 |
/** Creates or opens a file for the page pool.
|
williamr@2
|
469 |
|
williamr@2
|
470 |
If there is an existing file with the same name, this function overwrites
|
williamr@2
|
471 |
it. If the file does not already exist, it is created.
|
williamr@2
|
472 |
|
williamr@2
|
473 |
@param aFs A file server session.
|
williamr@2
|
474 |
@param aName The name of the file. Any path components which are not specified
|
williamr@2
|
475 |
here are taken from the session path.
|
williamr@2
|
476 |
@param aFileMode The mode in which the file is opened. For more information
|
williamr@2
|
477 |
see the TFileMode enumeration.
|
williamr@2
|
478 |
@return KErrNone if successful, otherwise another of the system-wide error
|
williamr@2
|
479 |
codes.
|
williamr@2
|
480 |
@see TFileMode */
|
williamr@2
|
481 |
{return iFile.Replace(aFs,aName,aFileMode);}
|
williamr@2
|
482 |
inline TInt RFilePagePool::Temp(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode)
|
williamr@2
|
483 |
/** Creates and opens a file for the page pool with a unique name.
|
williamr@2
|
484 |
|
williamr@2
|
485 |
@param aFs A file server session.
|
williamr@2
|
486 |
@param aPath The directory in which the file should be created.
|
williamr@2
|
487 |
@param aName On return, contains the full path and name of the file. The filename
|
williamr@2
|
488 |
is guaranteed to be unique within the directory specified by aPath.
|
williamr@2
|
489 |
@param aFileMode The mode in which the file is opened. For more information
|
williamr@2
|
490 |
see the TFileMode enumeration.
|
williamr@2
|
491 |
@return KErrNone if successful, otherwise another of the system-wide error
|
williamr@2
|
492 |
codes. */
|
williamr@2
|
493 |
{return iFile.Temp(aFs,aPath,aName,aFileMode);}
|
williamr@2
|
494 |
inline void RFilePagePool::Attach(RFile& aFile)
|
williamr@2
|
495 |
/** Sets an existing file to be used for the page pool.
|
williamr@2
|
496 |
|
williamr@2
|
497 |
@param aFile File to use for the page pool */
|
williamr@2
|
498 |
{iFile=aFile;}
|
williamr@2
|
499 |
inline void RFilePagePool::Detach()
|
williamr@2
|
500 |
/** Ends the use of the file for the page pool, but does not close the file. */
|
williamr@2
|
501 |
{iFile=RFile();}
|
williamr@2
|
502 |
inline RFile& RFilePagePool::File() const
|
williamr@2
|
503 |
{return MUTABLE_CAST(RFile&,iFile);}
|