summaryrefslogtreecommitdiff
path: root/registry/inc/registry
diff options
context:
space:
mode:
Diffstat (limited to 'registry/inc/registry')
-rw-r--r--registry/inc/registry/reader.h610
-rw-r--r--registry/inc/registry/reader.hxx632
-rw-r--r--registry/inc/registry/reflread.hxx519
-rw-r--r--registry/inc/registry/refltype.hxx86
-rw-r--r--registry/inc/registry/reflwrit.hxx355
-rw-r--r--registry/inc/registry/registry.h477
-rw-r--r--registry/inc/registry/registry.hxx1258
-rw-r--r--registry/inc/registry/regtype.h179
-rw-r--r--registry/inc/registry/types.h340
-rw-r--r--registry/inc/registry/version.h77
-rw-r--r--registry/inc/registry/writer.h269
-rw-r--r--registry/inc/registry/writer.hxx303
12 files changed, 5105 insertions, 0 deletions
diff --git a/registry/inc/registry/reader.h b/registry/inc/registry/reader.h
new file mode 100644
index 000000000000..50fa802c4f83
--- /dev/null
+++ b/registry/inc/registry/reader.h
@@ -0,0 +1,610 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_registry_reader_h
+#define INCLUDED_registry_reader_h
+
+#include "registry/types.h"
+#include "registry/version.h"
+
+#include "rtl/ustring.h"
+#include "sal/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/// @HTML
+
+/**
+ Creates a type reader working on a binary blob that represents a UNOIDL type.
+
+ <p>If a non-null handle is returned through <code>result</code>, its
+ reference count will be one. Operations on a non-null handle are not
+ multi-thread&ndash;safe.</p>
+
+ @param buffer the binary blob representing the type; must point to at least
+ <code>length</code> bytes, and need only be byte-aligned
+
+ @param length the size in bytes of the binary blob representing the type
+
+ @param copy if true, the type reader creates an internal copy of the given
+ buffer, and the given buffer is not accessed after this function returns; if
+ false, the type reader works directly on the given buffer, which must remain
+ available unmodified until the type reader is destroyed
+
+ @param maxVersion the maximum binary blob version the client is prepared to
+ handle; must not be negative
+
+ @param result an out-parameter obtaining a handle on the type reader; must
+ not be null; if the given binary blob is malformed, or of a version larger
+ than <code>maxVersion</code>, null is returned
+
+ @return false iff an out-of-memory condition occured, in which case
+ <code>result</code> is left unchanged, and no type reader is created
+
+ @since UDK 3.2.0
+ */
+sal_Bool SAL_CALL typereg_reader_create(
+ void const * buffer, sal_uInt32 length, sal_Bool copy,
+ enum typereg_Version maxVersion, void ** result)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Increments the reference count of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @since UDK 3.2.0
+ */
+void SAL_CALL typereg_reader_acquire(void * handle) SAL_THROW_EXTERN_C();
+
+/**
+ Decrements the reference count of a type reader.
+
+ <p>If the reference count drops to zero, the type reader is destroyed.</p>
+
+ @param handle a handle on a type reader; may be null
+
+ @since UDK 3.2.0
+ */
+void SAL_CALL typereg_reader_release(void * handle) SAL_THROW_EXTERN_C();
+
+/**
+ Returns the binary blob version of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @return the version of the binary blob from which the type reader was
+ constructed; if <code>handle</code> is null, <code>TYPEREG_VERSION_0</code>
+ is returned
+
+ @since UDK 3.2.0
+ */
+enum typereg_Version SAL_CALL typereg_reader_getVersion(void * handle)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the documentation of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @param result an out-parameter obtaining the documentation string; must not
+ be null; if <code>handle</code> is null, an empty string is returned; if an
+ out-of-memory condition occurs, a pointer to a null pointer is returned
+
+ @since UDK 3.2.0
+ */
+void SAL_CALL typereg_reader_getDocumentation(
+ void * handle, rtl_uString ** result) SAL_THROW_EXTERN_C();
+
+/**
+ Returns the file name of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @param result an out-parameter obtaining the file name string; must not be
+ null; if <code>handle</code> is null, an empty string is returned; if an
+ out-of-memory condition occurs, a pointer to a null pointer is returned
+
+ @since UDK 3.2.0
+ @deprecated
+ */
+void SAL_CALL typereg_reader_getFileName(void * handle, rtl_uString ** result)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the type class of a type reader.
+
+ <p>This function will always return the type class without the internal
+ <code>RT_TYPE_PUBLISHED</code> flag set. Use
+ <code>typereg_reader_isPublished</code> to determine whether a type reader is
+ published.</p>
+
+ @param handle a handle on a type reader; may be null
+
+ @return the type class of the type reader; if <code>handle</code> is null,
+ <code>RT_TYPE_INVALID</code> is returned
+
+ @since UDK 3.2.0
+ */
+enum RTTypeClass SAL_CALL typereg_reader_getTypeClass(void * handle)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns whether a type reader is published.
+
+ @param handle a handle on a type reader; may be null
+
+ @return whether the type reader is published; if <code>handle</code> is null,
+ <code>sal_False</code> is returned
+
+ @since UDK 3.2.0
+ */
+sal_Bool SAL_CALL typereg_reader_isPublished(void * handle)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the type name of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @param result an out-parameter obtaining the type name string; must not be
+ null; if <code>handle</code> is null, an empty string is returned; if an
+ out-of-memory condition occurs, a pointer to a null pointer is returned
+
+ @since UDK 3.2.0
+ */
+void SAL_CALL typereg_reader_getTypeName(void * handle, rtl_uString ** result)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the number of super types of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @return the number of super types of the type reader; if <code>handle</code>
+ is null, zero is returned
+
+ @since UDK 3.2.0
+ */
+sal_uInt16 SAL_CALL typereg_reader_getSuperTypeCount(void * handle)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the type name of a super type of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the super type's type name string;
+ must not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param index a valid index into the range of super types of the given type
+ reader
+
+ @since UDK 3.2.0
+ */
+void SAL_CALL typereg_reader_getSuperTypeName(
+ void * handle, rtl_uString ** result, sal_uInt16 index)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the number of fields of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @return the number of fields of the type reader; if <code>handle</code> is
+ null, zero is returned
+
+ @since UDK 3.2.0
+ */
+sal_uInt16 SAL_CALL typereg_reader_getFieldCount(void * handle)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the documentation of a field of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the field's documentation string;
+ must not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param index a valid index into the range of fields of the given type reader
+
+ @since UDK 3.2.0
+ */
+void SAL_CALL typereg_reader_getFieldDocumentation(
+ void * handle, rtl_uString ** result, sal_uInt16 index)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the file name of a field of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the field's file name string; must
+ not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param index a valid index into the range of fields of the given type reader
+
+ @since UDK 3.2.0
+ @deprecated
+ */
+void SAL_CALL typereg_reader_getFieldFileName(
+ void * handle, rtl_uString ** result, sal_uInt16 index)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the flags of a field of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param index a valid index into the range of fields of the given type reader
+
+ @return the flags of the given field of the type reader
+
+ @since UDK 3.2.0
+ */
+RTFieldAccess SAL_CALL typereg_reader_getFieldFlags(
+ void * handle, sal_uInt16 index) SAL_THROW_EXTERN_C();
+
+/**
+ Returns the name of a field of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the field's name string; must not be
+ null; if an out-of-memory condition occurs, a pointer to a null pointer is
+ returned
+
+ @param index a valid index into the range of fields of the given type reader
+
+ @since UDK 3.2.0
+ */
+void SAL_CALL typereg_reader_getFieldName(
+ void * handle, rtl_uString ** result, sal_uInt16 index)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the type name of a field of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the field's type name string; must
+ not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param index a valid index into the range of fields of the given type reader
+
+ @since UDK 3.2.0
+ */
+void SAL_CALL typereg_reader_getFieldTypeName(
+ void * handle, rtl_uString ** result, sal_uInt16 index)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the value of a field of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param index a valid index into the range of fields of the given type reader
+
+ @param type an out-parameter obtaining the field value's type; must not be
+ null
+
+ @param result an out-parameter obtaining the field value's value; must not be
+ null
+
+ @return false iff an out-of-memory condition occured, in which case
+ <code>type</code> and <code>value</code> are left unchanged
+
+ @since UDK 3.2.0
+ */
+sal_Bool SAL_CALL typereg_reader_getFieldValue(
+ void * handle, sal_uInt16 index, enum RTValueType * type,
+ union RTConstValueUnion * value)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the number of methods of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @return the number of methods of the type reader; if <code>handle</code> is
+ null, zero is returned
+
+ @since UDK 3.2.0
+ */
+sal_uInt16 SAL_CALL typereg_reader_getMethodCount(void * handle)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the documentation of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the methods's documentation string;
+ must not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param index a valid index into the range of methods of the given type reader
+
+ @since UDK 3.2.0
+ */
+void SAL_CALL typereg_reader_getMethodDocumentation(
+ void * handle, rtl_uString ** result, sal_uInt16 index)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the flags of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param index a valid index into the range of methods of the given type reader
+
+ @return the flags of the given method of the type reader
+
+ @since UDK 3.2.0
+ */
+enum RTMethodMode SAL_CALL typereg_reader_getMethodFlags(
+ void * handle, sal_uInt16 index) SAL_THROW_EXTERN_C();
+
+/**
+ Returns the name of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the methods's name string; must not
+ be null; if an out-of-memory condition occurs, a pointer to a null pointer is
+ returned
+
+ @param index a valid index into the range of methods of the given type reader
+
+ @since UDK 3.2.0
+ */
+void SAL_CALL typereg_reader_getMethodName(
+ void * handle, rtl_uString ** result, sal_uInt16 index)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the return type name of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the methods's return type name
+ string; must not be null; if an out-of-memory condition occurs, a pointer to
+ a null pointer is returned
+
+ @param index a valid index into the range of methods of the given type reader
+
+ @since UDK 3.2.0
+ */
+void SAL_CALL typereg_reader_getMethodReturnTypeName(
+ void * handle, rtl_uString ** result, sal_uInt16 index)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the number of parameters of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param index a valid index into the range of methods of the given type reader
+
+ @return the number of parameters of the given method of the type reader
+
+ @since UDK 3.2.0
+ */
+sal_uInt16 SAL_CALL typereg_reader_getMethodParameterCount(
+ void * handle, sal_uInt16 index) SAL_THROW_EXTERN_C();
+
+/**
+ Returns the flags of a parameter of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param methodIndex a valid index into the range of methods of the given type
+ reader
+
+ @param parameterIndex a valid index into the range of parameters of the given
+ method
+
+ @return the flags of the given parameter of the given method of the type
+ reader
+
+ @since UDK 3.2.0
+ */
+enum RTParamMode SAL_CALL typereg_reader_getMethodParameterFlags(
+ void * handle, sal_uInt16 methodIndex, sal_uInt16 parameterIndex)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the name of a parameter of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the parameter's name string; must
+ not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param methodIndex a valid index into the range of methods of the given type
+ reader
+
+ @param parameterIndex a valid index into the range of parameters of the given
+ method
+
+ @since UDK 3.2.0
+ */
+void SAL_CALL typereg_reader_getMethodParameterName(
+ void * handle, rtl_uString ** result, sal_uInt16 methodIndex,
+ sal_uInt16 parameterIndex)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the type name of a parameter of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the parameter's type name string;
+ must not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param methodIndex a valid index into the range of methods of the given type
+ reader
+
+ @param parameterIndex a valid index into the range of parameters of the given
+ method
+
+ @since UDK 3.2.0
+ */
+void SAL_CALL typereg_reader_getMethodParameterTypeName(
+ void * handle, rtl_uString ** result, sal_uInt16 methodIndex,
+ sal_uInt16 parameterIndex)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the number of exceptions of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param index a valid index into the range of methods of the given type reader
+
+ @return the number of exceptions of the given method of the type reader
+
+ @since UDK 3.2.0
+ */
+sal_uInt16 SAL_CALL typereg_reader_getMethodExceptionCount(
+ void * handle, sal_uInt16 index) SAL_THROW_EXTERN_C();
+
+/**
+ Returns the type name of an exception of a method of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the exception's type name string;
+ must not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param methodIndex a valid index into the range of methods of the given type
+ reader
+
+ @param exceptionIndex a valid index into the range of exceptions of the given
+ method
+
+ @since UDK 3.2.0
+ */
+void SAL_CALL typereg_reader_getMethodExceptionTypeName(
+ void * handle, rtl_uString ** result, sal_uInt16 methodIndex,
+ sal_uInt16 exceptionIndex)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the number of references of a type reader.
+
+ @param handle a handle on a type reader; may be null
+
+ @return the number of references of the type reader; if <code>handle</code>
+ is null, zero is returned
+
+ @since UDK 3.2.0
+ */
+sal_uInt16 SAL_CALL typereg_reader_getReferenceCount(void * handle)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the documentation of a reference of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the reference's documentation
+ string; must not be null; if an out-of-memory condition occurs, a pointer to
+ a null pointer is returned
+
+ @param index a valid index into the range of references of the given type
+ reader
+
+ @since UDK 3.2.0
+ */
+void SAL_CALL typereg_reader_getReferenceDocumentation(
+ void * handle, rtl_uString ** result, sal_uInt16 index)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the flags of a reference of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param index a valid index into the range of references of the given type
+ reader
+
+ @return the flags of the given reference of the type reader
+
+ @since UDK 3.2.0
+ */
+RTFieldAccess SAL_CALL typereg_reader_getReferenceFlags(
+ void * handle, sal_uInt16 index) SAL_THROW_EXTERN_C();
+
+/**
+ Returns the sort of a reference of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param index a valid index into the range of references of the given type
+ reader
+
+ @return the sort of the given reference of the type reader
+
+ @since UDK 3.2.0
+ */
+enum RTReferenceType SAL_CALL typereg_reader_getReferenceSort(
+ void * handle, sal_uInt16 index) SAL_THROW_EXTERN_C();
+
+/**
+ Returns the type name of a reference of a type reader.
+
+ @param handle a handle on a type reader; must not be null
+
+ @param result an out-parameter obtaining the reference's type name string;
+ must not be null; if an out-of-memory condition occurs, a pointer to a null
+ pointer is returned
+
+ @param index a valid index into the range of references of the given type
+ reader
+
+ @since UDK 3.2.0
+ */
+void SAL_CALL typereg_reader_getReferenceTypeName(
+ void * handle, rtl_uString ** result, sal_uInt16 index)
+ SAL_THROW_EXTERN_C();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/registry/inc/registry/reader.hxx b/registry/inc/registry/reader.hxx
new file mode 100644
index 000000000000..30e5abb148aa
--- /dev/null
+++ b/registry/inc/registry/reader.hxx
@@ -0,0 +1,632 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_registry_reader_hxx
+#define INCLUDED_registry_reader_hxx
+
+#include "registry/reader.h"
+#include "registry/refltype.hxx"
+#include "registry/types.h"
+#include "registry/version.h"
+
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+
+#include <algorithm>
+#include <new>
+
+namespace typereg {
+
+/// @HTML
+
+/**
+ A type reader working on a binary blob that represents a UNOIDL type.
+
+ <p>Instances of this class are not multi-thread&ndash;safe.</p>
+
+ @since UDK 3.2.0
+ */
+class Reader {
+public:
+ /**
+ Creates an invalid type reader.
+ */
+ Reader(): m_handle(0) {}
+
+ /**
+ Creates a type reader.
+
+ <p>If the given binary blob is malformed, or of a version larger than
+ <code>maxVersion</code>, the created type reader is flagged as
+ invalid.</p>
+
+ @param buffer the binary blob representing the type; must point to at
+ least <code>length</code> bytes, and need only be byte-aligned
+
+ @param length the size in bytes of the binary blob representing the type
+
+ @param copy if true, the type reader creates an internal copy of the
+ given buffer, and the given buffer is not accessed after this constructor
+ returns; if false, the type reader works directly on the given buffer,
+ which must remain available unmodified until the underlying type reader
+ is destroyed (note that the lifetime of the underlying type reader can be
+ different from the lifetime of this <code>Reader</code> instance)
+
+ @param maxVersion the maximum binary blob version the client is prepared
+ to handle; must not be negative
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ Reader(
+ void const * buffer, sal_uInt32 length, bool copy,
+ typereg_Version maxVersion)
+ {
+ if (!typereg_reader_create(buffer, length, copy, maxVersion, &m_handle))
+ {
+ throw std::bad_alloc();
+ }
+ }
+
+ /**
+ Shares a type reader between two <code>Reader</code> instances.
+
+ @param other another <code>Reader</code> instance
+ */
+ Reader(Reader const & other): m_handle(other.m_handle) {
+ typereg_reader_acquire(m_handle);
+ }
+
+ /**
+ Destroys this <code>Reader</code> instance.
+
+ <p>The underlying type reader is only destroyed if this instance was its
+ last user.</p>
+ */
+ ~Reader() {
+ typereg_reader_release(m_handle);
+ }
+
+ /**
+ Replaces the underlying type reader.
+
+ @param other any <code>Reader</code> instance
+
+ @return this <code>Reader</code> instance
+ */
+ Reader & operator =(Reader const & other) {
+ Reader temp(other);
+ std::swap(this->m_handle, temp.m_handle);
+ return *this;
+ }
+
+ /**
+ Returns whether this type reader is valid.
+
+ @return true iff this type reader is valid
+ */
+ bool isValid() const {
+ return m_handle != 0;
+ }
+
+ /**
+ Returns the binary blob version of this type reader.
+
+ @return the version of the binary blob from which this type reader was
+ constructed; if this type reader is invalid,
+ <code>TYPEREG_VERSION_0</code> is returned
+ */
+ typereg_Version getVersion() const {
+ return typereg_reader_getVersion(m_handle);
+ }
+
+ /**
+ Returns the documentation of this type reader.
+
+ @return the documentation of this type reader; if this type reader is
+ invalid, an empty string is returned
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ rtl::OUString getDocumentation() const {
+ rtl_uString * s = 0;
+ typereg_reader_getDocumentation(m_handle, &s);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return rtl::OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the file name of this type reader.
+
+ @return the file name of this type reader; if this type reader is
+ invalid, an empty string is returned
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ @deprecated
+ */
+ rtl::OUString getFileName() const {
+ rtl_uString * s = 0;
+ typereg_reader_getFileName(m_handle, &s);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return rtl::OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the type class of this type reader.
+
+ <p>This function will always return the type class without the internal
+ <code>RT_TYPE_PUBLISHED</code> flag set. Use <code>isPublished</code> to
+ determine whether this type reader is published.</p>
+
+ @return the type class of this type reader; if this type reader is
+ invalid, <code>RT_TYPE_INVALID</code> is returned
+ */
+ RTTypeClass getTypeClass() const {
+ return typereg_reader_getTypeClass(m_handle);
+ }
+
+ /**
+ Returns whether this type reader is published.
+
+ @return whether this type reader is published; if this type reader is
+ invalid, <code>false</code> is returned
+ */
+ bool isPublished() const {
+ return typereg_reader_isPublished(m_handle);
+ }
+
+ /**
+ Returns the type name of this type reader.
+
+ @return the type name of this type reader; if this type reader is
+ invalid, an empty string is returned
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ rtl::OUString getTypeName() const {
+ rtl_uString * s = 0;
+ typereg_reader_getTypeName(m_handle, &s);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return rtl::OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the number of super types of this type reader.
+
+ @return the number of super types of this type reader; if this type
+ reader is invalid, zero is returned
+ */
+ sal_uInt16 getSuperTypeCount() const {
+ return typereg_reader_getSuperTypeCount(m_handle);
+ }
+
+ /**
+ Returns the type name of a super type of this type reader.
+
+ @param index a valid index into the range of super types of this type
+ reader
+
+ @return the type name of the given super type
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ rtl::OUString getSuperTypeName(sal_uInt16 index) const {
+ rtl_uString * s = 0;
+ typereg_reader_getSuperTypeName(m_handle, &s, index);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return rtl::OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the number of fields of this type reader.
+
+ @return the number of fields of this type reader; if this type reader is
+ invalid, zero is returned
+ */
+ sal_uInt16 getFieldCount() const {
+ return typereg_reader_getFieldCount(m_handle);
+ }
+
+ /**
+ Returns the documentation of a field of this type reader.
+
+ @param index a valid index into the range of fields of this type reader
+
+ @return the documentation of the given field
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ rtl::OUString getFieldDocumentation(sal_uInt16 index) const {
+ rtl_uString * s = 0;
+ typereg_reader_getFieldDocumentation(m_handle, &s, index);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return rtl::OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the file name of a field of this type reader.
+
+ @param index a valid index into the range of fields of this type reader
+
+ @return the file name of the given field
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ @deprecated
+ */
+ rtl::OUString getFieldFileName(sal_uInt16 index) const {
+ rtl_uString * s = 0;
+ typereg_reader_getFieldFileName(m_handle, &s, index);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return rtl::OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the flags of a field of this type reader.
+
+ @param index a valid index into the range of fields of this type reader
+
+ @return the flags of the given field
+ */
+ RTFieldAccess getFieldFlags(sal_uInt16 index) const {
+ return typereg_reader_getFieldFlags(m_handle, index);
+ }
+
+ /**
+ Returns the name of a field of this type reader.
+
+ @param index a valid index into the range of fields of this type reader
+
+ @return the name of the given field
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ rtl::OUString getFieldName(sal_uInt16 index) const {
+ rtl_uString * s = 0;
+ typereg_reader_getFieldName(m_handle, &s, index);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return rtl::OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the type name of a field of this type reader.
+
+ @param index a valid index into the range of fields of this type reader
+
+ @return the type name of the given field
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ rtl::OUString getFieldTypeName(sal_uInt16 index) const {
+ rtl_uString * s = 0;
+ typereg_reader_getFieldTypeName(m_handle, &s, index);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return rtl::OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the value of a field of this type reader.
+
+ @param index a valid index into the range of fields of this type reader
+
+ @return the value of the given field
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ RTConstValue getFieldValue(sal_uInt16 index) const {
+ RTConstValue v;
+ if (!typereg_reader_getFieldValue(
+ m_handle, index, &v.m_type, &v.m_value))
+ {
+ throw std::bad_alloc();
+ }
+ return v;
+ }
+
+ /**
+ Returns the number of methods of this type reader.
+
+ @return the number of methods of this type reader; if this type reader is
+ invalid, zero is returned
+ */
+ sal_uInt16 getMethodCount() const {
+ return typereg_reader_getMethodCount(m_handle);
+ }
+
+ /**
+ Returns the documentation of a method of this type reader.
+
+ @param index a valid index into the range of methods of this type reader
+
+ @return the documentation of the given method
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ rtl::OUString getMethodDocumentation(sal_uInt16 index) const {
+ rtl_uString * s = 0;
+ typereg_reader_getMethodDocumentation(m_handle, &s, index);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return rtl::OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the flags of a method of this type reader.
+
+ @param index a valid index into the range of methods of this type reader
+
+ @return the flags of the given method
+ */
+ RTMethodMode getMethodFlags(sal_uInt16 index) const {
+ return typereg_reader_getMethodFlags(m_handle, index);
+ }
+
+ /**
+ Returns the name of a method of this type reader.
+
+ @param index a valid index into the range of methods of this type reader
+
+ @return the name of the given method
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ rtl::OUString getMethodName(sal_uInt16 index) const {
+ rtl_uString * s = 0;
+ typereg_reader_getMethodName(m_handle, &s, index);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return rtl::OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the return type name of a method of this type reader.
+
+ @param index a valid index into the range of methods of this type reader
+
+ @return the return type name of the given method
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ rtl::OUString getMethodReturnTypeName(sal_uInt16 index) const {
+ rtl_uString * s = 0;
+ typereg_reader_getMethodReturnTypeName(m_handle, &s, index);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return rtl::OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the number of parameters of a method of this type reader.
+
+ @param index a valid index into the range of methods of this type reader
+
+ @return the number of parameters of the given method
+ */
+ sal_uInt16 getMethodParameterCount(sal_uInt16 index) const {
+ return typereg_reader_getMethodParameterCount(m_handle, index);
+ }
+
+ /**
+ Returns the flags of a parameter of a method of this type reader.
+
+ @param methodIndex a valid index into the range of methods of this type
+ reader
+
+ @param parameterIndex a valid index into the range of parameters of the
+ given method
+
+ @return the flags of the given method parameter
+ */
+ RTParamMode getMethodParameterFlags(
+ sal_uInt16 methodIndex, sal_uInt16 parameterIndex) const
+ {
+ return typereg_reader_getMethodParameterFlags(
+ m_handle, methodIndex, parameterIndex);
+ }
+
+ /**
+ Returns the name of a parameter of a method of this type reader.
+
+ @param methodIndex a valid index into the range of methods of this type
+ reader
+
+ @param parameterIndex a valid index into the range of parameters of the
+ given method
+
+ @return the name of the given method parameter
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ rtl::OUString getMethodParameterName(
+ sal_uInt16 methodIndex, sal_uInt16 parameterIndex) const
+ {
+ rtl_uString * s = 0;
+ typereg_reader_getMethodParameterName(
+ m_handle, &s, methodIndex, parameterIndex);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return rtl::OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the type name of a parameter of a method of this type reader.
+
+ @param methodIndex a valid index into the range of methods of this type
+ reader
+
+ @param parameterIndex a valid index into the range of parameters of the
+ given method
+
+ @return the type name of the given method parameter
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ rtl::OUString getMethodParameterTypeName(
+ sal_uInt16 methodIndex, sal_uInt16 parameterIndex) const
+ {
+ rtl_uString * s = 0;
+ typereg_reader_getMethodParameterTypeName(
+ m_handle, &s, methodIndex, parameterIndex);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return rtl::OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the number of exceptions of a method of this type reader.
+
+ @param index a valid index into the range of methods of this type reader
+
+ @return the number of exceptions of the given method
+ */
+ sal_uInt16 getMethodExceptionCount(sal_uInt16 index) const {
+ return typereg_reader_getMethodExceptionCount(m_handle, index);
+ }
+
+ /**
+ Returns the type name of an exception of a method of this type reader.
+
+ @param methodIndex a valid index into the range of methods of this type
+ reader
+
+ @param exceptionIndex a valid index into the range of exceptions of the
+ given method
+
+ @return the type name of the given method exception
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ rtl::OUString getMethodExceptionTypeName(
+ sal_uInt16 methodIndex, sal_uInt16 exceptionIndex) const
+ {
+ rtl_uString * s = 0;
+ typereg_reader_getMethodExceptionTypeName(
+ m_handle, &s, methodIndex, exceptionIndex);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return rtl::OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the number of references of this type reader.
+
+ @return the number of references of this type reader; if this type reader
+ is invalid, zero is returned
+ */
+ sal_uInt16 getReferenceCount() const {
+ return typereg_reader_getReferenceCount(m_handle);
+ }
+
+ /**
+ Returns the documentation of a reference of this type reader.
+
+ @param index a valid index into the range of references of this type
+ reader
+
+ @return the documentation of the given reference
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ rtl::OUString getReferenceDocumentation(sal_uInt16 index) const {
+ rtl_uString * s = 0;
+ typereg_reader_getReferenceDocumentation(m_handle, &s, index);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return rtl::OUString(s, SAL_NO_ACQUIRE);
+ }
+
+ /**
+ Returns the flags of a reference of this type reader.
+
+ @param index a valid index into the range of references of this type
+ reader
+
+ @return the flags of the given reference
+ */
+ RTFieldAccess getReferenceFlags(sal_uInt16 index) const {
+ return typereg_reader_getReferenceFlags(m_handle, index);
+ }
+
+ /**
+ Returns the sort of a reference of this type reader.
+
+ @param index a valid index into the range of references of this type
+ reader
+
+ @return the sort of the given reference
+ */
+ RTReferenceType getReferenceSort(sal_uInt16 index) const {
+ return typereg_reader_getReferenceSort(m_handle, index);
+ }
+
+ /**
+ Returns the type name of a reference of this type reader.
+
+ @param index a valid index into the range of references of this type
+ reader
+
+ @return the type name of the given reference
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ rtl::OUString getReferenceTypeName(sal_uInt16 index) const {
+ rtl_uString * s = 0;
+ typereg_reader_getReferenceTypeName(m_handle, &s, index);
+ if (s == 0) {
+ throw std::bad_alloc();
+ }
+ return rtl::OUString(s, SAL_NO_ACQUIRE);
+ }
+
+private:
+ void * m_handle;
+};
+
+}
+
+#endif
diff --git a/registry/inc/registry/reflread.hxx b/registry/inc/registry/reflread.hxx
new file mode 100644
index 000000000000..4b964ee8a013
--- /dev/null
+++ b/registry/inc/registry/reflread.hxx
@@ -0,0 +1,519 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _REGISTRY_REFLREAD_HXX_
+#define _REGISTRY_REFLREAD_HXX_
+
+#include <registry/refltype.hxx>
+#include <registry/regtype.h>
+#include <rtl/ustring.hxx>
+
+/// Implememetation handle
+typedef void* TypeReaderImpl;
+
+/****************************************************************************
+
+ C-Api
+
+*****************************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** specifies a collection of function pointers which represents the complete registry type reader C-API.
+
+ This funtions pointers are used by the C++ wrapper to call the C-API.
+*/
+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);
+};
+
+/** the API initialization function.
+*/
+RegistryTypeReader_Api* TYPEREG_CALLTYPE initRegistryTypeReader_Api(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+/** RegistryTypeReades reads a binary type blob.
+
+ This class provides the necessary functions to read type informations
+ for all kinds of types of a type blob.
+ The class is inline and use a C-Api.
+
+ @deprecated
+ use typereg::Reader instead
+*/
+class RegistryTypeReader
+{
+public:
+
+ /** Constructor.
+
+ @param buffer points to the binary data block.
+ @param bufferlen specifies the size of the binary data block.
+ @param copyData specifies if the data block should be copied.
+ The block can be copied to ensure that the data
+ is valid for the lifetime of this instance.
+ */
+ inline RegistryTypeReader(const sal_uInt8* buffer,
+ sal_uInt32 bufferLen,
+ sal_Bool copyData);
+
+ /// Copy constructcor
+ inline RegistryTypeReader(const RegistryTypeReader& toCopy);
+
+ /// Destructor. The Destructor frees the data block if the copyData flag was TRUE.
+ inline ~RegistryTypeReader();
+
+ /// Assign operator
+ inline RegistryTypeReader& operator == (const RegistryTypeReader& toAssign);
+
+ /// checks if the registry type reader points to a valid Api.
+ inline sal_Bool isValid() const;
+
+ /** @deprecated
+ returns the minor version number.
+
+ We currently don't support a versioning concept of IDL interfaces and
+ so this function is currently not used.
+ */
+ inline sal_uInt16 getMinorVersion() const;
+
+ /** @deprecated
+ returns the major version number.
+
+ We currently don't support a versioning concept of IDL interfaces and
+ so this function is currently not used.
+ */
+ inline sal_uInt16 getMajorVersion() const;
+
+ /** returns the typeclass of the type represented by this blob.
+
+ This function will always return the type class without the internal
+ RT_TYPE_PUBLISHED flag set.
+ */
+ inline RTTypeClass getTypeClass() const;
+
+ /** returns the full qualified name of the type.
+ */
+ inline ::rtl::OUString getTypeName() const;
+
+ /** returns the full qualified name of the supertype.
+ */
+ inline ::rtl::OUString getSuperTypeName() const;
+
+ /** @deprecated
+ returns the unique identifier for an interface type as an out parameter.
+
+ An earlier version of UNO used an unique identifier for interfaces. In the
+ current version of UNO this uik was eliminated and this function is
+ not longer used.
+ */
+ inline void getUik(RTUik& uik) const;
+
+ /** returns the documentation string of this type.
+ */
+ inline ::rtl::OUString getDoku() const;
+
+ /** returns the IDL filename where the type is defined.
+ */
+ inline ::rtl::OUString getFileName() const;
+
+ /** returns the number of fields (attributes/properties, enum values or number
+ of constants in a module).
+
+ */
+ inline sal_uInt32 getFieldCount() const;
+
+ /** returns the name of the field specified by index.
+ */
+ inline ::rtl::OUString getFieldName( sal_uInt16 index ) const;
+
+ /** returns the full qualified name of the field specified by index.
+ */
+ inline ::rtl::OUString getFieldType( sal_uInt16 index ) const;
+
+ /** returns the access mode of the field specified by index.
+ */
+ inline RTFieldAccess getFieldAccess( sal_uInt16 index ) const;
+
+ /** returns the value of the field specified by index.
+
+ This function returns the value of an enum value or of a constant.
+ */
+ inline RTConstValue getFieldConstValue( sal_uInt16 index ) const;
+
+ /** returns the documentation string for the field specified by index.
+
+ Each field of a type can have their own documentation.
+ */
+ inline ::rtl::OUString getFieldDoku( sal_uInt16 index ) const;
+
+ /** returns the IDL filename of the field specified by index.
+
+ The IDL filename of a field can differ from the filename of the ype itself
+ because modules and also constants can be defined in different IDL files.
+ */
+ inline ::rtl::OUString getFieldFileName( sal_uInt16 index ) const;
+
+ /** returns the number of methods of an interface type.
+ */
+ inline sal_uInt32 getMethodCount() const;
+
+ /** returns the name of the method specified by index.
+ */
+ inline ::rtl::OUString getMethodName( sal_uInt16 index ) const;
+
+ /** returns number of parameters of the method specified by index.
+ */
+ inline sal_uInt32 getMethodParamCount( sal_uInt16 index ) const;
+
+ /** returns the full qualified parameter typename.
+
+ @param index indicates the method
+ @param paramIndex indeciates the parameter which type will be returned.
+ */
+ inline ::rtl::OUString getMethodParamType( sal_uInt16 index, sal_uInt16 paramIndex ) const;
+
+ /** returns the name of a parameter.
+
+ @param index indicates the method
+ @param paramIndex indiciates the parameter which name will be returned.
+ */
+ inline ::rtl::OUString getMethodParamName( sal_uInt16 index, sal_uInt16 paramIndex ) const;
+
+ /** returns the parameter mode, if it is an in, out or inout parameter.
+
+ @param index indicates the method
+ @param paramIndex indeciates the parameter which mode will be returned.
+ */
+ inline RTParamMode getMethodParamMode( sal_uInt16 index, sal_uInt16 paramIndex ) const;
+
+ /** returns the number of exceptions which are declared for the method specified by index.
+
+ @param index indicates the method
+ */
+ inline sal_uInt32 getMethodExcCount( sal_uInt16 index ) const;
+
+ /** returns the full qualified exception type of the specified exception.
+
+ @param index indicates the method
+ @param paramIndex indeciates the exception which typename will be returned.
+ */
+ inline ::rtl::OUString getMethodExcType( sal_uInt16 index, sal_uInt16 excIndex ) const;
+
+ /** returns the full qualified return type of the method specified by index.
+ */
+ inline ::rtl::OUString getMethodReturnType( sal_uInt16 index ) const;
+
+ /** returns the full qualified exception type of the specified exception.
+
+ @param index indicates the method
+ @param paramIndex indeciates the exception which typename will be returned.
+ */
+ inline RTMethodMode getMethodMode( sal_uInt16 index ) const;
+
+ /** returns the documentation string of the method specified by index.
+
+ @param index indicates the method.
+ */
+ inline ::rtl::OUString getMethodDoku( sal_uInt16 index ) const;
+
+ /** returns the number of references (supported interfaces, exported services).
+ */
+ inline sal_uInt32 getReferenceCount() const;
+
+ /** returns the full qualified typename of the reference specified by index.
+
+ @param index indicates the reference.
+ */
+ inline ::rtl::OUString getReferenceName( sal_uInt16 index ) const;
+
+ /** returns the type of the reference specified by index.
+
+ @param index indicates the reference.
+ */
+ inline RTReferenceType getReferenceType( sal_uInt16 index ) const;
+
+ /** returns the documentation string of the reference specified by index.
+
+ @param index indicates the reference.
+ */
+ inline ::rtl::OUString getReferenceDoku( sal_uInt16 index ) const;
+
+ /** returns the access mode of the reference specified by index.
+
+ The only valid value is RT_ACCESS_OPTIONAL in the context of
+ references.
+ @param index indicates the reference.
+ */
+ inline RTFieldAccess getReferenceAccess( sal_uInt16 index ) const;
+
+protected:
+
+ /// stores the registry type reader Api.
+ const RegistryTypeReader_Api* m_pApi;
+ /// stores the handle of an implementation class
+ TypeReaderImpl m_hImpl;
+};
+
+
+
+inline RegistryTypeReader::RegistryTypeReader(const sal_uInt8* buffer,
+ sal_uInt32 bufferLen,
+ sal_Bool copyData)
+ : m_pApi(initRegistryTypeReader_Api())
+ , m_hImpl(NULL)
+ {
+ m_hImpl = m_pApi->createEntry(buffer, bufferLen, copyData);
+ }
+
+
+inline RegistryTypeReader::RegistryTypeReader(const RegistryTypeReader& toCopy)
+ : m_pApi(toCopy.m_pApi)
+ , 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..27634e9dce28
--- /dev/null
+++ b/registry/inc/registry/refltype.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _REGISTRY_REFLTYPE_HXX_
+#define _REGISTRY_REFLTYPE_HXX_
+
+#include "registry/types.h"
+#include <sal/types.h>
+
+/** specifies the type source of a binary type blob.
+
+ Currently only RT_UNO_IDL type is used.
+ */
+enum RTTypeSource
+{
+ RT_UNO_IDL,
+ RT_CORBA_IDL,
+ RT_JAVA
+};
+
+/** specifies a helper class for const values.
+
+ This class is used for easy handling of constants or enum values
+ as fields in binary type blob.
+ */
+class RTConstValue
+{
+public:
+ /// stores the type of the constant value.
+ RTValueType m_type;
+ /// stores the value of the constant.
+ RTConstValueUnion m_value;
+
+ /// Default constructor.
+ RTConstValue()
+ : m_type(RT_TYPE_NONE)
+ {
+ m_value.aDouble = 0.0;
+ }
+
+ /// Destructor
+ ~RTConstValue() {}
+};
+
+/** deprecated.
+
+ An earlier version of UNO used an unique identifier for interfaces. In the
+ current version of UNO this uik was eliminated and this type is not longer used.
+ */
+struct RTUik
+{
+ sal_uInt32 m_Data1;
+ sal_uInt16 m_Data2;
+ sal_uInt16 m_Data3;
+ sal_uInt32 m_Data4;
+ sal_uInt32 m_Data5;
+};
+
+/// specifies the calling onvention for type reader/wrter api
+#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..0046b8829810
--- /dev/null
+++ b/registry/inc/registry/reflwrit.hxx
@@ -0,0 +1,355 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _REGISTRY_REFLWRIT_HXX_
+#define _REGISTRY_REFLWRIT_HXX_
+
+#include <registry/refltype.hxx>
+#include <registry/regtype.h>
+#include <rtl/ustring.hxx>
+
+/// Implememetation handle
+typedef void* TypeWriterImpl;
+
+/****************************************************************************
+
+ C-Api
+
+*****************************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** specifies a collection of function pointers which represents the complete registry type writer C-API.
+
+ This funtions pointers are used by the C++ wrapper to call the C-API.
+*/
+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);
+};
+
+/** the API initialization function.
+*/
+RegistryTypeWriter_Api* TYPEREG_CALLTYPE initRegistryTypeWriter_Api(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+/** RegistryTypeWriter writes/creates a binary type blob.
+
+ This class provides the necessary functions to write type informations
+ for all kinds of types into a blob.
+ The class is inline and use a C-Api.
+
+ @deprecated
+ use typereg::Writer instead
+*/
+class RegistryTypeWriter
+{
+public:
+
+ /** Constructor.
+
+ @param RTTypeClass specifies the type of the new blob.
+ @param typeName specifies the full qualified type name with '/' as separator.
+ @param superTypeName specifies the full qualified type name of the base type
+ with '/' as separator.
+ @param fieldCount specifies the number of fields (eg. number of attrbutes/properties,
+ enum values or constants).
+ @param methodCount specifies the number of methods.
+ @param referenceCount specifies the number of references (eg. number of supported interfaces,
+ exported services ...)
+ */
+ inline RegistryTypeWriter(RTTypeClass RTTypeClass,
+ const ::rtl::OUString& typeName,
+ const ::rtl::OUString& superTypeName,
+ sal_uInt16 fieldCount,
+ sal_uInt16 methodCount,
+ sal_uInt16 referenceCount);
+
+ /// Copy constructcor
+ inline RegistryTypeWriter(const RegistryTypeWriter& toCopy);
+
+ /** Destructor. The Destructor frees the internal data block.
+
+ The pointer (returned by getBlop) will be set to NULL.
+ */
+ inline ~RegistryTypeWriter();
+
+ /// Assign operator
+ inline RegistryTypeWriter& operator == (const RegistryTypeWriter& toAssign);
+
+ /** @deprecated
+ sets the unique identifier for an interface type.
+
+ An earlier version of UNO used an unique identifier for interfaces. In the
+ current version of UNO this uik was eliminated and this function is
+ not longer used.
+ */
+ inline void setUik(const RTUik& uik);
+
+ /** sets a documentation string for the type.
+
+ This documentation should be the same as the documentation which is provided
+ for this type in IDL.
+ */
+ inline void setDoku(const ::rtl::OUString& doku);
+
+ /** sets the IDL filename where this type is defined.
+ */
+ inline void setFileName(const ::rtl::OUString& fileName);
+
+ /** sets the data for a field member of a type blob.
+
+ @param index indicates the index of the field.
+ @param name specifies the name.
+ @param typeName specifies the full qualified typename.
+ @param doku specifies the documentation string of the field.
+ @param fileName specifies the name of the IDL file where the field is defined.
+ @param access specifies the access mode of the field.
+ @param constValue specifies the value of the field. The value is only interesting
+ for enum values or constants.
+ */
+ 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());
+
+ /** sets the data for a method.
+
+ @param index indicates the index of the method.
+ @param name specifies the name.
+ @param typeName specifies the full qualified return typename.
+ @param mode specifies the method mode.
+ @param paramCount specifies the number of parameters.
+ @param excCount specifies the number of exceptions.
+ @param doku specifies the documentation string of the field.
+ */
+ 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);
+
+ /** sets the data for the specified parameter of a method.
+
+ @param index indicates the index of the method.
+ @param paramIndex specifies the index of the parameter.
+ @param type specifies the full qualified typename.
+ @param name specifies the name.
+ @param mode specifies the parameter mode.
+ */
+ inline void setParamData(sal_uInt16 index,
+ sal_uInt16 paramIndex,
+ const ::rtl::OUString& type,
+ const ::rtl::OUString& name,
+ RTParamMode mode);
+
+ /** sets the data for the specified exception of a mehtod.
+
+ @param index indicates the index of the method.
+ @param excIndex specifies the index of the exception.
+ @param type specifies the full qualified typename of the exception.
+ */
+ inline void setExcData(sal_uInt16 index,
+ sal_uInt16 excIndex,
+ const ::rtl::OUString& type);
+
+ /** returns a pointer to the new type blob.
+
+ The pointer will be invalid (NULL) if the instance of
+ the RegistryTypeWriter will be destroyed.
+ */
+ inline const sal_uInt8* getBlop();
+
+ /** returns the size of the new type blob in bytes.
+ */
+ inline sal_uInt32 getBlopSize();
+
+ /** sets the data for a reference member.
+
+ @param index indicates the index of the reference.
+ @param name specifies the name.
+ @param refType specifies the full qualified typename of the reference.
+ @param doku specifies the documentation string of the reference.
+ @param access specifies the access mode of the reference.
+ */
+ inline void setReferenceData( sal_uInt16 index,
+ const ::rtl::OUString& name,
+ RTReferenceType refType,
+ const ::rtl::OUString& doku,
+ RTFieldAccess access = RT_ACCESS_INVALID);
+
+protected:
+
+ /// stores the registry type writer Api.
+ const RegistryTypeWriter_Api* m_pApi;
+ /// stores the handle of an implementation class
+ TypeWriterImpl m_hImpl;
+};
+
+
+
+inline RegistryTypeWriter::RegistryTypeWriter(RTTypeClass RTTypeClass,
+ const ::rtl::OUString& typeName,
+ const ::rtl::OUString& superTypeName,
+ sal_uInt16 fieldCount,
+ sal_uInt16 methodCount,
+ sal_uInt16 referenceCount)
+ : m_pApi(initRegistryTypeWriter_Api())
+ , m_hImpl(NULL)
+{
+ 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_hImpl(toCopy.m_hImpl)
+{
+ m_pApi->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..6286af132283
--- /dev/null
+++ b/registry/inc/registry/registry.h
@@ -0,0 +1,477 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _REGISTRY_REGISTRY_H_
+#define _REGISTRY_REGISTRY_H_
+
+#include <stddef.h>
+#include <rtl/ustring.h>
+#include <registry/regtype.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/** This function creates the specified key.
+
+ If the key already exists in the registry, the function opens the key only.
+ @param hKey identifies a currently open key. The key which will be 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.
+ @param phNewKey points to a variable that receives the handle of the opened or created key.
+ The memory to store this variable will be allocated and will be freed by 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_createKey(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegKeyHandle* phNewKey);
+
+
+/** This function opens the specified key.
+
+ @param hKey identifies a currently open key. The key which will be 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.
+ @param phNewKey points to a variable that receives the handle of the opened key.
+ The memory to store this variable will be allocated and will be freed by 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 will be 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 whose subkeys
+ will be opened.
+ @param pphSubKeys points to a variable that receives an array of all opened subkeys.
+ The memory to store this variable will be allocated and will be freed by the function
+ reg_closeSubKeys. If the function fails, pphSubKeys is NULL.
+ @param pnSubKeys specifies 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 closes all subkeys specified in the array.
+
+ @param phSubKeys points to a variable that containss an array of all opened subkeys.
+ The allocated memory of pphSubKeys and all open subkeys will be freed.
+ @param nSubKeys specifies 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 which will
+ be deleted.
+ @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 which will be closed by this function.
+ The memory of the variable specifying the key will be freed.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_closeKey(RegKeyHandle hKey);
+
+
+/** This function returns the name of a key.
+
+ @param hKey identifies a currently open key which name will be returned.
+ @param pKeyName contains the keyname if succeeds else an empty string.
+*/
+RegError REGISTRY_CALLTYPE reg_getKeyName(RegKeyHandle hKey, rtl_uString** pKeyName);
+
+
+/** This function sets a value of a key.
+
+ @param hKey identifies a currently open key. The key which value will be set 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
+ will be set. If keyName is NULL, then the value of the key specified by
+ hKey will be set.
+ @param valueType specifies the type of the value.
+ @param pData points to a memory block containing the data of the value.
+ @param valueSize specifies 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 of a key.
+
+ @param keyName points to a null terminated string specifying the name of a key which value
+ will be set. If keyName is NULL, then the value of the key specified by
+ hKey will be set.
+ @param pValueList points to an array of longs containing the data of the value.
+ @param len specifies 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 of a key.
+
+ @param keyName points to a null terminated string specifying the name of a key which value
+ will be set. If keyName is NULL, then the value of the key specified by
+ hKey will be set.
+ @param pValueList points to an array of sal_Char* containing the data of the value.
+ @param len specifies 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 of a key.
+
+ @param keyName points to a null terminated string specifying the name of a key which value
+ will be set. If keyName is NULL, then the value of the key specified by
+ hKey will be set.
+ @param pValueList points to an array of sal_Unicode* containing the data of the value.
+ @param len specifies 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 a key value.
+
+ @param hKey identifies a currently open key. The key which value info will be got 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
+ will be got. If keyName is NULL, then the value info of the key specified by
+ hKey will be got.
+ @param pValueType returns the type of the value.
+ @param pValueSize returns the size of the value 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 of a key.
+
+ @param hKey identifies a currently open key. The key which value will be got 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
+ will be got. If keyName is NULL, then the value of the key specified by
+ hKey will be got.
+ @param pData points to an allocated memory block receiving the data of 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 long list value of a key.
+
+ @param keyName points to a null terminated string specifying the name of a key which value
+ will be got. If keyName is NULL, then the value of the key specified by
+ hKey will be got.
+ @param pValueList a Pointer to a long value list which returns the data of the value.
+ @param pLen returns 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 string list value of a key.
+
+ @param keyName points to a null terminated string specifying the name of a key which value
+ will be got. If keyName is NULL, then the value of the key specified by
+ hKey will be got.
+ @param pValueList a Pointer to an ascii value list which returns the data of the value.
+ @param pLen returns 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 unicode list value of a key.
+
+ @param keyName points to a null terminated string specifying the name of a key which value
+ will be got. If keyName is NULL, then the value of the key specified by
+ hKey will be got.
+ @param pValueList a Pointer to an unicode value list which returns the data of the value.
+ @param pLen returns 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 frees the memory of a value list.
+
+ @param valueType specifies the type of the list values.
+ @param pValueList a Pointer to the value list.
+ @param len 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);
+
+/** This function used to create a link.
+
+ @obsolete Links are no longer supported.
+
+ @return REG_INVALID_LINK
+*/
+RegError REGISTRY_CALLTYPE reg_createLink(RegKeyHandle hKey,
+ rtl_uString* linkName,
+ rtl_uString* linkTarget);
+
+/** This function used to delete a link.
+
+ @obsolete Links are no longer supported.
+
+ @return REG_INVALID_LINK
+*/
+RegError REGISTRY_CALLTYPE reg_deleteLink(RegKeyHandle hKey,
+ rtl_uString* linkName);
+
+/** This function returns the type of a key.
+
+ The registry differentiates two possible types:
+ - RG_KEYTYPE represents a real key
+ - RG_LINKTYPE used to represent a link (no longer used)
+ @param keyName points to a null terminated string specifying the name of the key which keytype
+ will be returned.
+ @param pKeyType returns the type of the key.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_getKeyType(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegKeyType* pKeyType);
+
+/** This function used to return the linktarget of a link.
+
+ @obsolete Links are no longer supported.
+
+ @return REG_INVALID_LINK
+*/
+RegError REGISTRY_CALLTYPE reg_getLinkTarget(RegKeyHandle hKey,
+ rtl_uString* linkName,
+ rtl_uString** pLinkTarget);
+
+/** This function resolves a keyname.
+
+ and returns the resolved keyName in pResolvedName.
+ @param hKey identifies a currently open key. The key specified by keyName is a subkey
+ of the key identified by hKey.
+ @param keyName points to a null terminated string specifying the relativ name of a key.
+ The name of hKey together with keyName will be generated.
+ @param firstLinkOnly ignored
+ @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 file and save it under the
+ specified keyName.
+
+ @param hKey identifies a currently open key. The key which should store the registry information
+ is a subkey of this key.
+ @param keyName points to a null terminated string specifying the name of the key which stores the
+ registry information. If keyName is NULL the registry information will be saved under
+ the key specified by hKey.
+ @param regFileName points to a null terminated string specifying the file which conains 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 under a specified key and all of its subkeys and save
+ it in a registry file.
+
+ @param hKey identifies a currently open key. The key which information 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
+ will be saved in the specified file.
+ @param regFileName points to a null terminated string specifying the file which will contain 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 a specified source with the information of the
+ currently open registry.
+
+ All existing keys will be extended and existing key values will be overwritten.
+ @param hKey identifies a currently open key. The key which information 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 key which will be merged.
+ If keyName is NULL the registry information under the key specified by hKey
+ is merged with the complete 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 handle of the new registry if the function succeeds otherwise NULL.
+ @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 a registry.
+
+ @param hReg identifies a currently open registry whose rootKey will be returned.
+ @param phRootKey points to a handle of the open root key if the function succeeds otherwise NULL.
+ @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 a registry.
+
+ @param hReg identifies a currently open registry whose name will be returned.
+ @param pName returns the name of the registry if the function succeeds otherwise an empty string.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+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 points to a null terminated string specifying the name of the registry.
+ @param phRegistry points to a hanle of the opened registry if the function succeeds otherwise NULL.
+ @param accessMode specifies the accessmode of 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 closes a registry.
+
+ @param hRegistry identifies a currently open registry which should be closed.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_closeRegistry(RegHandle hRegistry);
+
+
+/** This function destroys a registry.
+
+ @param hRegistry identifies a currently open registry.
+ @param registryName specifies a registry name of a registry which should be destroyed. 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 reports the complete registry information of a key and all of its subkeys.
+
+ All information which are available (keynames, value types, values, ...)
+ will be printed to stdout for report issues only.
+ @param hKey identifies a currently open key which content will be reported.
+ @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..7ded0738cd72
--- /dev/null
+++ b/registry/inc/registry/registry.hxx
@@ -0,0 +1,1258 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _REGISTRY_REGISTRY_HXX_
+#define _REGISTRY_REGISTRY_HXX_
+
+#include <registry/regtype.h>
+#include <rtl/ustring.hxx>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** specifies a collection of function pointers which represents the complete registry C-API.
+
+ This funtions pointers are used by the C++ wrapper to call the C-API.
+*/
+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);
+};
+
+/** the API initialization function.
+*/
+Registry_Api* REGISTRY_CALLTYPE initRegistry_Api(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+class RegistryKey;
+
+//-----------------------------------------------------------------------------
+
+/** The Registry provides the functionality to read and write information in a registry file.
+
+ The class is implemented inline and use a C-Api.
+*/
+class Registry
+{
+public:
+ /** Default constructor.
+ */
+ inline Registry();
+
+ /// 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);
+
+ /// checks if the registry points to a valid registry data file.
+ inline sal_Bool isValid() const;
+
+ /** returns the access mode of the registry.
+
+ @return TRUE if the access mode is readonly else FALSE.
+ */
+ inline sal_Bool isReadOnly() const;
+
+ /** opens the root key of the registry.
+
+ @param rRootKey reference to a RegistryKey which is filled with the rootkey.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError openRootKey(RegistryKey& rRootKey);
+
+ /// returns the name of the current registry data file.
+ inline ::rtl::OUString getName();
+
+ /** 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);
+
+ /** opens a registry with the specified name.
+
+ If the registry already points to a valid registry, the old registry will be closed.
+ @param registryName specifies a registry name.
+ @param accessMode specifies the access mode 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);
+
+ /// closes explicitly the current registry data file.
+ inline RegError close();
+
+ /** destroys a registry.
+
+ @param registryName specifies 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);
+
+ /** loads registry information from a specified file and save it under the
+ specified keyName.
+
+ @param rKey references a currently open key. The key which should store the registry information
+ is a subkey of this key.
+ @param keyName specifies the name of the key which stores the registry information. If keyName is
+ is an empty string the registry information will be 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);
+
+ /** saves the registry information of the specified key and all subkeys and save
+ it in the specified file.
+
+ @param rKey references a currently open key. The key which information is saved by this
+ function is a subkey of this key.
+ @param keyName specifies the name of the key which information should be stored.
+ 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);
+
+ /** merges the registry information of the specified key with the registry
+ information of the specified file.
+
+ All existing keys will be extended and existing key values will be overwritten.
+ @param rKey references a currently open key. The key which information is merged by this
+ function is a subkey of this key
+ @param keyName specifies the name of the key which will be merged.
+ 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 it 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 reports the complete registry information of a key and all of its subkeys.
+
+ All information which are available (keynames, value types, values, ...)
+ will be printed to stdout for report issues only.
+ @param rKey references a currently open key which content will be reported.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError dumpRegistry(RegistryKey& rKey);
+
+ friend class RegistryKey;
+ friend class RegistryKeyArray;
+ friend class RegistryKeyNames;
+
+ /// returns the used registry Api.
+ const Registry_Api* getApi() { return m_pApi; }
+protected:
+
+ /// stores the used and initialized registry Api.
+ const Registry_Api* m_pApi;
+ /// stores the handle of the underlying registry file on which most of the functions work.
+ RegHandle m_hImpl;
+};
+
+
+//-----------------------------------------------------------------------------
+
+/** RegistryKeyArray represents an array of open keys.
+
+ RegistryKeyArray is a helper class to work with an array of keys.
+*/
+class RegistryKeyArray
+{
+public:
+ /// Default constructor
+ inline RegistryKeyArray();
+
+ /// Destructor, all subkeys will be closed.
+ inline ~RegistryKeyArray();
+
+ /// returns the open key specified by index.
+ inline RegistryKey getElement(sal_uInt32 index);
+
+ /// returns the length of the array.
+ inline sal_uInt32 getLength();
+
+ friend class RegistryKey;
+protected:
+ /** sets the data of the key array.
+
+ @param registry specifies the registry files where the keys are located.
+ @param phKeys points to an array of open keys.
+ @param length specifies the length of the array specified by phKeys.
+ */
+ inline void setKeyHandles(Registry& registry, RegKeyHandle* phKeys, sal_uInt32 length);
+ /// close all subkeys
+ inline RegError closeKeyHandles();
+
+ /// stores the number of open subkeys, the number of elements.
+ sal_uInt32 m_length;
+ /// stores an array of open subkeys.
+ RegKeyHandle* m_phKeys;
+ /// stores the handle to the registry file where the appropriate keys are located.
+ Registry m_registry;
+};
+
+
+/** RegistryKeyNames represents an array of key names.
+
+ RegistryKeyNames is a helper class to work with an array of key names.
+*/
+class RegistryKeyNames
+{
+public:
+ /// Default constructor
+ inline RegistryKeyNames();
+
+ /// Destructor, the internal array with key names will be deleted.
+ inline ~RegistryKeyNames();
+
+ /// returns the name of the key sepecified by index.
+ inline ::rtl::OUString getElement(sal_uInt32 index);
+
+ /// returns the length of the array.
+ inline sal_uInt32 getLength();
+
+ friend class RegistryKey;
+protected:
+ /** sets the data of the array.
+
+ @param registry specifies the registry files where the keys are located.
+ @param pKeyNames points to an array of key names.
+ @param length specifies the length of the array specified by pKeyNames.
+ */
+ inline void setKeyNames(Registry& registry, rtl_uString** pKeyNames, sal_uInt32 length);
+ /// delete the array of key names.
+ inline RegError freeKeyNames();
+
+ /// stores the number of key names, the number of elements.
+ sal_uInt32 m_length;
+ /// stores an array of key names.
+ rtl_uString** m_pKeyNames;
+ /// stores the handle to the registry file where the appropriate keys are located.
+ Registry m_registry;
+};
+
+//-----------------------------------------------------------------------------
+
+/** RegistryValueList represents a 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_valueType(RG_VALUETYPE_NOT_DEFINED)
+ {}
+
+ /// Destructor, the internal value list will be freed.
+ ~RegistryValueList()
+ {
+ if (m_pValueList)
+ {
+ m_registry.getApi()->freeValueList(m_valueType, m_pValueList, m_length);
+ }
+ }
+
+ /// returns the value of the list specified by index.
+ ValueType getElement(sal_uInt32 index)
+ {
+ if (m_registry.isValid() && index < m_length)
+ {
+ return m_pValueList[index];
+ } else
+ {
+ return 0;
+ }
+ }
+
+ /// returns the length of the list.
+ sal_uInt32 getLength()
+ {
+ return m_length;
+ }
+
+ friend class RegistryKey;
+protected:
+ /** sets the data of the value list.
+
+ @param registry specifies the registry files where the appropriate key is located.
+ @param valueType specifies the type of the list values.
+ @param pValueList points to a value list.
+ @param length specifies the length of the list.
+ */
+ void setValueList(Registry& registry, RegValueType valueType,
+ ValueType* pValueList, sal_uInt32 length)
+ {
+ m_length = length;
+ m_pValueList = pValueList;
+ m_valueType = valueType;
+ m_registry = registry;
+ }
+
+ /// stores the length of the list, the number of elements.
+ sal_uInt32 m_length;
+ /// stores the value list.
+ ValueType* m_pValueList;
+ /// stores the type of the list elements
+ RegValueType m_valueType;
+ /** stores the handle to the registry file where the appropriate key to this
+ value is located.
+ */
+ Registry m_registry;
+};
+
+//-----------------------------------------------------------------------------
+
+/** RegistryKey reads or writes information of the underlying 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, close the key if it references an open one.
+ inline ~RegistryKey();
+
+ /// Assign operator
+ inline RegistryKey& operator = (const RegistryKey& toAssign);
+
+ /// checks if the key points to a valid registry key.
+ inline sal_Bool isValid() const;
+
+ /** returns the access mode of the key.
+
+ @return TRUE if access mode is read only else FALSE.
+ */
+ inline sal_Bool isReadOnly() const;
+
+ /// returns the full qualified name of the key beginning with the rootkey.
+ inline ::rtl::OUString getName();
+
+ /** creates a new key or opens a key if the specified key already exists.
+
+ The specified keyname is relativ to this key.
+ @param keyName specifies the name of the key which will be opened or created.
+ @param rNewKey references 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);
+
+ /** opens the specified key.
+
+ The specified keyname is relativ to this key.
+ @param keyName specifies the name of the key which will be opened.
+ @param rOpenKey references 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);
+
+ /** opens all subkeys of the specified key.
+
+ The specified keyname is relativ to this key.
+ @param keyName specifies the name of the key which subkeys will be opened.
+ @param rSubKeys reference a RegistryKeyArray which will be filled with the open subkeys.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError openSubKeys(const ::rtl::OUString& keyName,
+ RegistryKeyArray& rSubKeys);
+
+ /** returns an array with the names of all subkeys of the specified key.
+
+ The specified keyname is relativ to this key.
+ @param keyName specifies the name of the key which subkey names will be returned.
+ @param rSubKeyNames reference a RegistryKeyNames array which will be filled with the subkey names.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getKeyNames(const ::rtl::OUString& keyName,
+ RegistryKeyNames& rSubKeyNames);
+
+ /** closes all keys specified in the array.
+
+ @param rSubKeys reference a RegistryKeyArray which contains the open keys.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError closeSubKeys(RegistryKeyArray& rSubKeys);
+
+ /** 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);
+
+ /// closes explicitly the current key
+ inline RegError closeKey();
+
+ /// releases the current key
+ inline void releaseKey();
+
+ /** sets a value of a key.
+
+ @param keyName specifies the name of the key which value will be set.
+ If keyName is an empty string, the value will be set for the key
+ specified by hKey.
+ @param valueType specifies the type of the value.
+ @param pData points to a memory block containing the data for the value.
+ @param valueSize specifies 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);
+
+ /** sets a long list value of a key.
+
+ @param keyName specifies the name of the key which value will be set.
+ If keyName is an empty string, the value will be set for the key
+ specified by hKey.
+ @param pValueList points to an array of longs containing the data for the value.
+ @param len specifies the length of the list (the array referenced by pValueList).
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError setLongListValue(const ::rtl::OUString& keyName,
+ sal_Int32* pValueList,
+ sal_uInt32 len);
+
+ /** sets an ascii list value of a key.
+
+ @param keyName specifies the name of the key which value will be set.
+ If keyName is an empty string, the value will be set for the key
+ specified by hKey.
+ @param pValueList points to an array of sal_Char* containing the data for the value.
+ @param len specifies the length of the list (the array referenced by pValueList).
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError setStringListValue(const ::rtl::OUString& keyName,
+ sal_Char** pValueList,
+ sal_uInt32 len);
+
+ /** sets an unicode string list value of a key.
+
+ @param keyName specifies the name of the key which value will be set.
+ If keyName is an empty string, the value will be set for the key
+ specified by hKey.
+ @param pValueList points to an array of sal_Unicode* containing the data for the value.
+ @param len specifies the length of the list (the array referenced by pValueList).
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError setUnicodeListValue(const ::rtl::OUString& keyName,
+ sal_Unicode** pValueList,
+ sal_uInt32 len);
+
+ /** gets info about type and size of a value.
+
+ @param keyName specifies the name of the key which value info will be returned.
+ If keyName is an empty string, the value info of the key
+ specified by hKey will be returned.
+ @param pValueType returns the type of the value.
+ @param pValueSize returns the size of the value 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);
+
+ /** gets the value of a key.
+
+ @param keyName specifies the name of the key which value will be returned.
+ 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 data of the value.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getValue(const ::rtl::OUString& keyName,
+ RegValue pValue);
+
+ /** gets a long list value of a key.
+
+ @param keyName specifies the name of the key which value will be returned.
+ If keyName is an empty string, the value is get from the key
+ specified by hKey.
+ @param rValueList references a RegistryValueList which will be filled with the long values.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getLongListValue(const ::rtl::OUString& keyName,
+ RegistryValueList<sal_Int32>& rValueList);
+
+ /** gets an ascii list value of a key.
+
+ @param keyName specifies the name of the key which value will be returned.
+ If keyName is an empty string, the value is get from the key
+ specified by hKey.
+ @param rValueList references 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);
+
+ /** gets a unicode value of a key.
+
+ @param keyName specifies the name of the key which value will be returned.
+ 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);
+
+ /** used to create a link.
+
+ @obsolete Links are no longer supported.
+
+ @return REG_INVALID_LINK
+ */
+ inline RegError createLink(const ::rtl::OUString& linkName,
+ const ::rtl::OUString& linkTarget);
+
+ /** used to delete a link.
+
+ @obsolete Links are no longer supported.
+
+ @return REG_INVALID_LINK
+ */
+ inline RegError deleteLink(const ::rtl::OUString& linkName);
+
+ /** returns the type of the specified key.
+
+ @param name specifies the name of the key or link.
+ @param pKeyType returns the type of the key (always RG_KEYTYPE).
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getKeyType(const ::rtl::OUString& name,
+ RegKeyType* pKeyType) const;
+
+ /** used to return the target of a link.
+
+ @obsolete Links are no longer supported.
+
+ @return REG_INVALID_LINK
+ */
+ inline RegError getLinkTarget(const ::rtl::OUString& linkName,
+ ::rtl::OUString& rLinkTarget) const;
+
+ /** resolves a keyname.
+
+ @param keyName specifies the name of the key which will be resolved relativ to this key.
+ The resolved name will be prefixed with the name of this key.
+ @param firstLinkOnly ignored
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getResolvedKeyName(const ::rtl::OUString& keyName,
+ sal_Bool firstLinkOnly,
+ ::rtl::OUString& rResolvedName) const;
+
+ /// returns the name of the registry in which the key is defined.
+ inline ::rtl::OUString getRegistryName();
+
+ /// returns the registry in which the key is defined.
+ Registry getRegistry() const { return m_registry; }
+
+ friend class Registry;
+public:
+ /** Constructor, which initialize a RegistryKey with registry and an valid key handle.
+
+ This constructor is internal only.
+ @internal
+ */
+ inline RegistryKey(Registry& registry,
+ RegKeyHandle hKey);
+
+ /** returns the internal key handle.
+
+ @internal
+ */
+ RegKeyHandle getKeyHandle() const { return m_hImpl; }
+
+protected:
+ /** sets the internal registry on which this key should work.
+
+ @internal
+ */
+ inline void setRegistry(Registry& registry);
+
+ /// stores the registry on which this key works
+ Registry m_registry;
+ /// stores the current key handle of this key
+ RegKeyHandle m_hImpl;
+};
+
+
+//-----------------------------------------------------------------------------
+
+inline RegistryKeyArray::RegistryKeyArray()
+ : m_length(0)
+ , m_phKeys(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_length = 0;
+ m_phKeys = NULL;
+ return ret;
+ } else
+ return(REG_INVALID_KEY);
+}
+
+//-----------------------------------------------------------------------------
+
+inline RegistryKeyNames::RegistryKeyNames()
+ : m_length(0)
+ , m_pKeyNames(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_length = 0;
+ m_pKeyNames = NULL;
+ return ret;
+ } else
+ return REG_INVALID_KEY;
+}
+
+//-----------------------------------------------------------------------------
+
+inline RegistryKey::RegistryKey()
+ : 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->releaseKey(m_hImpl);
+ }
+
+inline RegistryKey& RegistryKey::operator = (const RegistryKey& toAssign)
+{
+ m_registry = toAssign.m_registry;
+
+ if (toAssign.m_hImpl)
+ m_registry.m_pApi->acquireKey(toAssign.m_hImpl);
+ if (m_hImpl)
+ m_registry.m_pApi->releaseKey(m_hImpl);
+ m_hImpl = toAssign.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;
+ ret = m_registry.m_pApi->openSubKeys(m_hImpl, keyName.pData,
+ &pSubKeys, &nSubKeys);
+ if ( ret )
+ {
+ 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;
+ ret = m_registry.m_pApi->getKeyNames(m_hImpl, keyName.pData,
+ &pSubKeyNames, &nSubKeys);
+ if ( ret )
+ {
+ 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();
+ }
+ return ret;
+ } else
+ return REG_INVALID_KEY;
+ }
+
+inline void RegistryKey::releaseKey()
+{
+ if (m_registry.isValid() && (m_hImpl != 0))
+ {
+ m_registry.m_pApi->releaseKey(m_hImpl), m_hImpl = 0;
+ }
+}
+
+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;
+ ret = m_registry.m_pApi->getLongListValue(m_hImpl, keyName.pData,
+ &pValueList, &length);
+ if ( ret )
+ {
+ 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;
+ ret = m_registry.m_pApi->getStringListValue(m_hImpl, keyName.pData,
+ &pValueList, &length);
+ if ( ret )
+ {
+ 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;
+ ret = m_registry.m_pApi->getUnicodeListValue(m_hImpl, keyName.pData,
+ &pValueList, &length);
+ if ( ret )
+ {
+ 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()
+ : m_pApi(initRegistry_Api())
+ , m_hImpl(NULL)
+ { }
+
+inline Registry::Registry(const Registry& toCopy)
+ : m_pApi(toCopy.m_pApi)
+ , m_hImpl(toCopy.m_hImpl)
+ {
+ if (m_hImpl)
+ m_pApi->acquire(m_hImpl);
+ }
+
+
+inline Registry::~Registry()
+ {
+ if (m_hImpl)
+ m_pApi->release(m_hImpl);
+ }
+
+inline Registry& Registry::operator = (const Registry& toAssign)
+{
+ if (toAssign.m_hImpl)
+ toAssign.m_pApi->acquire(toAssign.m_hImpl);
+ if (m_hImpl)
+ m_pApi->release(m_hImpl);
+
+ m_pApi = toAssign.m_pApi;
+ m_hImpl = toAssign.m_hImpl;
+
+ return *this;
+}
+
+inline sal_Bool Registry::isValid() const
+ { return ( m_hImpl != 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..be3cf42de735
--- /dev/null
+++ b/registry/inc/registry/regtype.h
@@ -0,0 +1,179 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _REGISTRY_REGTYPE_H_
+#define _REGISTRY_REGTYPE_H_
+
+#include <sal/types.h>
+#include <sal/udkversion.h>
+
+// 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 SAL_UDK_MAJOR
+
+/// defines the type of a registry handle used in the C API.
+typedef void* RegHandle;
+
+/// defines the type of a registry key handle used in the C API.
+typedef void* RegKeyHandle;
+
+/// defines the type of a registry key value handle used in the C API.
+typedef void* RegValue;
+
+/** defines the open/access mode of the registry.
+
+ Two modes are valid:
+ -REG_READONLY allows readonly access
+ -REG_READWRITE allows read and write access
+ */
+typedef sal_uInt16 RegAccessMode;
+
+/// Flag to specify the open mode of a registry. This mode allows readonly access.
+#define REG_READONLY 0x0001
+/// Flag to specify the open mode of a registry. This mode allows read and write access.
+#define REG_READWRITE 0x0002
+
+/** defines the type of a registry key.
+
+ The registry differs between normal keys which can contain subkeys or
+ a value and link keys which navigate over the linktarget to an existing
+ other key (which are no longer supported).
+*/
+enum RegKeyType
+{
+ /// represents a real key
+ RG_KEYTYPE,
+ /// represents a link (which is no longer supported)
+ RG_LINKTYPE
+};
+
+/** defines the type of a key value.
+
+ A registry key can contain a value which has one of seven different types.
+ Three simple types (long, ascii and unicode string) and a list type of
+ these simple types. Furthermore a binary type which provides the possibilty
+ to define own data structures and store these types in the registry. The UNO
+ core reflection data is stored as a binary blob in the type registry.
+ */
+enum RegValueType
+{
+ /// The key has no value or the value type is unknown.
+ RG_VALUETYPE_NOT_DEFINED,
+ /// The key has a value of type long
+ RG_VALUETYPE_LONG,
+ /// The key has a value of type ascii string
+ RG_VALUETYPE_STRING,
+ /// The key has a value of type unicode string
+ 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 string list
+ RG_VALUETYPE_STRINGLIST,
+ /// The key has a value of type unicode string list
+ RG_VALUETYPE_UNICODELIST
+};
+
+/// specifies the possible error codes which can occur using the registry API.
+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 open with readonly access rights.
+ REG_REGISTRY_READONLY,
+ /// destroy a registry failed. There are may be any open keys.
+ REG_DESTROY_REGISTRY_FAILED,
+ /** registry cannot be opened with readwrite access because the registry is already
+ open with readwrite access anywhere.
+ */
+ REG_CANNOT_OPEN_FOR_READWRITE,
+ /** registry is in an invalid state or the registry does not point to
+ a valid registry data file.
+ */
+ REG_INVALID_REGISTRY,
+
+ /// the key or key handle points to an invalid key or closed key.
+ REG_KEY_NOT_OPEN,
+ /// the specified keyname points to a nonexisting key.
+ REG_KEY_NOT_EXISTS,
+ /// the key with the specified keyname cannot be created.
+ REG_CREATE_KEY_FAILED,
+ /// the specified key cannot be deleted. Maybe an open key handle exists to this key.
+ 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 a called function.
+ */
+ REG_INVALID_KEYNAME,
+ /// the key is not in a valid state.
+ REG_INVALID_KEY,
+
+ /// the key has no value
+ REG_VALUE_NOT_EXISTS,
+ /// setting the specified value of a key failed.
+ REG_SET_VALUE_FAILED,
+ /// deleting of the key value failed.
+ REG_DELETE_VALUE_FAILED,
+ /// the key has a invalid value or the value type is unknown.
+ REG_INVALID_VALUE,
+
+ /// merging a key, the value and all subkeys failed.
+ REG_MERGE_ERROR,
+ /** conflicts exists during the merge process of a key. This could happen if
+ the value of a key already exists and the merge process will replace it.
+ */
+ REG_MERGE_CONFLICT,
+
+ /** a recursion was detected resolving different link targets (no longer
+ used).
+ */
+ REG_DETECT_RECURSION,
+ /** the link is invalid and can not be resolved (now used by all
+ link-related operations, as links are no longer supported).
+ */
+ REG_INVALID_LINK,
+ /// the specified linkname is not valid (no longer used).
+ REG_INVALID_LINKNAME,
+ /// the linknane is not valid (no longer used).
+ REG_INVALID_LINKTARGET,
+ /// the link target points to a nonexisting key (no longer used).
+ REG_LINKTARGET_NOT_EXIST,
+ /// the reserved buffer for the resolved keyname is to small.
+ REG_BUFFERSIZE_TOSMALL
+};
+
+/// specify the calling convention for the registry API
+#define REGISTRY_CALLTYPE SAL_CALL
+
+#endif
diff --git a/registry/inc/registry/types.h b/registry/inc/registry/types.h
new file mode 100644
index 000000000000..a6898be582d9
--- /dev/null
+++ b/registry/inc/registry/types.h
@@ -0,0 +1,340 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_registry_types_h
+#define INCLUDED_registry_types_h
+
+#include "sal/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** specifies the typeclass of a binary type blob.
+
+ The general structure of a binary type blob is always the same. It depends
+ on the typeclass which parts of the blob are filled with data or not.
+ */
+enum RTTypeClass {
+ /** specifies that the structure of the given blob is unknown and can't be
+ read.
+ */
+ RT_TYPE_INVALID,
+
+ /** specifies that the blob represents an interface type. An interface blob
+ can contain a base interface, attributes and methods.
+ */
+ RT_TYPE_INTERFACE,
+
+ /** specifies that the blob represents a module type. A module blob can
+ contain a base module and constant members (fields).
+ */
+ RT_TYPE_MODULE,
+
+ /** specifies that the blob represents a struct type. A struct blob can
+ contain a base struct and members (fields).
+ */
+ RT_TYPE_STRUCT,
+
+ /** specifies that the blob represents an enum type. An enum blob can
+ contain enum values which are accessible as fields.
+ */
+ RT_TYPE_ENUM,
+
+ /** specifies that the blob represents an exception type. An exception blob
+ can contain a base exception and members (fields).
+ */
+ RT_TYPE_EXCEPTION,
+
+ /** specifies that the blob represents a typedef type. A typedef blob can
+ contain a base type.
+ */
+ RT_TYPE_TYPEDEF,
+
+ /** specifies that the blob represents a service type. A service blob can
+ contain a base service, properties (fields), references to services or
+ interfaces.
+ */
+ RT_TYPE_SERVICE,
+
+ /** specifies that the blob represents a singleton type (a named object)
+ which refers exactly one existing service.
+ */
+ RT_TYPE_SINGLETON,
+
+ /// deprecated, not used.
+ RT_TYPE_OBJECT,
+
+ /** specifies that the blob represents a constants type. A constants blob
+ can contain constant types as fields.
+ */
+ RT_TYPE_CONSTANTS,
+
+ /** @deprecated
+ a union type was evaluated but currently not supported.
+ */
+ RT_TYPE_UNION,
+
+ /**
+ Flag for published entities.
+
+ Used in combination with RT_TYPE_INTERFACE, RT_TYPE_STRUCT, RT_TYPE_ENUM,
+ RT_TYPE_EXCEPTION, RT_TYPE_TYPEDEF, RT_TYPE_SERVICE, RT_TYPE_SINGLETON,
+ or RT_TYPE_CONSTANTS to mark an entity as published.
+
+ (The value of this enumerator is chosen so that it is unlikely that its
+ addition changes the underlying type of this enumeration for any C/C++
+ compiler.)
+
+ @internal
+
+ @since UDK 3.2.0
+ */
+ RT_TYPE_PUBLISHED = 0x4000
+};
+
+/** specifies the type for the field access.
+
+ Fields in a type blob are used for different types. Among others they were
+ used for properties of services and these poperties can have several flags.
+
+ @see RT_ACCESS_INVALID
+ @see RT_ACCESS_READONLY
+ @see RT_ACCESS_OPTIONAL
+ @see RT_ACCESS_MAYBEVOID
+ @see RT_ACCESS_BOUND
+ @see RT_ACCESS_CONSTRAINED
+ @see RT_ACCESS_TRANSIENT
+ @see RT_ACCESS_MAYBEAMBIGUOUS
+ @see RT_ACCESS_MAYBEDEFAULT
+ @see RT_ACCESS_REMOVEABLE
+ @see RT_ACCESS_ATTRIBUTE
+ @see RT_ACCESS_PROPERTY
+ @see RT_ACCESS_CONST
+ @see RT_ACCESS_READWRITE
+ @see RT_ACCESS_DEFAULT
+ @see RT_ACCESS_PARAMETERIZED_TYPE
+ @see RT_ACCESS_PUBLISHED
+ */
+typedef sal_uInt16 RTFieldAccess;
+
+/// specifies a unknown flag
+#define RT_ACCESS_INVALID 0x0000
+/// specifies a readonly property/attribute
+#define RT_ACCESS_READONLY 0x0001
+/// specifies a property as optional that means that it must not be implemented.
+#define RT_ACCESS_OPTIONAL 0x0002
+/// @see com::sun::star::beans::PropertyAttribute
+#define RT_ACCESS_MAYBEVOID 0x0004
+/// @see com::sun::star::beans::PropertyAttribute
+#define RT_ACCESS_BOUND 0x0008
+/// @see com::sun::star::beans::PropertyAttribute
+#define RT_ACCESS_CONSTRAINED 0x0010
+/// @see com::sun::star::beans::PropertyAttribute
+#define RT_ACCESS_TRANSIENT 0x0020
+/// @see com::sun::star::beans::PropertyAttribute
+#define RT_ACCESS_MAYBEAMBIGUOUS 0x0040
+/// @see com::sun::star::beans::PropertyAttribute
+#define RT_ACCESS_MAYBEDEFAULT 0x0080
+/// @see com::sun::star::beans::PropertyAttribute
+#define RT_ACCESS_REMOVEABLE 0x0100
+/// @see com::sun::star::beans::PropertyAttribute
+#define RT_ACCESS_ATTRIBUTE 0x0200
+/// specifies that the field is a property
+#define RT_ACCESS_PROPERTY 0x0400
+/// specifies that the field is a constant or enum value
+#define RT_ACCESS_CONST 0x0800
+/// specifies that the property/attribute has read/write access
+#define RT_ACCESS_READWRITE 0x1000
+/// only to describe a union default label
+#define RT_ACCESS_DEFAULT 0x2000
+
+/**
+ Indicates that a member of a polymorphic struct type template is of a
+ parameterized type.
+
+ Only valid for fields that represent members of polymorphic struct type
+ templates.
+
+ @since UDK 3.2.0
+ */
+#define RT_ACCESS_PARAMETERIZED_TYPE 0x4000
+
+/**
+ Flag for published individual constants.
+
+ Used in combination with RT_ACCESS_CONST for individual constants (which are
+ not members of constant groups).
+
+ @since UDK 3.2.0
+ */
+#define RT_ACCESS_PUBLISHED 0x8000
+
+/** specifies the type of a field value.
+
+ A field can have a value if it repsresents a constant or an enum value.
+ */
+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
+};
+
+/** specifies a variable container for field values.
+ */
+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;
+ sal_Unicode const * aString;
+};
+
+/** specifies the mode of a method.
+
+ A method can be synchron or asynchron (oneway). The const attribute for
+ methods was removed so that the const values are deprecated.
+ */
+enum RTMethodMode {
+ /// indicates an invalid mode
+ RT_MODE_INVALID,
+
+ /// indicates the asynchronous mode of a method
+ RT_MODE_ONEWAY,
+
+ /// @deprecated
+ RT_MODE_ONEWAY_CONST,
+
+ /// indicated the synchronous mode of a method
+ RT_MODE_TWOWAY,
+
+ /// @deprecated
+ RT_MODE_TWOWAY_CONST,
+
+ /**
+ Indicates an extended attribute getter (that has a 'raises' clause) of an
+ interface type.
+
+ @since UDK 3.2.0
+ */
+ RT_MODE_ATTRIBUTE_GET,
+
+ /**
+ Indicates an extended attribute setter (that has a 'raises' clause) of an
+ interface type.
+
+ @since UDK 3.2.0
+ */
+ RT_MODE_ATTRIBUTE_SET
+};
+
+/** specifies the mode of a parameter.
+
+ There are three paramter modes which have impact of the handling of the
+ paramter in the UNO bridges and the UNO code generation.
+ */
+enum RTParamMode {
+ /// indicates an invalid parameter mode
+ RT_PARAM_INVALID = 0,
+
+ /// indicates a pure in parameter which is used by value
+ RT_PARAM_IN = 1,
+
+ /// indicates a pure out parameter which is used by reference
+ RT_PARAM_OUT = 2,
+
+ /// indicates a in and out parameter which is used also by reference
+ RT_PARAM_INOUT = 3,
+
+ /**
+ Indicates a rest parameter (currently only valid for service
+ constructors).
+
+ This value can be combined with any of RT_PARAM_IN, RT_PARAM_OUT, and
+ RT_PARAM_INOUT (however, service constructors currently only allow
+ RT_PARAM_IN, anyway).
+
+ @since UDK 3.2.0
+ */
+ RT_PARAM_REST = 4
+};
+
+/** specifies the type of a reference used in a service description.
+ */
+enum RTReferenceType {
+ /// the reference type is unknown
+ RT_REF_INVALID,
+
+ /** the service support the interface that means a implementation of this
+ service must implement this interface.
+ */
+ RT_REF_SUPPORTS,
+
+ /** @deprecated
+ the service observes the interface.
+ */
+ RT_REF_OBSERVES,
+
+ /** the service exports the specified service that means this service
+ provides also the specified service.
+ */
+ RT_REF_EXPORTS,
+
+ /** @deprecated
+ the service needs the specified service that means in the context of
+ this service the specified service will be used or must be available.
+ */
+ RT_REF_NEEDS,
+
+ /**
+ Indicates a type parameter of a polymorphic struct type template.
+
+ @since UDK 3.2.0
+ */
+ RT_REF_TYPE_PARAMETER
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/registry/inc/registry/version.h b/registry/inc/registry/version.h
new file mode 100644
index 000000000000..cabd3639104c
--- /dev/null
+++ b/registry/inc/registry/version.h
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_registry_version_h
+#define INCLUDED_registry_version_h
+
+#include "sal/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/// @HTML
+
+/**
+ The version of a binary blob that represents a UNOIDL type.
+
+ <p>All values between <code>TYPEREG_VERSION_0</code> and
+ <code>TYPEREG_MAX_VERSION</code> are valid, where currently unallocated
+ values represent future versions. Negative values are not valid.</p>
+
+ @see typereg::Reader
+ @see typereg::Writer
+
+ @since UDK 3.2.0
+ */
+enum typereg_Version {
+ /**
+ Denotes the original version of UNOIDL type blobs.
+ */
+ TYPEREG_VERSION_0,
+
+ /**
+ Denotes the updated version of UNOIDL type blobs.
+
+ <p>This version added support for multiple-inheritance interface types,
+ extended interface type attributes, single-interface&ndash;based
+ services, interface-based singletons, polymorphic struct types, and
+ published entities.</p>
+ */
+ TYPEREG_VERSION_1,
+
+ /**
+ Denotes the maximum future version of UNOIDL type blobs.
+ */
+ TYPEREG_MAX_VERSION = SAL_MAX_INT32
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/registry/inc/registry/writer.h b/registry/inc/registry/writer.h
new file mode 100644
index 000000000000..5f14766b0f30
--- /dev/null
+++ b/registry/inc/registry/writer.h
@@ -0,0 +1,269 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_registry_writer_h
+#define INCLUDED_registry_writer_h
+
+#include "registry/types.h"
+#include "registry/version.h"
+
+#include "rtl/ustring.h"
+#include "sal/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/// @HTML
+
+/**
+ Creates a type writer working on a binary blob that represents a UNOIDL type.
+
+ <p>Operations on a returned handle are not multi-thread&ndash;safe.</p>
+
+ @param version the version of the created type writer; must not be negative
+
+ @param documentation the documentation; must not be null
+
+ @param fileName the file name; must not be null (deprecated, use an empty string)
+
+ @param typeClass the type class of the created type writer
+
+ @param published whether the created type writer is published; for a type
+ class that cannot be published, this should be false
+
+ @param typeName the type name of the created type writer; must not be null
+
+ @param superTypeCount the number of super types of the created type writer
+
+ @param fieldCount the number of fields of the created type writer
+
+ @param methodCount the number of methods of the created type writer
+
+ @param referenceCount the number of references of the created type writer
+
+ @return a handle on the type writer; if an out-of-memory condition occurs,
+ null is returned, and no type writer is created
+
+ @since UDK 3.2.0
+ */
+void * SAL_CALL typereg_writer_create(
+ typereg_Version version, rtl_uString const * documentation,
+ rtl_uString const * fileName, RTTypeClass typeClass, sal_Bool published,
+ rtl_uString const * typeName, sal_uInt16 superTypeCount,
+ sal_uInt16 fieldCount, sal_uInt16 methodCount, sal_uInt16 referenceCount)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Destroys a type writer.
+
+ @param handle a handle on a type writer obtained from a call to
+ <code>typereg_writer_create</code>; must not be null
+
+ @since UDK 3.2.0
+ */
+void SAL_CALL typereg_writer_destroy(void * handle) SAL_THROW_EXTERN_C();
+
+/**
+ Sets the type name of a super type of a type writer.
+
+ @param handle a handle on a type writer; must not be null
+
+ @param index a valid index into the range of super types of the given type
+ writer
+
+ @param typeName the super type name; must not be null
+
+ @return false iff an out-of-memory condition ocurred, in which case the type
+ writer is not modified
+
+ @since UDK 3.2.0
+ */
+sal_Bool SAL_CALL typereg_writer_setSuperTypeName(
+ void * handle, sal_uInt16 index, rtl_uString const * typeName)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Sets the data of a field of a type writer.
+
+ @param handle a handle on a type writer; must not be null
+
+ @param index a valid index into the range of fields of the given type writer
+
+ @param documentation the documentation of the field; must not be null
+
+ @param fileName the file name of the field; must not be null (deprecated, use an empty string)
+
+ @param flags the flags of the field
+
+ @param name the name of the field; must not be null
+
+ @param typeName the type name of the field; must not be null
+
+ @param valueType the type of the value of the field
+
+ @param valueValue the value of the value of the field
+
+ @return false iff an out-of-memory condition ocurred, in which case the type
+ writer is not modified
+
+ @since UDK 3.2.0
+ */
+sal_Bool SAL_CALL typereg_writer_setFieldData(
+ void * handle, sal_uInt16 index, rtl_uString const * documentation,
+ rtl_uString const * fileName, RTFieldAccess flags, rtl_uString const * name,
+ rtl_uString const * typeName, RTValueType valueType,
+ RTConstValueUnion valueValue)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Sets the data of a method of a type writer.
+
+ @param handle a handle on a type writer; must not be null
+
+ @param index a valid index into the range of methods of the given type writer
+
+ @param documentation the documentation of the method; must not be null
+
+ @param flags the flags of the method
+
+ @param name the name of the method; must not be null
+
+ @param returnTypeName the return type name of the method; must not be null
+
+ @param parameterCount the number of parameters of the method
+
+ @param exceptionCount the number of exceptions of the method
+
+ @return false iff an out-of-memory condition ocurred, in which case the type
+ writer is not modified
+
+ @since UDK 3.2.0
+ */
+sal_Bool SAL_CALL typereg_writer_setMethodData(
+ void * handle, sal_uInt16 index, rtl_uString const * documentation,
+ RTMethodMode flags, rtl_uString const * name,
+ rtl_uString const * returnTypeName, sal_uInt16 parameterCount,
+ sal_uInt16 exceptionCount)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Sets the data of a parameter of a method of a type writer.
+
+ @param handle a handle on a type writer; must not be null
+
+ @param methodIndex a valid index into the range of methods of the given type
+ writer
+
+ @param parameterIndex a valid index into the range of parameters of the given
+ method
+
+ @param flags the flags of the parameter
+
+ @param name the name of the parameter; must not be null
+
+ @param typeName the type name of the parameter; must not be null
+
+ @return false iff an out-of-memory condition ocurred, in which case the type
+ writer is not modified
+
+ @since UDK 3.2.0
+ */
+sal_Bool SAL_CALL typereg_writer_setMethodParameterData(
+ void * handle, sal_uInt16 methodIndex, sal_uInt16 parameterIndex,
+ RTParamMode flags, rtl_uString const * name, rtl_uString const * typeName)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Sets an exception type name of a method of a type writer.
+
+ @param handle a handle on a type writer; must not be null
+
+ @param methodIndex a valid index into the range of methods of the given type
+ writer
+
+ @param exceptionIndex a valid index into the range of exceptions of the given
+ method
+
+ @param typeName the exception type name; must not be null
+
+ @return false iff an out-of-memory condition ocurred, in which case the type
+ writer is not modified
+
+ @since UDK 3.2.0
+ */
+sal_Bool SAL_CALL typereg_writer_setMethodExceptionTypeName(
+ void * handle, sal_uInt16 methodIndex, sal_uInt16 exceptionIndex,
+ rtl_uString const * typeName)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Sets the data of a reference of a type writer.
+
+ @param handle a handle on a type writer; must not be null
+
+ @param index a valid index into the range of references of the given type
+ writer
+
+ @param documentation the documentation of the reference; must not be null
+
+ @param sort the sort of the reference
+
+ @param flags the flags of the reference
+
+ @param typeName the type name of the reference; must not be null
+
+ @return false iff an out-of-memory condition ocurred, in which case the type
+ writer is not modified
+
+ @since UDK 3.2.0
+ */
+sal_Bool SAL_CALL typereg_writer_setReferenceData(
+ void * handle, sal_uInt16 index, rtl_uString const * documentation,
+ RTReferenceType sort, RTFieldAccess flags, rtl_uString const * typeName)
+ SAL_THROW_EXTERN_C();
+
+/**
+ Returns the blob of a type writer.
+
+ @param handle a handle on a type writer; must not be null
+
+ @param size an out-parameter obtaining the size of the blob; must not be null
+
+ @return a (byte-aligned) pointer to the blob; the returned pointer and the
+ returned <code>size</code> remain valid until the next function is called on
+ the given type writer; if an out-of-memory condition occurs, null is returned
+ and <code>size</code> is not modified
+ */
+void const * SAL_CALL typereg_writer_getBlob(void * handle, sal_uInt32 * size)
+ SAL_THROW_EXTERN_C();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/registry/inc/registry/writer.hxx b/registry/inc/registry/writer.hxx
new file mode 100644
index 000000000000..50bf542024b8
--- /dev/null
+++ b/registry/inc/registry/writer.hxx
@@ -0,0 +1,303 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_registry_writer_hxx
+#define INCLUDED_registry_writer_hxx
+
+#include "registry/writer.h"
+#include "registry/refltype.hxx"
+#include "registry/types.h"
+#include "registry/version.h"
+
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+
+#include <new>
+
+namespace typereg {
+
+/// @HTML
+
+/**
+ A type writer working on a binary blob that represents a UNOIDL type.
+
+ <p>Instances of this class are not multi-thread&ndash;safe.</p>
+
+ @since UDK 3.2.0
+ */
+class Writer {
+public:
+ /**
+ Creates a type writer.
+
+ @param version the version of the created type writer; must not be
+ negative
+
+ @param documentation the documentation
+
+ @param fileName the file name (deprecated, use an empty string)
+
+ @param typeClass the type class of the created type writer
+
+ @param published whether the created type writer is published; for a type
+ class that cannot be published, this should be false
+
+ @param typeName the type name of the created type writer
+
+ @param superTypeCount the number of super types of the created type
+ writer
+
+ @param fieldCount the number of fields of the created type writer
+
+ @param methodCount the number of methods of the created type writer
+
+ @param referenceCount the number of references of the created type writer
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ Writer(
+ typereg_Version version, rtl::OUString const & documentation,
+ rtl::OUString const & fileName, RTTypeClass typeClass, bool published,
+ rtl::OUString const & typeName, sal_uInt16 superTypeCount,
+ sal_uInt16 fieldCount, sal_uInt16 methodCount,
+ sal_uInt16 referenceCount):
+ m_handle(
+ typereg_writer_create(
+ version, documentation.pData, fileName.pData, typeClass,
+ published, typeName.pData, superTypeCount, fieldCount,
+ methodCount, referenceCount))
+ {
+ if (m_handle == 0) {
+ throw std::bad_alloc();
+ }
+ }
+
+ /**
+ Destroys this <code>Writer</code> instance.
+ */
+ ~Writer() {
+ typereg_writer_destroy(m_handle);
+ }
+
+ /**
+ Sets the type name of a super type of this type writer.
+
+ @param index a valid index into the range of super types of this type
+ writer
+
+ @param typeName the super type name
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ void setSuperTypeName(sal_uInt16 index, rtl::OUString const & typeName) {
+ if (!typereg_writer_setSuperTypeName(m_handle, index, typeName.pData)) {
+ throw std::bad_alloc();
+ }
+ }
+
+ /**
+ Sets the data of a field of this type writer.
+
+ @param index a valid index into the range of fields of this type writer
+
+ @param documentation the documentation of the field
+
+ @param fileName the file name of the field (deprecated, use an empty string)
+
+ @param flags the flags of the field
+
+ @param name the name of the field
+
+ @param typeName the type name of the field
+
+ @param valueType the type of the value of the field
+
+ @param valueValue the value of the value of the field
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ void setFieldData(
+ sal_uInt16 index, rtl::OUString const & documentation,
+ rtl::OUString const & fileName, RTFieldAccess flags, rtl::OUString const & name,
+ rtl::OUString const & typeName, RTConstValue const & value)
+ {
+ if (!typereg_writer_setFieldData(
+ m_handle, index, documentation.pData, fileName.pData, flags,
+ name.pData, typeName.pData, value.m_type, value.m_value))
+ {
+ throw std::bad_alloc();
+ }
+ }
+
+ /**
+ Sets the data of a method of this type writer.
+
+ @param index a valid index into the range of methods of this type writer
+
+ @param documentation the documentation of the method
+
+ @param flags the flags of the method
+
+ @param name the name of the method
+
+ @param returnTypeName the return type name of the method
+
+ @param parameterCount the number of parameters of the method
+
+ @param exceptionCount the number of exceptions of the method
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ void setMethodData(
+ sal_uInt16 index, rtl::OUString const & documentation,
+ RTMethodMode flags, rtl::OUString const & name,
+ rtl::OUString const & returnTypeName, sal_uInt16 parameterCount,
+ sal_uInt16 exceptionCount)
+ {
+ if (!typereg_writer_setMethodData(
+ m_handle, index, documentation.pData, flags, name.pData,
+ returnTypeName.pData, parameterCount, exceptionCount))
+ {
+ throw std::bad_alloc();
+ }
+ }
+
+ /**
+ Sets the data of a parameter of a method of this type writer.
+
+ @param methodIndex a valid index into the range of methods of this type
+ writer
+
+ @param parameterIndex a valid index into the range of parameters of the
+ given method
+
+ @param flags the flags of the parameter
+
+ @param name the name of the parameter
+
+ @param typeName the type name of the parameter
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ void setMethodParameterData(
+ sal_uInt16 methodIndex, sal_uInt16 parameterIndex,
+ RTParamMode flags, rtl::OUString const & name,
+ rtl::OUString const & typeName)
+ {
+ if (!typereg_writer_setMethodParameterData(
+ m_handle, methodIndex, parameterIndex, flags, name.pData,
+ typeName.pData))
+ {
+ throw std::bad_alloc();
+ }
+ }
+
+ /**
+ Sets an exception type name of a method of this type writer.
+
+ @param methodIndex a valid index into the range of methods of this type
+ writer
+
+ @param exceptionIndex a valid index into the range of exceptions of the
+ given method
+
+ @param typeName the exception type name
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ void setMethodExceptionTypeName(
+ sal_uInt16 methodIndex, sal_uInt16 exceptionIndex,
+ rtl::OUString const & typeName)
+ {
+ if (!typereg_writer_setMethodExceptionTypeName(
+ m_handle, methodIndex, exceptionIndex, typeName.pData))
+ {
+ throw std::bad_alloc();
+ }
+ }
+
+ /**
+ Sets the data of a reference of this type writer.
+
+ @param handle a handle on a type writer
+
+ @param index a valid index into the range of references of this type
+ writer
+
+ @param documentation the documentation of the reference
+
+ @param sort the sort of the reference
+
+ @param flags the flags of the reference
+
+ @param typeName the type name of the reference
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ */
+ void setReferenceData(
+ sal_uInt16 index, rtl::OUString const & documentation,
+ RTReferenceType sort, RTFieldAccess flags,
+ rtl::OUString const & typeName)
+ {
+ if (!typereg_writer_setReferenceData(
+ m_handle, index, documentation.pData, sort, flags,
+ typeName.pData))
+ {
+ throw std::bad_alloc();
+ }
+ }
+
+ /**
+ Returns the blob of this type writer.
+
+ @param size an out-parameter obtaining the size of the blob
+
+ @return a (byte-aligned) pointer to the blob; the returned pointer and
+ the returned <code>size</code> remain valid until the next function is
+ called on this type writer
+
+ @exception std::bad_alloc is raised if an out-of-memory condition occurs
+ (in which case <code>siez</code> is not modified
+ */
+ void const * getBlob(sal_uInt32 * size) {
+ void const * p = typereg_writer_getBlob(m_handle, size);
+ if (p == 0) {
+ throw std::bad_alloc();
+ }
+ return p;
+ }
+
+private:
+ Writer(Writer &); // not implemented
+ void operator =(Writer); // not implemented
+
+ void * m_handle;
+};
+
+}
+
+#endif