Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / store / store.h
blobbd6027b6390e3614d5ea248bea57dca0073e5fb4
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/storedllapi.h>
24 #include <store/types.h>
25 #include <rtl/ustring.h>
26 #include <sal/types.h>
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
32 /** Handle opaque type.
34 typedef void* storeHandle;
37 /** Acquire a Handle.
38 @param Handle [in] the Handle.
39 @return store_E_None upon success
41 STORE_DLLPUBLIC storeError SAL_CALL store_acquireHandle (
42 storeHandle Handle
43 ) SAL_THROW_EXTERN_C();
46 /** Release a Handle.
47 @param Handle [in] the Handle.
48 @return store_E_None upon success,
49 store_E_InvalidHandle otherwise.
51 STORE_DLLPUBLIC storeError SAL_CALL store_releaseHandle (
52 storeHandle Handle
53 ) SAL_THROW_EXTERN_C();
57 /** File Handle opaque type.
59 typedef void* storeFileHandle;
62 /** Open a temporary file in memory.
63 @param nPageSize [in] the creation page size,
64 integer multiple of minimum page size.
65 @param phFile [out] the File Handle.
66 @return store_E_None upon success
68 STORE_DLLPUBLIC storeError SAL_CALL store_createMemoryFile (
69 sal_uInt16 nPageSize,
70 storeFileHandle *phFile
71 ) SAL_THROW_EXTERN_C();
74 /** Open a file.
75 @param pFilename [in] the filename as URL or system path.
76 @param eAccessMode [in] the access mode.
77 storeAccessMode::Create truncate existing and create,
78 store_AccessReadCreate create not existing,
79 storeAccessMode::ReadWrite write existing,
80 storeAccessMode::ReadOnly never modifies.
81 @param nPageSize [in] the creation page size,
82 integer multiple of minimum page size.
83 @param phFile [out] the File Handle.
84 @return store_E_None upon success
86 STORE_DLLPUBLIC storeError SAL_CALL store_openFile (
87 rtl_uString *pFilename,
88 storeAccessMode eAccessMode,
89 sal_uInt16 nPageSize,
90 storeFileHandle *phFile
91 ) SAL_THROW_EXTERN_C();
94 /** Close a file.
95 @param hFile [in] the File Handle.
96 @return store_E_None upon success,
97 store_E_InvalidHandle otherwise.
99 STORE_DLLPUBLIC storeError SAL_CALL store_closeFile (
100 storeFileHandle hFile
101 ) SAL_THROW_EXTERN_C();
104 /** Flush a file.
105 @param hFile [in] the File Handle.
106 @return store_E_None upon success
108 STORE_DLLPUBLIC storeError SAL_CALL store_flushFile (
109 storeFileHandle hFile
110 ) SAL_THROW_EXTERN_C();
113 /** Directory Handle opaque type.
115 typedef void* storeDirectoryHandle;
118 /** Open a directory.
119 @see store_openFile()
121 @param hFile [in] the File Handle.
122 @param pPath [in] the directory path.
123 @param pName [in] the directory name.
124 @param eAccessMode [in] the access mode.
125 @param phDirectory [out] the Directory Handle.
126 @return store_E_None upon success
128 STORE_DLLPUBLIC storeError SAL_CALL store_openDirectory (
129 storeFileHandle hFile,
130 rtl_uString *pPath,
131 rtl_uString *pName,
132 storeAccessMode eAccessMode,
133 storeDirectoryHandle *phDirectory
134 ) SAL_THROW_EXTERN_C();
137 /** Find first directory entry.
138 @param hDirectory [in] the Directory Handle.
139 @param pFindData [out] the Find Data structure.
140 @return store_E_None upon success,
141 store_E_NoMoreFile upon end of iteration.
143 STORE_DLLPUBLIC storeError SAL_CALL store_findFirst (
144 storeDirectoryHandle hDirectory,
145 storeFindData *pFindData
146 ) SAL_THROW_EXTERN_C();
149 /** Find next directory entry.
150 @param hDirectory [in] the Directory Handle.
151 @param pFindData [out] the Find Data structure.
152 @return store_E_None upon success,
153 store_E_NoMoreFile upon end of iteration.
155 STORE_DLLPUBLIC storeError SAL_CALL store_findNext (
156 storeDirectoryHandle hDirectory,
157 storeFindData *pFindData
158 ) SAL_THROW_EXTERN_C();
162 /** Stream Handle opaque type.
164 typedef void* storeStreamHandle;
167 /** Open a stream.
168 @see store_openFile()
170 @param hFile [in] the File Handle.
171 @param pPath [in] the stream path.
172 @param pName [in] the stream name.
173 @param eMode [in] the access mode.
174 @param phStrm [out] the Stream Handle.
175 @return store_E_None upon success
177 STORE_DLLPUBLIC storeError SAL_CALL store_openStream (
178 storeFileHandle hFile,
179 rtl_uString *pPath,
180 rtl_uString *pName,
181 storeAccessMode eMode,
182 storeStreamHandle *phStrm
183 ) SAL_THROW_EXTERN_C();
186 /** Read from a stream.
187 @param hStrm [in] the Stream Handle.
188 @param nOffset [in] the offset of the first byte to read.
189 @param pBuffer [out] the buffer.
190 @param nBytes [in] the number of bytes to read.
191 @param pnDone [out] the number of bytes actually read.
192 @return store_E_None upon success
194 STORE_DLLPUBLIC storeError SAL_CALL store_readStream (
195 storeStreamHandle hStrm,
196 sal_uInt32 nOffset,
197 void *pBuffer,
198 sal_uInt32 nBytes,
199 sal_uInt32 *pnDone
200 ) SAL_THROW_EXTERN_C();
203 /** Write to a stream.
204 @param hStrm [in] the Stream Handle.
205 @param nOffset [in] the offset of the first byte to write.
206 @param pBuffer [in] the buffer.
207 @param nBytes [in] the number of bytes to write.
208 @param pnDone [out] the number of bytes actually written.
209 @return store_E_None upon success
211 STORE_DLLPUBLIC storeError SAL_CALL store_writeStream (
212 storeStreamHandle hStrm,
213 sal_uInt32 nOffset,
214 const void *pBuffer,
215 sal_uInt32 nBytes,
216 sal_uInt32 *pnDone
217 ) SAL_THROW_EXTERN_C();
221 /** Remove a file entry.
222 @param hFile [in] the File Handle
223 @param pPath [in] the entry path
224 @param pName [in] the entry name
225 @return store_E_None upon success
227 STORE_DLLPUBLIC storeError SAL_CALL store_remove (
228 storeFileHandle hFile,
229 rtl_uString *pPath,
230 rtl_uString *pName
231 ) SAL_THROW_EXTERN_C();
233 /*========================================================================
235 * The End.
237 *======================================================================*/
239 #ifdef __cplusplus
241 #endif
243 #endif // INCLUDED_STORE_STORE_H
248 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */