summaryrefslogtreecommitdiff
path: root/registry/inc
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 14:18:43 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 14:18:43 +0000
commit9399c662f36c385b0c705eb34e636a9aec450282 (patch)
treef502e9d9258960ff214ab90e98e31d0075e60196 /registry/inc
initial import
Diffstat (limited to 'registry/inc')
-rw-r--r--registry/inc/registry/reflread.hxx499
-rw-r--r--registry/inc/registry/refltype.hxx266
-rw-r--r--registry/inc/registry/reflwrit.hxx422
-rw-r--r--registry/inc/registry/registry.h456
-rw-r--r--registry/inc/registry/registry.hxx1220
-rw-r--r--registry/inc/registry/regtype.h185
6 files changed, 3048 insertions, 0 deletions
diff --git a/registry/inc/registry/reflread.hxx b/registry/inc/registry/reflread.hxx
new file mode 100644
index 000000000000..352cf7980dfe
--- /dev/null
+++ b/registry/inc/registry/reflread.hxx
@@ -0,0 +1,499 @@
+/*************************************************************************
+ *
+ * $RCSfile: reflread.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/*************************************************************************
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.20 2000/09/17 12:30:32 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.19 2000/08/04 15:31:39 jsc
+ extend biniary type format
+
+ Revision 1.18 2000/07/26 17:44:32 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.17 2000/05/02 06:06:21 jsc
+ insert LIBRARY_VERSION for dynamic loading
+
+ Revision 1.16 2000/04/18 10:09:48 jsc
+ modified for unicode changes
+
+ Revision 1.15 2000/03/24 15:00:36 jsc
+ modified for unicode changes
+
+ Revision 1.14 1999/10/19 16:13:55 kr
+ Parameter for Version 1 of Registry added.
+
+ Revision 1.13 1999/09/06 08:33:00 jsc
+ insert IDL filename in registry
+
+ Revision 1.12 1999/07/02 09:25:39 jsc
+ #67179# Binaerblop der CoreReflection ist erweitert worden
+
+ Revision 1.11 1999/03/12 14:16:38 jsc
+ #61011# Anpassung an osl-Typen
+
+ Revision 1.10 1999/02/05 09:44:33 jsc
+ #61011# Typanpassung
+
+ Revision 1.9 1998/12/11 11:57:42 jsc
+ Anpassung an ODynamicLoader
+
+ Revision 1.8 1998/08/06 09:43:43 jsc
+ #54698# Anpassung an DynamicLoader
+
+ Revision 1.7 1998/07/06 17:00:31 jsc
+ Calltype von InitRegistryTypeReader_Api gesetzt
+
+ Revision 1.6 1998/07/03 11:20:07 ts
+ prefixen von typen
+
+ Revision 1.5 1998/07/03 08:41:02 ts
+ bugs und set/getUik()
+
+ Revision 1.4 1998/07/02 11:58:29 jsc
+ Typ Anpassung, Schnittstelle frei von solar.h
+
+ Revision 1.3 1998/07/01 13:39:01 ts
+ bugs, bugs, bugs
+
+ Revision 1.2 1998/06/30 13:42:27 ts
+ Anpassung an SOLARIS
+
+ Revision 1.1.1.1 1998/06/30 11:17:45 jsc
+ neu
+
+
+*************************************************************************/
+
+#ifndef __REGISTRY_REFLREAD_HXX__
+#define __REGISTRY_REFLREAD_HXX__
+
+#ifndef _REGISTRY_REFLTYPE_HXX_
+#include <registry/refltype.hxx>
+#endif
+#ifndef _REGISTRY_REGTYPE_H_
+#include <registry/regtype.h>
+#endif
+#ifndef _VOS_DYNLOAD_HXX_
+#include <vos/dynload.hxx>
+#endif
+
+// Implememetation handle
+typedef void* TypeReaderImpl;
+
+/****************************************************************************
+
+ C-Api for load on call
+
+*****************************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct RegistryTypeReader_Api
+{
+ TypeReaderImpl (TYPEREG_CALLTYPE *createEntry) (const sal_uInt8*, sal_uInt32, sal_Bool);
+ void (TYPEREG_CALLTYPE *acquire) (TypeReaderImpl);
+ void (TYPEREG_CALLTYPE *release) (TypeReaderImpl);
+ sal_uInt16 (TYPEREG_CALLTYPE *getMinorVersion) (TypeReaderImpl);
+ sal_uInt16 (TYPEREG_CALLTYPE *getMajorVersion) (TypeReaderImpl);
+ RTTypeClass (TYPEREG_CALLTYPE *getTypeClass) (TypeReaderImpl);
+ void (TYPEREG_CALLTYPE *getUik) (TypeReaderImpl, RTUik*);
+ void (TYPEREG_CALLTYPE *getDoku) (TypeReaderImpl, rtl_uString**);
+ void (TYPEREG_CALLTYPE *getFileName) (TypeReaderImpl, rtl_uString**);
+ void (TYPEREG_CALLTYPE *getTypeName) (TypeReaderImpl, rtl_uString**);
+ void (TYPEREG_CALLTYPE *getSuperTypeName) (TypeReaderImpl, rtl_uString**);
+ sal_uInt32 (TYPEREG_CALLTYPE *getFieldCount) (TypeReaderImpl);
+ void (TYPEREG_CALLTYPE *getFieldName) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+ void (TYPEREG_CALLTYPE *getFieldType) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+ RTFieldAccess (TYPEREG_CALLTYPE *getFieldAccess) (TypeReaderImpl, sal_uInt16);
+ RTValueType (TYPEREG_CALLTYPE *getFieldConstValue) (TypeReaderImpl, sal_uInt16, RTConstValueUnion*);
+ void (TYPEREG_CALLTYPE *getFieldDoku) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+ void (TYPEREG_CALLTYPE *getFieldFileName) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+ sal_uInt32 (TYPEREG_CALLTYPE *getMethodCount) (TypeReaderImpl);
+ void (TYPEREG_CALLTYPE *getMethodName) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+ sal_uInt32 (TYPEREG_CALLTYPE *getMethodParamCount) (TypeReaderImpl, sal_uInt16);
+ void (TYPEREG_CALLTYPE *getMethodParamType) (TypeReaderImpl, rtl_uString**, sal_uInt16, sal_uInt16);
+ void (TYPEREG_CALLTYPE *getMethodParamName) (TypeReaderImpl, rtl_uString**, sal_uInt16, sal_uInt16);
+ RTParamMode (TYPEREG_CALLTYPE *getMethodParamMode) (TypeReaderImpl, sal_uInt16, sal_uInt16);
+ sal_uInt32 (TYPEREG_CALLTYPE *getMethodExcCount) (TypeReaderImpl, sal_uInt16);
+ void (TYPEREG_CALLTYPE *getMethodExcType) (TypeReaderImpl, rtl_uString**, sal_uInt16, sal_uInt16);
+ void (TYPEREG_CALLTYPE *getMethodReturnType) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+ RTMethodMode (TYPEREG_CALLTYPE *getMethodMode) (TypeReaderImpl, sal_uInt16);
+ void (TYPEREG_CALLTYPE *getMethodDoku) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+
+ sal_uInt32 (TYPEREG_CALLTYPE *getReferenceCount) (TypeReaderImpl);
+ void (TYPEREG_CALLTYPE *getReferenceName) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+ RTReferenceType (TYPEREG_CALLTYPE *getReferenceType) (TypeReaderImpl, sal_uInt16);
+ void (TYPEREG_CALLTYPE *getReferenceDoku) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+ RTFieldAccess (TYPEREG_CALLTYPE *getReferenceAccess) (TypeReaderImpl, sal_uInt16);
+};
+
+typedef RegistryTypeReader_Api* (TYPEREG_CALLTYPE *InitRegistryTypeReader_Api)(void);
+
+#define REGISTRY_TYPE_READER_INIT_FUNCTION_NAME "initRegistryTypeReader_Api"
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/** RegistryTypeReaderLoader load the needed DLL for a RegistryTypeReader.
+ The loader can be checked if the DLL is loaded. If the DLL is loaded the
+ loader provides a valid Api for the RegistryTypeReader.
+*/
+class RegistryTypeReaderLoader
+ : public ::vos::ODynamicLoader<RegistryTypeReader_Api>
+{
+public:
+ RegistryTypeReaderLoader()
+ : ::vos::ODynamicLoader<RegistryTypeReader_Api>
+ (::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("reg") ),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(REGISTRY_TYPE_READER_INIT_FUNCTION_NAME) ),
+ sal_True, LIBRARY_VERSION, sal_False)
+ {}
+
+ ~RegistryTypeReaderLoader()
+ {}
+};
+
+
+/** RegistryTypeReader reads type informations from a blop.
+ Class is inline and use a load on call C-Api.
+*/
+class RegistryTypeReader
+{
+public:
+
+ inline RegistryTypeReader(const RegistryTypeReader_Api* pApi,
+ const sal_uInt8* buffer,
+ sal_uInt32 bufferLen,
+ sal_Bool copyData);
+ inline RegistryTypeReader(const RegistryTypeReaderLoader& rLoader,
+ const sal_uInt8* buffer,
+ sal_uInt32 bufferLen,
+ sal_Bool copyData);
+ inline RegistryTypeReader(const RegistryTypeReader& toCopy);
+ inline ~RegistryTypeReader();
+
+ inline RegistryTypeReader& operator == (const RegistryTypeReader& toAssign);
+
+ inline sal_Bool isValid() const;
+
+ inline sal_uInt16 getMinorVersion() const;
+ inline sal_uInt16 getMajorVersion() const;
+ inline RTTypeClass getTypeClass() const;
+ inline ::rtl::OUString getTypeName() const;
+ inline ::rtl::OUString getSuperTypeName() const;
+ inline void getUik(RTUik& uik) const;
+ inline ::rtl::OUString getDoku() const;
+ inline ::rtl::OUString getFileName() const;
+ inline sal_uInt32 getFieldCount() const;
+ inline ::rtl::OUString getFieldName( sal_uInt16 index ) const;
+ inline ::rtl::OUString getFieldType( sal_uInt16 index ) const;
+ inline RTFieldAccess getFieldAccess( sal_uInt16 index ) const;
+ inline RTConstValue getFieldConstValue( sal_uInt16 index ) const;
+ inline ::rtl::OUString getFieldDoku( sal_uInt16 index ) const;
+ inline ::rtl::OUString getFieldFileName( sal_uInt16 index ) const;
+ inline sal_uInt32 getMethodCount() const;
+ inline ::rtl::OUString getMethodName( sal_uInt16 index ) const;
+ inline sal_uInt32 getMethodParamCount( sal_uInt16 index ) const;
+ inline ::rtl::OUString getMethodParamType( sal_uInt16 index, sal_uInt16 paramIndex ) const;
+ inline ::rtl::OUString getMethodParamName( sal_uInt16 index, sal_uInt16 paramIndex ) const;
+ inline RTParamMode getMethodParamMode( sal_uInt16 index, sal_uInt16 paramIndex ) const;
+ inline sal_uInt32 getMethodExcCount( sal_uInt16 index ) const;
+ inline ::rtl::OUString getMethodExcType( sal_uInt16 index, sal_uInt16 excIndex ) const;
+ inline ::rtl::OUString getMethodReturnType( sal_uInt16 index ) const;
+ inline RTMethodMode getMethodMode( sal_uInt16 index ) const;
+ inline ::rtl::OUString getMethodDoku( sal_uInt16 index ) const;
+
+ inline sal_uInt32 getReferenceCount() const;
+ inline ::rtl::OUString getReferenceName( sal_uInt16 index ) const;
+ inline RTReferenceType getReferenceType( sal_uInt16 index ) const;
+ inline ::rtl::OUString getReferenceDoku( sal_uInt16 index ) const;
+ inline RTFieldAccess getReferenceAccess( sal_uInt16 index ) const;
+
+protected:
+
+ const RegistryTypeReader_Api* m_pApi;
+ const NAMESPACE_VOS(ODynamicLoader)<RegistryTypeReader_Api> m_Api;
+ TypeReaderImpl m_hImpl;
+};
+
+
+
+inline RegistryTypeReader::RegistryTypeReader(const RegistryTypeReader_Api* pApi,
+ const sal_uInt8* buffer,
+ sal_uInt32 bufferLen,
+ sal_Bool copyData)
+ : m_pApi(pApi)
+ , m_Api()
+ , m_hImpl(NULL)
+ {
+ m_hImpl = m_pApi->createEntry(buffer, bufferLen, copyData);
+ }
+
+
+inline RegistryTypeReader::RegistryTypeReader(const RegistryTypeReaderLoader& rLoader,
+ const sal_uInt8* buffer,
+ sal_uInt32 bufferLen,
+ sal_Bool copyData)
+ : m_pApi(NULL)
+ , m_Api(rLoader)
+ , m_hImpl(NULL)
+ {
+ m_pApi = m_Api.getApi();
+ m_hImpl = m_pApi->createEntry(buffer, bufferLen, copyData);
+ }
+
+
+inline RegistryTypeReader::RegistryTypeReader(const RegistryTypeReader& toCopy)
+ : m_pApi(toCopy.m_pApi)
+ , m_Api(toCopy.m_Api)
+ , m_hImpl(toCopy.m_hImpl)
+ { m_pApi->acquire(m_hImpl); }
+
+
+inline RegistryTypeReader::~RegistryTypeReader()
+ { m_pApi->release(m_hImpl); }
+
+inline RegistryTypeReader& RegistryTypeReader::operator == (const RegistryTypeReader& toAssign)
+{
+ if (m_hImpl != toAssign.m_hImpl)
+ {
+ m_pApi->release(m_hImpl);
+ m_hImpl = toAssign.m_hImpl;
+ m_pApi->acquire(m_hImpl);
+ }
+
+ return *this;
+}
+
+inline sal_uInt16 RegistryTypeReader::getMinorVersion() const
+ { return m_pApi->getMinorVersion(m_hImpl); }
+
+inline sal_Bool RegistryTypeReader::isValid() const
+ { return (m_hImpl != NULL); }
+
+inline sal_uInt16 RegistryTypeReader::getMajorVersion() const
+ { return m_pApi->getMajorVersion(m_hImpl); }
+
+inline RTTypeClass RegistryTypeReader::getTypeClass() const
+ { return m_pApi->getTypeClass(m_hImpl); }
+
+inline ::rtl::OUString RegistryTypeReader::getTypeName() const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getTypeName(m_hImpl, &sRet.pData);
+ return sRet;
+ }
+
+inline ::rtl::OUString RegistryTypeReader::getSuperTypeName() const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getSuperTypeName(m_hImpl, &sRet.pData);
+ return sRet;
+ }
+
+inline void RegistryTypeReader::getUik(RTUik& uik) const
+ { m_pApi->getUik(m_hImpl, &uik); }
+
+inline ::rtl::OUString RegistryTypeReader::getDoku() const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getDoku(m_hImpl, &sRet.pData);
+ return sRet;
+ }
+
+inline ::rtl::OUString RegistryTypeReader::getFileName() const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getFileName(m_hImpl, &sRet.pData);
+ return sRet;
+ }
+
+inline sal_uInt32 RegistryTypeReader::getFieldCount() const
+ { return m_pApi->getFieldCount(m_hImpl); }
+
+inline ::rtl::OUString RegistryTypeReader::getFieldName( sal_uInt16 index ) const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getFieldName(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline ::rtl::OUString RegistryTypeReader::getFieldType( sal_uInt16 index ) const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getFieldType(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline RTFieldAccess RegistryTypeReader::getFieldAccess( sal_uInt16 index ) const
+ { return m_pApi->getFieldAccess(m_hImpl, index); }
+
+inline RTConstValue RegistryTypeReader::getFieldConstValue( sal_uInt16 index ) const
+ {
+ RTConstValue ret;
+ ret.m_type = m_pApi->getFieldConstValue(m_hImpl, index, &ret.m_value);
+ return ret;
+ }
+
+inline ::rtl::OUString RegistryTypeReader::getFieldDoku( sal_uInt16 index ) const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getFieldDoku(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline ::rtl::OUString RegistryTypeReader::getFieldFileName( sal_uInt16 index ) const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getFieldFileName(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline sal_uInt32 RegistryTypeReader::getMethodCount() const
+ { return m_pApi->getMethodCount(m_hImpl); }
+
+inline ::rtl::OUString RegistryTypeReader::getMethodName( sal_uInt16 index ) const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getMethodName(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline sal_uInt32 RegistryTypeReader::getMethodParamCount( sal_uInt16 index ) const
+ { return m_pApi->getMethodParamCount(m_hImpl, index); }
+
+inline ::rtl::OUString RegistryTypeReader::getMethodParamType( sal_uInt16 index, sal_uInt16 paramIndex ) const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getMethodParamType(m_hImpl, &sRet.pData, index, paramIndex);
+ return sRet;
+ }
+
+inline ::rtl::OUString RegistryTypeReader::getMethodParamName( sal_uInt16 index, sal_uInt16 paramIndex ) const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getMethodParamName(m_hImpl, &sRet.pData, index, paramIndex);
+ return sRet;
+ }
+
+inline RTParamMode RegistryTypeReader::getMethodParamMode( sal_uInt16 index, sal_uInt16 paramIndex ) const
+ { return m_pApi->getMethodParamMode(m_hImpl, index, paramIndex); }
+
+inline sal_uInt32 RegistryTypeReader::getMethodExcCount( sal_uInt16 index ) const
+ { return m_pApi->getMethodExcCount(m_hImpl, index); }
+
+inline ::rtl::OUString RegistryTypeReader::getMethodExcType( sal_uInt16 index, sal_uInt16 excIndex ) const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getMethodExcType(m_hImpl, &sRet.pData, index, excIndex);
+ return sRet;
+ }
+
+inline ::rtl::OUString RegistryTypeReader::getMethodReturnType( sal_uInt16 index ) const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getMethodReturnType(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline RTMethodMode RegistryTypeReader::getMethodMode( sal_uInt16 index ) const
+ { return m_pApi->getMethodMode(m_hImpl, index); }
+
+inline ::rtl::OUString RegistryTypeReader::getMethodDoku( sal_uInt16 index ) const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getMethodDoku(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline sal_uInt32 RegistryTypeReader::getReferenceCount() const
+ { return m_pApi->getReferenceCount(m_hImpl); }
+
+inline ::rtl::OUString RegistryTypeReader::getReferenceName( sal_uInt16 index ) const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getReferenceName(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline RTReferenceType RegistryTypeReader::getReferenceType( sal_uInt16 index ) const
+ { return m_pApi->getReferenceType(m_hImpl, index); }
+
+inline ::rtl::OUString RegistryTypeReader::getReferenceDoku( sal_uInt16 index ) const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getReferenceDoku(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline RTFieldAccess RegistryTypeReader::getReferenceAccess( sal_uInt16 index ) const
+ { return m_pApi->getReferenceAccess(m_hImpl, index); }
+
+#endif
diff --git a/registry/inc/registry/refltype.hxx b/registry/inc/registry/refltype.hxx
new file mode 100644
index 000000000000..7e217e7e84f7
--- /dev/null
+++ b/registry/inc/registry/refltype.hxx
@@ -0,0 +1,266 @@
+/*************************************************************************
+ *
+ * $RCSfile: refltype.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/*************************************************************************
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.19 2000/09/17 12:30:32 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.18 2000/08/04 15:31:39 jsc
+ extend biniary type format
+
+ Revision 1.17 2000/07/26 17:44:32 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.16 2000/03/24 15:00:36 jsc
+ modified for unicode changes
+
+ Revision 1.15 2000/02/08 16:01:09 hr
+ #70473# changes for unicode ( patched by automated patchtool )
+
+ Revision 1.14 1999/10/22 09:58:47 jsc
+ TYPEREG_CALLTYPE = SAL_CALL
+
+ Revision 1.13 1999/10/21 15:48:50 jsc
+ optional flag now in registry
+
+ Revision 1.12 1999/10/15 11:05:51 dbo
+ short RTConstValue from sal_uInt16 to sal_Int16
+
+ Revision 1.11 1999/07/02 09:25:40 jsc
+ #67179# Binaerblop der CoreReflection ist erweitert worden
+
+ Revision 1.10 1999/03/12 14:16:38 jsc
+ #61011# Anpassung an osl-Typen
+
+ Revision 1.9 1998/07/03 12:36:16 ts
+ added SERVICE and OBJECT
+
+ Revision 1.8 1998/07/03 11:20:07 ts
+ prefixen von typen
+
+ Revision 1.7 1998/07/03 10:55:41 ts
+ added RT_TYPE_TYPEDEF
+
+ Revision 1.6 1998/07/03 08:41:02 ts
+ bugs und set/getUik()
+
+ Revision 1.5 1998/07/02 11:58:47 jsc
+ Typ Anpassung, Schnittstelle frei von solar.h
+
+ Revision 1.4 1998/07/01 16:55:19 ts
+ alignment unter soaris beachten
+
+ Revision 1.3 1998/07/01 13:39:01 ts
+ bugs, bugs, bugs
+
+ Revision 1.2 1998/06/30 13:42:27 ts
+ Anpassung an SOLARIS
+
+ Revision 1.1.1.1 1998/06/30 11:17:45 jsc
+ neu
+
+
+*************************************************************************/
+
+#ifndef __REGISTRY_REFLTYPE_HXX__
+#define __REGISTRY_REFLTYPE_HXX__
+
+#ifdef SOLARIS
+#include <wchar.h>
+#else
+#include <stdlib.h>
+#endif
+
+#ifndef _SAL_TYPES_H_
+#include <sal/types.h>
+#endif
+
+enum RTTypeClass
+{
+ RT_TYPE_INVALID,
+ RT_TYPE_INTERFACE,
+ RT_TYPE_MODULE,
+ RT_TYPE_STRUCT,
+ RT_TYPE_ENUM,
+ RT_TYPE_EXCEPTION,
+ RT_TYPE_TYPEDEF,
+ RT_TYPE_SERVICE,
+ RT_TYPE_OBJECT,
+ RT_TYPE_CONSTANTS
+};
+
+typedef sal_uInt16 RTFieldAccess;
+
+#define RT_ACCESS_INVALID 0x0000
+#define RT_ACCESS_READONLY 0x0001
+#define RT_ACCESS_OPTIONAL 0x0002
+#define RT_ACCESS_MAYBEVOID 0x0004
+#define RT_ACCESS_BOUND 0x0008
+#define RT_ACCESS_CONSTRAINED 0x0010
+#define RT_ACCESS_TRANSIENT 0x0020
+#define RT_ACCESS_MAYBEAMBIGUOUS 0x0040
+#define RT_ACCESS_MAYBEDEFAULT 0x0080
+#define RT_ACCESS_REMOVEABLE 0x0100
+#define RT_ACCESS_ATTRIBUTE 0x0200
+#define RT_ACCESS_PROPERTY 0x0400
+#define RT_ACCESS_CONST 0x0800
+#define RT_ACCESS_READWRITE 0x1000
+/*
+enum RTFieldAccess
+{
+ RT_ACCESS_INVALID,
+ RT_ACCESS_CONST,
+ RT_ACCESS_READONLY,
+ RT_ACCESS_WRITEONLY,
+ RT_ACCESS_READWRITE,
+ RT_ACCESS_READONLY_OPTIONAL,
+ RT_ACCESS_WRITEONLY_OPTIONAL,
+ RT_ACCESS_READWRITE_OPTIONAL
+};
+*/
+enum RTReferenceType
+{
+ RT_REF_INVALID,
+ RT_REF_SUPPORTS,
+ RT_REF_OBSERVES,
+ RT_REF_EXPORTS,
+ RT_REF_NEEDS
+};
+
+enum RTMethodMode
+{
+ RT_MODE_INVALID,
+ RT_MODE_ONEWAY,
+ RT_MODE_ONEWAY_CONST,
+ RT_MODE_TWOWAY,
+ RT_MODE_TWOWAY_CONST
+};
+
+enum RTParamMode
+{
+ RT_PARAM_INVALID,
+ RT_PARAM_IN,
+ RT_PARAM_OUT,
+ RT_PARAM_INOUT
+};
+
+enum RTValueType
+{
+ RT_TYPE_NONE,
+ RT_TYPE_BOOL,
+ RT_TYPE_BYTE,
+ RT_TYPE_INT16,
+ RT_TYPE_UINT16,
+ RT_TYPE_INT32,
+ RT_TYPE_UINT32,
+ RT_TYPE_INT64,
+ RT_TYPE_UINT64,
+ RT_TYPE_FLOAT,
+ RT_TYPE_DOUBLE,
+ RT_TYPE_STRING
+};
+
+union RTConstValueUnion
+{
+ sal_Bool aBool;
+ sal_uInt8 aByte;
+ sal_Int16 aShort;
+ sal_uInt16 aUShort;
+ sal_Int32 aLong;
+ sal_uInt32 aULong;
+// sal_Int64 aHyper;
+// sal_UInt64 aUHyper;
+ float aFloat;
+ double aDouble;
+ const sal_Unicode* aString;
+};
+
+class RTConstValue
+{
+public:
+ RTValueType m_type;
+ RTConstValueUnion m_value;
+
+ RTConstValue()
+ : m_type(RT_TYPE_NONE)
+ {
+ m_value.aDouble = 0.0;
+ }
+
+ ~RTConstValue() {};
+};
+
+struct RTUik
+{
+ sal_uInt32 m_Data1;
+ sal_uInt16 m_Data2;
+ sal_uInt16 m_Data3;
+ sal_uInt32 m_Data4;
+ sal_uInt32 m_Data5;
+};
+
+#define TYPEREG_CALLTYPE SAL_CALL
+
+#endif
diff --git a/registry/inc/registry/reflwrit.hxx b/registry/inc/registry/reflwrit.hxx
new file mode 100644
index 000000000000..ae96e0284776
--- /dev/null
+++ b/registry/inc/registry/reflwrit.hxx
@@ -0,0 +1,422 @@
+/*************************************************************************
+ *
+ * $RCSfile: reflwrit.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/*************************************************************************
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.20 2000/09/17 12:30:32 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.19 2000/08/04 15:31:39 jsc
+ extend biniary type format
+
+ Revision 1.18 2000/07/26 17:44:32 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.17 2000/05/02 06:06:21 jsc
+ insert LIBRARY_VERSION for dynamic loading
+
+ Revision 1.16 2000/04/18 10:09:48 jsc
+ modified for unicode changes
+
+ Revision 1.15 2000/03/24 15:00:36 jsc
+ modified for unicode changes
+
+ Revision 1.14 1999/10/19 16:14:49 kr
+ Version parameter for dynload added
+
+ Revision 1.13 1999/09/06 08:33:00 jsc
+ insert IDL filename in registry
+
+ Revision 1.12 1999/07/02 09:25:40 jsc
+ #67179# Binaerblop der CoreReflection ist erweitert worden
+
+ Revision 1.11 1999/03/12 14:16:38 jsc
+ #61011# Anpassung an osl-Typen
+
+ Revision 1.10 1999/02/05 09:44:33 jsc
+ #61011# Typanpassung
+
+ Revision 1.9 1998/12/11 11:57:42 jsc
+ Anpassung an ODynamicLoader
+
+ Revision 1.8 1998/08/06 09:43:44 jsc
+ #54698# Anpassung an DynamicLoader
+
+ Revision 1.7 1998/07/06 17:02:03 jsc
+ Calltype von InitRegistryTypeWriter_Api gesetzt
+
+ Revision 1.6 1998/07/03 11:20:08 ts
+ prefixen von typen
+
+ Revision 1.5 1998/07/03 08:41:03 ts
+ bugs und set/getUik()
+
+ Revision 1.4 1998/07/02 11:58:39 jsc
+ Typ Anpassung, Schnittstelle frei von solar.h
+
+ Revision 1.3 1998/07/01 16:55:19 ts
+ alignment unter soaris beachten
+
+ Revision 1.2 1998/07/01 13:39:01 ts
+ bugs, bugs, bugs
+
+ Revision 1.1.1.1 1998/06/30 11:17:45 jsc
+ neu
+
+
+*************************************************************************/
+
+#ifndef __REGISTRY_REFLWRIT_HXX__
+#define __REGISTRY_REFLWRIT_HXX__
+
+#ifndef _REGISTRY_REFLTYPE_HXX_
+#include <registry/refltype.hxx>
+#endif
+#ifndef _REGISTRY_REGTYPE_H_
+#include <registry/regtype.h>
+#endif
+#ifndef _VOS_DYNLOAD_HXX_
+#include <vos/dynload.hxx>
+#endif
+
+// Implememetation handle
+typedef void* TypeWriterImpl;
+
+/****************************************************************************
+
+ C-Api for load on call
+
+*****************************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct RegistryTypeWriter_Api
+{
+ TypeWriterImpl (TYPEREG_CALLTYPE *createEntry) (RTTypeClass, rtl_uString*, rtl_uString*, sal_uInt16, sal_uInt16, sal_uInt16);
+ void (TYPEREG_CALLTYPE *acquire) (TypeWriterImpl);
+ void (TYPEREG_CALLTYPE *release) (TypeWriterImpl);
+ void (TYPEREG_CALLTYPE *setUik) (TypeWriterImpl, const RTUik*);
+ void (TYPEREG_CALLTYPE *setDoku) (TypeWriterImpl, rtl_uString*);
+ void (TYPEREG_CALLTYPE *setFileName) (TypeWriterImpl, rtl_uString*);
+ void (TYPEREG_CALLTYPE *setFieldData) (TypeWriterImpl, sal_uInt16, rtl_uString*, rtl_uString*, rtl_uString*, rtl_uString*, RTFieldAccess, RTValueType, RTConstValueUnion);
+ void (TYPEREG_CALLTYPE *setMethodData) (TypeWriterImpl, sal_uInt16, rtl_uString*, rtl_uString*, RTMethodMode, sal_uInt16, sal_uInt16, rtl_uString*);
+ void (TYPEREG_CALLTYPE *setParamData) (TypeWriterImpl, sal_uInt16, sal_uInt16, rtl_uString*, rtl_uString*, RTParamMode);
+ void (TYPEREG_CALLTYPE *setExcData) (TypeWriterImpl, sal_uInt16, sal_uInt16, rtl_uString*);
+ const sal_uInt8* (TYPEREG_CALLTYPE *getBlop) (TypeWriterImpl);
+ sal_uInt32 (TYPEREG_CALLTYPE *getBlopSize) (TypeWriterImpl);
+
+ void (TYPEREG_CALLTYPE *setReferenceData) (TypeWriterImpl, sal_uInt16, rtl_uString*, RTReferenceType, rtl_uString*, RTFieldAccess);
+};
+
+typedef RegistryTypeWriter_Api* (TYPEREG_CALLTYPE *InitRegistryTypeWriter_Api)(void);
+
+#define REGISTRY_TYPE_WRITER_INIT_FUNCTION_NAME "initRegistryTypeWriter_Api"
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/** RegistryTypeWriterLoader load the needed DLL for a RegistryTypeWriter.
+ The loader can be checked if the DLL is loaded. If the DLL is loaded the
+ loader provides a valid Api for the RegistryTypeWriter.
+*/
+class RegistryTypeWriterLoader
+ : public ::vos::ODynamicLoader<RegistryTypeWriter_Api>
+{
+public:
+ RegistryTypeWriterLoader()
+ : ::vos::ODynamicLoader<RegistryTypeWriter_Api>
+ (::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("reg") ),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(REGISTRY_TYPE_WRITER_INIT_FUNCTION_NAME) ),
+ sal_True, LIBRARY_VERSION, sal_False)
+ {}
+
+ ~RegistryTypeWriterLoader()
+ {}
+};
+
+
+/** RegistryTypeWriter writes type informations into a blop.
+ Class is inline and use a load on call C-Api.
+*/
+class RegistryTypeWriter
+{
+public:
+
+ inline RegistryTypeWriter(const RegistryTypeWriter_Api* pApi,
+ RTTypeClass RTTypeClass,
+ const ::rtl::OUString& typeName,
+ const ::rtl::OUString& superTypeName,
+ sal_uInt16 fieldCount,
+ sal_uInt16 methodCount,
+ sal_uInt16 referenceCount);
+
+ inline RegistryTypeWriter(const RegistryTypeWriterLoader& rLoader,
+ RTTypeClass RTTypeClass,
+ const ::rtl::OUString& typeName,
+ const ::rtl::OUString& superTypeName,
+ sal_uInt16 fieldCount,
+ sal_uInt16 methodCount,
+ sal_uInt16 referenceCount);
+
+ inline RegistryTypeWriter(const RegistryTypeWriter& toCopy);
+ inline ~RegistryTypeWriter();
+
+ inline RegistryTypeWriter& operator == (const RegistryTypeWriter& toAssign);
+
+ inline void setUik(const RTUik& uik);
+
+ inline void setDoku(const ::rtl::OUString& doku);
+
+ inline void setFileName(const ::rtl::OUString& fileName);
+
+ inline void setFieldData( sal_uInt16 index,
+ const ::rtl::OUString& name,
+ const ::rtl::OUString& typeName,
+ const ::rtl::OUString& doku,
+ const ::rtl::OUString& fileName,
+ RTFieldAccess access,
+ RTConstValue constValue = RTConstValue());
+
+ inline void setMethodData(sal_uInt16 index,
+ const ::rtl::OUString& name,
+ const ::rtl::OUString& returnTypeName,
+ RTMethodMode mode,
+ sal_uInt16 paramCount,
+ sal_uInt16 excCount,
+ const ::rtl::OUString& doku);
+
+ inline void setParamData(sal_uInt16 index,
+ sal_uInt16 paramIndex,
+ const ::rtl::OUString& type,
+ const ::rtl::OUString& name,
+ RTParamMode mode);
+
+ inline void setExcData(sal_uInt16 index,
+ sal_uInt16 excIndex,
+ const ::rtl::OUString& type);
+
+ inline const sal_uInt8* getBlop();
+ inline sal_uInt32 getBlopSize();
+
+ inline void setReferenceData( sal_uInt16 index,
+ const ::rtl::OUString& name,
+ RTReferenceType refType,
+ const ::rtl::OUString& doku,
+ RTFieldAccess access = RT_ACCESS_INVALID);
+
+protected:
+
+ const RegistryTypeWriter_Api* m_pApi;
+ const NAMESPACE_VOS(ODynamicLoader)<RegistryTypeWriter_Api> m_Api;
+ TypeWriterImpl m_hImpl;
+};
+
+
+
+inline RegistryTypeWriter::RegistryTypeWriter(const RegistryTypeWriter_Api* pApi,
+ RTTypeClass RTTypeClass,
+ const ::rtl::OUString& typeName,
+ const ::rtl::OUString& superTypeName,
+ sal_uInt16 fieldCount,
+ sal_uInt16 methodCount,
+ sal_uInt16 referenceCount)
+ : m_pApi(pApi)
+ , m_Api()
+ , m_hImpl(NULL)
+{
+ m_hImpl = m_pApi->createEntry(RTTypeClass,
+ typeName.pData,
+ superTypeName.pData,
+ fieldCount,
+ methodCount,
+ referenceCount);
+}
+
+
+inline RegistryTypeWriter::RegistryTypeWriter(const RegistryTypeWriterLoader& rLoader,
+ RTTypeClass RTTypeClass,
+ const ::rtl::OUString& typeName,
+ const ::rtl::OUString& superTypeName,
+ sal_uInt16 fieldCount,
+ sal_uInt16 methodCount,
+ sal_uInt16 referenceCount)
+ : m_pApi(NULL)
+ , m_Api(rLoader)
+ , m_hImpl(NULL)
+{
+ m_pApi = m_Api.getApi();
+ m_hImpl = m_pApi->createEntry(RTTypeClass,
+ typeName.pData,
+ superTypeName.pData,
+ fieldCount,
+ methodCount,
+ referenceCount);
+}
+
+
+inline RegistryTypeWriter::RegistryTypeWriter(const RegistryTypeWriter& toCopy)
+ : m_pApi(toCopy.m_pApi)
+ , m_Api(toCopy.m_Api)
+ , m_hImpl(toCopy.m_hImpl)
+{
+ m_Api->acquire(m_hImpl);
+}
+
+inline RegistryTypeWriter::~RegistryTypeWriter()
+{
+ m_pApi->release(m_hImpl);
+}
+
+inline RegistryTypeWriter& RegistryTypeWriter::operator == (const RegistryTypeWriter& toAssign)
+{
+ if (m_hImpl != toAssign.m_hImpl)
+ {
+ m_pApi->release(m_hImpl);
+ m_hImpl = toAssign.m_hImpl;
+ m_pApi->acquire(m_hImpl);
+ }
+
+ return *this;
+}
+
+inline void RegistryTypeWriter::setFieldData( sal_uInt16 index,
+ const ::rtl::OUString& name,
+ const ::rtl::OUString& typeName,
+ const ::rtl::OUString& doku,
+ const ::rtl::OUString& fileName,
+ RTFieldAccess access,
+ RTConstValue constValue)
+{
+ m_pApi->setFieldData(m_hImpl, index, name.pData, typeName.pData, doku.pData, fileName.pData, access, constValue.m_type, constValue.m_value);
+}
+
+
+inline void RegistryTypeWriter::setMethodData(sal_uInt16 index,
+ const ::rtl::OUString& name,
+ const ::rtl::OUString& returnTypeName,
+ RTMethodMode mode,
+ sal_uInt16 paramCount,
+ sal_uInt16 excCount,
+ const ::rtl::OUString& doku)
+{
+ m_pApi->setMethodData(m_hImpl, index, name.pData, returnTypeName.pData, mode, paramCount, excCount, doku.pData);
+}
+
+
+inline void RegistryTypeWriter::setUik(const RTUik& uik)
+{
+ m_pApi->setUik(m_hImpl, &uik);
+}
+
+inline void RegistryTypeWriter::setDoku(const ::rtl::OUString& doku)
+{
+ m_pApi->setDoku(m_hImpl, doku.pData);
+}
+
+inline void RegistryTypeWriter::setFileName(const ::rtl::OUString& doku)
+{
+ m_pApi->setFileName(m_hImpl, doku.pData);
+}
+
+inline void RegistryTypeWriter::setParamData(sal_uInt16 index,
+ sal_uInt16 paramIndex,
+ const ::rtl::OUString& type,
+ const ::rtl::OUString& name,
+ RTParamMode mode)
+{
+ m_pApi->setParamData(m_hImpl, index, paramIndex, type.pData, name.pData, mode);
+}
+
+inline void RegistryTypeWriter::setExcData(sal_uInt16 index,
+ sal_uInt16 excIndex,
+ const ::rtl::OUString& type)
+{
+ m_pApi->setExcData(m_hImpl, index, excIndex, type.pData);
+}
+
+inline const sal_uInt8* RegistryTypeWriter::getBlop()
+{
+ return m_pApi->getBlop(m_hImpl);
+}
+
+inline sal_uInt32 RegistryTypeWriter::getBlopSize()
+{
+ return m_pApi->getBlopSize(m_hImpl);
+}
+
+
+inline void RegistryTypeWriter::setReferenceData( sal_uInt16 index,
+ const ::rtl::OUString& name,
+ RTReferenceType refType,
+ const ::rtl::OUString& doku,
+ RTFieldAccess access)
+{
+ m_pApi->setReferenceData(m_hImpl, index, name.pData, refType, doku.pData, access);
+}
+
+#endif
diff --git a/registry/inc/registry/registry.h b/registry/inc/registry/registry.h
new file mode 100644
index 000000000000..392fb8b82fe2
--- /dev/null
+++ b/registry/inc/registry/registry.h
@@ -0,0 +1,456 @@
+/*************************************************************************
+ *
+ * $RCSfile: registry.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $
+ *
+ * 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 _REGISTRY_REGISTRY_H_
+#define _REGISTRY_REGISTRY_H_
+
+#include <stddef.h>
+
+#ifndef _RTL_USTRING_H_
+#include <rtl/ustring.h>
+#endif
+#ifndef _REGISTRY_REGTYPE_H_
+#include <registry/regtype.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/** This function creates the specified key. If the key already exists in the registry,
+ the function opens it.
+ @param hKey Identifies a currently open key. The key opened or created by this function
+ is a subkey of the key identified by hKey.
+ @param keyName Points to a null terminated string specifying the name of a key that this
+ function opens or creates.
+ @param phNewKey Points to a variable that receives the handle of the opened or created key.
+ Memory to store this variable is allocated and is freed with the function
+ closeRegKey. If the function fails, phNewKey is NULL.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_createKey(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegKeyHandle* phNewKey);
+
+
+/** This function opens the specified key.
+ @param hKey Identifies a currently open key. The key opened by this function
+ is a subkey of the key identified by hKey
+ @param keyName Points to a null terminated string specifying the name of a key that this
+ function opens.
+ @param phNewKey Points to a variable that receives the handle of the opened key.
+ Memory to store this variable is allocated and is freed with the function
+ reg_closeKey. If the function fails, phNewKey is NULL.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_openKey(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegKeyHandle* phOpenKey);
+
+
+
+/** This function opens all subkeys of the specified key.
+ @param hKey Identifies a currently open key. The key that subkeys opened by this
+ function is a subkey of the key identified by hKey
+ @param keyName Points to a null terminated string specifying the name of a key that subkeys
+ this function opens.
+ @param pphSubKeys Points to a variable that receives an array of of all opened subkeys.
+ Memory to store this variable is allocated and is freed with the function
+ reg_closeSubKeys. If the function fails, pphSubKeys is NULL.
+ @param pnSubKeys Specified the length of the array (the number of open subkeys).
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_openSubKeys(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegKeyHandle** pphSubKeys,
+ sal_uInt32* pnSubKeys);
+
+
+/** This function close all subkeys specified in the array.
+ @param phSubKeys Points to a variable that containss an array of of all opened subkeys.
+ The allocated memory of pphSubKeys and all open subkeys is freed.
+ @param nSubKeys Specified the length of the array (the number of subkeys to closed).
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_closeSubKeys(RegKeyHandle* phSubKeys,
+ sal_uInt32 nSubKeys);
+
+
+/** This function deletes the specified key.
+ @param hKey Identifies a currently open key. The key deleted by this function
+ is a subkey of the key identified by hKey
+ @param keyName Points to a null terminated string specifying the name of a key that this
+ function deletes.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_deleteKey(RegKeyHandle hKey,
+ rtl_uString* keyName);
+
+
+/** This function closes the specified key.
+ @param hKey Identifies a currently open key. The key is closed by this function.
+ The memory of the variable specifying the key is freeing.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_closeKey(RegKeyHandle hKey);
+
+
+/** This function returns the name of the key.
+ @param hKey Identifies a currently open key which name will returned.
+ @param pKeyName contains the keyname if succeeds else an empty string.
+*/
+const RegError REGISTRY_CALLTYPE reg_getKeyName(RegKeyHandle hKey, rtl_uString** pKeyName);
+
+
+/** This function sets an value under the specified key.
+ @param hKey Identifies a currently open key. The key which value is setted by this
+ function is a subkey of the key identified by hKey.
+ @param keyName Points to a null terminated string specifying the name of a key which value
+ is set by this function. If keyName is NULL, the value is set for the key
+ specified by hKey.
+ @param valueType Specified the type of the value.
+ @param pData Points to a memory block containing the current data for the value.
+ @param valueSize Specified the size of pData in bytes
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_setValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegValueType valueType,
+ RegValue pData,
+ sal_uInt32 valueSize);
+
+
+/** This function sets an long list value under the key.
+ @param keyName Points to a null terminated string specifying the name of a key which value
+ is set by this function. If keyName is NULL, the value is set for the key
+ specified by hKey.
+ @param pValueList Points to an array of longs containing the current data for the value.
+ @param len Specified the len of pValueList.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_setLongListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Int32* pValueList,
+ sal_uInt32 len);
+
+
+/** This function sets an ascii list value under the key.
+ @param keyName Points to a null terminated string specifying the name of a key which value
+ is set by this function. If keyName is NULL, the value is set for the key
+ specified by hKey.
+ @param pValueList Points to an array of sal_Char* containing the current data for the value.
+ @param len Specified the len of pValueList.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_setStringListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Char** pValueList,
+ sal_uInt32 len);
+
+
+/** This function sets an unicode string list value under the key.
+ @param keyName Points to a null terminated string specifying the name of a key which value
+ is set by this function. If keyName is NULL, the value is set for the key
+ specified by hKey.
+ @param pValueList Points to an array of sal_Unicode* containing the current data for the value.
+ @param len Specified the len of pValueList.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_setUnicodeListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Unicode** pValueList,
+ sal_uInt32 len);
+
+
+/** This function gets info about type and size of the value.
+ @param hKey Identifies a currently open key. The key which value info is getted by this
+ function is a subkey of the key identified by hKey.
+ @param keyName Points to a null terminated string specifying the name of a key which value
+ is get by this function. If keyName is NULL, the value info is get from the
+ key specified by hKey.
+ @param pValueType Specified the type of the value.
+ @param pValueSize Specified the size of pData in bytes
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_getValueInfo(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegValueType* pValueType,
+ sal_uInt32* pValueSize);
+
+
+/** This function gets the value under the specified key.
+ @param hKey Identifies a currently open key. The key which value is getted by this
+ function is a subkey of the key identified by hKey.
+ @param keyName Points to a null terminated string specifying the name of a key which value
+ is get by this function. If keyName is NULL, the value is get from the key
+ specified by hKey.
+ @param pData Points to an allocated memory block receiving the current data for the value.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_getValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegValue pData);
+
+
+/** This function gets the value under the specified key.
+ @param keyName Points to a null terminated string specifying the name of a key which value
+ is get by this function. If keyName is NULL, the value is get from the key
+ specified by hKey.
+ @param pValueList A Pointer to a long value list.
+ @param pLen Specifies the length of the value list.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_getLongListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Int32** pValueList,
+ sal_uInt32* pLen);
+
+
+/** This function gets the value under the specified key.
+ @param keyName Points to a null terminated string specifying the name of a key which value
+ is get by this function. If keyName is NULL, the value is get from the key
+ specified by hKey.
+ @param pValueList A Pointer to a ascii value list.
+ @param pLen Specifies the length of the value list.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_getStringListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Char*** pValueList,
+ sal_uInt32* pLen);
+
+
+/** This function gets the value under the specified key.
+ @param keyName Points to a null terminated string specifying the name of a key which value
+ is get by this function. If keyName is NULL, the value is get from the key
+ specified by hKey.
+ @param pValueList A Pointer to a unicode value list.
+ @param pLen Specifies the length of the value list.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_getUnicodeListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Unicode*** pValueList,
+ sal_uInt32* pLen);
+
+
+/** This function free a value list.
+ @param valueType Specifies the type of the list members.
+ @param pValueList A Pointer to value list.
+ @param pLen Specifies the length of the value list.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_freeValueList(RegValueType valueType,
+ RegValue pValueList,
+ sal_uInt32 len);
+
+RegError REGISTRY_CALLTYPE reg_createLink(RegKeyHandle hKey,
+ rtl_uString* linkName,
+ rtl_uString* linkTarget);
+
+RegError REGISTRY_CALLTYPE reg_deleteLink(RegKeyHandle hKey,
+ rtl_uString* linkName);
+
+RegError REGISTRY_CALLTYPE reg_getKeyType(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegKeyType* pKeyType);
+
+RegError REGISTRY_CALLTYPE reg_getLinkTarget(RegKeyHandle hKey,
+ rtl_uString* linkName,
+ rtl_uString** pLinkTarget);
+
+/** This function will resolved all or only the first link of a keyname
+ and returns the resolved keyName in pResolvedName.
+ @param hKey Identifies a currently open key.
+ @param keyName Points to a null terminated string specifying the relativ name of a key.
+ The name of rKey together with keyName will be resolved from links.
+ If keyName is NULL the registry information under the key specified by rKey
+ is saved in the specified file.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+RegError REGISTRY_CALLTYPE reg_getResolvedKeyName(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Bool firstLinkOnly,
+ rtl_uString** pResolvedName);
+
+/** This function loads registry information from a specified file and save it under the
+ specified keyName.
+ @param hKey Specifies the key where the subkey will be created.
+ @param keyName Points to a null terminated string specifying the name of the created subkey.
+ If keyName is NULL the registry information is saved under the key specified
+ by hKey.
+ @param regFileName Points to a null terminated string specifying the file containing the
+ registry information.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_loadKey(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ rtl_uString* regFileName);
+
+
+/** This function saves the registry information from the specified key and all subkeys and save
+ it in the specified file.
+ @param hKey Identifies a currently open key. The key which inforamtion is saved by this
+ function is a subkey of the key identified by hKey.
+ @param keyName Points to a null terminated string specifying the name of the subkey.
+ If keyName is NULL the registry information under the key specified by hKey
+ is saved in the specified file.
+ @param regFileName Points to a null terminated string specifying the file containing the
+ registry information.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_saveKey(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ rtl_uString* regFileName);
+
+
+/** This function merges the registry information from the specified key and the registry
+ information of the specified file. Existing keys will extended.
+ @param hKey Identifies a currently open key. The key which inforamtion is merged by this
+ function is a subkey of the key identified by hKey.
+ @param keyName Points to a null terminated string specifying the name of the subkey.
+ If keyName is NULL the registry information under the key specified by hKey
+ is merged with the information from the specified file.
+ @param regFileName Points to a null terminated string specifying the file containing the
+ registry information.
+ @param bWarnings if TRUE the function returns an error if a key already exists.
+ @param bReport if TRUE the function reports warnings on stdout if a key already exists.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_mergeKey(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ rtl_uString* regFileName,
+ sal_Bool bWarnings,
+ sal_Bool bReport);
+
+
+/** This function creates a new registry with the specified name and creates a root key.
+ @param registryName Points to a null terminated string specifying the name of the new registry.
+ @param phRegistry Points to a variable that receives the handle of the created registry.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_createRegistry(rtl_uString* registryName,
+ RegHandle* phRegistry);
+
+
+/** This function opens the root key of the sepcified registry.
+ @param hReg Identifies a currently open registry which rootKey will returned.
+ @param phRootKey Points to a variable that receives the handle of the open root key.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_openRootKey(RegHandle hRegistry,
+ RegKeyHandle* phRootKey);
+
+
+/** This function returns the name of the registry.
+ @param hReg Identifies a currently open registry which name will returned.
+ @param pName name if succeeds else an empty string.
+*/
+const RegError REGISTRY_CALLTYPE reg_getName(RegHandle hRegistry, rtl_uString** pName);
+
+
+/** This function returns the access mode of the registry.
+ @param hReg Identifies a currently open registry.
+ @return TRUE if accessmode is read only else FALSE.
+*/
+sal_Bool REGISTRY_CALLTYPE reg_isReadOnly(RegHandle hReg);
+
+
+/** This function opens a registry with the specified name.
+ @param registryName Identifies a registry name.
+ @param phRegistry Points to a variable that receives the handle of the opened registry.
+ @param accessMode specify the accessmode for the registry, REG_READONLY or REG_READWRITE.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_openRegistry(rtl_uString* registryName,
+ RegHandle* phRegistry,
+ RegAccessMode accessMode);
+
+
+/** This function close the specified registry.
+ @param hRegistry Identifies a currently open registry.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_closeRegistry(RegHandle hRegistry);
+
+
+/** This function destroy the specified registry.
+ @param hRegistry Identifies a currently open registry.
+ @param registryName Identifies a registry name, if the name is NULL the registry
+ itselfs will be destroyed.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_destroyRegistry(RegHandle hRegistry,
+ rtl_uString* registryName);
+
+
+/** This function dump the content under the open key to stdout
+ @param hKey Identifies a currently open key which subtree is dumped.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_dumpRegistry(RegKeyHandle hKey);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/registry/inc/registry/registry.hxx b/registry/inc/registry/registry.hxx
new file mode 100644
index 000000000000..bc4acd25b3ad
--- /dev/null
+++ b/registry/inc/registry/registry.hxx
@@ -0,0 +1,1220 @@
+/*************************************************************************
+ *
+ * $RCSfile: registry.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $
+ *
+ * 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 _REGISTRY_REGISTRY_HXX_
+#define _REGISTRY_REGISTRY_HXX_
+
+#ifndef _REGISTRY_REGTYPE_H_
+#include <registry/regtype.h>
+#endif
+#ifndef _VOS_DYNLOAD_HXX_
+#include <vos/dynload.hxx>
+#endif
+
+#ifndef _VOS_MACROS_HXX_
+#include <vos/macros.hxx>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct Registry_Api
+{
+ void (REGISTRY_CALLTYPE *acquire) (RegHandle);
+ void (REGISTRY_CALLTYPE *release) (RegHandle);
+ sal_Bool (REGISTRY_CALLTYPE *isReadOnly) (RegHandle);
+ RegError (REGISTRY_CALLTYPE *openRootKey) (RegHandle, RegKeyHandle*);
+ RegError (REGISTRY_CALLTYPE *getName) (RegHandle, rtl_uString**);
+ RegError (REGISTRY_CALLTYPE *createRegistry) (rtl_uString*, RegHandle*);
+ RegError (REGISTRY_CALLTYPE *openRegistry) (rtl_uString*, RegHandle*, RegAccessMode);
+ RegError (REGISTRY_CALLTYPE *closeRegistry) (RegHandle);
+ RegError (REGISTRY_CALLTYPE *destroyRegistry) (RegHandle, rtl_uString*);
+ RegError (REGISTRY_CALLTYPE *loadKey) (RegHandle, RegKeyHandle, rtl_uString*, rtl_uString*);
+ RegError (REGISTRY_CALLTYPE *saveKey) (RegHandle, RegKeyHandle, rtl_uString*, rtl_uString*);
+ RegError (REGISTRY_CALLTYPE *mergeKey) (RegHandle, RegKeyHandle, rtl_uString*, rtl_uString*, sal_Bool, sal_Bool);
+ RegError (REGISTRY_CALLTYPE *dumpRegistry) (RegHandle, RegKeyHandle);
+ void (REGISTRY_CALLTYPE *acquireKey) (RegKeyHandle);
+ void (REGISTRY_CALLTYPE *releaseKey) (RegKeyHandle);
+ sal_Bool (REGISTRY_CALLTYPE *isKeyReadOnly) (RegKeyHandle);
+ RegError (REGISTRY_CALLTYPE *getKeyName) (RegKeyHandle, rtl_uString**);
+ RegError (REGISTRY_CALLTYPE *createKey) (RegKeyHandle, rtl_uString*, RegKeyHandle*);
+ RegError (REGISTRY_CALLTYPE *openKey) (RegKeyHandle, rtl_uString*, RegKeyHandle*);
+ RegError (REGISTRY_CALLTYPE *openSubKeys) (RegKeyHandle, rtl_uString*, RegKeyHandle**, sal_uInt32*);
+ RegError (REGISTRY_CALLTYPE *closeSubKeys) (RegKeyHandle*, sal_uInt32);
+ RegError (REGISTRY_CALLTYPE *deleteKey) (RegKeyHandle, rtl_uString*);
+ RegError (REGISTRY_CALLTYPE *closeKey) (RegKeyHandle);
+ RegError (REGISTRY_CALLTYPE *setValue) (RegKeyHandle, rtl_uString*, RegValueType, RegValue, sal_uInt32);
+ RegError (REGISTRY_CALLTYPE *setLongListValue) (RegKeyHandle, rtl_uString*, sal_Int32*, sal_uInt32);
+ RegError (REGISTRY_CALLTYPE *setStringListValue) (RegKeyHandle, rtl_uString*, sal_Char**, sal_uInt32);
+ RegError (REGISTRY_CALLTYPE *setUnicodeListValue)(RegKeyHandle, rtl_uString*, sal_Unicode**, sal_uInt32);
+ RegError (REGISTRY_CALLTYPE *getValueInfo) (RegKeyHandle, rtl_uString*, RegValueType*, sal_uInt32*);
+ RegError (REGISTRY_CALLTYPE *getValue) (RegKeyHandle, rtl_uString*, RegValue);
+ RegError (REGISTRY_CALLTYPE *getLongListValue) (RegKeyHandle, rtl_uString*, sal_Int32**, sal_uInt32*);
+ RegError (REGISTRY_CALLTYPE *getStringListValue) (RegKeyHandle, rtl_uString*, sal_Char***, sal_uInt32*);
+ RegError (REGISTRY_CALLTYPE *getUnicodeListValue)(RegKeyHandle, rtl_uString*, sal_Unicode***, sal_uInt32*);
+ RegError (REGISTRY_CALLTYPE *freeValueList) (RegValueType, RegValue, sal_uInt32);
+ RegError (REGISTRY_CALLTYPE *createLink) (RegKeyHandle, rtl_uString*, rtl_uString*);
+ RegError (REGISTRY_CALLTYPE *deleteLink) (RegKeyHandle, rtl_uString*);
+ RegError (REGISTRY_CALLTYPE *getKeyType) (RegKeyHandle, rtl_uString*, RegKeyType*);
+ RegError (REGISTRY_CALLTYPE *getLinkTarget) (RegKeyHandle, rtl_uString*, rtl_uString**);
+ RegError (REGISTRY_CALLTYPE *getResolvedKeyName) (RegKeyHandle, rtl_uString*, sal_Bool, rtl_uString**);
+ RegError (REGISTRY_CALLTYPE *getKeyNames) (RegKeyHandle, rtl_uString*, rtl_uString***, sal_uInt32*);
+ RegError (REGISTRY_CALLTYPE *freeKeyNames) (rtl_uString**, sal_uInt32);
+};
+
+typedef Registry_Api* (REGISTRY_CALLTYPE *InitRegistry_Api)(void);
+
+#define REGISTRY_INIT_FUNCTION_NAME "initRegistry_Api"
+
+#ifdef __cplusplus
+}
+#endif
+
+
+class RegistryKey;
+
+//-----------------------------------------------------------------------------
+
+/** RegistryLoader load the needed DLL for the registry.
+ The loader can be checked if the DLL is loaded. If the DLL is loaded the
+ loader provides a valid Api for the registry.
+*/
+class RegistryLoader : public ::vos::ODynamicLoader<Registry_Api>
+{
+public:
+ /// Default constructor, try to load the registry DLL and initialize the needed api.
+ RegistryLoader()
+ : ::vos::ODynamicLoader<Registry_Api>
+ (::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("reg") ),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(REGISTRY_INIT_FUNCTION_NAME) ),
+ sal_True, LIBRARY_VERSION, sal_False)
+ {}
+
+ /// Destructor, decrease the refcount and unload the DLL if the refcount is 0.
+ ~RegistryLoader()
+ {}
+};
+
+/** Registry read and write information in a registry file.
+ Class is inline and use a load on call C-Api.
+*/
+class Registry
+{
+public:
+ /** Constructor.
+ This constructor is called with a valid api for the registry.
+ The constructor is used if the api is known. Use open() or create()
+ to initialize the registry with a valid registry data file.
+ */
+ inline Registry(const Registry_Api* pApi);
+
+ /** Constructor.
+ This constructor is called with a RegisterLoader for the registry.
+ The RegistryLoader load the needed DLL and provide the needed api for
+ the registry. Use open() or create() to initialize the registry with a
+ valid registry data file.
+ */
+ inline Registry(const RegistryLoader& rLoader);
+
+ /// Copy constructcor
+ inline Registry(const Registry& toCopy);
+
+ /// Destructor. The Destructor close the registry if it is open.
+ inline ~Registry();
+
+ /// Assign operator
+ inline Registry& operator = (const Registry& toAssign);
+
+ /// isValid checks if the registry points to a valid registry data file.
+ inline sal_Bool isValid() const;
+
+ /** isReadOnly returns the access mode of the registry.
+ @return TRUE if accessmode is readonly else FALSE.
+ */
+ inline sal_Bool isReadOnly() const;
+
+ /** openRootKey opens the root key of the registry.
+ @param rRootKey reference on a RegistryKey which is filled with the rootkey.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError openRootKey(RegistryKey& rRootKey);
+
+ /// getName returns the name of the current registry data file.
+ inline ::rtl::OUString getName();
+
+ /** This function creates a new registry with the specified name and creates a root key.
+ @param registryName specifies the name of the new registry.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError create(const ::rtl::OUString& registryName);
+
+ /** This function opens a registry with the specified name. If the registry alreday points
+ to a valid registry, the old regitry will be closed.
+ @param registryName Identifies a registry name.
+ @param accessMode Specifies the accessmode for the registry, REG_READONLY or REG_READWRITE.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError open(const ::rtl::OUString& registryName,
+ RegAccessMode accessMode);
+
+ /// close explicitly the current registry data file
+ inline RegError close();
+
+ /** This function destroy the specified registry.
+ @param registryName Identifies a registry name, if the name is an empty string the registry
+ itselfs will be destroyed.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError destroy(const ::rtl::OUString& registryName);
+
+ /** This function loads registry information from a specified file and save it under the
+ specified keyName.
+ @param rKey Specifies the key where the subkey will be created.
+ @param keyName specifies the name of the subkey.
+ If keyName is an empty string the registry information is saved under the key
+ specified by rKey.
+ @param regFileName specifies the file containing the registry information.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError loadKey(RegistryKey& rKey,
+ const ::rtl::OUString& keyName,
+ const ::rtl::OUString& regFileName);
+
+ /** This function saves the registry information from the specified key and all subkeys and save
+ it in the specified file.
+ @param rKey Identifies a currently open key. The key which inforamtion is saved by this
+ function is a subkey of the key identified by hKey.
+ @param keyName specifies the name of the subkey.
+ If keyName is an empty string the registry information under the key specified
+ by rKey is saved in the specified file.
+ @param regFileName specifies the file containing the registry information.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError saveKey(RegistryKey& rKey,
+ const ::rtl::OUString& keyName,
+ const ::rtl::OUString& regFileName);
+
+ /** This function merges the registry information from the specified key and the registry
+ information of the specified file. Existing keys will extended.
+ @param rKey Identifies a currently open key. The key which inforamtion is merged by this
+ function is a subkey of the key identified by hKey.
+ @param keyName specifies the name of the subkey.
+ If keyName is an empty string the registry information under the key specified
+ by rKey is merged with the information from the specified file.
+ @param regFileName specifies the file containing the registry information.
+ @param bWarnings if TRUE the function returns an error if a key already exists.
+ @param bReport if TRUE the function reports warnings on stdout if a key already exists.
+ @return REG_NO_ERROR if succeeds else an error code. If returns an error the registry will
+ restore the state before merging.
+ */
+ inline RegError mergeKey(RegistryKey& rKey,
+ const ::rtl::OUString& keyName,
+ const ::rtl::OUString& regFileName,
+ sal_Bool bWarnings = sal_False,
+ sal_Bool bReport = sal_False);
+
+ /** This function dump the content under the open key to stdout
+ @param rKey Identifies a currently open key which subtree is dumped.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError dumpRegistry(RegistryKey& rKey);
+
+ friend class RegistryKey;
+ friend class RegistryKeyArray;
+ friend class RegistryKeyNames;
+
+ const Registry_Api* getApi() { return m_pApi; }
+protected:
+
+ const Registry_Api* m_pApi;
+ NAMESPACE_VOS(ODynamicLoader)<Registry_Api> m_Api;
+ RegHandle m_hImpl;
+};
+
+
+//-----------------------------------------------------------------------------
+
+/** RegistryKeyArray presents an array of open keys.
+ RegistryKeyArray is a helper class to work with an array of subkeys.
+*/
+class RegistryKeyArray
+{
+public:
+ /// Default constructor
+ inline RegistryKeyArray();
+
+ /// Destructor
+ inline ~RegistryKeyArray();
+
+ /// This function returns the open key sepecified with index.
+ inline RegistryKey getElement(sal_uInt32 index);
+
+ /// This function returns the length of the array.
+ inline sal_uInt32 getLength();
+
+ friend class RegistryKey;
+protected:
+ inline void setKeyHandles(Registry& registry, RegKeyHandle* phKeys, sal_uInt32 length);
+ inline RegError closeKeyHandles();
+
+ sal_uInt32 m_length;
+ RegKeyHandle* m_phKeys;
+ Registry m_registry;
+};
+
+
+/** RegistryKeyNames presents an array of subkey names.
+ RegistryKeyNames is a helper class to work with an array of subkeys.
+*/
+class RegistryKeyNames
+{
+public:
+ /// Default constructor
+ inline RegistryKeyNames();
+
+ /// Destructor
+ inline ~RegistryKeyNames();
+
+ /// This function returns the name of the key sepecified with index.
+ inline ::rtl::OUString getElement(sal_uInt32 index);
+
+ /// This function returns the length of the array.
+ inline sal_uInt32 getLength();
+
+ friend class RegistryKey;
+protected:
+ inline void setKeyNames(Registry& registry, rtl_uString** pKeyNames, sal_uInt32 length);
+ inline RegError freeKeyNames();
+
+ sal_uInt32 m_length;
+ rtl_uString** m_pKeyNames;
+ Registry m_registry;
+};
+
+//-----------------------------------------------------------------------------
+
+/** RegistryValueList presents an value list of the specified type.
+ RegistryValueList is a helper class to work with a list value.
+*/
+template<class ValueType>
+class RegistryValueList
+{
+public:
+ /// Default constructor
+ RegistryValueList()
+ : m_length(0)
+ , m_pValueList(NULL)
+ , m_registry(NULL)
+ {}
+
+ /// Destructor
+ ~RegistryValueList()
+ {
+ if (m_pValueList)
+ {
+ m_registry.getApi()->freeValueList(m_valueType, m_pValueList, m_length);
+ }
+ }
+
+ /// This function returns the value of the list with the sepecified index.
+ ValueType getElement(sal_uInt32 index)
+ {
+ if (m_registry.isValid() && index < m_length)
+ {
+ return m_pValueList[index];
+ } else
+ {
+ return 0;
+ }
+ }
+
+ /// This function returns the length of the list.
+ sal_uInt32 getLength()
+ {
+ return m_length;
+ }
+
+ friend class RegistryKey;
+protected:
+ void setValueList(Registry& registry, RegValueType valueType,
+ ValueType* pValueList, sal_uInt32 length)
+ {
+ m_length = length;
+ m_pValueList = pValueList;
+ m_valueType = valueType;
+ m_registry = registry;
+ }
+
+ sal_uInt32 m_length;
+ ValueType* m_pValueList;
+ RegValueType m_valueType;
+ Registry m_registry;
+};
+
+//-----------------------------------------------------------------------------
+
+/** RegistryKey read and write information for the specified key in a registry.
+ Class is inline and use a load on call C-Api.
+*/
+class RegistryKey
+{
+public:
+ /// Default constructor
+ inline RegistryKey();
+
+ /// Copy constructor
+ inline RegistryKey(const RegistryKey& toCopy);
+
+ /// Destructor. The Destructor close the key if it is open.
+ inline ~RegistryKey();
+
+ /// Assign operator
+ inline RegistryKey& operator = (const RegistryKey& toAssign);
+
+ /// isValid checks if the key points to a valid registry key.
+ inline sal_Bool isValid() const;
+
+ /** isReadOnly returns the access mode of the key.
+ @return TRUE if accessmode is read only else FALSE.
+ */
+ inline sal_Bool isReadOnly() const;
+
+ /// getName returns the full name of the key beginning with the rootkey.
+ inline ::rtl::OUString getName();
+
+ /** This function creates the specified key. If the key already exists in the registry,
+ the function opens it.
+ @param keyName specifies the name of the key which will be opened or created.
+ @param rNewKey Reference a RegistryKey which will be filled with the new or open key.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError createKey(const ::rtl::OUString& keyName,
+ RegistryKey& rNewKey);
+
+ /** This function opens the specified key.
+ @param keyName Points to a null terminated string specifying the name of a key that this
+ function opens.
+ @param rOpenKey Reference a RegistryKey which will be filled with the open key.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError openKey(const ::rtl::OUString& keyName,
+ RegistryKey& rOpenKey);
+
+ /** This function returns the names of all subkeys of the key.
+ @param keyName Points to a null terminated string specifying the name of a key.
+ @param rSubKeys Reference a RegistryKeyArray which will be filled with the names of the subkeys.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError openSubKeys(const ::rtl::OUString& keyName,
+ RegistryKeyArray& rSubKeys);
+
+ /** This function opens all subkeys of the key.
+ @param keyName Points to a null terminated string specifying the name of a key that subkeys
+ this function opens.
+ @param rSubKeyNames Reference a RegistryKeyNames array which will be filled with the open subkeys.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getKeyNames(const ::rtl::OUString& keyName,
+ RegistryKeyNames& rSubKeyNames);
+
+ /** This function close all subkeys specified in the array.
+ @param rSubKeys Reference a RegistryKeyArray which contains the open subkeys.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError closeSubKeys(RegistryKeyArray& rSubKeys);
+
+ /** This function deletes the specified key.
+ @param keyName specifies the name of the key which will be deleted.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError deleteKey(const ::rtl::OUString& keyName);
+
+ /// close explicitly the current key
+ inline RegError closeKey();
+
+ /** This function sets an value under the key.
+ @param keyName specifies the name of the key which value is set by this function.
+ If keyName is an empty string, the value is set for the key
+ specified by hKey.
+ @param valueType Specified the type of the value.
+ @param pData Points to a memory block containing the current data for the value.
+ @param valueSize Specified the size of pData in bytes
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError setValue(const ::rtl::OUString& keyName,
+ RegValueType valueType,
+ RegValue pValue,
+ sal_uInt32 valueSize);
+
+ /** This function sets an long list value under the key.
+ @param keyName specifies the name of the key which value is set by this function.
+ If keyName is an empty string, the value is set for the key
+ specified by hKey.
+ @param pValueList Points to an array of longs containing the current data for the value.
+ @param len Specified the len of pValueList.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError setLongListValue(const ::rtl::OUString& keyName,
+ sal_Int32* pValueList,
+ sal_uInt32 len);
+
+ /** This function sets an ascii list value under the key.
+ @param keyName specifies the name of the key which value is set by this function.
+ If keyName is an empty string, the value is set for the key
+ specified by hKey.
+ @param pValueList Points to an array of sal_Char* containing the current data for the value.
+ @param len Specified the len of pValueList.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError setStringListValue(const ::rtl::OUString& keyName,
+ sal_Char** pValueList,
+ sal_uInt32 len);
+
+ /** This function sets an unicode string list value under the key.
+ @param keyName specifies the name of the key which value is set by this function.
+ If keyName is an empty string, the value is set for the key
+ specified by hKey.
+ @param pValueList Points to an array of sal_Unicode* containing the current data for the value.
+ @param len Specified the len of pValueList.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError setUnicodeListValue(const ::rtl::OUString& keyName,
+ sal_Unicode** pValueList,
+ sal_uInt32 len);
+
+ /** This function gets info about type and size of the value.
+ @param keyName specifies the name of the key which value is set by this function.
+ If keyName is an empty string, the value is set for the key
+ specified by hKey.
+ @param pValueType Specified the type of the value.
+ @param pValueSize Specified the size of pData in bytes or the length of a list value.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getValueInfo(const ::rtl::OUString& keyName,
+ RegValueType* pValueType,
+ sal_uInt32* pValueSize);
+
+ /** This function gets the value under the specified key.
+ @param keyName specifies the name of the key which value is get by this function.
+ If keyName is an empty string, the value is get from the key
+ specified by hKey.
+ @param pValue Points to an allocated memory block receiving the current data for the value.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getValue(const ::rtl::OUString& keyName,
+ RegValue pValue);
+
+ /** This function gets the value under the specified key.
+ @param keyName specifies the name of the key which value is get by this function.
+ If keyName is an empty string, the value is get from the key
+ specified by hKey.
+ @param rValueList Reference a RegistryValueList which will be filled with the ascii values.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getLongListValue(const ::rtl::OUString& keyName,
+ RegistryValueList<sal_Int32>& rValueList);
+
+ /** This function gets the value under the specified key.
+ @param keyName specifies the name of the key which value is get by this function.
+ If keyName is an empty string, the value is get from the key
+ specified by hKey.
+ @param rValueList Reference a RegistryValueList which will be filled with the ascii values.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getStringListValue(const ::rtl::OUString& keyName,
+ RegistryValueList<sal_Char*>& rValueList);
+
+ /** This function gets the value under the specified key.
+ @param keyName specifies the name of the key which value is get by this function.
+ If keyName is an empty string, the value is get from the key
+ specified by hKey.
+ @param rValueList Reference a RegistryValueList which will be filled with the unicode values.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getUnicodeListValue(const ::rtl::OUString& keyName,
+ RegistryValueList<sal_Unicode*>& rValueList);
+
+
+ inline RegError createLink(const ::rtl::OUString& linkName,
+ const ::rtl::OUString& linkTarget);
+
+ inline RegError deleteLink(const ::rtl::OUString& linkName);
+
+ inline RegError getKeyType(const ::rtl::OUString& name,
+ RegKeyType* pKeyType) const;
+
+ inline RegError getLinkTarget(const ::rtl::OUString& linkName,
+ ::rtl::OUString& rLinkTarget) const;
+
+ /** This function will resolved all or only the first link of a keyname
+ and returns the resolved keyName in rResolvedName.
+ @param keyName specifies the relativ name of the key which name will be resolved.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getResolvedKeyName(const ::rtl::OUString& keyName,
+ sal_Bool firstLinkOnly,
+ ::rtl::OUString& rResolvedName) const;
+
+ /** getRegistryName returns the name of the current registry in which
+ the key is defined.
+ */
+ inline ::rtl::OUString getRegistryName();
+
+ /// getRegistry returns the registry in which the key is defined.
+ Registry getRegistry() const { return m_registry; }
+
+ friend class Registry;
+public:
+ inline RegistryKey(Registry& registry,
+ RegKeyHandle hKey);
+
+ RegKeyHandle getKeyHandle() const { return m_hImpl; }
+
+protected:
+ inline void setRegistry(Registry& registry);
+
+ Registry m_registry;
+ RegKeyHandle m_hImpl;
+};
+
+
+//-----------------------------------------------------------------------------
+
+inline RegistryKeyArray::RegistryKeyArray()
+ : m_length(0)
+ , m_phKeys(NULL)
+ , m_registry(NULL)
+{
+}
+
+inline RegistryKeyArray::~RegistryKeyArray()
+{
+ if (m_phKeys)
+ m_registry.m_pApi->closeSubKeys(m_phKeys, m_length);
+}
+
+inline RegistryKey RegistryKeyArray::getElement(sal_uInt32 index)
+{
+ if (m_registry.isValid() && index < m_length)
+ return RegistryKey(m_registry, m_phKeys[index]);
+ else
+ return RegistryKey();
+}
+
+inline sal_uInt32 RegistryKeyArray::getLength()
+{
+ return m_length;
+}
+
+inline void RegistryKeyArray::setKeyHandles(Registry& registry,
+ RegKeyHandle* phKeys,
+ sal_uInt32 length)
+{
+ m_phKeys = phKeys;
+ m_length = length;
+ m_registry = registry;
+}
+
+inline RegError RegistryKeyArray::closeKeyHandles()
+{
+ if (m_registry.isValid() && m_phKeys)
+ {
+ RegError ret;
+ ret = m_registry.m_pApi->closeSubKeys(m_phKeys, m_length);
+ m_registry = Registry(m_registry.m_pApi);
+ m_length = 0;
+ m_phKeys = NULL;
+ return ret;
+ } else
+ return(REG_INVALID_KEY);
+}
+
+//-----------------------------------------------------------------------------
+
+inline RegistryKeyNames::RegistryKeyNames()
+ : m_length(0)
+ , m_pKeyNames(NULL)
+ , m_registry(NULL)
+{
+}
+
+inline RegistryKeyNames::~RegistryKeyNames()
+{
+ if (m_pKeyNames)
+ m_registry.m_pApi->freeKeyNames(m_pKeyNames, m_length);
+}
+
+inline ::rtl::OUString RegistryKeyNames::getElement(sal_uInt32 index)
+{
+
+ if (m_pKeyNames && index < m_length)
+ return m_pKeyNames[index];
+ else
+ return ::rtl::OUString();
+}
+
+inline sal_uInt32 RegistryKeyNames::getLength()
+{
+ return m_length;
+}
+
+inline void RegistryKeyNames::setKeyNames(Registry& registry,
+ rtl_uString** pKeyNames,
+ sal_uInt32 length)
+{
+ m_pKeyNames = pKeyNames;
+ m_length = length;
+ m_registry = registry;
+}
+
+inline RegError RegistryKeyNames::freeKeyNames()
+{
+ if (m_registry.isValid() && m_pKeyNames)
+ {
+ RegError ret = REG_NO_ERROR;
+ ret = m_registry.m_pApi->freeKeyNames(m_pKeyNames, m_length);
+ m_registry = Registry(m_registry.m_pApi);
+ m_length = 0;
+ m_pKeyNames = NULL;
+ return ret;
+ } else
+ return REG_INVALID_KEY;
+}
+
+//-----------------------------------------------------------------------------
+
+inline RegistryKey::RegistryKey()
+ : m_registry(NULL)
+ , m_hImpl(NULL)
+ { }
+
+inline RegistryKey::RegistryKey(Registry& registry, RegKeyHandle hKey)
+ : m_registry(registry)
+ , m_hImpl(hKey)
+ {
+ if (m_hImpl)
+ m_registry.m_pApi->acquireKey(m_hImpl);
+ }
+
+inline RegistryKey::RegistryKey(const RegistryKey& toCopy)
+ : m_registry(toCopy.m_registry)
+ , m_hImpl(toCopy.m_hImpl)
+ {
+ if (m_hImpl)
+ m_registry.m_pApi->acquireKey(m_hImpl);
+ }
+
+inline void RegistryKey::setRegistry(Registry& registry)
+ {
+ m_registry = registry;
+ }
+
+inline RegistryKey::~RegistryKey()
+ {
+ if (m_hImpl)
+ m_registry.m_pApi->closeKey(m_hImpl);
+ }
+
+inline RegistryKey& RegistryKey::operator = (const RegistryKey& toAssign)
+{
+ m_registry = toAssign.m_registry;
+
+ if (m_hImpl != toAssign.m_hImpl)
+ {
+ m_registry.m_pApi->releaseKey(m_hImpl);
+ m_hImpl = toAssign.m_hImpl;
+ m_registry.m_pApi->acquireKey(m_hImpl);
+ }
+
+ return *this;
+}
+
+inline sal_Bool RegistryKey::isValid() const
+ { return (m_hImpl != NULL); }
+
+inline sal_Bool RegistryKey::isReadOnly() const
+ {
+ if (m_registry.isValid())
+ return (m_registry.m_pApi)->isKeyReadOnly(m_hImpl);
+ else
+ return sal_False;
+ }
+
+inline ::rtl::OUString RegistryKey::getName()
+ {
+ ::rtl::OUString sRet;
+ if (m_registry.isValid())
+ m_registry.m_pApi->getKeyName(m_hImpl, &sRet.pData);
+ return sRet;;
+ }
+
+inline RegError RegistryKey::createKey(const ::rtl::OUString& keyName,
+ RegistryKey& rNewKey)
+ {
+ if (rNewKey.isValid()) rNewKey.closeKey();
+ if (m_registry.isValid())
+ {
+ RegError ret = m_registry.m_pApi->createKey(m_hImpl, keyName.pData, &rNewKey.m_hImpl);
+ if (!ret) rNewKey.setRegistry(m_registry);
+ return ret;
+ } else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::openKey(const ::rtl::OUString& keyName,
+ RegistryKey& rOpenKey)
+ {
+ if (rOpenKey.isValid()) rOpenKey.closeKey();
+ if (m_registry.isValid())
+ {
+ RegError ret = m_registry.m_pApi->openKey(m_hImpl, keyName.pData,
+ &rOpenKey.m_hImpl);
+ if (!ret) rOpenKey.setRegistry(m_registry);
+ return ret;
+ } else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::openSubKeys(const ::rtl::OUString& keyName,
+ RegistryKeyArray& rSubKeys)
+ {
+ if (m_registry.isValid())
+ {
+ RegError ret = REG_NO_ERROR;
+ RegKeyHandle* pSubKeys;
+ sal_uInt32 nSubKeys;
+ if (ret = m_registry.m_pApi->openSubKeys(m_hImpl, keyName.pData,
+ &pSubKeys, &nSubKeys))
+ {
+ return ret;
+ } else
+ {
+ rSubKeys.setKeyHandles(m_registry, pSubKeys, nSubKeys);
+ return ret;
+ }
+ } else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getKeyNames(const ::rtl::OUString& keyName,
+ RegistryKeyNames& rSubKeyNames)
+ {
+ if (m_registry.isValid())
+ {
+ RegError ret = REG_NO_ERROR;
+ rtl_uString** pSubKeyNames;
+ sal_uInt32 nSubKeys;
+ if (ret = m_registry.m_pApi->getKeyNames(m_hImpl, keyName.pData,
+ &pSubKeyNames, &nSubKeys))
+ {
+ return ret;
+ } else
+ {
+ rSubKeyNames.setKeyNames(m_registry, pSubKeyNames, nSubKeys);
+ return ret;
+ }
+ } else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::closeSubKeys(RegistryKeyArray& rSubKeys)
+ {
+ if (m_registry.isValid())
+ return rSubKeys.closeKeyHandles();
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::deleteKey(const ::rtl::OUString& keyName)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->deleteKey(m_hImpl, keyName.pData);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::closeKey()
+ {
+ if (m_registry.isValid())
+ {
+ RegError ret = m_registry.m_pApi->closeKey(m_hImpl);
+ if (!ret)
+ {
+ m_hImpl = NULL;
+ m_registry = Registry(m_registry.m_pApi);
+ }
+ return ret;
+ } else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::setValue(const ::rtl::OUString& keyName,
+ RegValueType valueType,
+ RegValue pValue,
+ sal_uInt32 valueSize)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->setValue(m_hImpl, keyName.pData, valueType,
+ pValue, valueSize);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::setLongListValue(const ::rtl::OUString& keyName,
+ sal_Int32* pValueList,
+ sal_uInt32 len)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->setLongListValue(m_hImpl, keyName.pData,
+ pValueList, len);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::setStringListValue(const ::rtl::OUString& keyName,
+ sal_Char** pValueList,
+ sal_uInt32 len)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->setStringListValue(m_hImpl, keyName.pData,
+ pValueList, len);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::setUnicodeListValue(const ::rtl::OUString& keyName,
+ sal_Unicode** pValueList,
+ sal_uInt32 len)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->setUnicodeListValue(m_hImpl, keyName.pData,
+ pValueList, len);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getValueInfo(const ::rtl::OUString& keyName,
+ RegValueType* pValueType,
+ sal_uInt32* pValueSize)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->getValueInfo(m_hImpl, keyName.pData, pValueType, pValueSize);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getValue(const ::rtl::OUString& keyName,
+ RegValue pValue)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->getValue(m_hImpl, keyName.pData, pValue);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getLongListValue(const ::rtl::OUString& keyName,
+ RegistryValueList<sal_Int32>& rValueList)
+ {
+ if (m_registry.isValid())
+ {
+ RegError ret = REG_NO_ERROR;
+ sal_Int32* pValueList;
+ sal_uInt32 length;
+ if (ret = m_registry.m_pApi->getLongListValue(m_hImpl, keyName.pData,
+ &pValueList, &length))
+ {
+ return ret;
+ } else
+ {
+ rValueList.setValueList(m_registry, RG_VALUETYPE_LONGLIST,
+ pValueList, length);
+ return ret;
+ }
+ } else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getStringListValue(const ::rtl::OUString& keyName,
+ RegistryValueList<sal_Char*>& rValueList)
+ {
+ if (m_registry.isValid())
+ {
+ RegError ret = REG_NO_ERROR;
+ sal_Char** pValueList;
+ sal_uInt32 length;
+ if (ret = m_registry.m_pApi->getStringListValue(m_hImpl, keyName.pData,
+ &pValueList, &length))
+ {
+ return ret;
+ } else
+ {
+ rValueList.setValueList(m_registry, RG_VALUETYPE_STRINGLIST,
+ pValueList, length);
+ return ret;
+ }
+ } else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getUnicodeListValue(const ::rtl::OUString& keyName,
+ RegistryValueList<sal_Unicode*>& rValueList)
+ {
+ if (m_registry.isValid())
+ {
+ RegError ret = REG_NO_ERROR;
+ sal_Unicode** pValueList;
+ sal_uInt32 length;
+ if (ret = m_registry.m_pApi->getUnicodeListValue(m_hImpl, keyName.pData,
+ &pValueList, &length))
+ {
+ return ret;
+ } else
+ {
+ rValueList.setValueList(m_registry, RG_VALUETYPE_UNICODELIST,
+ pValueList, length);
+ return ret;
+ }
+ } else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::createLink(const ::rtl::OUString& linkName,
+ const ::rtl::OUString& linkTarget)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->createLink(m_hImpl, linkName.pData, linkTarget.pData);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::deleteLink(const ::rtl::OUString& linkName)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->deleteLink(m_hImpl, linkName.pData);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getKeyType(const ::rtl::OUString& keyName,
+ RegKeyType* pKeyType) const
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->getKeyType(m_hImpl, keyName.pData, pKeyType);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getLinkTarget(const ::rtl::OUString& linkName,
+ ::rtl::OUString& rLinkTarget) const
+ {
+ if (m_registry.isValid())
+ {
+ return m_registry.m_pApi->getLinkTarget(m_hImpl,
+ linkName.pData,
+ &rLinkTarget.pData);
+ } else
+ return REG_INVALID_KEY;
+ }
+
+
+inline RegError RegistryKey::getResolvedKeyName(const ::rtl::OUString& keyName,
+ sal_Bool firstLinkOnly,
+ ::rtl::OUString& rResolvedName) const
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->getResolvedKeyName(m_hImpl,
+ keyName.pData,
+ firstLinkOnly,
+ &rResolvedName.pData);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline ::rtl::OUString RegistryKey::getRegistryName()
+ {
+ if (m_registry.isValid())
+ {
+ return m_registry.getName();
+ } else
+ return ::rtl::OUString();
+ }
+
+//-----------------------------------------------------------------------------
+
+inline Registry::Registry(const Registry_Api* pApi)
+ : m_pApi(pApi)
+ , m_Api()
+ , m_hImpl(NULL)
+ { }
+
+inline Registry::Registry(const RegistryLoader& rLoader)
+ : m_pApi(NULL)
+ , m_Api(rLoader)
+ , m_hImpl(NULL)
+ {
+ m_pApi = m_Api.getApi();
+ }
+
+inline Registry::Registry(const Registry& toCopy)
+ : m_pApi(toCopy.m_pApi)
+ , m_Api(toCopy.m_Api)
+ , m_hImpl(toCopy.m_hImpl)
+ {
+ if (m_hImpl)
+ m_pApi->acquire(m_hImpl);
+ }
+
+
+inline Registry::~Registry()
+ {
+ if (m_pApi && m_hImpl)
+ m_pApi->release(m_hImpl);
+ }
+
+inline Registry& Registry::operator = (const Registry& toAssign)
+{
+
+ if (m_hImpl != toAssign.m_hImpl)
+ {
+ if (m_pApi) m_pApi->release(m_hImpl);
+ m_pApi = toAssign.m_pApi;
+ m_Api = toAssign.m_Api;
+ m_hImpl = toAssign.m_hImpl;
+ }
+ if (m_hImpl && m_pApi)
+ m_pApi->acquire(m_hImpl);
+
+ return *this;
+}
+
+inline sal_Bool Registry::isValid() const
+ { return ( m_hImpl != NULL && m_pApi != NULL ); }
+
+inline sal_Bool Registry::isReadOnly() const
+ { return m_pApi->isReadOnly(m_hImpl); }
+
+inline RegError Registry::openRootKey(RegistryKey& rRootKey)
+ {
+ rRootKey.setRegistry(*this);
+ return m_pApi->openRootKey(m_hImpl, &rRootKey.m_hImpl);
+ }
+
+inline ::rtl::OUString Registry::getName()
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getName(m_hImpl, &sRet.pData);
+ return sRet;
+ }
+
+inline RegError Registry::create(const ::rtl::OUString& registryName)
+ {
+ if (m_hImpl)
+ m_pApi->release(m_hImpl);
+ return m_pApi->createRegistry(registryName.pData, &m_hImpl);
+ }
+
+inline RegError Registry::open(const ::rtl::OUString& registryName,
+ RegAccessMode accessMode)
+ {
+ if (m_hImpl)
+ m_pApi->release(m_hImpl);
+ return m_pApi->openRegistry(registryName.pData, &m_hImpl, accessMode);
+ }
+
+inline RegError Registry::close()
+ {
+ RegError ret = m_pApi->closeRegistry(m_hImpl);
+ if (!ret)
+ m_hImpl = NULL;
+ return ret;
+ }
+
+inline RegError Registry::destroy(const ::rtl::OUString& registryName)
+ {
+ RegError ret = m_pApi->destroyRegistry(m_hImpl, registryName.pData);
+ if ( !ret && (registryName.getLength() == 0) )
+ m_hImpl = NULL;
+ return ret;
+ }
+
+inline RegError Registry::loadKey(RegistryKey& rKey,
+ const ::rtl::OUString& keyName,
+ const ::rtl::OUString& regFileName)
+ { return m_pApi->loadKey(m_hImpl, rKey.m_hImpl, keyName.pData, regFileName.pData); }
+
+inline RegError Registry::saveKey(RegistryKey& rKey,
+ const ::rtl::OUString& keyName,
+ const ::rtl::OUString& regFileName)
+ { return m_pApi->saveKey(m_hImpl, rKey.m_hImpl, keyName.pData, regFileName.pData); }
+
+inline RegError Registry::mergeKey(RegistryKey& rKey,
+ const ::rtl::OUString& keyName,
+ const ::rtl::OUString& regFileName,
+ sal_Bool bWarnings,
+ sal_Bool bReport)
+ { return m_pApi->mergeKey(m_hImpl, rKey.m_hImpl, keyName.pData, regFileName.pData, bWarnings, bReport); }
+
+inline RegError Registry::dumpRegistry(RegistryKey& rKey)
+ { return m_pApi->dumpRegistry(m_hImpl, rKey.m_hImpl); }
+
+
+#endif
diff --git a/registry/inc/registry/regtype.h b/registry/inc/registry/regtype.h
new file mode 100644
index 000000000000..42f8643e3fa7
--- /dev/null
+++ b/registry/inc/registry/regtype.h
@@ -0,0 +1,185 @@
+/*************************************************************************
+ *
+ * $RCSfile: regtype.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $
+ *
+ * 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 _REGISTRY_REGTYPE_H_
+#define _REGISTRY_REGTYPE_H_
+
+#ifndef _SAL_TYPES_H_
+#include <sal/types.h>
+#endif
+
+// version number of the library. This number is used for the load on call
+// mechanism and must be modifed when the library will be upgraded to a new version.
+#define LIBRARY_VERSION 2
+
+typedef void* RegHandle;
+
+typedef void* RegKeyHandle;
+
+typedef void* RegValue;
+
+typedef sal_uInt16 RegAccessMode;
+
+#define REG_READONLY 0x0001 // allow read accesses only
+#define REG_READWRITE 0x0002 // allow read and write accesses
+
+/// RegKeyType specify the type of the key, if it is a real key or a link
+enum RegKeyType
+{
+ /// The key is a real key
+ RG_KEYTYPE,
+ /// The key is a link
+ RG_LINKTYPE
+};
+
+/// RegValueType specify the type of the value of a key
+enum RegValueType
+{
+ /// The key has no value
+ RG_VALUETYPE_NOT_DEFINED,
+ /// The key has a value of type long
+ RG_VALUETYPE_LONG,
+ /// The key has a value of type ascii
+ RG_VALUETYPE_STRING,
+ /// The key has a value of type unicode
+ RG_VALUETYPE_UNICODE,
+ /// The key has a value of type binary
+ RG_VALUETYPE_BINARY,
+ /// The key has a value of type long list
+ RG_VALUETYPE_LONGLIST,
+ /// The key has a value of type ascii list
+ RG_VALUETYPE_STRINGLIST,
+ /// The key has a value of type unicode list
+ RG_VALUETYPE_UNICODELIST
+};
+
+/// RegError specify the possible error codes
+enum RegError
+{
+ /// no error
+ REG_NO_ERROR,
+ /// internal registry error
+ REG_INTERNAL_ERROR,
+
+ /// registry is not open
+ REG_REGISTRY_NOT_OPEN,
+ /// registry does not exists
+ REG_REGISTRY_NOT_EXISTS,
+ /// registry is readonly
+ REG_REGISTRY_READONLY,
+ /// destroy registry failed. Ther are may be any open keys.
+ REG_DESTROY_REGISTRY_FAILED,
+ /** registry cannot open for readwrite because the registry is already
+ open for readwrite anywhere.
+ */
+ REG_CANNOT_OPEN_FOR_READWRITE,
+ /** registry is in a invalid state or the registry does not point to
+ a valid registry data file
+ */
+ REG_INVALID_REGISTRY,
+
+ /// The key is not open
+ REG_KEY_NOT_OPEN,
+ /// The key not exists
+ REG_KEY_NOT_EXISTS,
+ /// The key cannot created
+ REG_CREATE_KEY_FAILED,
+ /// The key cannot not deleted
+ REG_DELETE_KEY_FAILED,
+ /** The keyname is invalid. This error will return if the keyname
+ is NULL but should not be NULL in the context of called function.
+ */
+ REG_INVALID_KEYNAME,
+ /// The key is not in a valid state
+ REG_INVALID_KEY,
+
+ /// key has no value
+ REG_VALUE_NOT_EXISTS,
+ ///
+ REG_SET_VALUE_FAILED,
+ ///
+ REG_DELETE_VALUE_FAILED,
+ ///
+ REG_INVALID_VALUE,
+
+ ///
+ REG_MERGE_ERROR,
+ ///
+ REG_MERGE_CONFLICT,
+
+ ///
+ REG_DETECT_RECURSION,
+ ///
+ REG_INVALID_LINK,
+ ///
+ REG_INVALID_LINKNAME,
+ ///
+ REG_INVALID_LINKTARGET,
+ ///
+ REG_LINKTARGET_NOT_EXIST,
+ ///
+ REG_BUFFERSIZE_TOSMALL
+};
+
+
+#define REGISTRY_CALLTYPE SAL_CALL
+
+#endif