1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_STORE_STORE_H
21 #define INCLUDED_STORE_STORE_H
23 #include <store/types.h>
24 #include <store/storedllapi.h>
30 /** Handle opaque type.
32 typedef void* storeHandle
;
36 @param Handle [in] the Handle.
37 @return store_E_None upon success
39 STORE_DLLPUBLIC storeError SAL_CALL
store_acquireHandle (
41 ) SAL_THROW_EXTERN_C();
45 @param Handle [in] the Handle.
46 @return store_E_None upon success,
47 store_E_InvalidHandle otherwise.
49 STORE_DLLPUBLIC storeError SAL_CALL
store_releaseHandle (
51 ) SAL_THROW_EXTERN_C();
55 /** File Handle opaque type.
57 typedef void* storeFileHandle
;
60 /** Open a temporary file in memory.
61 @param nPageSize [in] the creation page size,
62 integer multiple of minimum page size.
63 @param phFile [out] the File Handle.
64 @return store_E_None upon success
66 STORE_DLLPUBLIC storeError SAL_CALL
store_createMemoryFile (
68 storeFileHandle
*phFile
69 ) SAL_THROW_EXTERN_C();
73 @param pFilename [in] the filename as URL or system path.
74 @param eAccessMode [in] the access mode.
75 store_AccessCreate truncate existing and create,
76 store_AccessReadCreate create not existing,
77 store_AccessReadWrite write existing,
78 store_AccessReadOnly never modifies.
79 @param nPageSize [in] the creation page size,
80 integer multiple of minimum page size.
81 @param phFile [out] the File Handle.
82 @return store_E_None upon success
84 STORE_DLLPUBLIC storeError SAL_CALL
store_openFile (
85 rtl_uString
*pFilename
,
86 storeAccessMode eAccessMode
,
88 storeFileHandle
*phFile
89 ) SAL_THROW_EXTERN_C();
93 @param hFile [in] the File Handle.
94 @return store_E_None upon success,
95 store_E_InvalidHandle otherwise.
97 STORE_DLLPUBLIC storeError SAL_CALL
store_closeFile (
99 ) SAL_THROW_EXTERN_C();
103 @param hFile [in] the File Handle.
104 @return store_E_None upon success
106 STORE_DLLPUBLIC storeError SAL_CALL
store_flushFile (
107 storeFileHandle hFile
108 ) SAL_THROW_EXTERN_C();
111 /** Get the number of referers to a file.
112 @param hFile [in] the File Handle.
113 @param pnRefCount [out] number of open directories and streams.
114 @return store_E_None upon success
116 STORE_DLLPUBLIC storeError SAL_CALL
store_getFileRefererCount (
117 storeFileHandle hFile
,
118 sal_uInt32
*pnRefCount
119 ) SAL_THROW_EXTERN_C();
122 /** Get the size of a file.
123 @param hFile [in] the File Handle.
124 @param pnSize [out] the file size in bytes.
125 @return store_E_None upon success
127 STORE_DLLPUBLIC storeError SAL_CALL
store_getFileSize (
128 storeFileHandle hFile
,
130 ) SAL_THROW_EXTERN_C();
133 /** Recover and Compact a file into another file.
134 @see store_openFile()
136 @param pSrcFilename [in] opened with store_AccessReadOnly.
137 @param pDstFilename [in] created with store_AccessCreate.
138 @return store_E_None upon success
140 STORE_DLLPUBLIC storeError SAL_CALL
store_rebuildFile (
141 rtl_uString
*pSrcFilename
,
142 rtl_uString
*pDstFilename
143 ) SAL_THROW_EXTERN_C();
147 /** Directory Handle opaque type.
149 typedef void* storeDirectoryHandle
;
152 /** Open a directory.
153 @see store_openFile()
155 @param hFile [in] the File Handle.
156 @param pPath [in] the directory path.
157 @param pName [in] the directory name.
158 @param eAccessMode [in] the access mode.
159 @param phDirectory [out] the Directory Handle.
160 @return store_E_None upon success
162 STORE_DLLPUBLIC storeError SAL_CALL
store_openDirectory (
163 storeFileHandle hFile
,
166 storeAccessMode eAccessMode
,
167 storeDirectoryHandle
*phDirectory
168 ) SAL_THROW_EXTERN_C();
171 /** Close a directory.
172 @param hDirectory [in] the Directory Handle.
173 @return store_E_None upon success,
174 store_E_InvalidHandle otherwise.
176 STORE_DLLPUBLIC storeError SAL_CALL
store_closeDirectory (
177 storeDirectoryHandle hDirectory
178 ) SAL_THROW_EXTERN_C();
181 /** Find first directory entry.
182 @param hDirectory [in] the Directory Handle.
183 @param pFindData [out] the Find Data structure.
184 @return store_E_None upon success,
185 store_E_NoMoreFile upon end of iteration.
187 STORE_DLLPUBLIC storeError SAL_CALL
store_findFirst (
188 storeDirectoryHandle hDirectory
,
189 storeFindData
*pFindData
190 ) SAL_THROW_EXTERN_C();
193 /** Find next directory entry.
194 @param hDirectory [in] the Directory Handle.
195 @param pFindData [out] the Find Data structure.
196 @return store_E_None upon success,
197 store_E_NoMoreFile upon end of iteration.
199 STORE_DLLPUBLIC storeError SAL_CALL
store_findNext (
200 storeDirectoryHandle hDirectory
,
201 storeFindData
*pFindData
202 ) SAL_THROW_EXTERN_C();
206 /** Stream Handle opaque type.
208 typedef void* storeStreamHandle
;
212 @see store_openFile()
214 @param hFile [in] the File Handle.
215 @param pPath [in] the stream path.
216 @param pName [in] the stream name.
217 @param eMode [in] the access mode.
218 @param phStrm [out] the Stream Handle.
219 @return store_E_None upon success
221 STORE_DLLPUBLIC storeError SAL_CALL
store_openStream (
222 storeFileHandle hFile
,
225 storeAccessMode eMode
,
226 storeStreamHandle
*phStrm
227 ) SAL_THROW_EXTERN_C();
231 @param hStrm [in] the Stream Handle.
232 @return store_E_None upon success,
233 store_E_InvalidHandle otherwise.
235 STORE_DLLPUBLIC storeError SAL_CALL
store_closeStream (
236 storeStreamHandle hStrm
237 ) SAL_THROW_EXTERN_C();
240 /** Read from a stream.
241 @param hStrm [in] the Stream Handle.
242 @param nOffset [in] the offset of the first byte to read.
243 @param pBuffer [out] the buffer.
244 @param nBytes [in] the number of bytes to read.
245 @param pnDone [out] the number of bytes actually read.
246 @return store_E_None upon success
248 STORE_DLLPUBLIC storeError SAL_CALL
store_readStream (
249 storeStreamHandle hStrm
,
254 ) SAL_THROW_EXTERN_C();
257 /** Write to a stream.
258 @param hStrm [in] the Stream Handle.
259 @param nOffset [in] the offset of the first byte to write.
260 @param pBuffer [in] the buffer.
261 @param nBytes [in] the number of bytes to write.
262 @param pnDone [out] the number of bytes actually written.
263 @return store_E_None upon success
265 STORE_DLLPUBLIC storeError SAL_CALL
store_writeStream (
266 storeStreamHandle hStrm
,
271 ) SAL_THROW_EXTERN_C();
275 @param hStrm [in] the Stream Handle.
276 @return store_E_None upon success
278 STORE_DLLPUBLIC storeError SAL_CALL
store_flushStream (
279 storeStreamHandle hStrm
280 ) SAL_THROW_EXTERN_C();
283 /** Get the size of a stream.
284 @param hStrm [in] the Stream Handle.
285 @param pnSize [out] the stream size in bytes.
286 @return store_E_None upon success
288 STORE_DLLPUBLIC storeError SAL_CALL
store_getStreamSize (
289 storeStreamHandle hStrm
,
291 ) SAL_THROW_EXTERN_C();
294 /** Set the size of a stream.
295 @param hStrm [in] the Stream Handle.
296 @param nSize [in] the new stream size in bytes.
297 @return store_E_None upon success
299 STORE_DLLPUBLIC storeError SAL_CALL
store_setStreamSize (
300 storeStreamHandle hStrm
,
302 ) SAL_THROW_EXTERN_C();
306 /** Set attributes of a file entry.
307 @param hFile [in] the File Handle.
308 @param pPath [in] the entry path.
309 @param pName [in] the entry name.
310 @param nMask1 [in] the attributes to be cleared.
311 @param nMask2 [in] the attributes to be set.
312 @param pnAttrib [out] the resulting attributes, may be NULL.
313 @return store_E_None upon success
315 STORE_DLLPUBLIC storeError SAL_CALL
store_attrib (
316 storeFileHandle hFile
,
322 ) SAL_THROW_EXTERN_C();
325 /** Insert a file entry as 'hard link' to another file entry.
326 @pre Source must not exist, Destination must exist.
327 @post Source has attribute STORE_ATTRIB_ISLINK.
330 @param hFile [in] the File Handle
331 @param pSrcPath [in] the Source path
332 @param pSrcName [in] the Source name
333 @param pDstPath [in] the Destination path
334 @param pDstName [in] the Destination name
335 @return store_E_None upon success
337 STORE_DLLPUBLIC storeError SAL_CALL
store_link (
338 storeFileHandle hFile
,
339 rtl_uString
*pSrcPath
, rtl_uString
*pSrcName
,
340 rtl_uString
*pDstPath
, rtl_uString
*pDstName
341 ) SAL_THROW_EXTERN_C();
344 /** Insert a file entry as 'symbolic link' to another file entry.
345 @pre Source must not exist
346 @post Source has attribute STORE_ATTRIB_ISLINK.
349 @param hFile [in] the File Handle
350 @param pSrcPath [in] the Source path
351 @param pSrcName [in] the Source name
352 @param pDstPath [in] the Destination path
353 @param pDstName [in] the Destination name
354 @return store_E_None upon success
356 STORE_DLLPUBLIC storeError SAL_CALL
store_symlink (
357 storeFileHandle hFile
,
358 rtl_uString
*pSrcPath
, rtl_uString
*pSrcName
,
359 rtl_uString
*pDstPath
, rtl_uString
*pDstName
360 ) SAL_THROW_EXTERN_C();
363 /** Rename a file entry.
364 @param hFile [in] the File Handle
365 @param pSrcPath [in] the Source path
366 @param pSrcName [in] the Source name
367 @param pDstPath [in] the Destination path
368 @param pDstName [in] the Destination name
369 @return store_E_None upon success
371 STORE_DLLPUBLIC storeError SAL_CALL
store_rename (
372 storeFileHandle hFile
,
373 rtl_uString
*pSrcPath
, rtl_uString
*pSrcName
,
374 rtl_uString
*pDstPath
, rtl_uString
*pDstName
375 ) SAL_THROW_EXTERN_C();
378 /** Remove a file entry.
379 @param hFile [in] the File Handle
380 @param pPath [in] the entry path
381 @param pName [in] the entry name
382 @return store_E_None upon success
384 STORE_DLLPUBLIC storeError SAL_CALL
store_remove (
385 storeFileHandle hFile
,
388 ) SAL_THROW_EXTERN_C();
390 /*========================================================================
394 *======================================================================*/
400 #endif // INCLUDED_STORE_STORE_H
405 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */