diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-07-03 10:16:12 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-07-03 15:41:15 +0200 |
commit | 6556043364877c0ac74c07b509856dccfe52e43a (patch) | |
tree | 91e0ca5b30526e4ed130e944d90df2f3aa0a96f5 /registry | |
parent | 4cf3dd78870456f786d39e8946648550a655d9a3 (diff) |
Move module-private includes from include/registry/ to registry/
Change-Id: I72bdd6627a191a65d5c3b479c100e30442a8bb9e
Diffstat (limited to 'registry')
-rw-r--r-- | registry/Executable_regview.mk | 5 | ||||
-rw-r--r-- | registry/Library_reg.mk | 5 | ||||
-rw-r--r-- | registry/inc/registry.h | 440 | ||||
-rw-r--r-- | registry/source/keyimpl.hxx | 2 | ||||
-rw-r--r-- | registry/source/reflread.cxx | 2 | ||||
-rw-r--r-- | registry/source/reflread.hxx | 285 | ||||
-rw-r--r-- | registry/source/reflwrit.cxx | 2 | ||||
-rw-r--r-- | registry/source/reflwrit.hxx | 220 | ||||
-rw-r--r-- | registry/source/regimpl.cxx | 4 | ||||
-rw-r--r-- | registry/source/regimpl.hxx | 2 | ||||
-rw-r--r-- | registry/source/registry.cxx | 2 | ||||
-rw-r--r-- | registry/tools/regview.cxx | 2 |
12 files changed, 963 insertions, 8 deletions
diff --git a/registry/Executable_regview.mk b/registry/Executable_regview.mk index 12baef21b55b..62b46acfc975 100644 --- a/registry/Executable_regview.mk +++ b/registry/Executable_regview.mk @@ -9,6 +9,11 @@ $(eval $(call gb_Executable_Executable,regview)) +$(eval $(call gb_Executable_set_include,regview, \ + $$(INCLUDE) \ + -I$(SRCDIR)/registry/inc \ +)) + $(eval $(call gb_Executable_use_libraries,regview,\ sal \ reg \ diff --git a/registry/Library_reg.mk b/registry/Library_reg.mk index d389d86af730..7994d0284f17 100644 --- a/registry/Library_reg.mk +++ b/registry/Library_reg.mk @@ -14,6 +14,11 @@ $(eval $(call gb_Library_add_defs,reg,\ -DREG_DLLIMPLEMENTATION \ )) +$(eval $(call gb_Library_set_include,reg, \ + $$(INCLUDE) \ + -I$(SRCDIR)/registry/inc \ +)) + $(eval $(call gb_Library_use_external,reg,boost_headers)) $(eval $(call gb_Library_use_libraries,reg,\ diff --git a/registry/inc/registry.h b/registry/inc/registry.h new file mode 100644 index 000000000000..8af32faa94ec --- /dev/null +++ b/registry/inc/registry.h @@ -0,0 +1,440 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_REGISTRY_INC_REGISTRY_H +#define INCLUDED_REGISTRY_INC_REGISTRY_H + +#include <stddef.h> +#include <rtl/ustring.h> +#include <registry/regtype.h> +#include <registry/regdllapi.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. +*/ +REG_DLLPUBLIC 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 phOpenKey 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. +*/ +REG_DLLPUBLIC 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. +*/ +REG_DLLPUBLIC 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. +*/ +REG_DLLPUBLIC 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. +*/ +REG_DLLPUBLIC 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. +*/ +REG_DLLPUBLIC 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. +*/ +REG_DLLPUBLIC 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. +*/ +REG_DLLPUBLIC 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[in] 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[in] 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[out] pValueList points to an array of longs containing the data of the value. + @param[out] len specifies the len of pValueList. + @return REG_NO_ERROR if succeeds else an error code. +*/ +REG_DLLPUBLIC 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[in] 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[in] 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[in] pValueList points to an array of sal_Char* containing the data of the value. + @param[in] len specifies the len of pValueList. + @return REG_NO_ERROR if succeeds else an error code. +*/ +REG_DLLPUBLIC 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[in] 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[in] 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[in] pValueList points to an array of sal_Unicode* containing the data of the value. + @param[in] len specifies the len of pValueList. + @return REG_NO_ERROR if succeeds else an error code. +*/ +REG_DLLPUBLIC 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. +*/ +REG_DLLPUBLIC 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. +*/ +REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_getValue(RegKeyHandle hKey, + rtl_uString* keyName, + RegValue pData); + + +/** This function gets the long list value of a key. + + @param[in] 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[in] 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[out] pValueList a Pointer to a long value list which returns the data of the value. + @param[out] pLen returns the length of the value list. + @return REG_NO_ERROR if succeeds else an error code. +*/ +REG_DLLPUBLIC 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[in] hKey identifies a currently open key. The key whose value will be retrieved by this + function is a subkey of the key identified by hKey. + @param[in] keyName points to a null terminated string specifying the name of a key whose value + will be retrieved. If keyName is NULL, then the value of the key specified by + hKey will be retrieved. + @param[out] pValueList a Pointer to an ascii value list which returns the data of the value. + @param[out] pLen returns the length of the value list. + @return REG_NO_ERROR if succeeds else an error code. +*/ +REG_DLLPUBLIC 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[in] hKey identifies a currently open key. The key whose value will be retrieved by this + function is a subkey of the key identified by hKey. + @param[in] keyName points to a null terminated string specifying the name of a key whose value + will be retrieved. If keyName is NULL, then the value of the key specified by + hKey will be retrieved. + @param[out] pValueList a Pointer to an unicode value list which returns the data of the value. + @param[out] pLen returns the length of the value list. + @return REG_NO_ERROR if succeeds else an error code. +*/ +REG_DLLPUBLIC 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. +*/ +REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_freeValueList(RegValueType valueType, + RegValue pValueList, + sal_uInt32 len); + +/** This function resolves a keyname. + + @param[in] hKey identifies a currently open key. The key specified by keyName is a subkey + of the key identified by hKey. + @param[in] 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[in] firstLinkOnly ignored + @param[out] pResolvedName returns the resolved keyName. + @return REG_NO_ERROR if succeeds else an error code. + */ +REG_DLLPUBLIC 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. +*/ +REG_DLLPUBLIC 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. +*/ +REG_DLLPUBLIC 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. +*/ +REG_DLLPUBLIC 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. +*/ +REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_createRegistry(rtl_uString* registryName, + RegHandle* phRegistry); + + +/** This function opens the root key of a registry. + + @param hRegistry 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. +*/ +REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_openRootKey(RegHandle hRegistry, + RegKeyHandle* phRootKey); + + +/** This function returns the name of a registry. + + @param hRegistry 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. +*/ +REG_DLLPUBLIC 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. +*/ +REG_DLLPUBLIC 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, RegAccessMode::READONLY or RegAccessMode::READWRITE. + @return REG_NO_ERROR if succeeds else an error code. +*/ +REG_DLLPUBLIC 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. +*/ +REG_DLLPUBLIC 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. +*/ +REG_DLLPUBLIC 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. +*/ +REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_dumpRegistry(RegKeyHandle hKey); + +#ifdef __cplusplus +} +#endif + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/registry/source/keyimpl.hxx b/registry/source/keyimpl.hxx index ddfbac418482..148aded6f488 100644 --- a/registry/source/keyimpl.hxx +++ b/registry/source/keyimpl.hxx @@ -20,7 +20,7 @@ #ifndef INCLUDED_REGISTRY_SOURCE_KEYIMPL_HXX #define INCLUDED_REGISTRY_SOURCE_KEYIMPL_HXX -#include <registry/registry.h> +#include <registry.h> #include "regimpl.hxx" #include <rtl/ustring.hxx> diff --git a/registry/source/reflread.cxx b/registry/source/reflread.cxx index 8d14bf664117..1dc6a4794a03 100644 --- a/registry/source/reflread.cxx +++ b/registry/source/reflread.cxx @@ -27,7 +27,7 @@ #include <sal/types.h> #include <osl/endian.h> #include <osl/diagnose.h> -#include <registry/reflread.hxx> +#include <reflread.hxx> #include <sal/log.hxx> #include "registry/typereg_reader.hxx" diff --git a/registry/source/reflread.hxx b/registry/source/reflread.hxx new file mode 100644 index 000000000000..9cd9447a6f5f --- /dev/null +++ b/registry/source/reflread.hxx @@ -0,0 +1,285 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_REGISTRY_SOURCE_REFLREAD_HXX +#define INCLUDED_REGISTRY_SOURCE_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, 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(); + +#ifdef __cplusplus +} +#endif + +/** RegistryTypeReades reads a binary type blob. + + This class provides the necessary functions to read type information + 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, + 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); + + + /** 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; + + /** 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; + +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, + 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 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 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; + } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/registry/source/reflwrit.cxx b/registry/source/reflwrit.cxx index 3096b8356cf8..ea269295ebb5 100644 --- a/registry/source/reflwrit.cxx +++ b/registry/source/reflwrit.cxx @@ -26,7 +26,7 @@ #include "rtl/string.hxx" #include "rtl/ustring.hxx" -#include "registry/reflwrit.hxx" +#include "reflwrit.hxx" #include "registry/version.h" #include "registry/writer.h" diff --git a/registry/source/reflwrit.hxx b/registry/source/reflwrit.hxx new file mode 100644 index 000000000000..0025ab013b38 --- /dev/null +++ b/registry/source/reflwrit.hxx @@ -0,0 +1,220 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_REGISTRY_SOURCE_REFLWRIT_HXX +#define INCLUDED_REGISTRY_SOURCE_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(); + +#ifdef __cplusplus +} +#endif + +/** RegistryTypeWriter writes/creates a binary type blob. + + This class provides the necessary functions to write type information + 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); + + /** 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, + const RTConstValue& constValue = RTConstValue()); + + /** 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(); + +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, + const RTConstValue& constValue) +{ + m_pApi->setFieldData(m_hImpl, index, name.pData, typeName.pData, doku.pData, fileName.pData, access, constValue.m_type, constValue.m_value); +} + +inline const sal_uInt8* RegistryTypeWriter::getBlop() +{ + return m_pApi->getBlop(m_hImpl); +} + +inline sal_uInt32 RegistryTypeWriter::getBlopSize() +{ + return m_pApi->getBlopSize(m_hImpl); +} + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx index e20b41d13794..d31458af72bb 100644 --- a/registry/source/regimpl.cxx +++ b/registry/source/regimpl.cxx @@ -31,9 +31,9 @@ #include <unistd.h> #endif -#include <registry/reflread.hxx> +#include <reflread.hxx> -#include <registry/reflwrit.hxx> +#include <reflwrit.hxx> #include "registry/reader.hxx" #include "registry/refltype.hxx" diff --git a/registry/source/regimpl.hxx b/registry/source/regimpl.hxx index 6d38cb796947..e1cf2832238b 100644 --- a/registry/source/regimpl.hxx +++ b/registry/source/regimpl.hxx @@ -23,7 +23,7 @@ #include <set> #include <unordered_map> -#include <registry/registry.h> +#include <registry.h> #include <rtl/ustring.hxx> #include <osl/mutex.hxx> #include <store/store.hxx> diff --git a/registry/source/registry.cxx b/registry/source/registry.cxx index 345e0bf6f8be..bc73fcb63d10 100644 --- a/registry/source/registry.cxx +++ b/registry/source/registry.cxx @@ -18,7 +18,7 @@ */ -#include <registry/registry.h> +#include <registry.h> #include <registry/registry.hxx> #include <osl/process.h> diff --git a/registry/tools/regview.cxx b/registry/tools/regview.cxx index e48e0d8156e1..3682d9054012 100644 --- a/registry/tools/regview.cxx +++ b/registry/tools/regview.cxx @@ -18,7 +18,7 @@ */ -#include "registry/registry.h" +#include "registry.h" #include "fileurl.hxx" #include "rtl/ustring.hxx" |