diff options
author | Juergen Schmidt <jsc@openoffice.org> | 2001-11-15 17:01:32 +0000 |
---|---|---|
committer | Juergen Schmidt <jsc@openoffice.org> | 2001-11-15 17:01:32 +0000 |
commit | a8ceddd32cb6cf7a1d7aae5074f0c85f76f6ac4d (patch) | |
tree | bc3139c2cacf778fd22bd5f479e118104dd2e5ab /registry/inc | |
parent | 7bd35c2cc62e22ea36dacf8f76da493306e8887f (diff) |
#88337# review docu
Diffstat (limited to 'registry/inc')
-rw-r--r-- | registry/inc/registry/reflread.hxx | 214 | ||||
-rw-r--r-- | registry/inc/registry/refltype.hxx | 144 | ||||
-rw-r--r-- | registry/inc/registry/reflwrit.hxx | 143 | ||||
-rw-r--r-- | registry/inc/registry/registry.h | 370 | ||||
-rw-r--r-- | registry/inc/registry/registry.hxx | 390 | ||||
-rw-r--r-- | registry/inc/registry/regtype.h | 114 |
6 files changed, 1029 insertions, 346 deletions
diff --git a/registry/inc/registry/reflread.hxx b/registry/inc/registry/reflread.hxx index f294dff91c81..82b71be0bc23 100644 --- a/registry/inc/registry/reflread.hxx +++ b/registry/inc/registry/reflread.hxx @@ -2,9 +2,9 @@ * * $RCSfile: reflread.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: vg $ $Date: 2001-05-14 16:10:39 $ + * last change: $Author: jsc $ $Date: 2001-11-15 18:01:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -72,7 +72,7 @@ #include <salhelper/dynload.hxx> #endif -// Implememetation handle +/// Implememetation handle typedef void* TypeReaderImpl; /**************************************************************************** @@ -85,6 +85,12 @@ typedef void* TypeReaderImpl; extern "C" { #endif +/** specifies a collection of function pointers which represents the complete registry type reader C-API. + + The function pointers of this struct will be initialized when the library is loaded over + the load on call mechanism specified in 'salhelper/dynload.hxx'. 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); @@ -124,8 +130,17 @@ struct RegistryTypeReader_Api RTFieldAccess (TYPEREG_CALLTYPE *getReferenceAccess) (TypeReaderImpl, sal_uInt16); }; +/** specifies a function pointer of the initialization function which is called to initialize + the RegistryTypeReader_Api struct. + + */ typedef RegistryTypeReader_Api* (TYPEREG_CALLTYPE *InitRegistryTypeReader_Api)(void); +/** spedifies the name of the API initialization function. + + This function will be searched by the load on call mechanism specified + in 'salhelper/dynload.hxx'. +*/ #define REGISTRY_TYPE_READER_INIT_FUNCTION_NAME "initRegistryTypeReader_Api" #ifdef __cplusplus @@ -133,84 +148,267 @@ typedef RegistryTypeReader_Api* (TYPEREG_CALLTYPE *InitRegistryTypeReader_Api)(v #endif -/** RegistryTypeReaderLoader load the needed DLL for a RegistryTypeReader. - The loader can be checked if the DLL is loaded. If the DLL is loaded the - loader provides a valid Api for the RegistryTypeReader. +/** The RegistryTypeReaderLoader provides a load on call mechanism for the library + used for the registry type reader api. + + Furthermore it provides a reference counter for the library. When the last reference will be + destroyed the RegisteryTypeReaderLoader will unload the library. If the library is loaded the loader + provides a valid Api for the type reader. + @see salhelper::ODynamicLoader<> */ class RegistryTypeReaderLoader : public ::salhelper::ODynamicLoader<RegistryTypeReader_Api> { public: + /// Default constructor, try to load the registry library and initialize the needed Api. RegistryTypeReaderLoader() : ::salhelper::ODynamicLoader<RegistryTypeReader_Api> (::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SAL_MODULENAME_WITH_VERSION( "reg", LIBRARY_VERSION ) ) ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(REGISTRY_TYPE_READER_INIT_FUNCTION_NAME) )) {} + /// Destructor, decrease the refcount and unload the library if the refcount is 0. ~RegistryTypeReaderLoader() {} }; -/** RegistryTypeReader reads type informations from a blop. - Class is inline and use a load on call C-Api. +/** 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 load on call C-Api. */ class RegistryTypeReader { public: + /** Constructor using the registry Api directly. + + The constructor is used if the api is known. + @param pApi points to an initialized RegistryTypeReader_Api. + @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 RegistryTypeReader_Api* pApi, const sal_uInt8* buffer, sal_uInt32 bufferLen, sal_Bool copyData); + + /** Constructor using the loader mechanism. + + This constructor is called with a RegistryTypeReaderLoader. + The RegistryTypeReaderLoader loads the needed DLL and provides the needed + Api for the registry type reader. + @param rLoader references a valid RegistryTypeReaderLoader. + @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 RegistryTypeReaderLoader& rLoader, 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. + */ 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 dynamic loader which is used to hold the library. const ::salhelper::ODynamicLoader< RegistryTypeReader_Api > m_Api; + /// stores the handle of an implementation class TypeReaderImpl m_hImpl; }; diff --git a/registry/inc/registry/refltype.hxx b/registry/inc/registry/refltype.hxx index 347bd7a6c826..3319278d8917 100644 --- a/registry/inc/registry/refltype.hxx +++ b/registry/inc/registry/refltype.hxx @@ -2,9 +2,9 @@ * * $RCSfile: refltype.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: jsc $ $Date: 2001-05-18 15:30:58 $ + * last change: $Author: jsc $ $Date: 2001-11-15 18:01:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -64,6 +64,9 @@ Source Code Control System - Update $Log: not supported by cvs2svn $ + Revision 1.5 2001/05/18 15:30:58 jsc + #87233# insert enum value + Revision 1.4 2001/03/14 09:37:08 jsc remove vos dependencies @@ -149,6 +152,10 @@ #include <sal/types.h> #endif +/** specifies the type source of a binary type blob. + + Currently only RT_UNO_IDL type is used. + */ enum RTTypeSource { RT_UNO_IDL, @@ -156,67 +163,179 @@ enum RTTypeSource RT_JAVA }; +/** 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 special service). A singleton blob + can contain a base service, properties (fields), references to services or interfaces. + */ 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 }; +/** 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 + */ 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 +/// only to describe a union default label #define RT_ACCESS_DEFAULT 0x2000 +/** 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 }; +/** 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 }; +/** 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, + /// indicates a pure in parameter which is used by value RT_PARAM_IN, + /// indicates a pure out parameter which is used by reference RT_PARAM_OUT, + /// indicates a in and out parameter which is used also by reference RT_PARAM_INOUT }; +/** 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, @@ -233,6 +352,8 @@ enum RTValueType RT_TYPE_STRING }; +/** specifies a variable container for field values. + */ union RTConstValueUnion { sal_Bool aBool; @@ -248,21 +369,35 @@ union RTConstValueUnion const sal_Unicode* aString; }; +/** 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; } - ~RTConstValue() {}; + /// 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; @@ -272,6 +407,7 @@ struct RTUik 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 index e1cfbc1b852a..0edff26f5c1d 100644 --- a/registry/inc/registry/reflwrit.hxx +++ b/registry/inc/registry/reflwrit.hxx @@ -2,9 +2,9 @@ * * $RCSfile: reflwrit.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: vg $ $Date: 2001-05-14 16:10:39 $ + * last change: $Author: jsc $ $Date: 2001-11-15 18:01:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -72,7 +72,7 @@ #include <salhelper/dynload.hxx> #endif -// Implememetation handle +/// Implememetation handle typedef void* TypeWriterImpl; /**************************************************************************** @@ -85,6 +85,12 @@ typedef void* TypeWriterImpl; extern "C" { #endif +/** specifies a collection of function pointers which represents the complete registry type writer C-API. + + The function pointers of this struct will be initialized when the library is loaded over + the load on call mechanism specified in 'salhelper/dynload.hxx'. 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); @@ -103,8 +109,17 @@ struct RegistryTypeWriter_Api void (TYPEREG_CALLTYPE *setReferenceData) (TypeWriterImpl, sal_uInt16, rtl_uString*, RTReferenceType, rtl_uString*, RTFieldAccess); }; +/** specifies a function pointer of the initialization function which is called to initialize + the RegistryTypeWriter_Api struct. + + */ typedef RegistryTypeWriter_Api* (TYPEREG_CALLTYPE *InitRegistryTypeWriter_Api)(void); +/** spedifies the name of the API initialization function. + + This function will be searched by the load on call mechanism specified + in 'salhelper/dynload.hxx'. +*/ #define REGISTRY_TYPE_WRITER_INIT_FUNCTION_NAME "initRegistryTypeWriter_Api" #ifdef __cplusplus @@ -112,32 +127,54 @@ typedef RegistryTypeWriter_Api* (TYPEREG_CALLTYPE *InitRegistryTypeWriter_Api)(v #endif -/** RegistryTypeWriterLoader load the needed DLL for a RegistryTypeWriter. - The loader can be checked if the DLL is loaded. If the DLL is loaded the - loader provides a valid Api for the RegistryTypeWriter. +/** The RegistryTypeWriterLoader provides a load on call mechanism for the library + used for the registry type writer api. + + Furthermore it provides a reference counter for the library. When the last reference will be + destroyed the RegisteryTypeWriterLoader will unload the library. If the library is loaded the loader + provides a valid Api for the type writer. + @see salhelper::ODynamicLoader<> */ class RegistryTypeWriterLoader : public ::salhelper::ODynamicLoader<RegistryTypeWriter_Api> { public: + /// Default constructor, try to load the registry library and initialize the needed Api. RegistryTypeWriterLoader() : ::salhelper::ODynamicLoader<RegistryTypeWriter_Api> (::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SAL_MODULENAME_WITH_VERSION( "reg", LIBRARY_VERSION ) ) ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(REGISTRY_TYPE_WRITER_INIT_FUNCTION_NAME) )) {} + /// Destructor, decrease the refcount and unload the library if the refcount is 0. ~RegistryTypeWriterLoader() {} }; -/** RegistryTypeWriter writes type informations into a blop. - Class is inline and use a load on call C-Api. +/** 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 load on call C-Api. */ class RegistryTypeWriter { public: + /** Constructor using the registry Api directly. + + The constructor is used if the api is known. + @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(const RegistryTypeWriter_Api* pApi, RTTypeClass RTTypeClass, const ::rtl::OUString& typeName, @@ -146,6 +183,21 @@ public: sal_uInt16 methodCount, sal_uInt16 referenceCount); + /** Constructor using the loader mechanism. + + This constructor is called with a RegistryTypeWriterLoader. + The RegistryTypeWriterLoader loads the needed DLL and provides the needed + Api for the registry type writer. + @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(const RegistryTypeWriterLoader& rLoader, RTTypeClass RTTypeClass, const ::rtl::OUString& typeName, @@ -154,17 +206,49 @@ public: 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, @@ -173,6 +257,16 @@ public: 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, @@ -181,19 +275,49 @@ public: 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, @@ -202,8 +326,11 @@ public: protected: + /// stores the registry type writer Api. const RegistryTypeWriter_Api* m_pApi; + /// stores the dynamic loader which is used to hold the library. const ::salhelper::ODynamicLoader< RegistryTypeWriter_Api > m_Api; + /// stores the handle of an implementation class TypeWriterImpl m_hImpl; }; diff --git a/registry/inc/registry/registry.h b/registry/inc/registry/registry.h index 392fb8b82fe2..9705b108c68a 100644 --- a/registry/inc/registry/registry.h +++ b/registry/inc/registry/registry.h @@ -2,9 +2,9 @@ * * $RCSfile: registry.h,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $ + * last change: $Author: jsc $ $Date: 2001-11-15 18:01:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -75,15 +75,15 @@ extern "C" { #endif /* __cplusplus */ -/** This function creates the specified key. If the key already exists in the registry, - the function opens it. - @param hKey Identifies a currently open key. The key opened or created by this function - is a subkey of the key identified by hKey. - @param keyName Points to a null terminated string specifying the name of a key that this - function opens or creates. - @param phNewKey Points to a variable that receives the handle of the opened or created key. - Memory to store this variable is allocated and is freed with the function - closeRegKey. If the function fails, phNewKey is NULL. +/** 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, @@ -92,13 +92,13 @@ RegError REGISTRY_CALLTYPE reg_createKey(RegKeyHandle hKey, /** This function opens the specified key. - @param hKey Identifies a currently open key. The key opened by this function - is a subkey of the key identified by hKey - @param keyName Points to a null terminated string specifying the name of a key that this - function opens. - @param phNewKey Points to a variable that receives the handle of the opened key. - Memory to store this variable is allocated and is freed with the function - reg_closeKey. If the function fails, phNewKey is NULL. + + @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, @@ -108,14 +108,15 @@ RegError REGISTRY_CALLTYPE reg_openKey(RegKeyHandle hKey, /** This function opens all subkeys of the specified key. - @param hKey Identifies a currently open key. The key that subkeys opened by this - function is a subkey of the key identified by hKey - @param keyName Points to a null terminated string specifying the name of a key that subkeys - this function opens. - @param pphSubKeys Points to a variable that receives an array of of all opened subkeys. - Memory to store this variable is allocated and is freed with the function - reg_closeSubKeys. If the function fails, pphSubKeys is NULL. - @param pnSubKeys Specified the length of the array (the number of open subkeys). + + @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, @@ -124,10 +125,11 @@ RegError REGISTRY_CALLTYPE reg_openSubKeys(RegKeyHandle hKey, sal_uInt32* pnSubKeys); -/** This function close all subkeys specified in the array. - @param phSubKeys Points to a variable that containss an array of of all opened subkeys. - The allocated memory of pphSubKeys and all open subkeys is freed. - @param nSubKeys Specified the length of the array (the number of subkeys to closed). +/** 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, @@ -135,10 +137,11 @@ RegError REGISTRY_CALLTYPE reg_closeSubKeys(RegKeyHandle* phSubKeys, /** This function deletes the specified key. - @param hKey Identifies a currently open key. The key deleted by this function - is a subkey of the key identified by hKey - @param keyName Points to a null terminated string specifying the name of a key that this - function deletes. + + @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, @@ -146,29 +149,32 @@ RegError REGISTRY_CALLTYPE reg_deleteKey(RegKeyHandle hKey, /** This function closes the specified key. - @param hKey Identifies a currently open key. The key is closed by this function. - The memory of the variable specifying the key is freeing. + + @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 the key. - @param hKey Identifies a currently open key which name will returned. +/** 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. */ const RegError REGISTRY_CALLTYPE reg_getKeyName(RegKeyHandle hKey, rtl_uString** pKeyName); -/** This function sets an value under the specified key. - @param hKey Identifies a currently open key. The key which value is setted by this - function is a subkey of the key identified by hKey. - @param keyName Points to a null terminated string specifying the name of a key which value - is set by this function. If keyName is NULL, the value is set for the key - specified by hKey. - @param valueType Specified the type of the value. - @param pData Points to a memory block containing the current data for the value. - @param valueSize Specified the size of pData in bytes +/** 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, @@ -178,12 +184,13 @@ RegError REGISTRY_CALLTYPE reg_setValue(RegKeyHandle hKey, sal_uInt32 valueSize); -/** This function sets an long list value under the key. - @param keyName Points to a null terminated string specifying the name of a key which value - is set by this function. If keyName is NULL, the value is set for the key - specified by hKey. - @param pValueList Points to an array of longs containing the current data for the value. - @param len Specified the len of pValueList. +/** 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, @@ -192,12 +199,13 @@ RegError REGISTRY_CALLTYPE reg_setLongListValue(RegKeyHandle hKey, sal_uInt32 len); -/** This function sets an ascii list value under the key. - @param keyName Points to a null terminated string specifying the name of a key which value - is set by this function. If keyName is NULL, the value is set for the key - specified by hKey. - @param pValueList Points to an array of sal_Char* containing the current data for the value. - @param len Specified the len of pValueList. +/** 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, @@ -206,12 +214,13 @@ RegError REGISTRY_CALLTYPE reg_setStringListValue(RegKeyHandle hKey, sal_uInt32 len); -/** This function sets an unicode string list value under the key. - @param keyName Points to a null terminated string specifying the name of a key which value - is set by this function. If keyName is NULL, the value is set for the key - specified by hKey. - @param pValueList Points to an array of sal_Unicode* containing the current data for the value. - @param len Specified the len of pValueList. +/** 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, @@ -220,14 +229,15 @@ RegError REGISTRY_CALLTYPE reg_setUnicodeListValue(RegKeyHandle hKey, sal_uInt32 len); -/** This function gets info about type and size of the value. - @param hKey Identifies a currently open key. The key which value info is getted by this - function is a subkey of the key identified by hKey. - @param keyName Points to a null terminated string specifying the name of a key which value - is get by this function. If keyName is NULL, the value info is get from the - key specified by hKey. - @param pValueType Specified the type of the value. - @param pValueSize Specified the size of pData in bytes +/** 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, @@ -236,13 +246,14 @@ RegError REGISTRY_CALLTYPE reg_getValueInfo(RegKeyHandle hKey, sal_uInt32* pValueSize); -/** This function gets the value under the specified key. - @param hKey Identifies a currently open key. The key which value is getted by this - function is a subkey of the key identified by hKey. - @param keyName Points to a null terminated string specifying the name of a key which value - is get by this function. If keyName is NULL, the value is get from the key - specified by hKey. - @param pData Points to an allocated memory block receiving the current data for the value. +/** 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, @@ -250,12 +261,13 @@ RegError REGISTRY_CALLTYPE reg_getValue(RegKeyHandle hKey, RegValue pData); -/** This function gets the value under the specified key. - @param keyName Points to a null terminated string specifying the name of a key which value - is get by this function. If keyName is NULL, the value is get from the key - specified by hKey. - @param pValueList A Pointer to a long value list. - @param pLen Specifies the length of the value list. +/** 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, @@ -264,12 +276,13 @@ RegError REGISTRY_CALLTYPE reg_getLongListValue(RegKeyHandle hKey, sal_uInt32* pLen); -/** This function gets the value under the specified key. - @param keyName Points to a null terminated string specifying the name of a key which value - is get by this function. If keyName is NULL, the value is get from the key - specified by hKey. - @param pValueList A Pointer to a ascii value list. - @param pLen Specifies the length of the value list. +/** 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, @@ -278,12 +291,13 @@ RegError REGISTRY_CALLTYPE reg_getStringListValue(RegKeyHandle hKey, sal_uInt32* pLen); -/** This function gets the value under the specified key. - @param keyName Points to a null terminated string specifying the name of a key which value - is get by this function. If keyName is NULL, the value is get from the key - specified by hKey. - @param pValueList A Pointer to a unicode value list. - @param pLen Specifies the length of the value list. +/** 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, @@ -292,38 +306,76 @@ RegError REGISTRY_CALLTYPE reg_getUnicodeListValue(RegKeyHandle hKey, sal_uInt32* pLen); -/** This function free a value list. - @param valueType Specifies the type of the list members. - @param pValueList A Pointer to value list. - @param pLen Specifies the length of the value list. +/** 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 creates a link with the specified link name and link target. + + Links in the registry are similar to links in the UNIX fielsystem. If a link will be opened, + the link target will be resolved and the key speciefied by the link target will be opened. + @param hKey identifies a currently open key. The link which will be created is a subkey + of the key identified by hKey. + @param linkName points to a null terminated string specifying the name of the new link. + @param linkTarget points to a null terminated string specifying the link target of the new link. + The linktarget must specify a valid name of an existing key. The linktarget itself + can contain links in the full qualified name. All links will be resolved if the + link will be opened. + @return REG_NO_ERROR if succeeds else an error code. +*/ RegError REGISTRY_CALLTYPE reg_createLink(RegKeyHandle hKey, rtl_uString* linkName, rtl_uString* linkTarget); +/** This function deletes a link with the specified linkname. + + @param hKey identifies a currently open key. The link which will be deleted is a subkey + of the key identified by hKey. + @param linkName points to a null terminated string specifying the name of the link. + @return REG_NO_ERROR if succeeds else an error code. +*/ 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 represents a link + @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 returns the linktarget of a link. + + @param linkName points to a null terminated string specifying the name of the link which + linktarget will be returned. + @param pLinkTarget contains the linktarget if succeeds else an empty string. + @return REG_NO_ERROR if succeeds else an error code. +*/ RegError REGISTRY_CALLTYPE reg_getLinkTarget(RegKeyHandle hKey, rtl_uString* linkName, rtl_uString** pLinkTarget); -/** This function will resolved all or only the first link of a keyname +/** This function resolves all or only the first link of a keyname. + and returns the resolved keyName in pResolvedName. - @param hKey Identifies a currently open key. - @param keyName Points to a null terminated string specifying the relativ name of a key. - The name of rKey together with keyName will be resolved from links. - If keyName is NULL the registry information under the key specified by rKey - is saved in the specified file. + @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 resolved from links. @return REG_NO_ERROR if succeeds else an error code. */ RegError REGISTRY_CALLTYPE reg_getResolvedKeyName(RegKeyHandle hKey, @@ -331,14 +383,16 @@ RegError REGISTRY_CALLTYPE reg_getResolvedKeyName(RegKeyHandle hKey, sal_Bool firstLinkOnly, rtl_uString** pResolvedName); -/** This function loads registry information from a specified file and save it under the +/** This function loads registry information from a file and save it under the specified keyName. - @param hKey Specifies the key where the subkey will be created. - @param keyName Points to a null terminated string specifying the name of the created subkey. - If keyName is NULL the registry information is saved under the key specified - by hKey. - @param regFileName Points to a null terminated string specifying the file containing the - registry information. + + @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, @@ -346,15 +400,16 @@ RegError REGISTRY_CALLTYPE reg_loadKey(RegKeyHandle hKey, rtl_uString* regFileName); -/** This function saves the registry information from the specified key and all subkeys and save - it in the specified file. - @param hKey Identifies a currently open key. The key which inforamtion is saved by this - function is a subkey of the key identified by hKey. - @param keyName Points to a null terminated string specifying the name of the subkey. +/** 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 - is saved in the specified file. - @param regFileName Points to a null terminated string specifying the file containing the - registry information. + 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, @@ -362,15 +417,17 @@ RegError REGISTRY_CALLTYPE reg_saveKey(RegKeyHandle hKey, rtl_uString* regFileName); -/** This function merges the registry information from the specified key and the registry - information of the specified file. Existing keys will extended. - @param hKey Identifies a currently open key. The key which inforamtion is merged by this - function is a subkey of the key identified by hKey. - @param keyName Points to a null terminated string specifying the name of the subkey. +/** 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 information from the specified file. - @param regFileName Points to a null terminated string specifying the file containing the - registry information. + 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. @@ -383,41 +440,47 @@ RegError REGISTRY_CALLTYPE reg_mergeKey(RegKeyHandle hKey, /** This function creates a new registry with the specified name and creates a root key. - @param registryName Points to a null terminated string specifying the name of the new registry. - @param phRegistry Points to a variable that receives the handle of the created registry. + + @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 the sepcified registry. - @param hReg Identifies a currently open registry which rootKey will returned. - @param phRootKey Points to a variable that receives the handle of the open root key. +/** 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 the registry. - @param hReg Identifies a currently open registry which name will returned. - @param pName name if succeeds else an empty string. +/** 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. */ const RegError REGISTRY_CALLTYPE reg_getName(RegHandle hRegistry, rtl_uString** pName); /** This function returns the access mode of the registry. - @param hReg Identifies a currently open registry. + + @param hReg identifies a currently open registry. @return TRUE if accessmode is read only else FALSE. */ sal_Bool REGISTRY_CALLTYPE reg_isReadOnly(RegHandle hReg); /** This function opens a registry with the specified name. - @param registryName Identifies a registry name. - @param phRegistry Points to a variable that receives the handle of the opened registry. - @param accessMode specify the accessmode for the registry, REG_READONLY or REG_READWRITE. + + @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, @@ -425,25 +488,30 @@ RegError REGISTRY_CALLTYPE reg_openRegistry(rtl_uString* registryName, RegAccessMode accessMode); -/** This function close the specified registry. - @param hRegistry Identifies a currently open registry. +/** 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 destroy the specified registry. - @param hRegistry Identifies a currently open registry. - @param registryName Identifies a registry name, if the name is NULL the registry - itselfs will be destroyed. +/** 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 dump the content under the open key to stdout - @param hKey Identifies a currently open key which subtree is dumped. +/** This function reports the complete registry information of a key and all of its subkeys. + + All information which are available (keynames, value types, values, linknames, linktargets, ...) + 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); diff --git a/registry/inc/registry/registry.hxx b/registry/inc/registry/registry.hxx index 6041e27181aa..7124b4180479 100644 --- a/registry/inc/registry/registry.hxx +++ b/registry/inc/registry/registry.hxx @@ -2,9 +2,9 @@ * * $RCSfile: registry.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: jsc $ $Date: 2001-05-18 15:31:42 $ + * last change: $Author: jsc $ $Date: 2001-11-15 18:01:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,6 +73,12 @@ extern "C" { #endif +/** specifies a collection of function pointers which represents the complete registry C-API. + + The function pointers of this struct will be initialized when the library is loaded over + the load on call mechanism specified in 'salhelper/dynload.hxx'. This funtions pointers are + used by the C++ wrapper to call the C-API. +*/ struct Registry_Api { void (REGISTRY_CALLTYPE *acquire) (RegHandle); @@ -117,8 +123,17 @@ struct Registry_Api RegError (REGISTRY_CALLTYPE *freeKeyNames) (rtl_uString**, sal_uInt32); }; +/** specifies a function pointer of the initialization function which is called to initialize + the Registry_Api struct. + + */ typedef Registry_Api* (REGISTRY_CALLTYPE *InitRegistry_Api)(void); +/** spedifies the name of the API initialization function. + + This function will be searched by the load on call mechanism specified + in 'salhelper/dynload.hxx'. +*/ #define REGISTRY_INIT_FUNCTION_NAME "initRegistry_Api" #ifdef __cplusplus @@ -130,41 +145,47 @@ class RegistryKey; //----------------------------------------------------------------------------- -/** RegistryLoader load the needed DLL for the registry. - The loader can be checked if the DLL is loaded. If the DLL is loaded the - loader provides a valid Api for the registry. +/** The RegistryLoader provides a load on call mechanism for the registry library. + + Furthermore it provides a reference counter for the library. When the last reference will be + destroyed the RegisteryLoader will unload the library. If the library is loaded the loader + provides a valid Api for the registry. + @see salhelper::ODynamicLoader<> */ class RegistryLoader : public ::salhelper::ODynamicLoader<Registry_Api> { public: - /// Default constructor, try to load the registry DLL and initialize the needed api. + /// Default constructor, try to load the registry library and initialize the needed Api. RegistryLoader() : ::salhelper::ODynamicLoader<Registry_Api> (::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SAL_MODULENAME_WITH_VERSION( "reg", LIBRARY_VERSION ) ) ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(REGISTRY_INIT_FUNCTION_NAME) )) {} - /// Destructor, decrease the refcount and unload the DLL if the refcount is 0. + /// Destructor, decrease the refcount and unload the library if the refcount is 0. ~RegistryLoader() {} }; -/** Registry read and write information in a registry file. - Class is inline and use a load on call C-Api. +/** The Registry provides the functionality to read and write information in a registry file. + + The class is implemented inline and use a load on call C-Api. */ class Registry { public: - /** Constructor. - This constructor is called with a valid api for the registry. - The constructor is used if the api is known. Use open() or create() + /** Constructor using the registry Api directly. + + This constructor is called with a valid Api for the registry. + The constructor is used if the Api is known. Use open() or create() to initialize the registry with a valid registry data file. */ inline Registry(const Registry_Api* pApi); - /** Constructor. + /** Constructor using the loader mechanism. + This constructor is called with a RegisterLoader for the registry. - The RegistryLoader load the needed DLL and provide the needed api for + The RegistryLoader loads the needed DLL and provides the needed Api for the registry. Use open() or create() to initialize the registry with a valid registry data file. */ @@ -179,54 +200,61 @@ public: /// Assign operator inline Registry& operator = (const Registry& toAssign); - /// isValid checks if the registry points to a valid registry data file. + /// checks if the registry points to a valid registry data file. inline sal_Bool isValid() const; - /** isReadOnly returns the access mode of the registry. - @return TRUE if accessmode is readonly else FALSE. + /** returns the access mode of the registry. + + @return TRUE if the access mode is readonly else FALSE. */ inline sal_Bool isReadOnly() const; - /** openRootKey opens the root key of the registry. - @param rRootKey reference on a RegistryKey which is filled with the rootkey. + /** 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); - /// getName returns the name of the current registry data file. + /// returns the name of the current registry data file. inline ::rtl::OUString getName(); - /** This function creates a new registry with the specified name and creates a root key. + /** creates a new registry with the specified name and creates a root key. + @param registryName specifies the name of the new registry. @return REG_NO_ERROR if succeeds else an error code. */ inline RegError create(const ::rtl::OUString& registryName); - /** This function opens a registry with the specified name. If the registry alreday points - to a valid registry, the old regitry will be closed. - @param registryName Identifies a registry name. - @param accessMode Specifies the accessmode for the registry, REG_READONLY or REG_READWRITE. + /** 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); - /// close explicitly the current registry data file + /// closes explicitly the current registry data file. inline RegError close(); - /** This function destroy the specified registry. - @param registryName Identifies a registry name, if the name is an empty string the registry - itselfs will be destroyed. + /** 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); - /** This function loads registry information from a specified file and save it under the + /** loads registry information from a specified file and save it under the specified keyName. - @param rKey Specifies the key where the subkey will be created. - @param keyName specifies the name of the subkey. - If keyName is an empty string the registry information is saved under the key - specified by rKey. + + @param 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. */ @@ -234,11 +262,12 @@ public: const ::rtl::OUString& keyName, const ::rtl::OUString& regFileName); - /** This function saves the registry information from the specified key and all subkeys and save + /** saves the registry information of the specified key and all subkeys and save it in the specified file. - @param rKey Identifies a currently open key. The key which inforamtion is saved by this - function is a subkey of the key identified by hKey. - @param keyName specifies the name of the subkey. + + @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. @@ -248,17 +277,19 @@ public: const ::rtl::OUString& keyName, const ::rtl::OUString& regFileName); - /** This function merges the registry information from the specified key and the registry - information of the specified file. Existing keys will extended. - @param rKey Identifies a currently open key. The key which inforamtion is merged by this - function is a subkey of the key identified by hKey. - @param keyName specifies the name of the subkey. + /** 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 returns an error the registry will + @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, @@ -267,8 +298,11 @@ public: sal_Bool bWarnings = sal_False, sal_Bool bReport = sal_False); - /** This function dump the content under the open key to stdout - @param rKey Identifies a currently open key which subtree is dumped. + /** This function reports the complete registry information of a key and all of its subkeys. + + All information which are available (keynames, value types, values, linknames, linktargets, ...) + 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); @@ -277,19 +311,24 @@ public: 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 dynamic loader which is used to hold the library. ::salhelper::ODynamicLoader< Registry_Api > m_Api; + /// stores the handle of the underlying registry file on which most of the functions work. RegHandle m_hImpl; }; //----------------------------------------------------------------------------- -/** RegistryKeyArray presents an array of open keys. - RegistryKeyArray is a helper class to work with an array of subkeys. +/** RegistryKeyArray represents an array of open keys. + + RegistryKeyArray is a helper class to work with an array of keys. */ class RegistryKeyArray { @@ -297,28 +336,39 @@ public: /// Default constructor inline RegistryKeyArray(); - /// Destructor + /// Destructor, all subkeys will be closed. inline ~RegistryKeyArray(); - /// This function returns the open key sepecified with index. + /// returns the open key specified by index. inline RegistryKey getElement(sal_uInt32 index); - /// This function returns the length of the array. + /// 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 presents an array of subkey names. - RegistryKeyNames is a helper class to work with an array of subkeys. +/** RegistryKeyNames represents an array of key names. + + RegistryKeyNames is a helper class to work with an array of key names. */ class RegistryKeyNames { @@ -326,28 +376,39 @@ public: /// Default constructor inline RegistryKeyNames(); - /// Destructor + /// Destructor, the internal array with key names will be deleted. inline ~RegistryKeyNames(); - /// This function returns the name of the key sepecified with index. + /// returns the name of the key sepecified by index. inline ::rtl::OUString getElement(sal_uInt32 index); - /// This function returns the length of the array. + /// 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 presents an value list of the specified type. +/** RegistryValueList represents a value list of the specified type. + RegistryValueList is a helper class to work with a list value. */ template<class ValueType> @@ -361,7 +422,7 @@ public: , m_registry(NULL) {} - /// Destructor + /// Destructor, the internal value list will be freed. ~RegistryValueList() { if (m_pValueList) @@ -370,7 +431,7 @@ public: } } - /// This function returns the value of the list with the sepecified index. + /// returns the value of the list specified by index. ValueType getElement(sal_uInt32 index) { if (m_registry.isValid() && index < m_length) @@ -382,7 +443,7 @@ public: } } - /// This function returns the length of the list. + /// returns the length of the list. sal_uInt32 getLength() { return m_length; @@ -390,6 +451,13 @@ public: 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) { @@ -399,15 +467,22 @@ protected: 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 read and write information for the specified key in a 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 @@ -419,80 +494,89 @@ public: /// Copy constructor inline RegistryKey(const RegistryKey& toCopy); - /// Destructor. The Destructor close the key if it is open. + /// Destructor, close the key if it references an open one. inline ~RegistryKey(); /// Assign operator inline RegistryKey& operator = (const RegistryKey& toAssign); - /// isValid checks if the key points to a valid registry key. + /// checks if the key points to a valid registry key. inline sal_Bool isValid() const; - /** isReadOnly returns the access mode of the key. - @return TRUE if accessmode is read only else FALSE. + /** returns the access mode of the key. + + @return TRUE if access mode is read only else FALSE. */ inline sal_Bool isReadOnly() const; - /// getName returns the full name of the key beginning with the rootkey. + /// returns the full qualified name of the key beginning with the rootkey. inline ::rtl::OUString getName(); - /** This function creates the specified key. If the key already exists in the registry, - the function opens it. + /** 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 Reference a RegistryKey which will be filled with the new or open key. + @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); - /** This function opens the specified key. - @param keyName Points to a null terminated string specifying the name of a key that this - function opens. - @param rOpenKey Reference a RegistryKey which will be filled with the open key. + /** 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); - /** This function returns an array with all subkeys. The subkeys will be open. - @param keyName Points to a null terminated string specifying the name of a key. - @param rSubKeys Reference a RegistryKeyArray which will be filled with open subkeys. + /** 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); - /** This function opens all subkeys of the key. - @param keyName Points to a null terminated string specifying the name of a key that subkeys - this function opens. - @param rSubKeyNames Reference a RegistryKeyNames array which will be filled with the open subkeys. + /** 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); - /** This function close all subkeys specified in the array. - @param rSubKeys Reference a RegistryKeyArray which contains the open subkeys. + /** 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); - /** This function deletes the specified key. + /** deletes the specified key. + @param keyName specifies the name of the key which will be deleted. @return REG_NO_ERROR if succeeds else an error code. */ inline RegError deleteKey(const ::rtl::OUString& keyName); - /// close explicitly the current key + /// closes explicitly the current key inline RegError closeKey(); - /** This function sets an value under the key. - @param keyName specifies the name of the key which value is set by this function. - If keyName is an empty string, the value is set for the key + /** 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 Specified the type of the value. - @param pData Points to a memory block containing the current data for the value. - @param valueSize Specified the size of pData in bytes + @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, @@ -500,134 +584,180 @@ public: RegValue pValue, sal_uInt32 valueSize); - /** This function sets an long list value under the key. - @param keyName specifies the name of the key which value is set by this function. - If keyName is an empty string, the value is set for the key + /** 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 current data for the value. - @param len Specified the len of pValueList. + @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); - /** This function sets an ascii list value under the key. - @param keyName specifies the name of the key which value is set by this function. - If keyName is an empty string, the value is set for the key + /** 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 current data for the value. - @param len Specified the len of pValueList. + @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); - /** This function sets an unicode string list value under the key. - @param keyName specifies the name of the key which value is set by this function. - If keyName is an empty string, the value is set for the key + /** 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 current data for the value. - @param len Specified the len of pValueList. + @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); - /** This function gets info about type and size of the value. - @param keyName specifies the name of the key which value is set by this function. - If keyName is an empty string, the value is set for the key - specified by hKey. - @param pValueType Specified the type of the value. - @param pValueSize Specified the size of pData in bytes or the length of a list value. + /** 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); - /** This function gets the value under the specified key. - @param keyName specifies the name of the key which value is get by this function. + /** 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 current data for the value. + @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); - /** This function gets the value under the specified key. - @param keyName specifies the name of the key which value is get by this function. + /** 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 Reference a RegistryValueList which will be filled with the ascii values. + @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); - /** This function gets the value under the specified key. - @param keyName specifies the name of the key which value is get by this function. + /** 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 Reference a RegistryValueList which will be filled with the ascii values. + @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); - /** This function gets the value under the specified key. - @param keyName specifies the name of the key which value is get by this function. + /** 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. + @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); + /** creates a new link with the specified name and target. + @param linkName specifies the name of link + @param linkTarget specifies a full qualified keyname as target for the link. + @return REG_NO_ERROR if succeeds else an error code. + */ inline RegError createLink(const ::rtl::OUString& linkName, const ::rtl::OUString& linkTarget); + /** deletes an existing link. + + @param linkName specifies the name of link + @return REG_NO_ERROR if succeeds else an error code. + */ inline RegError deleteLink(const ::rtl::OUString& linkName); + /** returns the type of the specified key if it is a link or a real key. + + @param name specifies the name of the key or link. + @param pKeyType returns the type of the key. + @return REG_NO_ERROR if succeeds else an error code. + */ inline RegError getKeyType(const ::rtl::OUString& name, RegKeyType* pKeyType) const; + /** returns the target of the specified link. + + @param linkName specifies the name of link. + @param rLinkTarget returns the target keyname of the link. + @return REG_NO_ERROR if succeeds else an error code. + */ inline RegError getLinkTarget(const ::rtl::OUString& linkName, ::rtl::OUString& rLinkTarget) const; - /** This function will resolved all or only the first link of a keyname - and returns the resolved keyName in rResolvedName. - @param keyName specifies the relativ name of the key which name will be resolved. + /** resolves all or only the first link of a keyname. + + The function resolves either only the first link or it resolves all links + which exists in the keyname or recursive in the resolved parts. + @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. @return REG_NO_ERROR if succeeds else an error code. */ inline RegError getResolvedKeyName(const ::rtl::OUString& keyName, sal_Bool firstLinkOnly, ::rtl::OUString& rResolvedName) const; - /** getRegistryName returns the name of the current registry in which - the key is defined. - */ + /// returns the name of the registry in which the key is defined. inline ::rtl::OUString getRegistryName(); - /// getRegistry returns the registry in which the key is defined. + /// 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; }; diff --git a/registry/inc/registry/regtype.h b/registry/inc/registry/regtype.h index 7ab181197c15..620efbb6640a 100644 --- a/registry/inc/registry/regtype.h +++ b/registry/inc/registry/regtype.h @@ -2,9 +2,9 @@ * * $RCSfile: regtype.h,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: kr $ $Date: 2001-05-14 09:28:19 $ + * last change: $Author: jsc $ $Date: 2001-11-15 18:01:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,117 +74,141 @@ // 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; -#define REG_READONLY 0x0001 // allow read accesses only -#define REG_READWRITE 0x0002 // allow read and write accesses +/// 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. -/// RegKeyType specify the type of the key, if it is a real key or a link + 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. The mechanism is similar to links in a UNIX filesystem. +*/ enum RegKeyType { - /// The key is a real key + /// represents a real key RG_KEYTYPE, - /// The key is a link + /// represents a link RG_LINKTYPE }; -/// RegValueType specify the type of the value of a key +/** 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 + /// 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 + /// The key has a value of type ascii string RG_VALUETYPE_STRING, - /// The key has a value of type unicode + /// 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 list + /// The key has a value of type ascii string list RG_VALUETYPE_STRINGLIST, - /// The key has a value of type unicode list + /// The key has a value of type unicode string list RG_VALUETYPE_UNICODELIST }; -/// RegError specify the possible error codes +/// specifies the possible error codes which can occur using the registry API. enum RegError { - /// no error + /// no error. REG_NO_ERROR, - /// internal registry error + /// internal registry error. REG_INTERNAL_ERROR, - /// registry is not open + /// registry is not open. REG_REGISTRY_NOT_OPEN, - /// registry does not exists + /// registry does not exists. REG_REGISTRY_NOT_EXISTS, - /// registry is readonly + /// registry is open with readonly access rights. REG_REGISTRY_READONLY, - /// destroy registry failed. Ther are may be any open keys. + /// destroy a registry failed. There are may be any open keys. REG_DESTROY_REGISTRY_FAILED, - /** registry cannot open for readwrite because the registry is already - open for readwrite anywhere. + /** 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 a invalid state or the registry does not point to - a valid registry data file + /** registry is in an invalid state or the registry does not point to + a valid registry data file. */ REG_INVALID_REGISTRY, - /// The key is not open + /// the key or key handle points to an invalid key or closed key. REG_KEY_NOT_OPEN, - /// The key not exists + /// the specified keyname points to a nonexisting key. REG_KEY_NOT_EXISTS, - /// The key cannot created + /// the key with the specified keyname cannot be created. REG_CREATE_KEY_FAILED, - /// The key cannot not deleted + /// 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 called function. + /** 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 + /// the key is not in a valid state. REG_INVALID_KEY, - /// key has no value + /// 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. REG_DETECT_RECURSION, - /// + /// the link is invalid and can not be resolved. REG_INVALID_LINK, - /// + /// the specified linkname is not valid. REG_INVALID_LINKNAME, - /// + /// the linknane is not valid. REG_INVALID_LINKTARGET, - /// + /// the link target points to a nonexisting key. 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 |