diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2000-09-18 14:18:43 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2000-09-18 14:18:43 +0000 |
commit | 215e8c7210756d6d9033f8d742a6cd0e9be132aa (patch) | |
tree | d1a56131d83c8298e6183cf17b912037ae63b9c9 /store/inc |
initial import
Diffstat (limited to 'store/inc')
-rw-r--r-- | store/inc/store/filelckb.hxx | 209 | ||||
-rw-r--r-- | store/inc/store/lockbyte.hxx | 169 | ||||
-rw-r--r-- | store/inc/store/memlckb.hxx | 197 | ||||
-rw-r--r-- | store/inc/store/object.hxx | 118 | ||||
-rw-r--r-- | store/inc/store/store.h | 377 | ||||
-rw-r--r-- | store/inc/store/store.hxx | 267 | ||||
-rw-r--r-- | store/inc/store/store.inl | 472 | ||||
-rw-r--r-- | store/inc/store/types.h | 194 |
8 files changed, 2003 insertions, 0 deletions
diff --git a/store/inc/store/filelckb.hxx b/store/inc/store/filelckb.hxx new file mode 100644 index 000000000..a9ef520e9 --- /dev/null +++ b/store/inc/store/filelckb.hxx @@ -0,0 +1,209 @@ +/************************************************************************* + * + * $RCSfile: filelckb.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 15:18:31 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _STORE_FILELCKB_HXX_ +#define _STORE_FILELCKB_HXX_ "$Revision: 1.1.1.1 $" + +#ifndef _SAL_TYPES_H_ +#include <sal/types.h> +#endif + +#ifndef _RTL_USTRING_H_ +#include <rtl/ustring.h> +#endif +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif + +#ifndef _STORE_MACROS_HXX_ +#include <store/macros.hxx> +#endif +#ifndef _STORE_OBJECT_HXX_ +#include <store/object.hxx> +#endif +#ifndef _STORE_LOCKBYTE_HXX_ +#include <store/lockbyte.hxx> +#endif + +#ifdef _USE_NAMESPACE +namespace store { +#endif + +class OFileLockBytes_Impl; + +/*======================================================================== + * + * OFileLockBytes interface. + * + *======================================================================*/ +class OFileLockBytes : + public NAMESPACE_STORE(ILockBytes), + public NAMESPACE_STORE(OStoreObject) +{ + VOS_DECLARE_CLASSINFO (VOS_NAMESPACE (OFileLockBytes, store)); + +public: + OFileLockBytes (void); + + /** create. + * @param pFilename [in] + * @param eAccessMode [in] + * @return store_E_None upon success + */ + storeError create ( + rtl_uString *pFilename, + storeAccessMode eAccessMode); + + /** Read at Offset into Buffer. + * @param nOffset [in] + * @param pBuffer [out] + * @param nBytes [in] + * @param rnDone [out] + * @return store_E_None upon success + */ + virtual storeError readAt ( + sal_uInt32 nOffset, + void *pBuffer, + sal_uInt32 nBytes, + sal_uInt32 &rnDone); + + /** Write at Offset from Buffer. + * @param nOffset [in] + * @param pBuffer [in] + * @param nBytes [in] + * @param rnDone [out] + * @return store_E_None upon success + */ + virtual storeError writeAt ( + sal_uInt32 nOffset, + const void *pBuffer, + sal_uInt32 nBytes, + sal_uInt32 &rnDone); + + /** flush. + * @return store_E_None upon success + */ + virtual storeError flush (void); + + /** setSize. + * @param nSize [in] + * @return store_E_None upon success + */ + virtual storeError setSize (sal_uInt32 nSize); + + /** stat. + * @param rnSize [out] + * @return store_E_None upon success + */ + virtual storeError stat (sal_uInt32 &rnSize); + + /** Lock range at Offset. + * @param nOffset [in] + * @param nBytes [in] + * @return store_E_None upon success + * store_E_LockingViolation + */ + virtual storeError lockRange ( + sal_uInt32 nOffset, + sal_uInt32 nBytes); + + /** Unlock range at Offset. + * @param nOffset [in] + * @param nBytes [in] + * @return store_E_None upon success + * store_E_LockingViolation + */ + virtual storeError unlockRange ( + sal_uInt32 nOffset, + sal_uInt32 nBytes); + + /** Delegate multiple inherited IReference. + */ + virtual RefCount SAL_CALL acquire (void); + virtual RefCount SAL_CALL release (void); + virtual RefCount SAL_CALL referenced (void) const; + +protected: + virtual ~OFileLockBytes (void); + +private: + /** Representation. + */ + NAMESPACE_OSL(Mutex) m_aMutex; + OFileLockBytes_Impl *m_pImpl; + + /** Not implemented. + */ + OFileLockBytes (const OFileLockBytes&); + OFileLockBytes& operator= (const OFileLockBytes&); +}; + +/*======================================================================== + * + * The End. + * + *======================================================================*/ +#ifdef _USE_NAMESPACE +} +#endif + +#endif /* !_STORE_FILELCKB_HXX_ */ + diff --git a/store/inc/store/lockbyte.hxx b/store/inc/store/lockbyte.hxx new file mode 100644 index 000000000..dbab735ca --- /dev/null +++ b/store/inc/store/lockbyte.hxx @@ -0,0 +1,169 @@ +/************************************************************************* + * + * $RCSfile: lockbyte.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 15:18:31 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _STORE_LOCKBYTE_HXX_ +#define _STORE_LOCKBYTE_HXX_ "$Revision: 1.1.1.1 $" + +#ifndef _SAL_TYPES_H_ +#include <sal/types.h> +#endif + +#ifndef _VOS_REFERNCE_HXX_ +#include <vos/refernce.hxx> +#endif + +#ifndef _STORE_TYPES_H_ +#include <store/types.h> +#endif +#ifndef _STORE_MACROS_HXX_ +#include <store/macros.hxx> +#endif + +#ifdef _USE_NAMESPACE +namespace store { +#endif + +/*======================================================================== + * + * ILockBytes interface. + * + *======================================================================*/ +class ILockBytes : public NAMESPACE_VOS(IReference) +{ +public: + /** + * @param nOffset [in] + * @param pBuffer [out] + * @param nBytes [in] + * @param rnDone [out] + * @return store_E_None upon success + */ + virtual storeError readAt ( + sal_uInt32 nOffset, + void *pBuffer, + sal_uInt32 nBytes, + sal_uInt32 &rnDone) = 0; + + /** + * @param nOffset [in] + * @param pBuffer [in] + * @param nBytes [in] + * @param rnDone [out] + * @return store_E_None upon success + */ + virtual storeError writeAt ( + sal_uInt32 nOffset, + const void *pBuffer, + sal_uInt32 nBytes, + sal_uInt32 &rnDone) = 0; + + /** + * @return store_E_None upon success + */ + virtual storeError flush (void) = 0; + + /** + * @param nSize [in] + * @return store_E_None upon success + */ + virtual storeError setSize (sal_uInt32 nSize) = 0; + + /** + * @param rnSize [out] + * @return store_E_None upon success + */ + virtual storeError stat (sal_uInt32 &rnSize) = 0; + + /** + * @param nOffset [in] + * @param nBytes [in] + * @return store_E_None upon success + * store_E_LockingViolation + */ + virtual storeError lockRange ( + sal_uInt32 nOffset, + sal_uInt32 nBytes) = 0; + + /** + * @param nOffset [in] + * @param nBytes [in] + * @return store_E_None upon success + * store_E_LockingViolation + */ + virtual storeError unlockRange ( + sal_uInt32 nOffset, + sal_uInt32 nBytes) = 0; + +protected: + virtual ~ILockBytes (void) {} +}; + +/*======================================================================== + * + * The End. + * + *======================================================================*/ +#ifdef _USE_NAMESPACE +} +#endif + +#endif /* !_STORE_LOCKBYTE_HXX_ */ + diff --git a/store/inc/store/memlckb.hxx b/store/inc/store/memlckb.hxx new file mode 100644 index 000000000..a78b946b6 --- /dev/null +++ b/store/inc/store/memlckb.hxx @@ -0,0 +1,197 @@ +/************************************************************************* + * + * $RCSfile: memlckb.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 15:18:31 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _STORE_MEMLCKB_HXX_ +#define _STORE_MEMLCKB_HXX_ "$Revision: 1.1.1.1 $" + +#ifndef _SAL_TYPES_H_ +#include <sal/types.h> +#endif + +#ifndef _VOS_MUTEX_HXX_ +#include <vos/mutex.hxx> +#endif + +#ifndef _STORE_MACROS_HXX_ +#include <store/macros.hxx> +#endif +#ifndef _STORE_OBJECT_HXX_ +#include <store/object.hxx> +#endif +#ifndef _STORE_LOCKBYTE_HXX_ +#include <store/lockbyte.hxx> +#endif + +#ifdef _USE_NAMESPACE +namespace store { +#endif + +class OMemoryLockBytes_Impl; + +/*======================================================================== + * + * OMemoryLockBytes interface. + * + *======================================================================*/ +class OMemoryLockBytes : + public NAMESPACE_STORE(ILockBytes), + public NAMESPACE_STORE(OStoreObject) +{ + VOS_DECLARE_CLASSINFO (VOS_NAMESPACE (OMemoryLockBytes, store)); + +public: + OMemoryLockBytes (void); + + /** Read at Offset into Buffer. + * @param nOffset [in] + * @param pBuffer [out] + * @param nBytes [in] + * @param rnDone [out] + * @return store_E_None upon success + */ + virtual storeError readAt ( + sal_uInt32 nOffset, + void *pBuffer, + sal_uInt32 nBytes, + sal_uInt32 &rnDone); + + /** Write at Offset from Buffer. + * @param nOffset [in] + * @param pBuffer [in] + * @param nBytes [in] + * @param rnDone [out] + * @return store_E_None upon success + */ + virtual storeError writeAt ( + sal_uInt32 nOffset, + const void *pBuffer, + sal_uInt32 nBytes, + sal_uInt32 &rnDone); + + /** flush. + * @return store_E_None upon success + */ + virtual storeError flush (void); + + /** setSize. + * @param nSize [in] + * @return store_E_None upon success + */ + virtual storeError setSize (sal_uInt32 nSize); + + /** stat. + * @param rnSize [out] + * @return store_E_None upon success + */ + virtual storeError stat (sal_uInt32 &rnSize); + + /** Lock range at Offset. + * @param nOffset [in] + * @param nBytes [in] + * @return store_E_None upon success + * store_E_LockingViolation + */ + virtual storeError lockRange ( + sal_uInt32 nOffset, + sal_uInt32 nBytes); + + /** Unlock range at Offset. + * @param nOffset [in] + * @param nBytes [in] + * @return store_E_None upon success + * store_E_LockingViolation + */ + virtual storeError unlockRange ( + sal_uInt32 nOffset, + sal_uInt32 nBytes); + + /** Delegate multiple inherited IReference. + */ + virtual RefCount SAL_CALL acquire (void); + virtual RefCount SAL_CALL release (void); + virtual RefCount SAL_CALL referenced (void) const; + +protected: + virtual ~OMemoryLockBytes (void); + +private: + /** Representation. + */ + NAMESPACE_VOS(OMutex) m_aMutex; + OMemoryLockBytes_Impl *m_pImpl; + + /** Not implemented. + */ + OMemoryLockBytes (const OMemoryLockBytes&); + OMemoryLockBytes& operator= (const OMemoryLockBytes&); +}; + +/*======================================================================== + * + * The End. + * + *======================================================================*/ +#ifdef _USE_NAMESPACE +} +#endif + +#endif /* !_STORE_MEMLCKB_HXX_ */ + diff --git a/store/inc/store/object.hxx b/store/inc/store/object.hxx new file mode 100644 index 000000000..c5caa83da --- /dev/null +++ b/store/inc/store/object.hxx @@ -0,0 +1,118 @@ +/************************************************************************* + * + * $RCSfile: object.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 15:18:31 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _STORE_OBJECT_HXX_ +#define _STORE_OBJECT_HXX_ "$Revision: 1.1.1.1 $" + +#ifndef _SAL_TYPES_H_ +#include <sal/types.h> +#endif + +#ifndef _VOS_OBJECT_HXX_ +#include <vos/object.hxx> +#endif +#ifndef _VOS_REFERNCE_HXX_ +#include <vos/refernce.hxx> +#endif + +#ifndef _STORE_MACROS_HXX_ +#include <store/macros.hxx> +#endif + +#ifdef _USE_NAMESPACE +namespace store { +#endif + +/*======================================================================== + * + * OStoreObject interface. + * + *======================================================================*/ +class OStoreObject : + public NAMESPACE_VOS(OReference), + public NAMESPACE_VOS(OObject) +{ + VOS_DECLARE_CLASSINFO (VOS_NAMESPACE (OStoreObject, store)); + +public: + OStoreObject (void); + +protected: + virtual ~OStoreObject (void); + +private: + /** Not implemented. + */ + OStoreObject (const OStoreObject&); + OStoreObject& operator= (const OStoreObject&); +}; + +/*======================================================================== + * + * The End. + * + *======================================================================*/ +#ifdef _USE_NAMESPACE +} +#endif + +#endif /* !_STORE_OBJECT_HXX_ */ + diff --git a/store/inc/store/store.h b/store/inc/store/store.h new file mode 100644 index 000000000..2e8ea11eb --- /dev/null +++ b/store/inc/store/store.h @@ -0,0 +1,377 @@ +/************************************************************************* + * + * $RCSfile: store.h,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 15:18:31 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _STORE_STORE_H_ +#define _STORE_STORE_H_ "$Revision: 1.1.1.1 $" + +#ifndef _STORE_TYPES_H_ +#include <store/types.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/** Opaque type storeHandle. + */ +typedef void* storeHandle; + +/** store_acquireHandle. + * @param Handle [in] + * @return store_E_None upon success + */ +storeError SAL_CALL store_acquireHandle (storeHandle Handle); + +/** store_releaseHandle. + * @param Handle [in] + * @return store_E_None upon success, + * store_E_InvalidHandle otherwise. + */ +storeError SAL_CALL store_releaseHandle (storeHandle Handle); + + +/** Opaque type storeFileHandle. + */ +typedef void* storeFileHandle; + +/** store_createMemoryFile. + * @param nPageSize [in] the creation page size, + * integer multiple of minimum page size. + * @param phFile [out] + * @return store_E_None upon success + */ +storeError SAL_CALL store_createMemoryFile ( + sal_uInt16 nPageSize, + storeFileHandle *phFile); + +/** store_openFile. + * @param pFilename [in] the filename in host syntax. + * @param eAccessMode [in] the access mode. + * store_AccessCreate truncate existing and create, + * store_AccessReadCreate create not existing, + * store_AccessReadWrite write existing, + * store_AccessReadOnly never modifies. + * @param nPageSize [in] the creation page size, + * integer multiple of minimum page size. + * @param phFile [out] + * @return store_E_None upon success + */ +storeError SAL_CALL store_openFile ( + rtl_uString *pFilename, + storeAccessMode eAccessMode, + sal_uInt16 nPageSize, + storeFileHandle *phFile); + +/** store_closeFile. + * @param hFile [in] + * @return store_E_None upon success, + * store_E_InvalidHandle otherwise. + */ +storeError SAL_CALL store_closeFile ( + storeFileHandle hFile); + +/** store_flushFile. + * @param hFile [in] + * @return store_E_None upon success + */ +storeError SAL_CALL store_flushFile ( + storeFileHandle hFile); + +/** store_getFileRefererCount. + * @param hFile [in] + * @param pnRefCount [out] number of open directories and streams. + * @return store_E_None upon success + */ +storeError SAL_CALL store_getFileRefererCount ( + storeFileHandle hFile, + sal_uInt32 *pnRefCount); + +/** store_getFileSize. + * @param hFile [in] + * @param pnSize [out] + * @return store_E_None upon success + */ +storeError SAL_CALL store_getFileSize ( + storeFileHandle hFile, + sal_uInt32 *pnSize); + +/** store_rebuildFile. + * @param pSrcFilename [in] opened with store_AccessReadOnly. + * @param pDstFilename [in] created with store_AccessCreate. + * @return store_E_None upon success + */ +storeError SAL_CALL store_rebuildFile ( + rtl_uString *pSrcFilename, + rtl_uString *pDstFilename); + + +/** Opaque type storeDirectoryHandle. + */ +typedef void* storeDirectoryHandle; + +/** store_openDirectory. + * @param hFile [in] + * @param pPath [in] + * @param pName [in] + * @param eAccessMode [in] + * @param phDirectory [out] + * @return store_E_None upon success + */ +storeError SAL_CALL store_openDirectory ( + storeFileHandle hFile, + rtl_uString *pPath, + rtl_uString *pName, + storeAccessMode eAccessMode, + storeDirectoryHandle *phDirectory); + +/** store_closeDirectory. + * @param hDirectory [in] + * @return store_E_None upon success, + * store_E_InvalidHandle otherwise. + */ +storeError SAL_CALL store_closeDirectory ( + storeDirectoryHandle hDirectory); + +/** store_findFirst. + * @param hDirectory [in] + * @param pFindData [out] + * @return store_E_None upon success, + * store_E_NoMoreFile upon end of iteration. + */ +storeError SAL_CALL store_findFirst ( + storeDirectoryHandle hDirectory, + storeFindData *pFindData); + +/** store_findNext. + * @param hDirectory [in] + * @param pFindData [out] + * @return store_E_None upon success, + * store_E_NoMoreFile upon end of iteration. + */ +storeError SAL_CALL store_findNext ( + storeDirectoryHandle hDirectory, + storeFindData *pFindData); + + +/** Opaque type storeStreamHandle. + */ +typedef void* storeStreamHandle; + +/** store_openStream. + * @param hFile [in] + * @param pPath [in] + * @param pName [in] + * @param eAccessMode [in] + * @param phStrm [out] + * @return store_E_None upon success + */ +storeError SAL_CALL store_openStream ( + storeFileHandle hFile, + rtl_uString *pPath, + rtl_uString *pName, + storeAccessMode eMode, + storeStreamHandle *phStrm); + +/** store_closeStream. + * @param hStrm [in] + * @return store_E_None upon success, + * store_E_InvalidHandle otherwise. + */ +storeError SAL_CALL store_closeStream ( + storeStreamHandle hStrm); + +/** store_readStream. + * @param hStrm [in] + * @param nOffset [in] + * @param pBuffer [out] + * @param nBytes [in] + * @param pnDone [out] + * @return store_E_None upon success + */ +storeError SAL_CALL store_readStream ( + storeStreamHandle hStrm, + sal_uInt32 nOffset, + void *pBuffer, + sal_uInt32 nBytes, + sal_uInt32 *pnDone); + +/** store_writeStream. + * @param hStrm [in] + * @param nOffset [in] + * @param pBuffer [in] + * @param nBytes [in] + * @param pnDone [out] + * @return store_E_None upon success + */ +storeError SAL_CALL store_writeStream ( + storeStreamHandle hStrm, + sal_uInt32 nOffset, + const void *pBuffer, + sal_uInt32 nBytes, + sal_uInt32 *pnDone); + +/** store_flushStream. + * @param hStrm [in] + * @return store_E_None upon success + */ +storeError SAL_CALL store_flushStream ( + storeStreamHandle hStrm); + +/** store_getStreamSize. + * @param hStrm [in] + * @param pnSize [out] + * @return store_E_None upon success + */ +storeError SAL_CALL store_getStreamSize ( + storeStreamHandle hStrm, + sal_uInt32 *pnSize); + +/** store_setStreamSize. + * @param hStrm [in] + * @param nSize [in] + * @return store_E_None upon success + */ +storeError SAL_CALL store_setStreamSize ( + storeStreamHandle hStrm, + sal_uInt32 nSize); + +/** store_attrib. + * @param hFile [in] + * @param pPath [in] + * @param pName [in] + * @param nMask1 [in] + * @param nMask2 [in] + * @param pnAttrib [out] may be NULL. + * @return store_E_None upon success + */ +storeError SAL_CALL store_attrib ( + storeFileHandle hFile, + rtl_uString *pPath, + rtl_uString *pName, + sal_uInt32 nMask1, + sal_uInt32 nMask2, + sal_uInt32 *pnAttrib); + +/** store_link. + * @param hFile [in] + * @param pSrcPath [in] + * @param pSrcName [in] + * @param pDstPath [in] + * @param pDstName [in] + * @return store_E_None upon success + */ +storeError SAL_CALL store_link ( + storeFileHandle hFile, + rtl_uString *pSrcPath, rtl_uString *pSrcName, + rtl_uString *pDstPath, rtl_uString *pDstName); + +/** store_symlink. + * @param hFile [in] + * @param pSrcPath [in] + * @param pSrcName [in] + * @param pDstPath [in] + * @param pDstName [in] + * @return store_E_None upon success + */ +storeError SAL_CALL store_symlink ( + storeFileHandle hFile, + rtl_uString *pSrcPath, rtl_uString *pSrcName, + rtl_uString *pDstPath, rtl_uString *pDstName); + +/** store_rename. + * @param hFile [in] + * @param pSrcPath [in] + * @param pSrcName [in] + * @param pDstPath [in] + * @param pDstName [in] + * @return store_E_None upon success + */ +storeError SAL_CALL store_rename ( + storeFileHandle hFile, + rtl_uString *pSrcPath, rtl_uString *pSrcName, + rtl_uString *pDstPath, rtl_uString *pDstName); + +/** store_remove. + * @param hFile [in] + * @param pPath [in] + * @param pName [in] + * @return store_E_None upon success + */ +storeError SAL_CALL store_remove ( + storeFileHandle hFile, + rtl_uString *pPath, + rtl_uString *pName); + +/*======================================================================== + * + * The End. + * + *======================================================================*/ + +#ifdef __cplusplus +} +#endif + +#endif /* _STORE_STORE_H_ */ + + + + diff --git a/store/inc/store/store.hxx b/store/inc/store/store.hxx new file mode 100644 index 000000000..13a25afe0 --- /dev/null +++ b/store/inc/store/store.hxx @@ -0,0 +1,267 @@ +/************************************************************************* + * + * $RCSfile: store.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 15:18:31 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _STORE_STORE_HXX_ +#define _STORE_STORE_HXX_ "$Revision: 1.1.1.1 $" + +#ifndef _SAL_TYPES_H_ +#include <sal/types.h> +#endif + +#ifndef _RTL_USTRING_HXX_ +#include <rtl/ustring.hxx> +#endif + +#ifndef _STORE_STORE_H_ +#include <store/store.h> +#endif + +#ifdef _USE_NAMESPACE +namespace store { +#endif + +/*======================================================================== + * + * OStoreStream interface. + * + *======================================================================*/ +class OStoreStream +{ +public: + inline OStoreStream (void); + inline ~OStoreStream (void); + + inline OStoreStream (const OStoreStream& rOther); + inline OStoreStream& operator= (const OStoreStream& rOther); + + inline OStoreStream (storeStreamHandle Handle); + inline operator storeStreamHandle (void) const; + + inline sal_Bool isValid (void) const; + + inline storeError create ( + storeFileHandle hFile, + const rtl::OUString &rPath, + const rtl::OUString &rName, + storeAccessMode eMode); + + inline void close (void); + + inline storeError readAt ( + sal_uInt32 nOffset, + void *pBuffer, + sal_uInt32 nBytes, + sal_uInt32 &rnDone); + + inline storeError writeAt ( + sal_uInt32 nOffset, + const void *pBuffer, + sal_uInt32 nBytes, + sal_uInt32 &rnDone); + + inline storeError flush (void) const; + + inline storeError getSize (sal_uInt32 &rnSize) const; + + inline storeError setSize (sal_uInt32 nSize); + +private: + storeStreamHandle m_hImpl; +}; + +/*======================================================================== + * + * OStoreDirectory interface. + * + *======================================================================*/ +class OStoreDirectory +{ +public: + inline OStoreDirectory (void); + inline ~OStoreDirectory (void); + + inline OStoreDirectory (const OStoreDirectory& rOther); + inline OStoreDirectory& operator= (const OStoreDirectory& rOther); + + inline OStoreDirectory (storeDirectoryHandle Handle); + inline operator storeDirectoryHandle (void) const; + + inline sal_Bool isValid (void) const; + + /** create. + */ + inline storeError create ( + storeFileHandle hFile, + const rtl::OUString &rPath, + const rtl::OUString &rName, + storeAccessMode eMode); + + /** close. + */ + inline void close (void); + + /** Iteration. + */ + typedef storeFindData iterator; + + inline storeError first (iterator& it); + inline storeError next (iterator& it); + + /** Traversal. + */ + class traveller + { + public: + virtual sal_Bool visit (const iterator& it) = 0; + }; + + inline storeError travel (traveller& rTraveller) const; + +private: + storeDirectoryHandle m_hImpl; +}; + +/*======================================================================== + * + * OStoreFile interface. + * + *======================================================================*/ +class OStoreFile +{ +public: + inline OStoreFile (void); + inline ~OStoreFile (void); + + inline OStoreFile (const OStoreFile& rOther); + inline OStoreFile& operator= (const OStoreFile& rOther); + + inline OStoreFile (storeFileHandle Handle); + inline operator storeFileHandle (void) const; + + inline sal_Bool isValid (void) const; + + inline storeError create ( + const rtl::OUString &rFilename, + storeAccessMode eAccessMode, + sal_uInt16 nPageSize = STORE_DEFAULT_PAGESIZE); + + inline storeError createInMemory ( + sal_uInt16 nPageSize = STORE_DEFAULT_PAGESIZE); + + inline void close (void); + + inline storeError flush (void) const; + + inline storeError getRefererCount (sal_uInt32 &rnRefCount) const; + + inline storeError getSize (sal_uInt32 &rnSize) const; + + /** Directory and Stream Manipulation. + */ + inline storeError attrib ( + const rtl::OUString &rPath, + const rtl::OUString &rName, + sal_uInt32 nMask1, + sal_uInt32 nMask2, + sal_uInt32 &rnAttrib); + inline storeError attrib ( + const rtl::OUString &rPath, + const rtl::OUString &rName, + sal_uInt32 nMask1, + sal_uInt32 nMask2); + + inline storeError link ( + const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName, + const rtl::OUString &rDstPath, const rtl::OUString &rDstName); + + inline storeError symlink ( + const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName, + const rtl::OUString &rDstPath, const rtl::OUString &rDstName); + + inline storeError rename ( + const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName, + const rtl::OUString &rDstPath, const rtl::OUString &rDstName); + + inline storeError remove ( + const rtl::OUString &rPath, + const rtl::OUString &rName); + +private: + storeFileHandle m_hImpl; +}; + +/*======================================================================== + * + * The End. + * + *======================================================================*/ + +#include <store/store.inl> + +#ifdef _USE_NAMESPACE +} +#endif + +#endif /* !_STORE_STORE_HXX_ */ + + + + diff --git a/store/inc/store/store.inl b/store/inc/store/store.inl new file mode 100644 index 000000000..bfcc2d89a --- /dev/null +++ b/store/inc/store/store.inl @@ -0,0 +1,472 @@ +/************************************************************************* + * + * $RCSfile: store.inl,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 15:18:31 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc.. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#define _STORE_STORE_INL_ "$Revision: 1.1.1.1 $" + +/*======================================================================== + * + * OStoreStream implementation. + * + *======================================================================*/ +inline OStoreStream::OStoreStream (void) + : m_hImpl (0) +{ +} + +inline OStoreStream::~OStoreStream (void) +{ + if (m_hImpl) + store_releaseHandle (m_hImpl); +} + +inline OStoreStream::OStoreStream (const OStoreStream& rOther) + : m_hImpl (rOther.m_hImpl) +{ + if (m_hImpl) + store_acquireHandle (m_hImpl); +} + +inline OStoreStream& OStoreStream::operator= (const OStoreStream& rOther) +{ + if (m_hImpl) + store_releaseHandle (m_hImpl); + m_hImpl = rOther.m_hImpl; + if (m_hImpl) + store_acquireHandle (m_hImpl); + return *this; +} + +inline OStoreStream::OStoreStream (storeStreamHandle Handle) + : m_hImpl (Handle) +{ + if (m_hImpl) + store_acquireHandle (m_hImpl); +} + +inline OStoreStream::operator storeStreamHandle (void) const +{ + return m_hImpl; +} + +inline sal_Bool OStoreStream::isValid (void) const +{ + return (!!m_hImpl); +} + +inline storeError OStoreStream::create ( + storeFileHandle hFile, + const rtl::OUString &rPath, + const rtl::OUString &rName, + storeAccessMode eMode) +{ + if (m_hImpl) + { + store_releaseHandle (m_hImpl); + m_hImpl = 0; + } + return store_openStream ( + hFile, rPath.pData, rName.pData, eMode, &m_hImpl); +} + +inline void OStoreStream::close (void) +{ + if (m_hImpl) + { + store_closeStream (m_hImpl); + m_hImpl = 0; + } +} + +inline storeError OStoreStream::readAt ( + sal_uInt32 nOffset, + void *pBuffer, + sal_uInt32 nBytes, + sal_uInt32 &rnDone) +{ + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_readStream ( + m_hImpl, nOffset, pBuffer, nBytes, &rnDone); +} + +inline storeError OStoreStream::writeAt ( + sal_uInt32 nOffset, + const void *pBuffer, + sal_uInt32 nBytes, + sal_uInt32 &rnDone) +{ + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_writeStream ( + m_hImpl, nOffset, pBuffer, nBytes, &rnDone); +} + +inline storeError OStoreStream::flush (void) const +{ + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_flushStream (m_hImpl); +} + +inline storeError OStoreStream::getSize (sal_uInt32 &rnSize) const +{ + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_getStreamSize (m_hImpl, &rnSize); +} + +inline storeError OStoreStream::setSize (sal_uInt32 nSize) +{ + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_setStreamSize (m_hImpl, nSize); +} + +/*======================================================================== + * + * OStoreDirectory implementation. + * + *======================================================================*/ +inline OStoreDirectory::OStoreDirectory (void) + : m_hImpl (0) +{ +} + +inline OStoreDirectory::~OStoreDirectory (void) +{ + if (m_hImpl) + store_releaseHandle (m_hImpl); +} + +inline OStoreDirectory::OStoreDirectory (const OStoreDirectory& rOther) + : m_hImpl (rOther.m_hImpl) +{ + if (m_hImpl) + store_acquireHandle (m_hImpl); +} + +inline OStoreDirectory& +OStoreDirectory::operator= (const OStoreDirectory& rOther) +{ + if (m_hImpl) + store_releaseHandle (m_hImpl); + m_hImpl = rOther.m_hImpl; + if (m_hImpl) + store_acquireHandle (m_hImpl); + return *this; +} + +inline OStoreDirectory::OStoreDirectory (storeDirectoryHandle Handle) + : m_hImpl (Handle) +{ + if (m_hImpl) + store_acquireHandle (m_hImpl); +} + +inline OStoreDirectory::operator storeDirectoryHandle (void) const +{ + return m_hImpl; +} + +inline sal_Bool OStoreDirectory::isValid (void) const +{ + return (!!m_hImpl); +} + +inline storeError OStoreDirectory::create ( + storeFileHandle hFile, + const rtl::OUString &rPath, + const rtl::OUString &rName, + storeAccessMode eMode) +{ + if (m_hImpl) + { + store_releaseHandle (m_hImpl); + m_hImpl = 0; + } + return store_openDirectory ( + hFile, rPath.pData, rName.pData, eMode, &m_hImpl); +} + +inline void OStoreDirectory::close (void) +{ + if (m_hImpl) + { + store_closeDirectory (m_hImpl); + m_hImpl = 0; + } +} + +inline storeError OStoreDirectory::first (iterator& it) +{ + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_findFirst (m_hImpl, &it); +} + +inline storeError OStoreDirectory::next (iterator& it) +{ + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_findNext (m_hImpl, &it); +} + +inline storeError OStoreDirectory::travel (traveller& rTraveller) const +{ + storeError eErrCode = store_E_InvalidHandle; + if (m_hImpl) + { + iterator it; + eErrCode = store_findFirst (m_hImpl, &it); + while ((eErrCode == store_E_None) && rTraveller.visit(it)) + eErrCode = store_findNext (m_hImpl, &it); + } + return eErrCode; +} + +/*======================================================================== + * + * OStoreFile implementation. + * + *======================================================================*/ +inline OStoreFile::OStoreFile (void) + : m_hImpl (0) +{ +} + +inline OStoreFile::~OStoreFile (void) +{ + if (m_hImpl) + store_releaseHandle (m_hImpl); +} + +inline OStoreFile::OStoreFile (const OStoreFile& rOther) + : m_hImpl (rOther.m_hImpl) +{ + if (m_hImpl) + store_acquireHandle (m_hImpl); +} + +inline OStoreFile& OStoreFile::operator= (const OStoreFile& rOther) +{ + if (m_hImpl) + store_releaseHandle (m_hImpl); + m_hImpl = rOther.m_hImpl; + if (m_hImpl) + store_acquireHandle (m_hImpl); + return *this; +} + +inline OStoreFile::OStoreFile (storeFileHandle Handle) + : m_hImpl (Handle) +{ + if (m_hImpl) + store_acquireHandle (m_hImpl); +} + +inline OStoreFile::operator storeFileHandle (void) const +{ + return m_hImpl; +} + +inline sal_Bool OStoreFile::isValid (void) const +{ + return (!!m_hImpl); +} + +inline storeError OStoreFile::create ( + const rtl::OUString &rFilename, + storeAccessMode eAccessMode, + sal_uInt16 nPageSize) +{ + if (m_hImpl) + { + store_releaseHandle (m_hImpl); + m_hImpl = 0; + } + return store_openFile (rFilename.pData, eAccessMode, nPageSize, &m_hImpl); +} + +inline storeError OStoreFile::createInMemory (sal_uInt16 nPageSize) +{ + if (m_hImpl) + { + store_releaseHandle (m_hImpl); + m_hImpl = 0; + } + return store_createMemoryFile (nPageSize, &m_hImpl); +} + +inline void OStoreFile::close (void) +{ + if (m_hImpl) + { + store_closeFile (m_hImpl); + m_hImpl = 0; + } +} + +inline storeError OStoreFile::flush (void) const +{ + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_flushFile (m_hImpl); +} + +inline storeError OStoreFile::getRefererCount (sal_uInt32 &rnRefCount) const +{ + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_getFileRefererCount (m_hImpl, &rnRefCount); +} + +inline storeError OStoreFile::getSize (sal_uInt32 &rnSize) const +{ + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_getFileSize (m_hImpl, &rnSize); +} + +inline storeError OStoreFile::attrib ( + const rtl::OUString &rPath, + const rtl::OUString &rName, + sal_uInt32 nMask1, + sal_uInt32 nMask2, + sal_uInt32 &rnAttrib) +{ + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_attrib ( + m_hImpl, rPath.pData, rName.pData, nMask1, nMask2, &rnAttrib); +} + +inline storeError OStoreFile::attrib ( + const rtl::OUString &rPath, + const rtl::OUString &rName, + sal_uInt32 nMask1, + sal_uInt32 nMask2) +{ + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_attrib ( + m_hImpl, rPath.pData, rName.pData, nMask1, nMask2, NULL); +} + +inline storeError OStoreFile::link ( + const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName, + const rtl::OUString &rDstPath, const rtl::OUString &rDstName) +{ + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_link ( + m_hImpl, + rSrcPath.pData, rSrcName.pData, + rDstPath.pData, rDstName.pData); +} + +inline storeError OStoreFile::symlink ( + const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName, + const rtl::OUString &rDstPath, const rtl::OUString &rDstName) +{ + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_symlink ( + m_hImpl, + rSrcPath.pData, rSrcName.pData, + rDstPath.pData, rDstName.pData); +} + +inline storeError OStoreFile::rename ( + const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName, + const rtl::OUString &rDstPath, const rtl::OUString &rDstName) +{ + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_rename ( + m_hImpl, + rSrcPath.pData, rSrcName.pData, + rDstPath.pData, rDstName.pData); +} + +inline storeError OStoreFile::remove ( + const rtl::OUString &rPath, const rtl::OUString &rName) +{ + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_remove (m_hImpl, rPath.pData, rName.pData); +} + diff --git a/store/inc/store/types.h b/store/inc/store/types.h new file mode 100644 index 000000000..2024c980e --- /dev/null +++ b/store/inc/store/types.h @@ -0,0 +1,194 @@ +/************************************************************************* + * + * $RCSfile: types.h,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 15:18:31 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _STORE_TYPES_H_ +#define _STORE_TYPES_H_ "$Revision: 1.1.1.1 $" + +#ifndef _SAL_TYPES_H_ +#include <sal/types.h> +#endif + +#ifndef _RTL_USTRING_H_ +#include <rtl/ustring.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/** PageSize (recommended) default. + * @see store_openFile(). + */ +#define STORE_DEFAULT_PAGESIZE ((sal_uInt16)0x0400) + + +/** PageSize (enforced) limits. + * @see store_openFile(). + */ +#define STORE_MINIMUM_PAGESIZE ((sal_uInt16)0x0200) +#define STORE_MAXIMUM_PAGESIZE ((sal_uInt16)0x8000) + + +/** NameSize (enforced) limit. + * @see any param pName. + * @see store_E_NameTooLong + */ +#define STORE_MAXIMUM_NAMESIZE 256 + + +/** Attributes (predefined). + * @see store_attrib(). + */ +#define STORE_ATTRIB_ISLINK 0x10000000UL +#define STORE_ATTRIB_ISDIR 0x20000000UL +#define STORE_ATTRIB_ISFILE 0x40000000UL + + +/** storeAccessMode. + * @see store_openFile(). + * @see store_openDirectory(). + * @see store_openStream(). + */ +typedef enum +{ + store_AccessCreate, + store_AccessReadCreate, + store_AccessReadWrite, + store_AccessReadOnly, + store_Access_FORCE_EQUAL_SIZE = SAL_MAX_ENUM +} storeAccessMode; + + +/** storeError. + */ +typedef enum +{ + store_E_None = 0, + store_E_AccessViolation, + store_E_LockingViolation, + store_E_CantSeek, + store_E_CantRead, + store_E_CantWrite, + store_E_InvalidAccess, + store_E_InvalidHandle, + store_E_InvalidParameter, + store_E_InvalidChecksum, + store_E_AlreadyExists, + store_E_NotExists, + store_E_NotDirectory, + store_E_NotFile, + store_E_NoMoreFiles, + store_E_NameTooLong, + store_E_OutOfMemory, + store_E_OutOfSpace, + store_E_Pending, + store_E_WrongFormat, + store_E_WrongVersion, + store_E_Unknown, + store_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM +} storeError; + + +/** storeFindData. + * @see store_findFirst(). + * @see store_findNext(). + */ +typedef struct +{ + /** Name. + * @see m_nLength. + */ + sal_Unicode m_pszName[STORE_MAXIMUM_NAMESIZE]; + + /** Name Length. + * @see m_pszName. + */ + sal_Int32 m_nLength; + + /** Attributes. + * @see store_attrib(). + */ + sal_uInt32 m_nAttrib; + + /** Size. + * @see store_getStreamSize(). + * @see store_setStreamSize(). + */ + sal_uInt32 m_nSize; + + /** Reserved for internal use. + */ + sal_uInt32 m_nReserved; +} storeFindData; + + +/*======================================================================== + * + * The End. + * + *======================================================================*/ + +#ifdef __cplusplus +} +#endif + +#endif /* _STORE_TYPES_H_ */ + |