xref: /AOO41X/main/registry/inc/registry/regtype.h (revision 2123d7570813d7d92dade2ba70822a073d984013)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _REGISTRY_REGTYPE_H_
25 #define _REGISTRY_REGTYPE_H_
26 
27 #include <sal/types.h>
28 #include <sal/udkversion.h>
29 
30 // version number of the library. This number is used for the load on call
31 // mechanism and must be modifed when the library will be upgraded to a new version.
32 #define LIBRARY_VERSION SAL_UDK_MAJOR
33 
34 /// defines the type of a registry handle used in the C API.
35 typedef void*       RegHandle;
36 
37 /// defines the type of a registry key handle used in the C API.
38 typedef void*       RegKeyHandle;
39 
40 /// defines the type of a registry key value handle used in the C API.
41 typedef void*       RegValue;
42 
43 /** defines the open/access mode of the registry.
44 
45     Two modes are valid:
46     -REG_READONLY    allows readonly access
47     -REG_READWRITE   allows read and write access
48  */
49 typedef sal_uInt16  RegAccessMode;
50 
51 /// Flag to specify the open mode of a registry. This mode allows readonly access.
52 #define REG_READONLY        0x0001
53 /// Flag to specify the open mode of a registry. This mode allows read and write access.
54 #define REG_READWRITE       0x0002
55 
56 /** defines the type of a registry key.
57 
58     The registry differs between normal keys which can contain subkeys or
59     a value and link keys which navigate over the linktarget to an existing
60     other key (which are no longer supported).
61 */
62 enum RegKeyType
63 {
64     /// represents a real key
65     RG_KEYTYPE,
66     /// represents a link (which is no longer supported)
67     RG_LINKTYPE
68 };
69 
70 /** defines the type of a key value.
71 
72     A registry key can contain a value which has one of seven different types.
73     Three simple types (long, ascii and unicode string) and a list type of
74     these simple types. Furthermore a binary type which provides the possibilty
75     to define own data structures and store these types in the registry. The UNO
76     core reflection data is stored as a binary blob in the type registry.
77  */
78 enum RegValueType
79 {
80     /// The key has no value or the value type is unknown.
81     RG_VALUETYPE_NOT_DEFINED,
82     /// The key has a value of type long
83     RG_VALUETYPE_LONG,
84     /// The key has a value of type ascii string
85     RG_VALUETYPE_STRING,
86     /// The key has a value of type unicode string
87     RG_VALUETYPE_UNICODE,
88     /// The key has a value of type binary
89     RG_VALUETYPE_BINARY,
90     /// The key has a value of type long list
91     RG_VALUETYPE_LONGLIST,
92     /// The key has a value of type ascii string list
93     RG_VALUETYPE_STRINGLIST,
94     /// The key has a value of type unicode string list
95     RG_VALUETYPE_UNICODELIST
96 };
97 
98 /// specifies the possible error codes which can occur using the registry API.
99 enum RegError
100 {
101     /// no error.
102     REG_NO_ERROR,
103     /// internal registry error.
104     REG_INTERNAL_ERROR,
105 
106     /// registry is not open.
107     REG_REGISTRY_NOT_OPEN,
108     /// registry does not exists.
109     REG_REGISTRY_NOT_EXISTS,
110     /// registry is open with readonly access rights.
111     REG_REGISTRY_READONLY,
112     /// destroy a registry failed. There are may be any open keys.
113     REG_DESTROY_REGISTRY_FAILED,
114     /** registry cannot be opened with readwrite access because the registry is already
115         open with readwrite access anywhere.
116     */
117     REG_CANNOT_OPEN_FOR_READWRITE,
118     /** registry is in an invalid state or the registry does not point to
119         a valid registry data file.
120     */
121     REG_INVALID_REGISTRY,
122 
123     /// the key or key handle points to an invalid key or closed key.
124     REG_KEY_NOT_OPEN,
125     /// the specified keyname points to a nonexisting key.
126     REG_KEY_NOT_EXISTS,
127     /// the key with the specified keyname cannot be created.
128     REG_CREATE_KEY_FAILED,
129     /// the specified key cannot be deleted. Maybe an open key handle exists to this key.
130     REG_DELETE_KEY_FAILED,
131     /** the keyname is invalid. This error will return if the keyname
132         is NULL but should not be NULL in the context of a called function.
133     */
134     REG_INVALID_KEYNAME,
135     /// the key is not in a valid state.
136     REG_INVALID_KEY,
137 
138     /// the key has no value
139     REG_VALUE_NOT_EXISTS,
140     /// setting the specified value of a key failed.
141     REG_SET_VALUE_FAILED,
142     /// deleting of the key value failed.
143     REG_DELETE_VALUE_FAILED,
144     /// the key has a invalid value or the value type is unknown.
145     REG_INVALID_VALUE,
146 
147     /// merging a key, the value and all subkeys failed.
148     REG_MERGE_ERROR,
149     /** conflicts exists during the merge process of a key. This could happen if
150         the value of a key already exists and the merge process will replace it.
151     */
152     REG_MERGE_CONFLICT,
153 
154     /** a recursion was detected resolving different link targets (no longer
155         used).
156     */
157     REG_DETECT_RECURSION,
158     /** the link is invalid and can not be resolved (now used by all
159         link-related operations, as links are no longer supported).
160     */
161     REG_INVALID_LINK,
162     /// the specified linkname is not valid (no longer used).
163     REG_INVALID_LINKNAME,
164     /// the linknane is not valid (no longer used).
165     REG_INVALID_LINKTARGET,
166     /// the link target points to a nonexisting key (no longer used).
167     REG_LINKTARGET_NOT_EXIST,
168     /// the reserved buffer for the resolved keyname is to small.
169     REG_BUFFERSIZE_TOSMALL
170 };
171 
172 /// specify the calling convention for the registry API
173 #define REGISTRY_CALLTYPE   SAL_CALL
174 
175 #endif
176