1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _STORE_STORE_H_ 25 #define _STORE_STORE_H_ "$Revision: 1.6 $" 26 27 #include <store/types.h> 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif 32 33 /** Handle opaque type. 34 */ 35 typedef void* storeHandle; 36 37 38 /** Acquire a Handle. 39 @param Handle [in] the Handle. 40 @return store_E_None upon success 41 */ 42 storeError SAL_CALL store_acquireHandle ( 43 storeHandle Handle 44 ) SAL_THROW_EXTERN_C(); 45 46 47 /** Release a Handle. 48 @param Handle [in] the Handle. 49 @return store_E_None upon success, 50 store_E_InvalidHandle otherwise. 51 */ 52 storeError SAL_CALL store_releaseHandle ( 53 storeHandle Handle 54 ) SAL_THROW_EXTERN_C(); 55 56 57 58 /** File Handle opaque type. 59 */ 60 typedef void* storeFileHandle; 61 62 63 /** Open a temporary file in memory. 64 @param nPageSize [in] the creation page size, 65 integer multiple of minimum page size. 66 @param phFile [out] the File Handle. 67 @return store_E_None upon success 68 */ 69 storeError SAL_CALL store_createMemoryFile ( 70 sal_uInt16 nPageSize, 71 storeFileHandle *phFile 72 ) SAL_THROW_EXTERN_C(); 73 74 75 /** Open a file. 76 @param pFilename [in] the filename as URL or system path. 77 @param eAccessMode [in] the access mode. 78 store_AccessCreate truncate existing and create, 79 store_AccessReadCreate create not existing, 80 store_AccessReadWrite write existing, 81 store_AccessReadOnly never modifies. 82 @param nPageSize [in] the creation page size, 83 integer multiple of minimum page size. 84 @param phFile [out] the File Handle. 85 @return store_E_None upon success 86 */ 87 storeError SAL_CALL store_openFile ( 88 rtl_uString *pFilename, 89 storeAccessMode eAccessMode, 90 sal_uInt16 nPageSize, 91 storeFileHandle *phFile 92 ) SAL_THROW_EXTERN_C(); 93 94 95 /** Close a file. 96 @param hFile [in] the File Handle. 97 @return store_E_None upon success, 98 store_E_InvalidHandle otherwise. 99 */ 100 storeError SAL_CALL store_closeFile ( 101 storeFileHandle hFile 102 ) SAL_THROW_EXTERN_C(); 103 104 105 /** Flush a file. 106 @param hFile [in] the File Handle. 107 @return store_E_None upon success 108 */ 109 storeError SAL_CALL store_flushFile ( 110 storeFileHandle hFile 111 ) SAL_THROW_EXTERN_C(); 112 113 114 /** Get the number of referers to a file. 115 @param hFile [in] the File Handle. 116 @param pnRefCount [out] number of open directories and streams. 117 @return store_E_None upon success 118 */ 119 storeError SAL_CALL store_getFileRefererCount ( 120 storeFileHandle hFile, 121 sal_uInt32 *pnRefCount 122 ) SAL_THROW_EXTERN_C(); 123 124 125 /** Get the size of a file. 126 @param hFile [in] the File Handle. 127 @param pnSize [out] the file size in bytes. 128 @return store_E_None upon success 129 */ 130 storeError SAL_CALL store_getFileSize ( 131 storeFileHandle hFile, 132 sal_uInt32 *pnSize 133 ) SAL_THROW_EXTERN_C(); 134 135 136 /** Recover and Compact a file into another file. 137 @see store_openFile() 138 139 @param pSrcFilename [in] opened with store_AccessReadOnly. 140 @param pDstFilename [in] created with store_AccessCreate. 141 @return store_E_None upon success 142 */ 143 storeError SAL_CALL store_rebuildFile ( 144 rtl_uString *pSrcFilename, 145 rtl_uString *pDstFilename 146 ) SAL_THROW_EXTERN_C(); 147 148 149 150 /** Directory Handle opaque type. 151 */ 152 typedef void* storeDirectoryHandle; 153 154 155 /** Open a directory. 156 @see store_openFile() 157 158 @param hFile [in] the File Handle. 159 @param pPath [in] the directory path. 160 @param pName [in] the directory name. 161 @param eAccessMode [in] the access mode. 162 @param phDirectory [out] the Directory Handle. 163 @return store_E_None upon success 164 */ 165 storeError SAL_CALL store_openDirectory ( 166 storeFileHandle hFile, 167 rtl_uString *pPath, 168 rtl_uString *pName, 169 storeAccessMode eAccessMode, 170 storeDirectoryHandle *phDirectory 171 ) SAL_THROW_EXTERN_C(); 172 173 174 /** Close a directory. 175 @param hDirectory [in] the Directory Handle. 176 @return store_E_None upon success, 177 store_E_InvalidHandle otherwise. 178 */ 179 storeError SAL_CALL store_closeDirectory ( 180 storeDirectoryHandle hDirectory 181 ) SAL_THROW_EXTERN_C(); 182 183 184 /** Find first directory entry. 185 @param hDirectory [in] the Directory Handle. 186 @param pFindData [out] the Find Data structure. 187 @return store_E_None upon success, 188 store_E_NoMoreFile upon end of iteration. 189 */ 190 storeError SAL_CALL store_findFirst ( 191 storeDirectoryHandle hDirectory, 192 storeFindData *pFindData 193 ) SAL_THROW_EXTERN_C(); 194 195 196 /** Find next directory entry. 197 @param hDirectory [in] the Directory Handle. 198 @param pFindData [out] the Find Data structure. 199 @return store_E_None upon success, 200 store_E_NoMoreFile upon end of iteration. 201 */ 202 storeError SAL_CALL store_findNext ( 203 storeDirectoryHandle hDirectory, 204 storeFindData *pFindData 205 ) SAL_THROW_EXTERN_C(); 206 207 208 209 /** Stream Handle opaque type. 210 */ 211 typedef void* storeStreamHandle; 212 213 214 /** Open a stream. 215 @see store_openFile() 216 217 @param hFile [in] the File Handle. 218 @param pPath [in] the stream path. 219 @param pName [in] the stream name. 220 @param eAccessMode [in] the access mode. 221 @param phStrm [out] the Stream Handle. 222 @return store_E_None upon success 223 */ 224 storeError SAL_CALL store_openStream ( 225 storeFileHandle hFile, 226 rtl_uString *pPath, 227 rtl_uString *pName, 228 storeAccessMode eMode, 229 storeStreamHandle *phStrm 230 ) SAL_THROW_EXTERN_C(); 231 232 233 /** Close a stream. 234 @param hStrm [in] the Stream Handle. 235 @return store_E_None upon success, 236 store_E_InvalidHandle otherwise. 237 */ 238 storeError SAL_CALL store_closeStream ( 239 storeStreamHandle hStrm 240 ) SAL_THROW_EXTERN_C(); 241 242 243 /** Read from a stream. 244 @param hStrm [in] the Stream Handle. 245 @param nOffset [in] the offset of the first byte to read. 246 @param pBuffer [out] the buffer. 247 @param nBytes [in] the number of bytes to read. 248 @param pnDone [out] the number of bytes actually read. 249 @return store_E_None upon success 250 */ 251 storeError SAL_CALL store_readStream ( 252 storeStreamHandle hStrm, 253 sal_uInt32 nOffset, 254 void *pBuffer, 255 sal_uInt32 nBytes, 256 sal_uInt32 *pnDone 257 ) SAL_THROW_EXTERN_C(); 258 259 260 /** Write to a stream. 261 @param hStrm [in] the Stream Handle. 262 @param nOffset [in] the offset of the first byte to write. 263 @param pBuffer [in] the buffer. 264 @param nBytes [in] the number of bytes to write. 265 @param pnDone [out] the number of bytes actually written. 266 @return store_E_None upon success 267 */ 268 storeError SAL_CALL store_writeStream ( 269 storeStreamHandle hStrm, 270 sal_uInt32 nOffset, 271 const void *pBuffer, 272 sal_uInt32 nBytes, 273 sal_uInt32 *pnDone 274 ) SAL_THROW_EXTERN_C(); 275 276 277 /** Flush a stream. 278 @param hStrm [in] the Stream Handle. 279 @return store_E_None upon success 280 */ 281 storeError SAL_CALL store_flushStream ( 282 storeStreamHandle hStrm 283 ) SAL_THROW_EXTERN_C(); 284 285 286 /** Get the size of a stream. 287 @param hStrm [in] the Stream Handle. 288 @param pnSize [out] the stream size in bytes. 289 @return store_E_None upon success 290 */ 291 storeError SAL_CALL store_getStreamSize ( 292 storeStreamHandle hStrm, 293 sal_uInt32 *pnSize 294 ) SAL_THROW_EXTERN_C(); 295 296 297 /** Set the size of a stream. 298 @param hStrm [in] the Stream Handle. 299 @param nSize [in] the new stream size in bytes. 300 @return store_E_None upon success 301 */ 302 storeError SAL_CALL store_setStreamSize ( 303 storeStreamHandle hStrm, 304 sal_uInt32 nSize 305 ) SAL_THROW_EXTERN_C(); 306 307 308 309 /** Set attributes of a file entry. 310 @param hFile [in] the File Handle. 311 @param pPath [in] the entry path. 312 @param pName [in] the entry name. 313 @param nMask1 [in] the attributes to be cleared. 314 @param nMask2 [in] the attributes to be set. 315 @param pnAttrib [out] the resulting attributes, may be NULL. 316 @return store_E_None upon success 317 */ 318 storeError SAL_CALL store_attrib ( 319 storeFileHandle hFile, 320 rtl_uString *pPath, 321 rtl_uString *pName, 322 sal_uInt32 nMask1, 323 sal_uInt32 nMask2, 324 sal_uInt32 *pnAttrib 325 ) SAL_THROW_EXTERN_C(); 326 327 328 /** Insert a file entry as 'hard link' to another file entry. 329 @precond Source must not exist, Destination must exist. 330 @postcond Source has attribute STORE_ATTRIB_ISLINK. 331 @see store_attrib() 332 333 @param hFile [in] the File Handle 334 @param pSrcPath [in] the Source path 335 @param pSrcName [in] the Source name 336 @param pDstPath [in] the Destination path 337 @param pDstName [in] the Destination name 338 @return store_E_None upon success 339 */ 340 storeError SAL_CALL store_link ( 341 storeFileHandle hFile, 342 rtl_uString *pSrcPath, rtl_uString *pSrcName, 343 rtl_uString *pDstPath, rtl_uString *pDstName 344 ) SAL_THROW_EXTERN_C(); 345 346 347 /** Insert a file entry as 'symbolic link' to another file entry. 348 @precond Source must not exist 349 @postcond Source has attribute STORE_ATTRIB_ISLINK. 350 @see store_attrib() 351 352 @param hFile [in] the File Handle 353 @param pSrcPath [in] the Source path 354 @param pSrcName [in] the Source name 355 @param pDstPath [in] the Destination path 356 @param pDstName [in] the Destination name 357 @return store_E_None upon success 358 */ 359 storeError SAL_CALL store_symlink ( 360 storeFileHandle hFile, 361 rtl_uString *pSrcPath, rtl_uString *pSrcName, 362 rtl_uString *pDstPath, rtl_uString *pDstName 363 ) SAL_THROW_EXTERN_C(); 364 365 366 /** Rename a file entry. 367 @param hFile [in] the File Handle 368 @param pSrcPath [in] the Source path 369 @param pSrcName [in] the Source name 370 @param pDstPath [in] the Destination path 371 @param pDstName [in] the Destination name 372 @return store_E_None upon success 373 */ 374 storeError SAL_CALL store_rename ( 375 storeFileHandle hFile, 376 rtl_uString *pSrcPath, rtl_uString *pSrcName, 377 rtl_uString *pDstPath, rtl_uString *pDstName 378 ) SAL_THROW_EXTERN_C(); 379 380 381 /** Remove a file entry. 382 @param hFile [in] the File Handle 383 @param pPath [in] the entry path 384 @param pName [in] the entry name 385 @return store_E_None upon success 386 */ 387 storeError SAL_CALL store_remove ( 388 storeFileHandle hFile, 389 rtl_uString *pPath, 390 rtl_uString *pName 391 ) SAL_THROW_EXTERN_C(); 392 393 /*======================================================================== 394 * 395 * The End. 396 * 397 *======================================================================*/ 398 399 #ifdef __cplusplus 400 } 401 #endif 402 403 #endif /* _STORE_STORE_H_ */ 404 405 406 407 408