summaryrefslogtreecommitdiff
path: root/Makefile.fetch
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile.fetch')
0 files changed, 0 insertions, 0 deletions
a href='/cgit/lo/core/tree/?h=feature/vclptr&id=9399c662f36c385b0c705eb34e636a9aec450282'>f502e9d9258960ff214ab90e98e31d0075e60196
initial import
Diffstat
-rw-r--r--registry/inc/registry/reflread.hxx499
-rw-r--r--registry/inc/registry/refltype.hxx266
-rw-r--r--registry/inc/registry/reflwrit.hxx422
-rw-r--r--registry/inc/registry/registry.h456
-rw-r--r--registry/inc/registry/registry.hxx1220
-rw-r--r--registry/inc/registry/regtype.h185
-rw-r--r--registry/prj/d.lst20
-rw-r--r--registry/source/keyimpl.cxx1260
-rw-r--r--registry/source/keyimpl.hxx215
-rw-r--r--registry/source/makefile.mk97
-rw-r--r--registry/source/reflcnst.hxx268
-rw-r--r--registry/source/reflread.cxx1602
-rw-r--r--registry/source/reflwrit.cxx1452
-rw-r--r--registry/source/regimpl.cxx2172
-rw-r--r--registry/source/regimpl.hxx266
-rw-r--r--registry/source/registry.cxx793
-rw-r--r--registry/source/regkey.cxx1298
-rw-r--r--registry/source/regmap.hxx117
-rw-r--r--registry/test/makefile.mk133
-rw-r--r--registry/test/testmerge.cxx492
-rw-r--r--registry/test/testregcpp.cxx738
-rw-r--r--registry/tools/makefile.mk111
-rw-r--r--registry/tools/regmerge.cxx217
-rw-r--r--registry/tools/regview.cxx144
-rw-r--r--registry/util/makefile.mk199
-rw-r--r--registry/version.mk74
-rw-r--r--registry/workben/makefile.mk134
-rw-r--r--registry/workben/regspeed.cxx307
-rw-r--r--registry/workben/regtest.cxx376
-rw-r--r--registry/workben/test.cxx85
-rw-r--r--sal/inc/osl/conditn.h127
-rw-r--r--sal/inc/osl/conditn.hxx145
-rw-r--r--sal/inc/osl/diagnose.h163
-rw-r--r--sal/inc/osl/file.h1066
-rw-r--r--sal/inc/osl/file.hxx1408
-rw-r--r--sal/inc/osl/interlck.h93
-rw-r--r--sal/inc/osl/module.h165
-rw-r--r--sal/inc/osl/mutex.h145
-rw-r--r--sal/inc/osl/mutex.hxx232
-rw-r--r--sal/inc/osl/pipe.h148
-rw-r--r--sal/inc/osl/process.h375
-rw-r--r--sal/inc/osl/profile.h205
-rw-r--r--sal/inc/osl/profile.hxx276
-rw-r--r--sal/inc/osl/security.h263
-rw-r--r--sal/inc/osl/semaphor.h146
-rw-r--r--sal/inc/osl/semaphor.hxx152
-rw-r--r--sal/inc/osl/signal.h182
-rw-r--r--sal/inc/osl/socket.h1001
-rw-r--r--sal/inc/osl/thread.h329
-rw-r--r--sal/inc/osl/time.h212
-rw-r--r--sal/inc/osl/util.h130
-rw-r--r--sal/inc/rtl/alloc.h116
-rw-r--r--sal/inc/rtl/byteseq.h330
-rw-r--r--sal/inc/rtl/byteseq.hxx155
-rw-r--r--sal/inc/rtl/cipher.h275
-rw-r--r--sal/inc/rtl/crc.h100
-rw-r--r--sal/inc/rtl/digest.h224
-rw-r--r--sal/inc/rtl/locale.h182
-rw-r--r--sal/inc/rtl/locale.hxx316
-rw-r--r--sal/inc/rtl/memory.h87
-rw-r--r--sal/inc/rtl/process.h89
-rw-r--r--sal/inc/rtl/random.h139
-rw-r--r--sal/inc/rtl/strbuf.h152
-rw-r--r--sal/inc/rtl/strbuf.hxx682
-rw-r--r--sal/inc/rtl/string.h588
-rw-r--r--sal/inc/rtl/string.hxx827
-rw-r--r--sal/inc/rtl/tencinfo.h166
-rw-r--r--sal/inc/rtl/textcvt.h174
-rw-r--r--sal/inc/rtl/textenc.h274
-rw-r--r--sal/inc/rtl/ustrbuf.h176
-rw-r--r--sal/inc/rtl/ustrbuf.hxx736
-rw-r--r--sal/inc/rtl/ustring.h717
-rw-r--r--sal/inc/rtl/ustring.hxx140
-rw-r--r--sal/inc/rtl/uuid.h231
-rw-r--r--sal/inc/sal/config.h124
-rw-r--r--sal/inc/sal/types.h225
-rw-r--r--sal/inc/systools/win32/StrConvert.h80
-rw-r--r--sal/inc/systools/win32/advapi9x.h198
-rw-r--r--sal/inc/systools/win32/comdlg9x.h102
-rw-r--r--sal/inc/systools/win32/kernel9x.h205
-rw-r--r--sal/inc/systools/win32/shell9x.h122
-rw-r--r--sal/inc/systools/win32/user9x.h132
-rw-r--r--sal/osl/all/makefile.mk115
-rw-r--r--sal/osl/os2/conditn.c157
-rw-r--r--sal/osl/os2/diagnose.c155
-rw-r--r--sal/osl/os2/dllentry.c109
-rw-r--r--sal/osl/os2/interlck.c95
-rw-r--r--sal/osl/os2/makefile.mk165
-rw-r--r--sal/osl/os2/module.c125
-rw-r--r--sal/osl/os2/mutex.c142
-rw-r--r--sal/osl/os2/process.c1320
-rw-r--r--sal/osl/os2/procimpl.h86
-rw-r--r--sal/osl/os2/profile.c1872
-rw-r--r--sal/osl/os2/secimpl.h96
-rw-r--r--sal/osl/os2/security.c371
-rw-r--r--sal/osl/os2/semaphor.c218
-rw-r--r--sal/osl/os2/signal.c272
-rw-r--r--sal/osl/os2/socket.c68
-rw-r--r--sal/osl/os2/sockimpl.h101
-rw-r--r--sal/osl/os2/system.h147
-rw-r--r--sal/osl/os2/thread.c702
-rw-r--r--sal/osl/os2/time.c90
-rw-r--r--sal/osl/os2/util.c76
-rw-r--r--sal/osl/unx/conditn.c394
-rw-r--r--sal/osl/unx/diagnose.c133
-rw-r--r--sal/osl/unx/interlck.c97
-rw-r--r--sal/osl/unx/makefile.mk151
-rw-r--r--sal/osl/unx/module.c875
-rw-r--r--sal/osl/unx/mutex.c326
-rw-r--r--sal/osl/unx/pipe.c530
-rw-r--r--sal/osl/unx/process.c2483
-rw-r--r--sal/osl/unx/procimpl.h84
-rw-r--r--sal/osl/unx/profile.c2896
-rw-r--r--sal/osl/unx/secimpl.h84
-rw-r--r--sal/osl/unx/security.c1101
-rw-r--r--sal/osl/unx/semaphor.c360
-rw-r--r--sal/osl/unx/signal.c490
-rw-r--r--sal/osl/unx/socket.c2795
-rw-r--r--sal/osl/unx/sockimpl.h87
-rw-r--r--sal/osl/unx/system.c454
-rw-r--r--sal/osl/unx/system.h555
-rw-r--r--sal/osl/unx/thread.c1073
-rw-r--r--sal/osl/unx/time.c234
-rw-r--r--sal/osl/unx/util.c323
-rw-r--r--sal/osl/w32/MAKEFILE.MK117
-rw-r--r--sal/osl/w32/conditn.c173
-rw-r--r--sal/osl/w32/diagnose.c155
-rw-r--r--sal/osl/w32/dllentry.c224
-rw-r--r--sal/osl/w32/interlck.c144
-rw-r--r--sal/osl/w32/libutil.c94
-rw-r--r--sal/osl/w32/module.c187
-rw-r--r--sal/osl/w32/mutex.c261
-rw-r--r--sal/osl/w32/pipe.c1063
-rw-r--r--sal/osl/w32/process.c918
-rw-r--r--sal/osl/w32/procimpl.h100
-rw-r--r--sal/osl/w32/profile.c3019
-rw-r--r--sal/osl/w32/secimpl.h116
-rw-r--r--sal/osl/w32/security.c1155
-rw-r--r--sal/osl/w32/semaphor.c196
-rw-r--r--sal/osl/w32/signal.c323
-rw-r--r--sal/osl/w32/sockimpl.h168
-rw-r--r--sal/osl/w32/system.h159
-rw-r--r--sal/osl/w32/thread.c820
-rw-r--r--sal/osl/w32/time.c256
-rw-r--r--sal/osl/w32/util.c94
-rw-r--r--sal/prj/d.lst42
-rw-r--r--sal/rtl/source/alloc.c187
-rw-r--r--sal/rtl/source/byteseq.c263
-rw-r--r--sal/rtl/source/cipher.c1177
-rw-r--r--sal/rtl/source/crc.c203
-rw-r--r--sal/rtl/source/digest.c1464
-rw-r--r--sal/rtl/source/locale.c367
-rw-r--r--sal/rtl/source/makefile.mk131
-rw-r--r--sal/rtl/source/memory.c124
-rw-r--r--sal/rtl/source/random.c383
-rw-r--r--sal/rtl/source/rtl_process.c83
-rw-r--r--sal/rtl/source/strbuf.c192
-rw-r--r--sal/rtl/source/string.c1015
-rw-r--r--sal/rtl/source/ustrbuf.c234
-rw-r--r--sal/rtl/source/ustring.c1774
-rw-r--r--sal/test/makefile.mk123
-rw-r--r--sal/textenc/makefile.mk98
-rw-r--r--sal/textenc/tcvtarb1.tab1078
-rw-r--r--sal/textenc/tcvtbyte.c407
-rw-r--r--sal/textenc/tcvteas1.tab353
-rw-r--r--sal/textenc/tcvtest1.tab4862
-rw-r--r--sal/textenc/tcvtjp1.tab1590
-rw-r--r--sal/textenc/tcvtjp2.tab3961
-rw-r--r--sal/textenc/tcvtjp3.tab2921
-rw-r--r--sal/textenc/tcvtjp4.tab3548
-rw-r--r--sal/textenc/tcvtjp5.tab3384
-rw-r--r--sal/textenc/tcvtjp6.tab2769
-rw-r--r--sal/textenc/tcvtkr1.tab3344
-rw-r--r--sal/textenc/tcvtkr2.tab5449
-rw-r--r--sal/textenc/tcvtkr4.tab71
-rw-r--r--sal/textenc/tcvtkr5.tab71
-rw-r--r--sal/textenc/tcvtkr6.tab708
-rw-r--r--sal/textenc/tcvtlat1.tab2130
-rw-r--r--sal/textenc/tcvtmb.c745
-rw-r--r--sal/textenc/tcvtscn1.tab3884
-rw-r--r--sal/textenc/tcvtscn2.tab4205
-rw-r--r--sal/textenc/tcvtscn3.tab1536
-rw-r--r--sal/textenc/tcvtscn4.tab3104
-rw-r--r--sal/textenc/tcvtscn5.tab3269
-rw-r--r--sal/textenc/tcvtscn6.tab2994
-rw-r--r--sal/textenc/tcvtsym1.tab108
-rw-r--r--sal/textenc/tcvttcn1.tab2926
-rw-r--r--sal/textenc/tcvttcn2.tab3749
-rw-r--r--sal/textenc/tcvttcn6.tab1819
-rw-r--r--sal/textenc/tcvtuni1.tab159
-rw-r--r--sal/textenc/tcvtutf7.c622
-rw-r--r--sal/textenc/tcvtutf8.c433
-rw-r--r--sal/textenc/tenchelp.c732
-rw-r--r--sal/textenc/tenchelp.h366
-rw-r--r--sal/textenc/tencinfo.c972
-rw-r--r--sal/textenc/textcvt.c301
-rw-r--r--sal/unosdk.mk82
-rw-r--r--sal/util/makefile.mk229
-rw-r--r--sal/version.mk75
-rw-r--r--sal/workben/makefile.mk288
-rw-r--r--sal/workben/t_cipher.c309
-rw-r--r--sal/workben/t_digest.c279
-rw-r--r--sal/workben/t_layer.c353
-rw-r--r--sal/workben/t_random.c99
-rw-r--r--sal/workben/t_tls.c301
-rw-r--r--sal/workben/t_zip.c223
-rw-r--r--sal/workben/test.cxx103
-rw-r--r--sal/workben/testfile.cxx2816
-rw-r--r--sal/workben/testpip2.cxx128
-rw-r--r--sal/workben/testpipe.cxx199
-rw-r--r--sal/workben/testproc.cxx108
-rw-r--r--sal/workben/tgetpwnam.cxx279
-rw-r--r--store/inc/store/filelckb.hxx209
-rw-r--r--store/inc/store/lockbyte.hxx169
-rw-r--r--store/inc/store/memlckb.hxx197
-rw-r--r--store/inc/store/object.hxx118
-rw-r--r--store/inc/store/store.h377
-rw-r--r--store/inc/store/store.hxx267
-rw-r--r--store/inc/store/store.inl472
-rw-r--r--store/inc/store/types.h194
-rw-r--r--store/prj/d.lst8
-rw-r--r--store/source/filelckb.cxx936
-rw-r--r--store/source/makefile.mk107
-rw-r--r--store/source/memlckb.cxx396
-rw-r--r--store/source/object.cxx103
-rw-r--r--store/source/storbase.cxx1944
-rw-r--r--store/source/storbase.hxx916
-rw-r--r--store/source/storcach.cxx696
-rw-r--r--store/source/storcach.hxx231
-rw-r--r--store/source/stordata.cxx1754
-rw-r--r--store/source/stordata.hxx934
-rw-r--r--store/source/store.cxx817
-rw-r--r--store/source/storlckb.cxx872
-rw-r--r--store/source/storlckb.hxx296
-rw-r--r--store/source/storpage.cxx1562
-rw-r--r--store/source/storpage.hxx276
-rw-r--r--store/source/stortree.cxx608
-rw-r--r--store/source/stortree.hxx451
-rw-r--r--store/util/makefile.mk113
-rw-r--r--store/util/sto.dxp25
-rw-r--r--store/util/sto.map30
-rw-r--r--store/version.mk75
-rw-r--r--store/workben/makefile.mk135
-rw-r--r--store/workben/t_base.cxx376
-rw-r--r--store/workben/t_file.cxx166
-rw-r--r--store/workben/t_store.cxx634
246 files changed, 161159 insertions, 0 deletions
diff --git a/registry/inc/registry/reflread.hxx b/registry/inc/registry/reflread.hxx
new file mode 100644
index 000000000000..352cf7980dfe
--- /dev/null
+++ b/registry/inc/registry/reflread.hxx
@@ -0,0 +1,499 @@
+/*************************************************************************
+ *
+ * $RCSfile: reflread.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/*************************************************************************
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.20 2000/09/17 12:30:32 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.19 2000/08/04 15:31:39 jsc
+ extend biniary type format
+
+ Revision 1.18 2000/07/26 17:44:32 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.17 2000/05/02 06:06:21 jsc
+ insert LIBRARY_VERSION for dynamic loading
+
+ Revision 1.16 2000/04/18 10:09:48 jsc
+ modified for unicode changes
+
+ Revision 1.15 2000/03/24 15:00:36 jsc
+ modified for unicode changes
+
+ Revision 1.14 1999/10/19 16:13:55 kr
+ Parameter for Version 1 of Registry added.
+
+ Revision 1.13 1999/09/06 08:33:00 jsc
+ insert IDL filename in registry
+
+ Revision 1.12 1999/07/02 09:25:39 jsc
+ #67179# Binaerblop der CoreReflection ist erweitert worden
+
+ Revision 1.11 1999/03/12 14:16:38 jsc
+ #61011# Anpassung an osl-Typen
+
+ Revision 1.10 1999/02/05 09:44:33 jsc
+ #61011# Typanpassung
+
+ Revision 1.9 1998/12/11 11:57:42 jsc
+ Anpassung an ODynamicLoader
+
+ Revision 1.8 1998/08/06 09:43:43 jsc
+ #54698# Anpassung an DynamicLoader
+
+ Revision 1.7 1998/07/06 17:00:31 jsc
+ Calltype von InitRegistryTypeReader_Api gesetzt
+
+ Revision 1.6 1998/07/03 11:20:07 ts
+ prefixen von typen
+
+ Revision 1.5 1998/07/03 08:41:02 ts
+ bugs und set/getUik()
+
+ Revision 1.4 1998/07/02 11:58:29 jsc
+ Typ Anpassung, Schnittstelle frei von solar.h
+
+ Revision 1.3 1998/07/01 13:39:01 ts
+ bugs, bugs, bugs
+
+ Revision 1.2 1998/06/30 13:42:27 ts
+ Anpassung an SOLARIS
+
+ Revision 1.1.1.1 1998/06/30 11:17:45 jsc
+ neu
+
+
+*************************************************************************/
+
+#ifndef __REGISTRY_REFLREAD_HXX__
+#define __REGISTRY_REFLREAD_HXX__
+
+#ifndef _REGISTRY_REFLTYPE_HXX_
+#include <registry/refltype.hxx>
+#endif
+#ifndef _REGISTRY_REGTYPE_H_
+#include <registry/regtype.h>
+#endif
+#ifndef _VOS_DYNLOAD_HXX_
+#include <vos/dynload.hxx>
+#endif
+
+// Implememetation handle
+typedef void* TypeReaderImpl;
+
+/****************************************************************************
+
+ C-Api for load on call
+
+*****************************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct RegistryTypeReader_Api
+{
+ TypeReaderImpl (TYPEREG_CALLTYPE *createEntry) (const sal_uInt8*, sal_uInt32, sal_Bool);
+ void (TYPEREG_CALLTYPE *acquire) (TypeReaderImpl);
+ void (TYPEREG_CALLTYPE *release) (TypeReaderImpl);
+ sal_uInt16 (TYPEREG_CALLTYPE *getMinorVersion) (TypeReaderImpl);
+ sal_uInt16 (TYPEREG_CALLTYPE *getMajorVersion) (TypeReaderImpl);
+ RTTypeClass (TYPEREG_CALLTYPE *getTypeClass) (TypeReaderImpl);
+ void (TYPEREG_CALLTYPE *getUik) (TypeReaderImpl, RTUik*);
+ void (TYPEREG_CALLTYPE *getDoku) (TypeReaderImpl, rtl_uString**);
+ void (TYPEREG_CALLTYPE *getFileName) (TypeReaderImpl, rtl_uString**);
+ void (TYPEREG_CALLTYPE *getTypeName) (TypeReaderImpl, rtl_uString**);
+ void (TYPEREG_CALLTYPE *getSuperTypeName) (TypeReaderImpl, rtl_uString**);
+ sal_uInt32 (TYPEREG_CALLTYPE *getFieldCount) (TypeReaderImpl);
+ void (TYPEREG_CALLTYPE *getFieldName) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+ void (TYPEREG_CALLTYPE *getFieldType) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+ RTFieldAccess (TYPEREG_CALLTYPE *getFieldAccess) (TypeReaderImpl, sal_uInt16);
+ RTValueType (TYPEREG_CALLTYPE *getFieldConstValue) (TypeReaderImpl, sal_uInt16, RTConstValueUnion*);
+ void (TYPEREG_CALLTYPE *getFieldDoku) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+ void (TYPEREG_CALLTYPE *getFieldFileName) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+ sal_uInt32 (TYPEREG_CALLTYPE *getMethodCount) (TypeReaderImpl);
+ void (TYPEREG_CALLTYPE *getMethodName) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+ sal_uInt32 (TYPEREG_CALLTYPE *getMethodParamCount) (TypeReaderImpl, sal_uInt16);
+ void (TYPEREG_CALLTYPE *getMethodParamType) (TypeReaderImpl, rtl_uString**, sal_uInt16, sal_uInt16);
+ void (TYPEREG_CALLTYPE *getMethodParamName) (TypeReaderImpl, rtl_uString**, sal_uInt16, sal_uInt16);
+ RTParamMode (TYPEREG_CALLTYPE *getMethodParamMode) (TypeReaderImpl, sal_uInt16, sal_uInt16);
+ sal_uInt32 (TYPEREG_CALLTYPE *getMethodExcCount) (TypeReaderImpl, sal_uInt16);
+ void (TYPEREG_CALLTYPE *getMethodExcType) (TypeReaderImpl, rtl_uString**, sal_uInt16, sal_uInt16);
+ void (TYPEREG_CALLTYPE *getMethodReturnType) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+ RTMethodMode (TYPEREG_CALLTYPE *getMethodMode) (TypeReaderImpl, sal_uInt16);
+ void (TYPEREG_CALLTYPE *getMethodDoku) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+
+ sal_uInt32 (TYPEREG_CALLTYPE *getReferenceCount) (TypeReaderImpl);
+ void (TYPEREG_CALLTYPE *getReferenceName) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+ RTReferenceType (TYPEREG_CALLTYPE *getReferenceType) (TypeReaderImpl, sal_uInt16);
+ void (TYPEREG_CALLTYPE *getReferenceDoku) (TypeReaderImpl, rtl_uString**, sal_uInt16);
+ RTFieldAccess (TYPEREG_CALLTYPE *getReferenceAccess) (TypeReaderImpl, sal_uInt16);
+};
+
+typedef RegistryTypeReader_Api* (TYPEREG_CALLTYPE *InitRegistryTypeReader_Api)(void);
+
+#define REGISTRY_TYPE_READER_INIT_FUNCTION_NAME "initRegistryTypeReader_Api"
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/** RegistryTypeReaderLoader load the needed DLL for a RegistryTypeReader.
+ The loader can be checked if the DLL is loaded. If the DLL is loaded the
+ loader provides a valid Api for the RegistryTypeReader.
+*/
+class RegistryTypeReaderLoader
+ : public ::vos::ODynamicLoader<RegistryTypeReader_Api>
+{
+public:
+ RegistryTypeReaderLoader()
+ : ::vos::ODynamicLoader<RegistryTypeReader_Api>
+ (::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("reg") ),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(REGISTRY_TYPE_READER_INIT_FUNCTION_NAME) ),
+ sal_True, LIBRARY_VERSION, sal_False)
+ {}
+
+ ~RegistryTypeReaderLoader()
+ {}
+};
+
+
+/** RegistryTypeReader reads type informations from a blop.
+ Class is inline and use a load on call C-Api.
+*/
+class RegistryTypeReader
+{
+public:
+
+ inline RegistryTypeReader(const RegistryTypeReader_Api* pApi,
+ const sal_uInt8* buffer,
+ sal_uInt32 bufferLen,
+ sal_Bool copyData);
+ inline RegistryTypeReader(const RegistryTypeReaderLoader& rLoader,
+ const sal_uInt8* buffer,
+ sal_uInt32 bufferLen,
+ sal_Bool copyData);
+ inline RegistryTypeReader(const RegistryTypeReader& toCopy);
+ inline ~RegistryTypeReader();
+
+ inline RegistryTypeReader& operator == (const RegistryTypeReader& toAssign);
+
+ inline sal_Bool isValid() const;
+
+ inline sal_uInt16 getMinorVersion() const;
+ inline sal_uInt16 getMajorVersion() const;
+ inline RTTypeClass getTypeClass() const;
+ inline ::rtl::OUString getTypeName() const;
+ inline ::rtl::OUString getSuperTypeName() const;
+ inline void getUik(RTUik& uik) const;
+ inline ::rtl::OUString getDoku() const;
+ inline ::rtl::OUString getFileName() const;
+ inline sal_uInt32 getFieldCount() const;
+ inline ::rtl::OUString getFieldName( sal_uInt16 index ) const;
+ inline ::rtl::OUString getFieldType( sal_uInt16 index ) const;
+ inline RTFieldAccess getFieldAccess( sal_uInt16 index ) const;
+ inline RTConstValue getFieldConstValue( sal_uInt16 index ) const;
+ inline ::rtl::OUString getFieldDoku( sal_uInt16 index ) const;
+ inline ::rtl::OUString getFieldFileName( sal_uInt16 index ) const;
+ inline sal_uInt32 getMethodCount() const;
+ inline ::rtl::OUString getMethodName( sal_uInt16 index ) const;
+ inline sal_uInt32 getMethodParamCount( sal_uInt16 index ) const;
+ inline ::rtl::OUString getMethodParamType( sal_uInt16 index, sal_uInt16 paramIndex ) const;
+ inline ::rtl::OUString getMethodParamName( sal_uInt16 index, sal_uInt16 paramIndex ) const;
+ inline RTParamMode getMethodParamMode( sal_uInt16 index, sal_uInt16 paramIndex ) const;
+ inline sal_uInt32 getMethodExcCount( sal_uInt16 index ) const;
+ inline ::rtl::OUString getMethodExcType( sal_uInt16 index, sal_uInt16 excIndex ) const;
+ inline ::rtl::OUString getMethodReturnType( sal_uInt16 index ) const;
+ inline RTMethodMode getMethodMode( sal_uInt16 index ) const;
+ inline ::rtl::OUString getMethodDoku( sal_uInt16 index ) const;
+
+ inline sal_uInt32 getReferenceCount() const;
+ inline ::rtl::OUString getReferenceName( sal_uInt16 index ) const;
+ inline RTReferenceType getReferenceType( sal_uInt16 index ) const;
+ inline ::rtl::OUString getReferenceDoku( sal_uInt16 index ) const;
+ inline RTFieldAccess getReferenceAccess( sal_uInt16 index ) const;
+
+protected:
+
+ const RegistryTypeReader_Api* m_pApi;
+ const NAMESPACE_VOS(ODynamicLoader)<RegistryTypeReader_Api> m_Api;
+ TypeReaderImpl m_hImpl;
+};
+
+
+
+inline RegistryTypeReader::RegistryTypeReader(const RegistryTypeReader_Api* pApi,
+ const sal_uInt8* buffer,
+ sal_uInt32 bufferLen,
+ sal_Bool copyData)
+ : m_pApi(pApi)
+ , m_Api()
+ , m_hImpl(NULL)
+ {
+ m_hImpl = m_pApi->createEntry(buffer, bufferLen, copyData);
+ }
+
+
+inline RegistryTypeReader::RegistryTypeReader(const RegistryTypeReaderLoader& rLoader,
+ const sal_uInt8* buffer,
+ sal_uInt32 bufferLen,
+ sal_Bool copyData)
+ : m_pApi(NULL)
+ , m_Api(rLoader)
+ , m_hImpl(NULL)
+ {
+ m_pApi = m_Api.getApi();
+ m_hImpl = m_pApi->createEntry(buffer, bufferLen, copyData);
+ }
+
+
+inline RegistryTypeReader::RegistryTypeReader(const RegistryTypeReader& toCopy)
+ : m_pApi(toCopy.m_pApi)
+ , m_Api(toCopy.m_Api)
+ , m_hImpl(toCopy.m_hImpl)
+ { m_pApi->acquire(m_hImpl); }
+
+
+inline RegistryTypeReader::~RegistryTypeReader()
+ { m_pApi->release(m_hImpl); }
+
+inline RegistryTypeReader& RegistryTypeReader::operator == (const RegistryTypeReader& toAssign)
+{
+ if (m_hImpl != toAssign.m_hImpl)
+ {
+ m_pApi->release(m_hImpl);
+ m_hImpl = toAssign.m_hImpl;
+ m_pApi->acquire(m_hImpl);
+ }
+
+ return *this;
+}
+
+inline sal_uInt16 RegistryTypeReader::getMinorVersion() const
+ { return m_pApi->getMinorVersion(m_hImpl); }
+
+inline sal_Bool RegistryTypeReader::isValid() const
+ { return (m_hImpl != NULL); }
+
+inline sal_uInt16 RegistryTypeReader::getMajorVersion() const
+ { return m_pApi->getMajorVersion(m_hImpl); }
+
+inline RTTypeClass RegistryTypeReader::getTypeClass() const
+ { return m_pApi->getTypeClass(m_hImpl); }
+
+inline ::rtl::OUString RegistryTypeReader::getTypeName() const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getTypeName(m_hImpl, &sRet.pData);
+ return sRet;
+ }
+
+inline ::rtl::OUString RegistryTypeReader::getSuperTypeName() const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getSuperTypeName(m_hImpl, &sRet.pData);
+ return sRet;
+ }
+
+inline void RegistryTypeReader::getUik(RTUik& uik) const
+ { m_pApi->getUik(m_hImpl, &uik); }
+
+inline ::rtl::OUString RegistryTypeReader::getDoku() const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getDoku(m_hImpl, &sRet.pData);
+ return sRet;
+ }
+
+inline ::rtl::OUString RegistryTypeReader::getFileName() const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getFileName(m_hImpl, &sRet.pData);
+ return sRet;
+ }
+
+inline sal_uInt32 RegistryTypeReader::getFieldCount() const
+ { return m_pApi->getFieldCount(m_hImpl); }
+
+inline ::rtl::OUString RegistryTypeReader::getFieldName( sal_uInt16 index ) const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getFieldName(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline ::rtl::OUString RegistryTypeReader::getFieldType( sal_uInt16 index ) const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getFieldType(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline RTFieldAccess RegistryTypeReader::getFieldAccess( sal_uInt16 index ) const
+ { return m_pApi->getFieldAccess(m_hImpl, index); }
+
+inline RTConstValue RegistryTypeReader::getFieldConstValue( sal_uInt16 index ) const
+ {
+ RTConstValue ret;
+ ret.m_type = m_pApi->getFieldConstValue(m_hImpl, index, &ret.m_value);
+ return ret;
+ }
+
+inline ::rtl::OUString RegistryTypeReader::getFieldDoku( sal_uInt16 index ) const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getFieldDoku(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline ::rtl::OUString RegistryTypeReader::getFieldFileName( sal_uInt16 index ) const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getFieldFileName(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline sal_uInt32 RegistryTypeReader::getMethodCount() const
+ { return m_pApi->getMethodCount(m_hImpl); }
+
+inline ::rtl::OUString RegistryTypeReader::getMethodName( sal_uInt16 index ) const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getMethodName(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline sal_uInt32 RegistryTypeReader::getMethodParamCount( sal_uInt16 index ) const
+ { return m_pApi->getMethodParamCount(m_hImpl, index); }
+
+inline ::rtl::OUString RegistryTypeReader::getMethodParamType( sal_uInt16 index, sal_uInt16 paramIndex ) const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getMethodParamType(m_hImpl, &sRet.pData, index, paramIndex);
+ return sRet;
+ }
+
+inline ::rtl::OUString RegistryTypeReader::getMethodParamName( sal_uInt16 index, sal_uInt16 paramIndex ) const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getMethodParamName(m_hImpl, &sRet.pData, index, paramIndex);
+ return sRet;
+ }
+
+inline RTParamMode RegistryTypeReader::getMethodParamMode( sal_uInt16 index, sal_uInt16 paramIndex ) const
+ { return m_pApi->getMethodParamMode(m_hImpl, index, paramIndex); }
+
+inline sal_uInt32 RegistryTypeReader::getMethodExcCount( sal_uInt16 index ) const
+ { return m_pApi->getMethodExcCount(m_hImpl, index); }
+
+inline ::rtl::OUString RegistryTypeReader::getMethodExcType( sal_uInt16 index, sal_uInt16 excIndex ) const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getMethodExcType(m_hImpl, &sRet.pData, index, excIndex);
+ return sRet;
+ }
+
+inline ::rtl::OUString RegistryTypeReader::getMethodReturnType( sal_uInt16 index ) const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getMethodReturnType(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline RTMethodMode RegistryTypeReader::getMethodMode( sal_uInt16 index ) const
+ { return m_pApi->getMethodMode(m_hImpl, index); }
+
+inline ::rtl::OUString RegistryTypeReader::getMethodDoku( sal_uInt16 index ) const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getMethodDoku(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline sal_uInt32 RegistryTypeReader::getReferenceCount() const
+ { return m_pApi->getReferenceCount(m_hImpl); }
+
+inline ::rtl::OUString RegistryTypeReader::getReferenceName( sal_uInt16 index ) const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getReferenceName(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline RTReferenceType RegistryTypeReader::getReferenceType( sal_uInt16 index ) const
+ { return m_pApi->getReferenceType(m_hImpl, index); }
+
+inline ::rtl::OUString RegistryTypeReader::getReferenceDoku( sal_uInt16 index ) const
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getReferenceDoku(m_hImpl, &sRet.pData, index);
+ return sRet;
+ }
+
+inline RTFieldAccess RegistryTypeReader::getReferenceAccess( sal_uInt16 index ) const
+ { return m_pApi->getReferenceAccess(m_hImpl, index); }
+
+#endif
diff --git a/registry/inc/registry/refltype.hxx b/registry/inc/registry/refltype.hxx
new file mode 100644
index 000000000000..7e217e7e84f7
--- /dev/null
+++ b/registry/inc/registry/refltype.hxx
@@ -0,0 +1,266 @@
+/*************************************************************************
+ *
+ * $RCSfile: refltype.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/*************************************************************************
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.19 2000/09/17 12:30:32 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.18 2000/08/04 15:31:39 jsc
+ extend biniary type format
+
+ Revision 1.17 2000/07/26 17:44:32 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.16 2000/03/24 15:00:36 jsc
+ modified for unicode changes
+
+ Revision 1.15 2000/02/08 16:01:09 hr
+ #70473# changes for unicode ( patched by automated patchtool )
+
+ Revision 1.14 1999/10/22 09:58:47 jsc
+ TYPEREG_CALLTYPE = SAL_CALL
+
+ Revision 1.13 1999/10/21 15:48:50 jsc
+ optional flag now in registry
+
+ Revision 1.12 1999/10/15 11:05:51 dbo
+ short RTConstValue from sal_uInt16 to sal_Int16
+
+ Revision 1.11 1999/07/02 09:25:40 jsc
+ #67179# Binaerblop der CoreReflection ist erweitert worden
+
+ Revision 1.10 1999/03/12 14:16:38 jsc
+ #61011# Anpassung an osl-Typen
+
+ Revision 1.9 1998/07/03 12:36:16 ts
+ added SERVICE and OBJECT
+
+ Revision 1.8 1998/07/03 11:20:07 ts
+ prefixen von typen
+
+ Revision 1.7 1998/07/03 10:55:41 ts
+ added RT_TYPE_TYPEDEF
+
+ Revision 1.6 1998/07/03 08:41:02 ts
+ bugs und set/getUik()
+
+ Revision 1.5 1998/07/02 11:58:47 jsc
+ Typ Anpassung, Schnittstelle frei von solar.h
+
+ Revision 1.4 1998/07/01 16:55:19 ts
+ alignment unter soaris beachten
+
+ Revision 1.3 1998/07/01 13:39:01 ts
+ bugs, bugs, bugs
+
+ Revision 1.2 1998/06/30 13:42:27 ts
+ Anpassung an SOLARIS
+
+ Revision 1.1.1.1 1998/06/30 11:17:45 jsc
+ neu
+
+
+*************************************************************************/
+
+#ifndef __REGISTRY_REFLTYPE_HXX__
+#define __REGISTRY_REFLTYPE_HXX__
+
+#ifdef SOLARIS
+#include <wchar.h>
+#else
+#include <stdlib.h>
+#endif
+
+#ifndef _SAL_TYPES_H_
+#include <sal/types.h>
+#endif
+
+enum RTTypeClass
+{
+ RT_TYPE_INVALID,
+ RT_TYPE_INTERFACE,
+ RT_TYPE_MODULE,
+ RT_TYPE_STRUCT,
+ RT_TYPE_ENUM,
+ RT_TYPE_EXCEPTION,
+ RT_TYPE_TYPEDEF,
+ RT_TYPE_SERVICE,
+ RT_TYPE_OBJECT,
+ RT_TYPE_CONSTANTS
+};
+
+typedef sal_uInt16 RTFieldAccess;
+
+#define RT_ACCESS_INVALID 0x0000
+#define RT_ACCESS_READONLY 0x0001
+#define RT_ACCESS_OPTIONAL 0x0002
+#define RT_ACCESS_MAYBEVOID 0x0004
+#define RT_ACCESS_BOUND 0x0008
+#define RT_ACCESS_CONSTRAINED 0x0010
+#define RT_ACCESS_TRANSIENT 0x0020
+#define RT_ACCESS_MAYBEAMBIGUOUS 0x0040
+#define RT_ACCESS_MAYBEDEFAULT 0x0080
+#define RT_ACCESS_REMOVEABLE 0x0100
+#define RT_ACCESS_ATTRIBUTE 0x0200
+#define RT_ACCESS_PROPERTY 0x0400
+#define RT_ACCESS_CONST 0x0800
+#define RT_ACCESS_READWRITE 0x1000
+/*
+enum RTFieldAccess
+{
+ RT_ACCESS_INVALID,
+ RT_ACCESS_CONST,
+ RT_ACCESS_READONLY,
+ RT_ACCESS_WRITEONLY,
+ RT_ACCESS_READWRITE,
+ RT_ACCESS_READONLY_OPTIONAL,
+ RT_ACCESS_WRITEONLY_OPTIONAL,
+ RT_ACCESS_READWRITE_OPTIONAL
+};
+*/
+enum RTReferenceType
+{
+ RT_REF_INVALID,
+ RT_REF_SUPPORTS,
+ RT_REF_OBSERVES,
+ RT_REF_EXPORTS,
+ RT_REF_NEEDS
+};
+
+enum RTMethodMode
+{
+ RT_MODE_INVALID,
+ RT_MODE_ONEWAY,
+ RT_MODE_ONEWAY_CONST,
+ RT_MODE_TWOWAY,
+ RT_MODE_TWOWAY_CONST
+};
+
+enum RTParamMode
+{
+ RT_PARAM_INVALID,
+ RT_PARAM_IN,
+ RT_PARAM_OUT,
+ RT_PARAM_INOUT
+};
+
+enum RTValueType
+{
+ RT_TYPE_NONE,
+ RT_TYPE_BOOL,
+ RT_TYPE_BYTE,
+ RT_TYPE_INT16,
+ RT_TYPE_UINT16,
+ RT_TYPE_INT32,
+ RT_TYPE_UINT32,
+ RT_TYPE_INT64,
+ RT_TYPE_UINT64,
+ RT_TYPE_FLOAT,
+ RT_TYPE_DOUBLE,
+ RT_TYPE_STRING
+};
+
+union RTConstValueUnion
+{
+ sal_Bool aBool;
+ sal_uInt8 aByte;
+ sal_Int16 aShort;
+ sal_uInt16 aUShort;
+ sal_Int32 aLong;
+ sal_uInt32 aULong;
+// sal_Int64 aHyper;
+// sal_UInt64 aUHyper;
+ float aFloat;
+ double aDouble;
+ const sal_Unicode* aString;
+};
+
+class RTConstValue
+{
+public:
+ RTValueType m_type;
+ RTConstValueUnion m_value;
+
+ RTConstValue()
+ : m_type(RT_TYPE_NONE)
+ {
+ m_value.aDouble = 0.0;
+ }
+
+ ~RTConstValue() {};
+};
+
+struct RTUik
+{
+ sal_uInt32 m_Data1;
+ sal_uInt16 m_Data2;
+ sal_uInt16 m_Data3;
+ sal_uInt32 m_Data4;
+ sal_uInt32 m_Data5;
+};
+
+#define TYPEREG_CALLTYPE SAL_CALL
+
+#endif
diff --git a/registry/inc/registry/reflwrit.hxx b/registry/inc/registry/reflwrit.hxx
new file mode 100644
index 000000000000..ae96e0284776
--- /dev/null
+++ b/registry/inc/registry/reflwrit.hxx
@@ -0,0 +1,422 @@
+/*************************************************************************
+ *
+ * $RCSfile: reflwrit.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/*************************************************************************
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.20 2000/09/17 12:30:32 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.19 2000/08/04 15:31:39 jsc
+ extend biniary type format
+
+ Revision 1.18 2000/07/26 17:44:32 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.17 2000/05/02 06:06:21 jsc
+ insert LIBRARY_VERSION for dynamic loading
+
+ Revision 1.16 2000/04/18 10:09:48 jsc
+ modified for unicode changes
+
+ Revision 1.15 2000/03/24 15:00:36 jsc
+ modified for unicode changes
+
+ Revision 1.14 1999/10/19 16:14:49 kr
+ Version parameter for dynload added
+
+ Revision 1.13 1999/09/06 08:33:00 jsc
+ insert IDL filename in registry
+
+ Revision 1.12 1999/07/02 09:25:40 jsc
+ #67179# Binaerblop der CoreReflection ist erweitert worden
+
+ Revision 1.11 1999/03/12 14:16:38 jsc
+ #61011# Anpassung an osl-Typen
+
+ Revision 1.10 1999/02/05 09:44:33 jsc
+ #61011# Typanpassung
+
+ Revision 1.9 1998/12/11 11:57:42 jsc
+ Anpassung an ODynamicLoader
+
+ Revision 1.8 1998/08/06 09:43:44 jsc
+ #54698# Anpassung an DynamicLoader
+
+ Revision 1.7 1998/07/06 17:02:03 jsc
+ Calltype von InitRegistryTypeWriter_Api gesetzt
+
+ Revision 1.6 1998/07/03 11:20:08 ts
+ prefixen von typen
+
+ Revision 1.5 1998/07/03 08:41:03 ts
+ bugs und set/getUik()
+
+ Revision 1.4 1998/07/02 11:58:39 jsc
+ Typ Anpassung, Schnittstelle frei von solar.h
+
+ Revision 1.3 1998/07/01 16:55:19 ts
+ alignment unter soaris beachten
+
+ Revision 1.2 1998/07/01 13:39:01 ts
+ bugs, bugs, bugs
+
+ Revision 1.1.1.1 1998/06/30 11:17:45 jsc
+ neu
+
+
+*************************************************************************/
+
+#ifndef __REGISTRY_REFLWRIT_HXX__
+#define __REGISTRY_REFLWRIT_HXX__
+
+#ifndef _REGISTRY_REFLTYPE_HXX_
+#include <registry/refltype.hxx>
+#endif
+#ifndef _REGISTRY_REGTYPE_H_
+#include <registry/regtype.h>
+#endif
+#ifndef _VOS_DYNLOAD_HXX_
+#include <vos/dynload.hxx>
+#endif
+
+// Implememetation handle
+typedef void* TypeWriterImpl;
+
+/****************************************************************************
+
+ C-Api for load on call
+
+*****************************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct RegistryTypeWriter_Api
+{
+ TypeWriterImpl (TYPEREG_CALLTYPE *createEntry) (RTTypeClass, rtl_uString*, rtl_uString*, sal_uInt16, sal_uInt16, sal_uInt16);
+ void (TYPEREG_CALLTYPE *acquire) (TypeWriterImpl);
+ void (TYPEREG_CALLTYPE *release) (TypeWriterImpl);
+ void (TYPEREG_CALLTYPE *setUik) (TypeWriterImpl, const RTUik*);
+ void (TYPEREG_CALLTYPE *setDoku) (TypeWriterImpl, rtl_uString*);
+ void (TYPEREG_CALLTYPE *setFileName) (TypeWriterImpl, rtl_uString*);
+ void (TYPEREG_CALLTYPE *setFieldData) (TypeWriterImpl, sal_uInt16, rtl_uString*, rtl_uString*, rtl_uString*, rtl_uString*, RTFieldAccess, RTValueType, RTConstValueUnion);
+ void (TYPEREG_CALLTYPE *setMethodData) (TypeWriterImpl, sal_uInt16, rtl_uString*, rtl_uString*, RTMethodMode, sal_uInt16, sal_uInt16, rtl_uString*);
+ void (TYPEREG_CALLTYPE *setParamData) (TypeWriterImpl, sal_uInt16, sal_uInt16, rtl_uString*, rtl_uString*, RTParamMode);
+ void (TYPEREG_CALLTYPE *setExcData) (TypeWriterImpl, sal_uInt16, sal_uInt16, rtl_uString*);
+ const sal_uInt8* (TYPEREG_CALLTYPE *getBlop) (TypeWriterImpl);
+ sal_uInt32 (TYPEREG_CALLTYPE *getBlopSize) (TypeWriterImpl);
+
+ void (TYPEREG_CALLTYPE *setReferenceData) (TypeWriterImpl, sal_uInt16, rtl_uString*, RTReferenceType, rtl_uString*, RTFieldAccess);
+};
+
+typedef RegistryTypeWriter_Api* (TYPEREG_CALLTYPE *InitRegistryTypeWriter_Api)(void);
+
+#define REGISTRY_TYPE_WRITER_INIT_FUNCTION_NAME "initRegistryTypeWriter_Api"
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/** RegistryTypeWriterLoader load the needed DLL for a RegistryTypeWriter.
+ The loader can be checked if the DLL is loaded. If the DLL is loaded the
+ loader provides a valid Api for the RegistryTypeWriter.
+*/
+class RegistryTypeWriterLoader
+ : public ::vos::ODynamicLoader<RegistryTypeWriter_Api>
+{
+public:
+ RegistryTypeWriterLoader()
+ : ::vos::ODynamicLoader<RegistryTypeWriter_Api>
+ (::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("reg") ),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(REGISTRY_TYPE_WRITER_INIT_FUNCTION_NAME) ),
+ sal_True, LIBRARY_VERSION, sal_False)
+ {}
+
+ ~RegistryTypeWriterLoader()
+ {}
+};
+
+
+/** RegistryTypeWriter writes type informations into a blop.
+ Class is inline and use a load on call C-Api.
+*/
+class RegistryTypeWriter
+{
+public:
+
+ inline RegistryTypeWriter(const RegistryTypeWriter_Api* pApi,
+ RTTypeClass RTTypeClass,
+ const ::rtl::OUString& typeName,
+ const ::rtl::OUString& superTypeName,
+ sal_uInt16 fieldCount,
+ sal_uInt16 methodCount,
+ sal_uInt16 referenceCount);
+
+ inline RegistryTypeWriter(const RegistryTypeWriterLoader& rLoader,
+ RTTypeClass RTTypeClass,
+ const ::rtl::OUString& typeName,
+ const ::rtl::OUString& superTypeName,
+ sal_uInt16 fieldCount,
+ sal_uInt16 methodCount,
+ sal_uInt16 referenceCount);
+
+ inline RegistryTypeWriter(const RegistryTypeWriter& toCopy);
+ inline ~RegistryTypeWriter();
+
+ inline RegistryTypeWriter& operator == (const RegistryTypeWriter& toAssign);
+
+ inline void setUik(const RTUik& uik);
+
+ inline void setDoku(const ::rtl::OUString& doku);
+
+ inline void setFileName(const ::rtl::OUString& fileName);
+
+ inline void setFieldData( sal_uInt16 index,
+ const ::rtl::OUString& name,
+ const ::rtl::OUString& typeName,
+ const ::rtl::OUString& doku,
+ const ::rtl::OUString& fileName,
+ RTFieldAccess access,
+ RTConstValue constValue = RTConstValue());
+
+ inline void setMethodData(sal_uInt16 index,
+ const ::rtl::OUString& name,
+ const ::rtl::OUString& returnTypeName,
+ RTMethodMode mode,
+ sal_uInt16 paramCount,
+ sal_uInt16 excCount,
+ const ::rtl::OUString& doku);
+
+ inline void setParamData(sal_uInt16 index,
+ sal_uInt16 paramIndex,
+ const ::rtl::OUString& type,
+ const ::rtl::OUString& name,
+ RTParamMode mode);
+
+ inline void setExcData(sal_uInt16 index,
+ sal_uInt16 excIndex,
+ const ::rtl::OUString& type);
+
+ inline const sal_uInt8* getBlop();
+ inline sal_uInt32 getBlopSize();
+
+ inline void setReferenceData( sal_uInt16 index,
+ const ::rtl::OUString& name,
+ RTReferenceType refType,
+ const ::rtl::OUString& doku,
+ RTFieldAccess access = RT_ACCESS_INVALID);
+
+protected:
+
+ const RegistryTypeWriter_Api* m_pApi;
+ const NAMESPACE_VOS(ODynamicLoader)<RegistryTypeWriter_Api> m_Api;
+ TypeWriterImpl m_hImpl;
+};
+
+
+
+inline RegistryTypeWriter::RegistryTypeWriter(const RegistryTypeWriter_Api* pApi,
+ RTTypeClass RTTypeClass,
+ const ::rtl::OUString& typeName,
+ const ::rtl::OUString& superTypeName,
+ sal_uInt16 fieldCount,
+ sal_uInt16 methodCount,
+ sal_uInt16 referenceCount)
+ : m_pApi(pApi)
+ , m_Api()
+ , m_hImpl(NULL)
+{
+ m_hImpl = m_pApi->createEntry(RTTypeClass,
+ typeName.pData,
+ superTypeName.pData,
+ fieldCount,
+ methodCount,
+ referenceCount);
+}
+
+
+inline RegistryTypeWriter::RegistryTypeWriter(const RegistryTypeWriterLoader& rLoader,
+ RTTypeClass RTTypeClass,
+ const ::rtl::OUString& typeName,
+ const ::rtl::OUString& superTypeName,
+ sal_uInt16 fieldCount,
+ sal_uInt16 methodCount,
+ sal_uInt16 referenceCount)
+ : m_pApi(NULL)
+ , m_Api(rLoader)
+ , m_hImpl(NULL)
+{
+ m_pApi = m_Api.getApi();
+ m_hImpl = m_pApi->createEntry(RTTypeClass,
+ typeName.pData,
+ superTypeName.pData,
+ fieldCount,
+ methodCount,
+ referenceCount);
+}
+
+
+inline RegistryTypeWriter::RegistryTypeWriter(const RegistryTypeWriter& toCopy)
+ : m_pApi(toCopy.m_pApi)
+ , m_Api(toCopy.m_Api)
+ , m_hImpl(toCopy.m_hImpl)
+{
+ m_Api->acquire(m_hImpl);
+}
+
+inline RegistryTypeWriter::~RegistryTypeWriter()
+{
+ m_pApi->release(m_hImpl);
+}
+
+inline RegistryTypeWriter& RegistryTypeWriter::operator == (const RegistryTypeWriter& toAssign)
+{
+ if (m_hImpl != toAssign.m_hImpl)
+ {
+ m_pApi->release(m_hImpl);
+ m_hImpl = toAssign.m_hImpl;
+ m_pApi->acquire(m_hImpl);
+ }
+
+ return *this;
+}
+
+inline void RegistryTypeWriter::setFieldData( sal_uInt16 index,
+ const ::rtl::OUString& name,
+ const ::rtl::OUString& typeName,
+ const ::rtl::OUString& doku,
+ const ::rtl::OUString& fileName,
+ RTFieldAccess access,
+ RTConstValue constValue)
+{
+ m_pApi->setFieldData(m_hImpl, index, name.pData, typeName.pData, doku.pData, fileName.pData, access, constValue.m_type, constValue.m_value);
+}
+
+
+inline void RegistryTypeWriter::setMethodData(sal_uInt16 index,
+ const ::rtl::OUString& name,
+ const ::rtl::OUString& returnTypeName,
+ RTMethodMode mode,
+ sal_uInt16 paramCount,
+ sal_uInt16 excCount,
+ const ::rtl::OUString& doku)
+{
+ m_pApi->setMethodData(m_hImpl, index, name.pData, returnTypeName.pData, mode, paramCount, excCount, doku.pData);
+}
+
+
+inline void RegistryTypeWriter::setUik(const RTUik& uik)
+{
+ m_pApi->setUik(m_hImpl, &uik);
+}
+
+inline void RegistryTypeWriter::setDoku(const ::rtl::OUString& doku)
+{
+ m_pApi->setDoku(m_hImpl, doku.pData);
+}
+
+inline void RegistryTypeWriter::setFileName(const ::rtl::OUString& doku)
+{
+ m_pApi->setFileName(m_hImpl, doku.pData);
+}
+
+inline void RegistryTypeWriter::setParamData(sal_uInt16 index,
+ sal_uInt16 paramIndex,
+ const ::rtl::OUString& type,
+ const ::rtl::OUString& name,
+ RTParamMode mode)
+{
+ m_pApi->setParamData(m_hImpl, index, paramIndex, type.pData, name.pData, mode);
+}
+
+inline void RegistryTypeWriter::setExcData(sal_uInt16 index,
+ sal_uInt16 excIndex,
+ const ::rtl::OUString& type)
+{
+ m_pApi->setExcData(m_hImpl, index, excIndex, type.pData);
+}
+
+inline const sal_uInt8* RegistryTypeWriter::getBlop()
+{
+ return m_pApi->getBlop(m_hImpl);
+}
+
+inline sal_uInt32 RegistryTypeWriter::getBlopSize()
+{
+ return m_pApi->getBlopSize(m_hImpl);
+}
+
+
+inline void RegistryTypeWriter::setReferenceData( sal_uInt16 index,
+ const ::rtl::OUString& name,
+ RTReferenceType refType,
+ const ::rtl::OUString& doku,
+ RTFieldAccess access)
+{
+ m_pApi->setReferenceData(m_hImpl, index, name.pData, refType, doku.pData, access);
+}
+
+#endif
diff --git a/registry/inc/registry/registry.h b/registry/inc/registry/registry.h
new file mode 100644
index 000000000000..392fb8b82fe2
--- /dev/null
+++ b/registry/inc/registry/registry.h
@@ -0,0 +1,456 @@
+/*************************************************************************
+ *
+ * $RCSfile: registry.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _REGISTRY_REGISTRY_H_
+#define _REGISTRY_REGISTRY_H_
+
+#include <stddef.h>
+
+#ifndef _RTL_USTRING_H_
+#include <rtl/ustring.h>
+#endif
+#ifndef _REGISTRY_REGTYPE_H_
+#include <registry/regtype.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/** This function creates the specified key. If the key already exists in the registry,
+ the function opens it.
+ @param hKey Identifies a currently open key. The key opened or created by this function
+ is a subkey of the key identified by hKey.
+ @param keyName Points to a null terminated string specifying the name of a key that this
+ function opens or creates.
+ @param phNewKey Points to a variable that receives the handle of the opened or created key.
+ Memory to store this variable is allocated and is freed with the function
+ closeRegKey. If the function fails, phNewKey is NULL.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_createKey(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegKeyHandle* phNewKey);
+
+
+/** This function opens the specified key.
+ @param hKey Identifies a currently open key. The key opened by this function
+ is a subkey of the key identified by hKey
+ @param keyName Points to a null terminated string specifying the name of a key that this
+ function opens.
+ @param phNewKey Points to a variable that receives the handle of the opened key.
+ Memory to store this variable is allocated and is freed with the function
+ reg_closeKey. If the function fails, phNewKey is NULL.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_openKey(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegKeyHandle* phOpenKey);
+
+
+
+/** This function opens all subkeys of the specified key.
+ @param hKey Identifies a currently open key. The key that subkeys opened by this
+ function is a subkey of the key identified by hKey
+ @param keyName Points to a null terminated string specifying the name of a key that subkeys
+ this function opens.
+ @param pphSubKeys Points to a variable that receives an array of of all opened subkeys.
+ Memory to store this variable is allocated and is freed with the function
+ reg_closeSubKeys. If the function fails, pphSubKeys is NULL.
+ @param pnSubKeys Specified the length of the array (the number of open subkeys).
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_openSubKeys(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegKeyHandle** pphSubKeys,
+ sal_uInt32* pnSubKeys);
+
+
+/** This function close all subkeys specified in the array.
+ @param phSubKeys Points to a variable that containss an array of of all opened subkeys.
+ The allocated memory of pphSubKeys and all open subkeys is freed.
+ @param nSubKeys Specified the length of the array (the number of subkeys to closed).
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_closeSubKeys(RegKeyHandle* phSubKeys,
+ sal_uInt32 nSubKeys);
+
+
+/** This function deletes the specified key.
+ @param hKey Identifies a currently open key. The key deleted by this function
+ is a subkey of the key identified by hKey
+ @param keyName Points to a null terminated string specifying the name of a key that this
+ function deletes.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_deleteKey(RegKeyHandle hKey,
+ rtl_uString* keyName);
+
+
+/** This function closes the specified key.
+ @param hKey Identifies a currently open key. The key is closed by this function.
+ The memory of the variable specifying the key is freeing.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_closeKey(RegKeyHandle hKey);
+
+
+/** This function returns the name of the key.
+ @param hKey Identifies a currently open key which name will returned.
+ @param pKeyName contains the keyname if succeeds else an empty string.
+*/
+const RegError REGISTRY_CALLTYPE reg_getKeyName(RegKeyHandle hKey, rtl_uString** pKeyName);
+
+
+/** This function sets an value under the specified key.
+ @param hKey Identifies a currently open key. The key which value is setted by this
+ function is a subkey of the key identified by hKey.
+ @param keyName Points to a null terminated string specifying the name of a key which value
+ is set by this function. If keyName is NULL, the value is set for the key
+ specified by hKey.
+ @param valueType Specified the type of the value.
+ @param pData Points to a memory block containing the current data for the value.
+ @param valueSize Specified the size of pData in bytes
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_setValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegValueType valueType,
+ RegValue pData,
+ sal_uInt32 valueSize);
+
+
+/** This function sets an long list value under the key.
+ @param keyName Points to a null terminated string specifying the name of a key which value
+ is set by this function. If keyName is NULL, the value is set for the key
+ specified by hKey.
+ @param pValueList Points to an array of longs containing the current data for the value.
+ @param len Specified the len of pValueList.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_setLongListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Int32* pValueList,
+ sal_uInt32 len);
+
+
+/** This function sets an ascii list value under the key.
+ @param keyName Points to a null terminated string specifying the name of a key which value
+ is set by this function. If keyName is NULL, the value is set for the key
+ specified by hKey.
+ @param pValueList Points to an array of sal_Char* containing the current data for the value.
+ @param len Specified the len of pValueList.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_setStringListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Char** pValueList,
+ sal_uInt32 len);
+
+
+/** This function sets an unicode string list value under the key.
+ @param keyName Points to a null terminated string specifying the name of a key which value
+ is set by this function. If keyName is NULL, the value is set for the key
+ specified by hKey.
+ @param pValueList Points to an array of sal_Unicode* containing the current data for the value.
+ @param len Specified the len of pValueList.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_setUnicodeListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Unicode** pValueList,
+ sal_uInt32 len);
+
+
+/** This function gets info about type and size of the value.
+ @param hKey Identifies a currently open key. The key which value info is getted by this
+ function is a subkey of the key identified by hKey.
+ @param keyName Points to a null terminated string specifying the name of a key which value
+ is get by this function. If keyName is NULL, the value info is get from the
+ key specified by hKey.
+ @param pValueType Specified the type of the value.
+ @param pValueSize Specified the size of pData in bytes
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_getValueInfo(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegValueType* pValueType,
+ sal_uInt32* pValueSize);
+
+
+/** This function gets the value under the specified key.
+ @param hKey Identifies a currently open key. The key which value is getted by this
+ function is a subkey of the key identified by hKey.
+ @param keyName Points to a null terminated string specifying the name of a key which value
+ is get by this function. If keyName is NULL, the value is get from the key
+ specified by hKey.
+ @param pData Points to an allocated memory block receiving the current data for the value.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_getValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegValue pData);
+
+
+/** This function gets the value under the specified key.
+ @param keyName Points to a null terminated string specifying the name of a key which value
+ is get by this function. If keyName is NULL, the value is get from the key
+ specified by hKey.
+ @param pValueList A Pointer to a long value list.
+ @param pLen Specifies the length of the value list.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_getLongListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Int32** pValueList,
+ sal_uInt32* pLen);
+
+
+/** This function gets the value under the specified key.
+ @param keyName Points to a null terminated string specifying the name of a key which value
+ is get by this function. If keyName is NULL, the value is get from the key
+ specified by hKey.
+ @param pValueList A Pointer to a ascii value list.
+ @param pLen Specifies the length of the value list.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_getStringListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Char*** pValueList,
+ sal_uInt32* pLen);
+
+
+/** This function gets the value under the specified key.
+ @param keyName Points to a null terminated string specifying the name of a key which value
+ is get by this function. If keyName is NULL, the value is get from the key
+ specified by hKey.
+ @param pValueList A Pointer to a unicode value list.
+ @param pLen Specifies the length of the value list.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_getUnicodeListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Unicode*** pValueList,
+ sal_uInt32* pLen);
+
+
+/** This function free a value list.
+ @param valueType Specifies the type of the list members.
+ @param pValueList A Pointer to value list.
+ @param pLen Specifies the length of the value list.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_freeValueList(RegValueType valueType,
+ RegValue pValueList,
+ sal_uInt32 len);
+
+RegError REGISTRY_CALLTYPE reg_createLink(RegKeyHandle hKey,
+ rtl_uString* linkName,
+ rtl_uString* linkTarget);
+
+RegError REGISTRY_CALLTYPE reg_deleteLink(RegKeyHandle hKey,
+ rtl_uString* linkName);
+
+RegError REGISTRY_CALLTYPE reg_getKeyType(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegKeyType* pKeyType);
+
+RegError REGISTRY_CALLTYPE reg_getLinkTarget(RegKeyHandle hKey,
+ rtl_uString* linkName,
+ rtl_uString** pLinkTarget);
+
+/** This function will resolved all or only the first link of a keyname
+ and returns the resolved keyName in pResolvedName.
+ @param hKey Identifies a currently open key.
+ @param keyName Points to a null terminated string specifying the relativ name of a key.
+ The name of rKey together with keyName will be resolved from links.
+ If keyName is NULL the registry information under the key specified by rKey
+ is saved in the specified file.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+RegError REGISTRY_CALLTYPE reg_getResolvedKeyName(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Bool firstLinkOnly,
+ rtl_uString** pResolvedName);
+
+/** This function loads registry information from a specified file and save it under the
+ specified keyName.
+ @param hKey Specifies the key where the subkey will be created.
+ @param keyName Points to a null terminated string specifying the name of the created subkey.
+ If keyName is NULL the registry information is saved under the key specified
+ by hKey.
+ @param regFileName Points to a null terminated string specifying the file containing the
+ registry information.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_loadKey(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ rtl_uString* regFileName);
+
+
+/** This function saves the registry information from the specified key and all subkeys and save
+ it in the specified file.
+ @param hKey Identifies a currently open key. The key which inforamtion is saved by this
+ function is a subkey of the key identified by hKey.
+ @param keyName Points to a null terminated string specifying the name of the subkey.
+ If keyName is NULL the registry information under the key specified by hKey
+ is saved in the specified file.
+ @param regFileName Points to a null terminated string specifying the file containing the
+ registry information.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_saveKey(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ rtl_uString* regFileName);
+
+
+/** This function merges the registry information from the specified key and the registry
+ information of the specified file. Existing keys will extended.
+ @param hKey Identifies a currently open key. The key which inforamtion is merged by this
+ function is a subkey of the key identified by hKey.
+ @param keyName Points to a null terminated string specifying the name of the subkey.
+ If keyName is NULL the registry information under the key specified by hKey
+ is merged with the information from the specified file.
+ @param regFileName Points to a null terminated string specifying the file containing the
+ registry information.
+ @param bWarnings if TRUE the function returns an error if a key already exists.
+ @param bReport if TRUE the function reports warnings on stdout if a key already exists.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_mergeKey(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ rtl_uString* regFileName,
+ sal_Bool bWarnings,
+ sal_Bool bReport);
+
+
+/** This function creates a new registry with the specified name and creates a root key.
+ @param registryName Points to a null terminated string specifying the name of the new registry.
+ @param phRegistry Points to a variable that receives the handle of the created registry.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_createRegistry(rtl_uString* registryName,
+ RegHandle* phRegistry);
+
+
+/** This function opens the root key of the sepcified registry.
+ @param hReg Identifies a currently open registry which rootKey will returned.
+ @param phRootKey Points to a variable that receives the handle of the open root key.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_openRootKey(RegHandle hRegistry,
+ RegKeyHandle* phRootKey);
+
+
+/** This function returns the name of the registry.
+ @param hReg Identifies a currently open registry which name will returned.
+ @param pName name if succeeds else an empty string.
+*/
+const RegError REGISTRY_CALLTYPE reg_getName(RegHandle hRegistry, rtl_uString** pName);
+
+
+/** This function returns the access mode of the registry.
+ @param hReg Identifies a currently open registry.
+ @return TRUE if accessmode is read only else FALSE.
+*/
+sal_Bool REGISTRY_CALLTYPE reg_isReadOnly(RegHandle hReg);
+
+
+/** This function opens a registry with the specified name.
+ @param registryName Identifies a registry name.
+ @param phRegistry Points to a variable that receives the handle of the opened registry.
+ @param accessMode specify the accessmode for the registry, REG_READONLY or REG_READWRITE.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_openRegistry(rtl_uString* registryName,
+ RegHandle* phRegistry,
+ RegAccessMode accessMode);
+
+
+/** This function close the specified registry.
+ @param hRegistry Identifies a currently open registry.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_closeRegistry(RegHandle hRegistry);
+
+
+/** This function destroy the specified registry.
+ @param hRegistry Identifies a currently open registry.
+ @param registryName Identifies a registry name, if the name is NULL the registry
+ itselfs will be destroyed.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_destroyRegistry(RegHandle hRegistry,
+ rtl_uString* registryName);
+
+
+/** This function dump the content under the open key to stdout
+ @param hKey Identifies a currently open key which subtree is dumped.
+ @return REG_NO_ERROR if succeeds else an error code.
+*/
+RegError REGISTRY_CALLTYPE reg_dumpRegistry(RegKeyHandle hKey);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/registry/inc/registry/registry.hxx b/registry/inc/registry/registry.hxx
new file mode 100644
index 000000000000..bc4acd25b3ad
--- /dev/null
+++ b/registry/inc/registry/registry.hxx
@@ -0,0 +1,1220 @@
+/*************************************************************************
+ *
+ * $RCSfile: registry.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _REGISTRY_REGISTRY_HXX_
+#define _REGISTRY_REGISTRY_HXX_
+
+#ifndef _REGISTRY_REGTYPE_H_
+#include <registry/regtype.h>
+#endif
+#ifndef _VOS_DYNLOAD_HXX_
+#include <vos/dynload.hxx>
+#endif
+
+#ifndef _VOS_MACROS_HXX_
+#include <vos/macros.hxx>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct Registry_Api
+{
+ void (REGISTRY_CALLTYPE *acquire) (RegHandle);
+ void (REGISTRY_CALLTYPE *release) (RegHandle);
+ sal_Bool (REGISTRY_CALLTYPE *isReadOnly) (RegHandle);
+ RegError (REGISTRY_CALLTYPE *openRootKey) (RegHandle, RegKeyHandle*);
+ RegError (REGISTRY_CALLTYPE *getName) (RegHandle, rtl_uString**);
+ RegError (REGISTRY_CALLTYPE *createRegistry) (rtl_uString*, RegHandle*);
+ RegError (REGISTRY_CALLTYPE *openRegistry) (rtl_uString*, RegHandle*, RegAccessMode);
+ RegError (REGISTRY_CALLTYPE *closeRegistry) (RegHandle);
+ RegError (REGISTRY_CALLTYPE *destroyRegistry) (RegHandle, rtl_uString*);
+ RegError (REGISTRY_CALLTYPE *loadKey) (RegHandle, RegKeyHandle, rtl_uString*, rtl_uString*);
+ RegError (REGISTRY_CALLTYPE *saveKey) (RegHandle, RegKeyHandle, rtl_uString*, rtl_uString*);
+ RegError (REGISTRY_CALLTYPE *mergeKey) (RegHandle, RegKeyHandle, rtl_uString*, rtl_uString*, sal_Bool, sal_Bool);
+ RegError (REGISTRY_CALLTYPE *dumpRegistry) (RegHandle, RegKeyHandle);
+ void (REGISTRY_CALLTYPE *acquireKey) (RegKeyHandle);
+ void (REGISTRY_CALLTYPE *releaseKey) (RegKeyHandle);
+ sal_Bool (REGISTRY_CALLTYPE *isKeyReadOnly) (RegKeyHandle);
+ RegError (REGISTRY_CALLTYPE *getKeyName) (RegKeyHandle, rtl_uString**);
+ RegError (REGISTRY_CALLTYPE *createKey) (RegKeyHandle, rtl_uString*, RegKeyHandle*);
+ RegError (REGISTRY_CALLTYPE *openKey) (RegKeyHandle, rtl_uString*, RegKeyHandle*);
+ RegError (REGISTRY_CALLTYPE *openSubKeys) (RegKeyHandle, rtl_uString*, RegKeyHandle**, sal_uInt32*);
+ RegError (REGISTRY_CALLTYPE *closeSubKeys) (RegKeyHandle*, sal_uInt32);
+ RegError (REGISTRY_CALLTYPE *deleteKey) (RegKeyHandle, rtl_uString*);
+ RegError (REGISTRY_CALLTYPE *closeKey) (RegKeyHandle);
+ RegError (REGISTRY_CALLTYPE *setValue) (RegKeyHandle, rtl_uString*, RegValueType, RegValue, sal_uInt32);
+ RegError (REGISTRY_CALLTYPE *setLongListValue) (RegKeyHandle, rtl_uString*, sal_Int32*, sal_uInt32);
+ RegError (REGISTRY_CALLTYPE *setStringListValue) (RegKeyHandle, rtl_uString*, sal_Char**, sal_uInt32);
+ RegError (REGISTRY_CALLTYPE *setUnicodeListValue)(RegKeyHandle, rtl_uString*, sal_Unicode**, sal_uInt32);
+ RegError (REGISTRY_CALLTYPE *getValueInfo) (RegKeyHandle, rtl_uString*, RegValueType*, sal_uInt32*);
+ RegError (REGISTRY_CALLTYPE *getValue) (RegKeyHandle, rtl_uString*, RegValue);
+ RegError (REGISTRY_CALLTYPE *getLongListValue) (RegKeyHandle, rtl_uString*, sal_Int32**, sal_uInt32*);
+ RegError (REGISTRY_CALLTYPE *getStringListValue) (RegKeyHandle, rtl_uString*, sal_Char***, sal_uInt32*);
+ RegError (REGISTRY_CALLTYPE *getUnicodeListValue)(RegKeyHandle, rtl_uString*, sal_Unicode***, sal_uInt32*);
+ RegError (REGISTRY_CALLTYPE *freeValueList) (RegValueType, RegValue, sal_uInt32);
+ RegError (REGISTRY_CALLTYPE *createLink) (RegKeyHandle, rtl_uString*, rtl_uString*);
+ RegError (REGISTRY_CALLTYPE *deleteLink) (RegKeyHandle, rtl_uString*);
+ RegError (REGISTRY_CALLTYPE *getKeyType) (RegKeyHandle, rtl_uString*, RegKeyType*);
+ RegError (REGISTRY_CALLTYPE *getLinkTarget) (RegKeyHandle, rtl_uString*, rtl_uString**);
+ RegError (REGISTRY_CALLTYPE *getResolvedKeyName) (RegKeyHandle, rtl_uString*, sal_Bool, rtl_uString**);
+ RegError (REGISTRY_CALLTYPE *getKeyNames) (RegKeyHandle, rtl_uString*, rtl_uString***, sal_uInt32*);
+ RegError (REGISTRY_CALLTYPE *freeKeyNames) (rtl_uString**, sal_uInt32);
+};
+
+typedef Registry_Api* (REGISTRY_CALLTYPE *InitRegistry_Api)(void);
+
+#define REGISTRY_INIT_FUNCTION_NAME "initRegistry_Api"
+
+#ifdef __cplusplus
+}
+#endif
+
+
+class RegistryKey;
+
+//-----------------------------------------------------------------------------
+
+/** RegistryLoader load the needed DLL for the registry.
+ The loader can be checked if the DLL is loaded. If the DLL is loaded the
+ loader provides a valid Api for the registry.
+*/
+class RegistryLoader : public ::vos::ODynamicLoader<Registry_Api>
+{
+public:
+ /// Default constructor, try to load the registry DLL and initialize the needed api.
+ RegistryLoader()
+ : ::vos::ODynamicLoader<Registry_Api>
+ (::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("reg") ),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(REGISTRY_INIT_FUNCTION_NAME) ),
+ sal_True, LIBRARY_VERSION, sal_False)
+ {}
+
+ /// Destructor, decrease the refcount and unload the DLL if the refcount is 0.
+ ~RegistryLoader()
+ {}
+};
+
+/** Registry read and write information in a registry file.
+ Class is inline and use a load on call C-Api.
+*/
+class Registry
+{
+public:
+ /** Constructor.
+ This constructor is called with a valid api for the registry.
+ The constructor is used if the api is known. Use open() or create()
+ to initialize the registry with a valid registry data file.
+ */
+ inline Registry(const Registry_Api* pApi);
+
+ /** Constructor.
+ This constructor is called with a RegisterLoader for the registry.
+ The RegistryLoader load the needed DLL and provide the needed api for
+ the registry. Use open() or create() to initialize the registry with a
+ valid registry data file.
+ */
+ inline Registry(const RegistryLoader& rLoader);
+
+ /// Copy constructcor
+ inline Registry(const Registry& toCopy);
+
+ /// Destructor. The Destructor close the registry if it is open.
+ inline ~Registry();
+
+ /// Assign operator
+ inline Registry& operator = (const Registry& toAssign);
+
+ /// isValid checks if the registry points to a valid registry data file.
+ inline sal_Bool isValid() const;
+
+ /** isReadOnly returns the access mode of the registry.
+ @return TRUE if accessmode is readonly else FALSE.
+ */
+ inline sal_Bool isReadOnly() const;
+
+ /** openRootKey opens the root key of the registry.
+ @param rRootKey reference on a RegistryKey which is filled with the rootkey.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError openRootKey(RegistryKey& rRootKey);
+
+ /// getName returns the name of the current registry data file.
+ inline ::rtl::OUString getName();
+
+ /** This function creates a new registry with the specified name and creates a root key.
+ @param registryName specifies the name of the new registry.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError create(const ::rtl::OUString& registryName);
+
+ /** This function opens a registry with the specified name. If the registry alreday points
+ to a valid registry, the old regitry will be closed.
+ @param registryName Identifies a registry name.
+ @param accessMode Specifies the accessmode for the registry, REG_READONLY or REG_READWRITE.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError open(const ::rtl::OUString& registryName,
+ RegAccessMode accessMode);
+
+ /// close explicitly the current registry data file
+ inline RegError close();
+
+ /** This function destroy the specified registry.
+ @param registryName Identifies a registry name, if the name is an empty string the registry
+ itselfs will be destroyed.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError destroy(const ::rtl::OUString& registryName);
+
+ /** This function loads registry information from a specified file and save it under the
+ specified keyName.
+ @param rKey Specifies the key where the subkey will be created.
+ @param keyName specifies the name of the subkey.
+ If keyName is an empty string the registry information is saved under the key
+ specified by rKey.
+ @param regFileName specifies the file containing the registry information.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError loadKey(RegistryKey& rKey,
+ const ::rtl::OUString& keyName,
+ const ::rtl::OUString& regFileName);
+
+ /** This function saves the registry information from the specified key and all subkeys and save
+ it in the specified file.
+ @param rKey Identifies a currently open key. The key which inforamtion is saved by this
+ function is a subkey of the key identified by hKey.
+ @param keyName specifies the name of the subkey.
+ If keyName is an empty string the registry information under the key specified
+ by rKey is saved in the specified file.
+ @param regFileName specifies the file containing the registry information.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError saveKey(RegistryKey& rKey,
+ const ::rtl::OUString& keyName,
+ const ::rtl::OUString& regFileName);
+
+ /** This function merges the registry information from the specified key and the registry
+ information of the specified file. Existing keys will extended.
+ @param rKey Identifies a currently open key. The key which inforamtion is merged by this
+ function is a subkey of the key identified by hKey.
+ @param keyName specifies the name of the subkey.
+ If keyName is an empty string the registry information under the key specified
+ by rKey is merged with the information from the specified file.
+ @param regFileName specifies the file containing the registry information.
+ @param bWarnings if TRUE the function returns an error if a key already exists.
+ @param bReport if TRUE the function reports warnings on stdout if a key already exists.
+ @return REG_NO_ERROR if succeeds else an error code. If returns an error the registry will
+ restore the state before merging.
+ */
+ inline RegError mergeKey(RegistryKey& rKey,
+ const ::rtl::OUString& keyName,
+ const ::rtl::OUString& regFileName,
+ sal_Bool bWarnings = sal_False,
+ sal_Bool bReport = sal_False);
+
+ /** This function dump the content under the open key to stdout
+ @param rKey Identifies a currently open key which subtree is dumped.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError dumpRegistry(RegistryKey& rKey);
+
+ friend class RegistryKey;
+ friend class RegistryKeyArray;
+ friend class RegistryKeyNames;
+
+ const Registry_Api* getApi() { return m_pApi; }
+protected:
+
+ const Registry_Api* m_pApi;
+ NAMESPACE_VOS(ODynamicLoader)<Registry_Api> m_Api;
+ RegHandle m_hImpl;
+};
+
+
+//-----------------------------------------------------------------------------
+
+/** RegistryKeyArray presents an array of open keys.
+ RegistryKeyArray is a helper class to work with an array of subkeys.
+*/
+class RegistryKeyArray
+{
+public:
+ /// Default constructor
+ inline RegistryKeyArray();
+
+ /// Destructor
+ inline ~RegistryKeyArray();
+
+ /// This function returns the open key sepecified with index.
+ inline RegistryKey getElement(sal_uInt32 index);
+
+ /// This function returns the length of the array.
+ inline sal_uInt32 getLength();
+
+ friend class RegistryKey;
+protected:
+ inline void setKeyHandles(Registry& registry, RegKeyHandle* phKeys, sal_uInt32 length);
+ inline RegError closeKeyHandles();
+
+ sal_uInt32 m_length;
+ RegKeyHandle* m_phKeys;
+ Registry m_registry;
+};
+
+
+/** RegistryKeyNames presents an array of subkey names.
+ RegistryKeyNames is a helper class to work with an array of subkeys.
+*/
+class RegistryKeyNames
+{
+public:
+ /// Default constructor
+ inline RegistryKeyNames();
+
+ /// Destructor
+ inline ~RegistryKeyNames();
+
+ /// This function returns the name of the key sepecified with index.
+ inline ::rtl::OUString getElement(sal_uInt32 index);
+
+ /// This function returns the length of the array.
+ inline sal_uInt32 getLength();
+
+ friend class RegistryKey;
+protected:
+ inline void setKeyNames(Registry& registry, rtl_uString** pKeyNames, sal_uInt32 length);
+ inline RegError freeKeyNames();
+
+ sal_uInt32 m_length;
+ rtl_uString** m_pKeyNames;
+ Registry m_registry;
+};
+
+//-----------------------------------------------------------------------------
+
+/** RegistryValueList presents an value list of the specified type.
+ RegistryValueList is a helper class to work with a list value.
+*/
+template<class ValueType>
+class RegistryValueList
+{
+public:
+ /// Default constructor
+ RegistryValueList()
+ : m_length(0)
+ , m_pValueList(NULL)
+ , m_registry(NULL)
+ {}
+
+ /// Destructor
+ ~RegistryValueList()
+ {
+ if (m_pValueList)
+ {
+ m_registry.getApi()->freeValueList(m_valueType, m_pValueList, m_length);
+ }
+ }
+
+ /// This function returns the value of the list with the sepecified index.
+ ValueType getElement(sal_uInt32 index)
+ {
+ if (m_registry.isValid() && index < m_length)
+ {
+ return m_pValueList[index];
+ } else
+ {
+ return 0;
+ }
+ }
+
+ /// This function returns the length of the list.
+ sal_uInt32 getLength()
+ {
+ return m_length;
+ }
+
+ friend class RegistryKey;
+protected:
+ void setValueList(Registry& registry, RegValueType valueType,
+ ValueType* pValueList, sal_uInt32 length)
+ {
+ m_length = length;
+ m_pValueList = pValueList;
+ m_valueType = valueType;
+ m_registry = registry;
+ }
+
+ sal_uInt32 m_length;
+ ValueType* m_pValueList;
+ RegValueType m_valueType;
+ Registry m_registry;
+};
+
+//-----------------------------------------------------------------------------
+
+/** RegistryKey read and write information for the specified key in a registry.
+ Class is inline and use a load on call C-Api.
+*/
+class RegistryKey
+{
+public:
+ /// Default constructor
+ inline RegistryKey();
+
+ /// Copy constructor
+ inline RegistryKey(const RegistryKey& toCopy);
+
+ /// Destructor. The Destructor close the key if it is open.
+ inline ~RegistryKey();
+
+ /// Assign operator
+ inline RegistryKey& operator = (const RegistryKey& toAssign);
+
+ /// isValid checks if the key points to a valid registry key.
+ inline sal_Bool isValid() const;
+
+ /** isReadOnly returns the access mode of the key.
+ @return TRUE if accessmode is read only else FALSE.
+ */
+ inline sal_Bool isReadOnly() const;
+
+ /// getName returns the full name of the key beginning with the rootkey.
+ inline ::rtl::OUString getName();
+
+ /** This function creates the specified key. If the key already exists in the registry,
+ the function opens it.
+ @param keyName specifies the name of the key which will be opened or created.
+ @param rNewKey Reference a RegistryKey which will be filled with the new or open key.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError createKey(const ::rtl::OUString& keyName,
+ RegistryKey& rNewKey);
+
+ /** This function opens the specified key.
+ @param keyName Points to a null terminated string specifying the name of a key that this
+ function opens.
+ @param rOpenKey Reference a RegistryKey which will be filled with the open key.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError openKey(const ::rtl::OUString& keyName,
+ RegistryKey& rOpenKey);
+
+ /** This function returns the names of all subkeys of the key.
+ @param keyName Points to a null terminated string specifying the name of a key.
+ @param rSubKeys Reference a RegistryKeyArray which will be filled with the names of the subkeys.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError openSubKeys(const ::rtl::OUString& keyName,
+ RegistryKeyArray& rSubKeys);
+
+ /** This function opens all subkeys of the key.
+ @param keyName Points to a null terminated string specifying the name of a key that subkeys
+ this function opens.
+ @param rSubKeyNames Reference a RegistryKeyNames array which will be filled with the open subkeys.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getKeyNames(const ::rtl::OUString& keyName,
+ RegistryKeyNames& rSubKeyNames);
+
+ /** This function close all subkeys specified in the array.
+ @param rSubKeys Reference a RegistryKeyArray which contains the open subkeys.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError closeSubKeys(RegistryKeyArray& rSubKeys);
+
+ /** This function deletes the specified key.
+ @param keyName specifies the name of the key which will be deleted.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError deleteKey(const ::rtl::OUString& keyName);
+
+ /// close explicitly the current key
+ inline RegError closeKey();
+
+ /** This function sets an value under the key.
+ @param keyName specifies the name of the key which value is set by this function.
+ If keyName is an empty string, the value is set for the key
+ specified by hKey.
+ @param valueType Specified the type of the value.
+ @param pData Points to a memory block containing the current data for the value.
+ @param valueSize Specified the size of pData in bytes
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError setValue(const ::rtl::OUString& keyName,
+ RegValueType valueType,
+ RegValue pValue,
+ sal_uInt32 valueSize);
+
+ /** This function sets an long list value under the key.
+ @param keyName specifies the name of the key which value is set by this function.
+ If keyName is an empty string, the value is set for the key
+ specified by hKey.
+ @param pValueList Points to an array of longs containing the current data for the value.
+ @param len Specified the len of pValueList.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError setLongListValue(const ::rtl::OUString& keyName,
+ sal_Int32* pValueList,
+ sal_uInt32 len);
+
+ /** This function sets an ascii list value under the key.
+ @param keyName specifies the name of the key which value is set by this function.
+ If keyName is an empty string, the value is set for the key
+ specified by hKey.
+ @param pValueList Points to an array of sal_Char* containing the current data for the value.
+ @param len Specified the len of pValueList.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError setStringListValue(const ::rtl::OUString& keyName,
+ sal_Char** pValueList,
+ sal_uInt32 len);
+
+ /** This function sets an unicode string list value under the key.
+ @param keyName specifies the name of the key which value is set by this function.
+ If keyName is an empty string, the value is set for the key
+ specified by hKey.
+ @param pValueList Points to an array of sal_Unicode* containing the current data for the value.
+ @param len Specified the len of pValueList.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError setUnicodeListValue(const ::rtl::OUString& keyName,
+ sal_Unicode** pValueList,
+ sal_uInt32 len);
+
+ /** This function gets info about type and size of the value.
+ @param keyName specifies the name of the key which value is set by this function.
+ If keyName is an empty string, the value is set for the key
+ specified by hKey.
+ @param pValueType Specified the type of the value.
+ @param pValueSize Specified the size of pData in bytes or the length of a list value.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getValueInfo(const ::rtl::OUString& keyName,
+ RegValueType* pValueType,
+ sal_uInt32* pValueSize);
+
+ /** This function gets the value under the specified key.
+ @param keyName specifies the name of the key which value is get by this function.
+ If keyName is an empty string, the value is get from the key
+ specified by hKey.
+ @param pValue Points to an allocated memory block receiving the current data for the value.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getValue(const ::rtl::OUString& keyName,
+ RegValue pValue);
+
+ /** This function gets the value under the specified key.
+ @param keyName specifies the name of the key which value is get by this function.
+ If keyName is an empty string, the value is get from the key
+ specified by hKey.
+ @param rValueList Reference a RegistryValueList which will be filled with the ascii values.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getLongListValue(const ::rtl::OUString& keyName,
+ RegistryValueList<sal_Int32>& rValueList);
+
+ /** This function gets the value under the specified key.
+ @param keyName specifies the name of the key which value is get by this function.
+ If keyName is an empty string, the value is get from the key
+ specified by hKey.
+ @param rValueList Reference a RegistryValueList which will be filled with the ascii values.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getStringListValue(const ::rtl::OUString& keyName,
+ RegistryValueList<sal_Char*>& rValueList);
+
+ /** This function gets the value under the specified key.
+ @param keyName specifies the name of the key which value is get by this function.
+ If keyName is an empty string, the value is get from the key
+ specified by hKey.
+ @param rValueList Reference a RegistryValueList which will be filled with the unicode values.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getUnicodeListValue(const ::rtl::OUString& keyName,
+ RegistryValueList<sal_Unicode*>& rValueList);
+
+
+ inline RegError createLink(const ::rtl::OUString& linkName,
+ const ::rtl::OUString& linkTarget);
+
+ inline RegError deleteLink(const ::rtl::OUString& linkName);
+
+ inline RegError getKeyType(const ::rtl::OUString& name,
+ RegKeyType* pKeyType) const;
+
+ inline RegError getLinkTarget(const ::rtl::OUString& linkName,
+ ::rtl::OUString& rLinkTarget) const;
+
+ /** This function will resolved all or only the first link of a keyname
+ and returns the resolved keyName in rResolvedName.
+ @param keyName specifies the relativ name of the key which name will be resolved.
+ @return REG_NO_ERROR if succeeds else an error code.
+ */
+ inline RegError getResolvedKeyName(const ::rtl::OUString& keyName,
+ sal_Bool firstLinkOnly,
+ ::rtl::OUString& rResolvedName) const;
+
+ /** getRegistryName returns the name of the current registry in which
+ the key is defined.
+ */
+ inline ::rtl::OUString getRegistryName();
+
+ /// getRegistry returns the registry in which the key is defined.
+ Registry getRegistry() const { return m_registry; }
+
+ friend class Registry;
+public:
+ inline RegistryKey(Registry& registry,
+ RegKeyHandle hKey);
+
+ RegKeyHandle getKeyHandle() const { return m_hImpl; }
+
+protected:
+ inline void setRegistry(Registry& registry);
+
+ Registry m_registry;
+ RegKeyHandle m_hImpl;
+};
+
+
+//-----------------------------------------------------------------------------
+
+inline RegistryKeyArray::RegistryKeyArray()
+ : m_length(0)
+ , m_phKeys(NULL)
+ , m_registry(NULL)
+{
+}
+
+inline RegistryKeyArray::~RegistryKeyArray()
+{
+ if (m_phKeys)
+ m_registry.m_pApi->closeSubKeys(m_phKeys, m_length);
+}
+
+inline RegistryKey RegistryKeyArray::getElement(sal_uInt32 index)
+{
+ if (m_registry.isValid() && index < m_length)
+ return RegistryKey(m_registry, m_phKeys[index]);
+ else
+ return RegistryKey();
+}
+
+inline sal_uInt32 RegistryKeyArray::getLength()
+{
+ return m_length;
+}
+
+inline void RegistryKeyArray::setKeyHandles(Registry& registry,
+ RegKeyHandle* phKeys,
+ sal_uInt32 length)
+{
+ m_phKeys = phKeys;
+ m_length = length;
+ m_registry = registry;
+}
+
+inline RegError RegistryKeyArray::closeKeyHandles()
+{
+ if (m_registry.isValid() && m_phKeys)
+ {
+ RegError ret;
+ ret = m_registry.m_pApi->closeSubKeys(m_phKeys, m_length);
+ m_registry = Registry(m_registry.m_pApi);
+ m_length = 0;
+ m_phKeys = NULL;
+ return ret;
+ } else
+ return(REG_INVALID_KEY);
+}
+
+//-----------------------------------------------------------------------------
+
+inline RegistryKeyNames::RegistryKeyNames()
+ : m_length(0)
+ , m_pKeyNames(NULL)
+ , m_registry(NULL)
+{
+}
+
+inline RegistryKeyNames::~RegistryKeyNames()
+{
+ if (m_pKeyNames)
+ m_registry.m_pApi->freeKeyNames(m_pKeyNames, m_length);
+}
+
+inline ::rtl::OUString RegistryKeyNames::getElement(sal_uInt32 index)
+{
+
+ if (m_pKeyNames && index < m_length)
+ return m_pKeyNames[index];
+ else
+ return ::rtl::OUString();
+}
+
+inline sal_uInt32 RegistryKeyNames::getLength()
+{
+ return m_length;
+}
+
+inline void RegistryKeyNames::setKeyNames(Registry& registry,
+ rtl_uString** pKeyNames,
+ sal_uInt32 length)
+{
+ m_pKeyNames = pKeyNames;
+ m_length = length;
+ m_registry = registry;
+}
+
+inline RegError RegistryKeyNames::freeKeyNames()
+{
+ if (m_registry.isValid() && m_pKeyNames)
+ {
+ RegError ret = REG_NO_ERROR;
+ ret = m_registry.m_pApi->freeKeyNames(m_pKeyNames, m_length);
+ m_registry = Registry(m_registry.m_pApi);
+ m_length = 0;
+ m_pKeyNames = NULL;
+ return ret;
+ } else
+ return REG_INVALID_KEY;
+}
+
+//-----------------------------------------------------------------------------
+
+inline RegistryKey::RegistryKey()
+ : m_registry(NULL)
+ , m_hImpl(NULL)
+ { }
+
+inline RegistryKey::RegistryKey(Registry& registry, RegKeyHandle hKey)
+ : m_registry(registry)
+ , m_hImpl(hKey)
+ {
+ if (m_hImpl)
+ m_registry.m_pApi->acquireKey(m_hImpl);
+ }
+
+inline RegistryKey::RegistryKey(const RegistryKey& toCopy)
+ : m_registry(toCopy.m_registry)
+ , m_hImpl(toCopy.m_hImpl)
+ {
+ if (m_hImpl)
+ m_registry.m_pApi->acquireKey(m_hImpl);
+ }
+
+inline void RegistryKey::setRegistry(Registry& registry)
+ {
+ m_registry = registry;
+ }
+
+inline RegistryKey::~RegistryKey()
+ {
+ if (m_hImpl)
+ m_registry.m_pApi->closeKey(m_hImpl);
+ }
+
+inline RegistryKey& RegistryKey::operator = (const RegistryKey& toAssign)
+{
+ m_registry = toAssign.m_registry;
+
+ if (m_hImpl != toAssign.m_hImpl)
+ {
+ m_registry.m_pApi->releaseKey(m_hImpl);
+ m_hImpl = toAssign.m_hImpl;
+ m_registry.m_pApi->acquireKey(m_hImpl);
+ }
+
+ return *this;
+}
+
+inline sal_Bool RegistryKey::isValid() const
+ { return (m_hImpl != NULL); }
+
+inline sal_Bool RegistryKey::isReadOnly() const
+ {
+ if (m_registry.isValid())
+ return (m_registry.m_pApi)->isKeyReadOnly(m_hImpl);
+ else
+ return sal_False;
+ }
+
+inline ::rtl::OUString RegistryKey::getName()
+ {
+ ::rtl::OUString sRet;
+ if (m_registry.isValid())
+ m_registry.m_pApi->getKeyName(m_hImpl, &sRet.pData);
+ return sRet;;
+ }
+
+inline RegError RegistryKey::createKey(const ::rtl::OUString& keyName,
+ RegistryKey& rNewKey)
+ {
+ if (rNewKey.isValid()) rNewKey.closeKey();
+ if (m_registry.isValid())
+ {
+ RegError ret = m_registry.m_pApi->createKey(m_hImpl, keyName.pData, &rNewKey.m_hImpl);
+ if (!ret) rNewKey.setRegistry(m_registry);
+ return ret;
+ } else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::openKey(const ::rtl::OUString& keyName,
+ RegistryKey& rOpenKey)
+ {
+ if (rOpenKey.isValid()) rOpenKey.closeKey();
+ if (m_registry.isValid())
+ {
+ RegError ret = m_registry.m_pApi->openKey(m_hImpl, keyName.pData,
+ &rOpenKey.m_hImpl);
+ if (!ret) rOpenKey.setRegistry(m_registry);
+ return ret;
+ } else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::openSubKeys(const ::rtl::OUString& keyName,
+ RegistryKeyArray& rSubKeys)
+ {
+ if (m_registry.isValid())
+ {
+ RegError ret = REG_NO_ERROR;
+ RegKeyHandle* pSubKeys;
+ sal_uInt32 nSubKeys;
+ if (ret = m_registry.m_pApi->openSubKeys(m_hImpl, keyName.pData,
+ &pSubKeys, &nSubKeys))
+ {
+ return ret;
+ } else
+ {
+ rSubKeys.setKeyHandles(m_registry, pSubKeys, nSubKeys);
+ return ret;
+ }
+ } else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getKeyNames(const ::rtl::OUString& keyName,
+ RegistryKeyNames& rSubKeyNames)
+ {
+ if (m_registry.isValid())
+ {
+ RegError ret = REG_NO_ERROR;
+ rtl_uString** pSubKeyNames;
+ sal_uInt32 nSubKeys;
+ if (ret = m_registry.m_pApi->getKeyNames(m_hImpl, keyName.pData,
+ &pSubKeyNames, &nSubKeys))
+ {
+ return ret;
+ } else
+ {
+ rSubKeyNames.setKeyNames(m_registry, pSubKeyNames, nSubKeys);
+ return ret;
+ }
+ } else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::closeSubKeys(RegistryKeyArray& rSubKeys)
+ {
+ if (m_registry.isValid())
+ return rSubKeys.closeKeyHandles();
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::deleteKey(const ::rtl::OUString& keyName)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->deleteKey(m_hImpl, keyName.pData);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::closeKey()
+ {
+ if (m_registry.isValid())
+ {
+ RegError ret = m_registry.m_pApi->closeKey(m_hImpl);
+ if (!ret)
+ {
+ m_hImpl = NULL;
+ m_registry = Registry(m_registry.m_pApi);
+ }
+ return ret;
+ } else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::setValue(const ::rtl::OUString& keyName,
+ RegValueType valueType,
+ RegValue pValue,
+ sal_uInt32 valueSize)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->setValue(m_hImpl, keyName.pData, valueType,
+ pValue, valueSize);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::setLongListValue(const ::rtl::OUString& keyName,
+ sal_Int32* pValueList,
+ sal_uInt32 len)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->setLongListValue(m_hImpl, keyName.pData,
+ pValueList, len);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::setStringListValue(const ::rtl::OUString& keyName,
+ sal_Char** pValueList,
+ sal_uInt32 len)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->setStringListValue(m_hImpl, keyName.pData,
+ pValueList, len);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::setUnicodeListValue(const ::rtl::OUString& keyName,
+ sal_Unicode** pValueList,
+ sal_uInt32 len)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->setUnicodeListValue(m_hImpl, keyName.pData,
+ pValueList, len);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getValueInfo(const ::rtl::OUString& keyName,
+ RegValueType* pValueType,
+ sal_uInt32* pValueSize)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->getValueInfo(m_hImpl, keyName.pData, pValueType, pValueSize);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getValue(const ::rtl::OUString& keyName,
+ RegValue pValue)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->getValue(m_hImpl, keyName.pData, pValue);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getLongListValue(const ::rtl::OUString& keyName,
+ RegistryValueList<sal_Int32>& rValueList)
+ {
+ if (m_registry.isValid())
+ {
+ RegError ret = REG_NO_ERROR;
+ sal_Int32* pValueList;
+ sal_uInt32 length;
+ if (ret = m_registry.m_pApi->getLongListValue(m_hImpl, keyName.pData,
+ &pValueList, &length))
+ {
+ return ret;
+ } else
+ {
+ rValueList.setValueList(m_registry, RG_VALUETYPE_LONGLIST,
+ pValueList, length);
+ return ret;
+ }
+ } else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getStringListValue(const ::rtl::OUString& keyName,
+ RegistryValueList<sal_Char*>& rValueList)
+ {
+ if (m_registry.isValid())
+ {
+ RegError ret = REG_NO_ERROR;
+ sal_Char** pValueList;
+ sal_uInt32 length;
+ if (ret = m_registry.m_pApi->getStringListValue(m_hImpl, keyName.pData,
+ &pValueList, &length))
+ {
+ return ret;
+ } else
+ {
+ rValueList.setValueList(m_registry, RG_VALUETYPE_STRINGLIST,
+ pValueList, length);
+ return ret;
+ }
+ } else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getUnicodeListValue(const ::rtl::OUString& keyName,
+ RegistryValueList<sal_Unicode*>& rValueList)
+ {
+ if (m_registry.isValid())
+ {
+ RegError ret = REG_NO_ERROR;
+ sal_Unicode** pValueList;
+ sal_uInt32 length;
+ if (ret = m_registry.m_pApi->getUnicodeListValue(m_hImpl, keyName.pData,
+ &pValueList, &length))
+ {
+ return ret;
+ } else
+ {
+ rValueList.setValueList(m_registry, RG_VALUETYPE_UNICODELIST,
+ pValueList, length);
+ return ret;
+ }
+ } else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::createLink(const ::rtl::OUString& linkName,
+ const ::rtl::OUString& linkTarget)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->createLink(m_hImpl, linkName.pData, linkTarget.pData);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::deleteLink(const ::rtl::OUString& linkName)
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->deleteLink(m_hImpl, linkName.pData);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getKeyType(const ::rtl::OUString& keyName,
+ RegKeyType* pKeyType) const
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->getKeyType(m_hImpl, keyName.pData, pKeyType);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline RegError RegistryKey::getLinkTarget(const ::rtl::OUString& linkName,
+ ::rtl::OUString& rLinkTarget) const
+ {
+ if (m_registry.isValid())
+ {
+ return m_registry.m_pApi->getLinkTarget(m_hImpl,
+ linkName.pData,
+ &rLinkTarget.pData);
+ } else
+ return REG_INVALID_KEY;
+ }
+
+
+inline RegError RegistryKey::getResolvedKeyName(const ::rtl::OUString& keyName,
+ sal_Bool firstLinkOnly,
+ ::rtl::OUString& rResolvedName) const
+ {
+ if (m_registry.isValid())
+ return m_registry.m_pApi->getResolvedKeyName(m_hImpl,
+ keyName.pData,
+ firstLinkOnly,
+ &rResolvedName.pData);
+ else
+ return REG_INVALID_KEY;
+ }
+
+inline ::rtl::OUString RegistryKey::getRegistryName()
+ {
+ if (m_registry.isValid())
+ {
+ return m_registry.getName();
+ } else
+ return ::rtl::OUString();
+ }
+
+//-----------------------------------------------------------------------------
+
+inline Registry::Registry(const Registry_Api* pApi)
+ : m_pApi(pApi)
+ , m_Api()
+ , m_hImpl(NULL)
+ { }
+
+inline Registry::Registry(const RegistryLoader& rLoader)
+ : m_pApi(NULL)
+ , m_Api(rLoader)
+ , m_hImpl(NULL)
+ {
+ m_pApi = m_Api.getApi();
+ }
+
+inline Registry::Registry(const Registry& toCopy)
+ : m_pApi(toCopy.m_pApi)
+ , m_Api(toCopy.m_Api)
+ , m_hImpl(toCopy.m_hImpl)
+ {
+ if (m_hImpl)
+ m_pApi->acquire(m_hImpl);
+ }
+
+
+inline Registry::~Registry()
+ {
+ if (m_pApi && m_hImpl)
+ m_pApi->release(m_hImpl);
+ }
+
+inline Registry& Registry::operator = (const Registry& toAssign)
+{
+
+ if (m_hImpl != toAssign.m_hImpl)
+ {
+ if (m_pApi) m_pApi->release(m_hImpl);
+ m_pApi = toAssign.m_pApi;
+ m_Api = toAssign.m_Api;
+ m_hImpl = toAssign.m_hImpl;
+ }
+ if (m_hImpl && m_pApi)
+ m_pApi->acquire(m_hImpl);
+
+ return *this;
+}
+
+inline sal_Bool Registry::isValid() const
+ { return ( m_hImpl != NULL && m_pApi != NULL ); }
+
+inline sal_Bool Registry::isReadOnly() const
+ { return m_pApi->isReadOnly(m_hImpl); }
+
+inline RegError Registry::openRootKey(RegistryKey& rRootKey)
+ {
+ rRootKey.setRegistry(*this);
+ return m_pApi->openRootKey(m_hImpl, &rRootKey.m_hImpl);
+ }
+
+inline ::rtl::OUString Registry::getName()
+ {
+ ::rtl::OUString sRet;
+ m_pApi->getName(m_hImpl, &sRet.pData);
+ return sRet;
+ }
+
+inline RegError Registry::create(const ::rtl::OUString& registryName)
+ {
+ if (m_hImpl)
+ m_pApi->release(m_hImpl);
+ return m_pApi->createRegistry(registryName.pData, &m_hImpl);
+ }
+
+inline RegError Registry::open(const ::rtl::OUString& registryName,
+ RegAccessMode accessMode)
+ {
+ if (m_hImpl)
+ m_pApi->release(m_hImpl);
+ return m_pApi->openRegistry(registryName.pData, &m_hImpl, accessMode);
+ }
+
+inline RegError Registry::close()
+ {
+ RegError ret = m_pApi->closeRegistry(m_hImpl);
+ if (!ret)
+ m_hImpl = NULL;
+ return ret;
+ }
+
+inline RegError Registry::destroy(const ::rtl::OUString& registryName)
+ {
+ RegError ret = m_pApi->destroyRegistry(m_hImpl, registryName.pData);
+ if ( !ret && (registryName.getLength() == 0) )
+ m_hImpl = NULL;
+ return ret;
+ }
+
+inline RegError Registry::loadKey(RegistryKey& rKey,
+ const ::rtl::OUString& keyName,
+ const ::rtl::OUString& regFileName)
+ { return m_pApi->loadKey(m_hImpl, rKey.m_hImpl, keyName.pData, regFileName.pData); }
+
+inline RegError Registry::saveKey(RegistryKey& rKey,
+ const ::rtl::OUString& keyName,
+ const ::rtl::OUString& regFileName)
+ { return m_pApi->saveKey(m_hImpl, rKey.m_hImpl, keyName.pData, regFileName.pData); }
+
+inline RegError Registry::mergeKey(RegistryKey& rKey,
+ const ::rtl::OUString& keyName,
+ const ::rtl::OUString& regFileName,
+ sal_Bool bWarnings,
+ sal_Bool bReport)
+ { return m_pApi->mergeKey(m_hImpl, rKey.m_hImpl, keyName.pData, regFileName.pData, bWarnings, bReport); }
+
+inline RegError Registry::dumpRegistry(RegistryKey& rKey)
+ { return m_pApi->dumpRegistry(m_hImpl, rKey.m_hImpl); }
+
+
+#endif
diff --git a/registry/inc/registry/regtype.h b/registry/inc/registry/regtype.h
new file mode 100644
index 000000000000..42f8643e3fa7
--- /dev/null
+++ b/registry/inc/registry/regtype.h
@@ -0,0 +1,185 @@
+/*************************************************************************
+ *
+ * $RCSfile: regtype.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _REGISTRY_REGTYPE_H_
+#define _REGISTRY_REGTYPE_H_
+
+#ifndef _SAL_TYPES_H_
+#include <sal/types.h>
+#endif
+
+// version number of the library. This number is used for the load on call
+// mechanism and must be modifed when the library will be upgraded to a new version.
+#define LIBRARY_VERSION 2
+
+typedef void* RegHandle;
+
+typedef void* RegKeyHandle;
+
+typedef void* RegValue;
+
+typedef sal_uInt16 RegAccessMode;
+
+#define REG_READONLY 0x0001 // allow read accesses only
+#define REG_READWRITE 0x0002 // allow read and write accesses
+
+/// RegKeyType specify the type of the key, if it is a real key or a link
+enum RegKeyType
+{
+ /// The key is a real key
+ RG_KEYTYPE,
+ /// The key is a link
+ RG_LINKTYPE
+};
+
+/// RegValueType specify the type of the value of a key
+enum RegValueType
+{
+ /// The key has no value
+ RG_VALUETYPE_NOT_DEFINED,
+ /// The key has a value of type long
+ RG_VALUETYPE_LONG,
+ /// The key has a value of type ascii
+ RG_VALUETYPE_STRING,
+ /// The key has a value of type unicode
+ RG_VALUETYPE_UNICODE,
+ /// The key has a value of type binary
+ RG_VALUETYPE_BINARY,
+ /// The key has a value of type long list
+ RG_VALUETYPE_LONGLIST,
+ /// The key has a value of type ascii list
+ RG_VALUETYPE_STRINGLIST,
+ /// The key has a value of type unicode list
+ RG_VALUETYPE_UNICODELIST
+};
+
+/// RegError specify the possible error codes
+enum RegError
+{
+ /// no error
+ REG_NO_ERROR,
+ /// internal registry error
+ REG_INTERNAL_ERROR,
+
+ /// registry is not open
+ REG_REGISTRY_NOT_OPEN,
+ /// registry does not exists
+ REG_REGISTRY_NOT_EXISTS,
+ /// registry is readonly
+ REG_REGISTRY_READONLY,
+ /// destroy registry failed. Ther are may be any open keys.
+ REG_DESTROY_REGISTRY_FAILED,
+ /** registry cannot open for readwrite because the registry is already
+ open for readwrite anywhere.
+ */
+ REG_CANNOT_OPEN_FOR_READWRITE,
+ /** registry is in a invalid state or the registry does not point to
+ a valid registry data file
+ */
+ REG_INVALID_REGISTRY,
+
+ /// The key is not open
+ REG_KEY_NOT_OPEN,
+ /// The key not exists
+ REG_KEY_NOT_EXISTS,
+ /// The key cannot created
+ REG_CREATE_KEY_FAILED,
+ /// The key cannot not deleted
+ REG_DELETE_KEY_FAILED,
+ /** The keyname is invalid. This error will return if the keyname
+ is NULL but should not be NULL in the context of called function.
+ */
+ REG_INVALID_KEYNAME,
+ /// The key is not in a valid state
+ REG_INVALID_KEY,
+
+ /// key has no value
+ REG_VALUE_NOT_EXISTS,
+ ///
+ REG_SET_VALUE_FAILED,
+ ///
+ REG_DELETE_VALUE_FAILED,
+ ///
+ REG_INVALID_VALUE,
+
+ ///
+ REG_MERGE_ERROR,
+ ///
+ REG_MERGE_CONFLICT,
+
+ ///
+ REG_DETECT_RECURSION,
+ ///
+ REG_INVALID_LINK,
+ ///
+ REG_INVALID_LINKNAME,
+ ///
+ REG_INVALID_LINKTARGET,
+ ///
+ REG_LINKTARGET_NOT_EXIST,
+ ///
+ REG_BUFFERSIZE_TOSMALL
+};
+
+
+#define REGISTRY_CALLTYPE SAL_CALL
+
+#endif
diff --git a/registry/prj/d.lst b/registry/prj/d.lst
new file mode 100644
index 000000000000..e3086d058171
--- /dev/null
+++ b/registry/prj/d.lst
@@ -0,0 +1,20 @@
+dos: mkdir %_DEST%\inc%_EXT%\registry
+mkdir: %_DEST%\lib%_EXT%\libreg2.dylib.framework
+
+..\inc\registry\*.h %_DEST%\inc%_EXT%\registry\*.h
+..\inc\registry\*.hxx %_DEST%\inc%_EXT%\registry\*.hxx
+
+..\%__SRC%\lib\ireg.lib %_DEST%\lib%_EXT%\ireg.lib
+..\%__SRC%\lib\libreg*.so %_DEST%\lib%_EXT%\libreg*.so
+..\%__SRC%\lib\libreg*.so.* %_DEST%\lib%_EXT%\libreg*.so.*
+..\%__SRC%\bin\reg*.dll %_DEST%\bin%_EXT%\reg*.dll
+..\%__SRC%\lib\libreg*.dylib %_DEST%\lib%_EXT%\libreg*.dylib
+..\%__SRC%\lib\libreg2.dylib.framework\libreg*.dylib %_DEST%\lib%_EXT%\libreg2.dylib.framework\libreg*.dylib
+
+..\%__SRC%\bin\regmerge.exe %_DEST%\bin%_EXT%\regmerge.exe
+..\%__SRC%\bin\regview.exe %_DEST%\bin%_EXT%\regview.exe
+..\%__SRC%\bin\regmerge %_DEST%\bin%_EXT%\regmerge
+..\%__SRC%\bin\regview %_DEST%\bin%_EXT%\regview
+..\version.mk %_DEST%\inc%_EXT%\registry\version.mk
+
+
diff --git a/registry/source/keyimpl.cxx b/registry/source/keyimpl.cxx
new file mode 100644
index 000000000000..88ab180472c7
--- /dev/null
+++ b/registry/source/keyimpl.cxx
@@ -0,0 +1,1260 @@
+/*************************************************************************
+ *
+ * $RCSfile: keyimpl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef __REFLCNST_HXX__
+#include "reflcnst.hxx"
+#endif
+
+#include "keyimpl.hxx"
+
+#ifndef _RTL_ALLOC_H_
+#include <rtl/alloc.h>
+#endif
+
+#ifndef _RTL_MEMORY_H_
+#include <rtl/memory.h>
+#endif
+
+//*********************************************************************
+// ORegKey()
+//
+ORegKey::ORegKey(const OUString& keyName, const OStoreDirectory& rStoreDir, ORegistry* pReg)
+ : m_refCount(1)
+ , m_name(keyName)
+ , m_bDeleted(sal_False)
+ , m_isLink(sal_False)
+ , m_pRegistry(pReg)
+{
+ if (pReg)
+ {
+ m_storeFile = pReg->getStoreFile();
+ }
+
+ checkLink();
+}
+
+//*********************************************************************
+// ORegKey()
+//
+ORegKey::ORegKey(const OUString& keyName, const OUString& linkName,
+ const OStoreDirectory& rStoreDir, ORegistry* pReg)
+ : m_refCount(1)
+ , m_name(keyName)
+ , m_bDeleted(sal_False)
+ , m_pRegistry(pReg)
+{
+ if (linkName.getLength())
+ {
+ m_link = linkName;
+ m_isLink = sal_True;
+
+ setValue(OUString( RTL_CONSTASCII_USTRINGPARAM("LINK_TARGET") ), RG_VALUETYPE_UNICODE,
+ (RegValue*)linkName.pData->buffer, linkName.getLength()+1);
+ } else
+ {
+ m_isLink = sal_False;
+ }
+}
+
+//*********************************************************************
+// ORegKey()
+//
+ORegKey::ORegKey()
+ : m_refCount(1)
+ , m_bDeleted(sal_False)
+ , m_isLink(sal_False)
+ , m_pRegistry(NULL)
+{
+}
+
+
+//*********************************************************************
+// ~ORegKey()
+//
+ORegKey::~ORegKey()
+{
+}
+
+
+//*********************************************************************
+// createKey
+//
+RegError ORegKey::createKey(const OUString& keyName, RegKeyHandle* phNewKey)
+{
+ return m_pRegistry->createKey(this, keyName, phNewKey);
+}
+
+
+//*********************************************************************
+// openKey
+//
+RegError ORegKey::openKey(const OUString& keyName, RegKeyHandle* phOpenKey, RESOLVE eResolve)
+{
+ return (m_pRegistry->openKey(this, keyName, phOpenKey, eResolve));
+}
+
+
+//*********************************************************************
+// openSubKeys
+//
+RegError ORegKey::openSubKeys(const OUString& keyName, RegKeyHandle** phOpenSubKeys, sal_uInt32* pnSubKeys)
+{
+ ORegKey* pKey;
+ OUString sFullKeyName, sSubKeyName;
+ RegKeyHandle hSKey, hSubKey;
+ RegError _ret = REG_NO_ERROR;
+ sal_uInt32 nSubKeys;
+ ORegKey* *subKeys;
+
+ if ( keyName.getLength() )
+ {
+ if ((_ret = openKey(keyName, &hSKey)))
+ {
+ *phOpenSubKeys = NULL;
+ *pnSubKeys = 0;
+ return _ret;
+ }
+
+ pKey = (ORegKey*)hSKey;
+ } else
+ {
+ pKey = this;
+ }
+
+ nSubKeys = pKey->countSubKeys();
+
+ *pnSubKeys = nSubKeys;
+ subKeys = (ORegKey**)rtl_allocateZeroMemory(nSubKeys * sizeof(ORegKey*));
+
+ OStoreDirectory::iterator iter;
+ OStoreDirectory rStoreDir(pKey->getStoreDir());
+ storeError _err = rStoreDir.first(iter);
+
+ nSubKeys = 0;
+ while ( _err == store_E_None )
+ {
+ if ( iter.m_nAttrib & STORE_ATTRIB_ISDIR )
+ {
+ sSubKeyName = iter.m_pszName;
+ sFullKeyName = pKey->getName();
+ if (sFullKeyName.getLength() > 1)
+ sFullKeyName += m_pRegistry->ROOT;
+ sFullKeyName += sSubKeyName;
+
+ if (_ret = pKey->openKey(sSubKeyName, &hSubKey))
+ {
+ *phOpenSubKeys = NULL;
+ *pnSubKeys = 0;
+ rtl_freeMemory(subKeys);
+ return _ret;
+ }
+
+ subKeys[nSubKeys] = ((ORegKey*)hSubKey);
+
+ nSubKeys++;
+ }
+
+ _err = rStoreDir.next(iter);
+ }
+
+ *phOpenSubKeys = (RegKeyHandle*)subKeys;
+ if (keyName.getLength())
+ {
+ closeKey(hSKey);
+ }
+ return REG_NO_ERROR;
+}
+
+
+//*********************************************************************
+// getKeyNames
+//
+RegError ORegKey::getKeyNames(const OUString& keyName,
+ rtl_uString*** pSubKeyNames,
+ sal_uInt32* pnSubKeys)
+{
+ ORegKey* pKey;
+ OUString sFullKeyName, sSubKeyName;
+ RegError _ret = REG_NO_ERROR;
+ sal_uInt32 nSubKeys;
+ rtl_uString** pSubKeys;
+
+ if (keyName.getLength())
+ {
+ if (_ret = openKey(keyName, (RegKeyHandle*)&pKey, RESOLVE_PART))
+ {
+ *pSubKeyNames = NULL;
+ *pnSubKeys = 0;
+ return _ret;
+ }
+ } else
+ {
+ pKey = this;
+ }
+
+ nSubKeys = pKey->countSubKeys();
+
+ *pnSubKeys = nSubKeys;
+ pSubKeys = (rtl_uString**)rtl_allocateZeroMemory(nSubKeys * sizeof(rtl_uString*));
+
+ OStoreDirectory::iterator iter;
+ OStoreDirectory rStoreDir(pKey->getStoreDir());
+ storeError _err = rStoreDir.first(iter);
+ OUString subKey;
+
+ nSubKeys = 0;
+
+ while ( _err == store_E_None )
+ {
+ if ( iter.m_nAttrib & STORE_ATTRIB_ISDIR)
+ {
+ sSubKeyName = iter.m_pszName;
+ sFullKeyName = pKey->getName();
+ if (sFullKeyName.getLength() > 1)
+ sFullKeyName += m_pRegistry->ROOT;
+ sFullKeyName += sSubKeyName;
+
+ subKey = sFullKeyName;
+ rtl_uString_newFromString(&pSubKeys[nSubKeys], subKey.pData);
+
+ nSubKeys++;
+ }
+
+ _err = rStoreDir.next(iter);
+ }
+
+ *pSubKeyNames = pSubKeys;
+ if (keyName.getLength())
+ {
+ closeKey((RegKeyHandle)pKey);
+ }
+ return REG_NO_ERROR;
+}
+
+
+//*********************************************************************
+// closeSubKeys
+//
+RegError ORegKey::closeSubKeys(RegKeyHandle* phSubKeys, sal_uInt32 nSubKeys)
+{
+ RegError _ret = REG_NO_ERROR;
+
+ for (int i=0; i < nSubKeys; i++)
+ {
+ _ret = closeKey(phSubKeys[i]);
+ }
+
+ rtl_freeMemory(phSubKeys);
+ return _ret;
+}
+
+
+//*********************************************************************
+// closeKey
+//
+RegError ORegKey::closeKey(RegKeyHandle hKey)
+{
+ return (m_pRegistry->closeKey(hKey));
+}
+
+
+//*********************************************************************
+// deleteKey
+//
+RegError ORegKey::deleteKey(const OUString& keyName)
+{
+ return (m_pRegistry->deleteKey(this, keyName));
+}
+
+
+//*********************************************************************
+// getValueType
+//
+RegError ORegKey::getValueInfo(const OUString& valueName, RegValueType* pValueType, sal_uInt32* pValueSize) const
+{
+ OStoreStream rValue;
+ sal_uInt8* pBuffer;
+ storeAccessMode accessMode = VALUE_MODE_OPEN;
+
+ if (m_pRegistry->isReadOnly())
+ {
+ accessMode = VALUE_MODE_OPENREAD;
+ }
+
+ OUString sImplValueName( RTL_CONSTASCII_USTRINGPARAM(VALUE_PREFIX) );
+ sImplValueName += valueName;
+
+ REG_GUARD(m_pRegistry->m_mutex);
+
+ if ( rValue.create(m_storeFile, m_name + m_pRegistry->ROOT, sImplValueName, accessMode) )
+ {
+ *pValueType = RG_VALUETYPE_NOT_DEFINED;
+ *pValueSize = 0;
+ return REG_VALUE_NOT_EXISTS;
+ }
+
+ pBuffer = (sal_uInt8*)rtl_allocateMemory(VALUE_HEADERSIZE);
+
+ sal_uInt32 readBytes;
+ if ( rValue.readAt(0, pBuffer, VALUE_HEADERSIZE, readBytes) )
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+ if (readBytes != VALUE_HEADERSIZE)
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+
+ sal_uInt32 size;
+ sal_uInt8 type = *((sal_uInt8*)pBuffer);
+ readUINT32(pBuffer+VALUE_TYPEOFFSET, size);
+
+ *pValueType = (RegValueType)type;
+// if (*pValueType == RG_VALUETYPE_UNICODE)
+// {
+// *pValueSize = (size / 2) * sizeof(sal_Unicode);
+// } else
+// {
+ if (*pValueType > 4)
+ {
+ rtl_freeMemory(pBuffer);
+ pBuffer = (sal_uInt8*)rtl_allocateMemory(4);
+ rValue.readAt(VALUE_HEADEROFFSET, pBuffer, 4, readBytes);
+
+ readUINT32(pBuffer, size);
+ }
+
+ *pValueSize = size;
+// }
+
+ rtl_freeMemory(pBuffer);
+ return REG_NO_ERROR;
+}
+
+
+//*********************************************************************
+// setValue
+//
+RegError ORegKey::setValue(const OUString& valueName, RegValueType vType, RegValue value, sal_uInt32 vSize)
+{
+ OStoreStream rValue;
+ sal_uInt8* pBuffer;
+
+ if (m_pRegistry->isReadOnly())
+ {
+ return REG_REGISTRY_READONLY;
+ }
+
+ if (vType > 4)
+ {
+ return REG_INVALID_VALUE;
+ }
+
+ OUString sImplValueName( RTL_CONSTASCII_USTRINGPARAM(VALUE_PREFIX) );
+ sImplValueName += valueName;
+
+ REG_GUARD(m_pRegistry->m_mutex);
+
+ if ( rValue.create(m_storeFile, m_name + m_pRegistry->ROOT , sImplValueName, VALUE_MODE_CREATE) )
+ {
+ return REG_SET_VALUE_FAILED;
+ }
+
+ sal_uInt32 size = vSize;
+
+// if (vType == RG_VALUETYPE_UNICODE)
+// {
+// size = (rtl_ustr_getLength((sal_Unicode*)value)+1) * 2;
+// }
+
+ sal_uInt8 type = (sal_uInt8)vType;
+ pBuffer = (sal_uInt8*)rtl_allocateMemory(VALUE_HEADERSIZE + size);
+ rtl_copyMemory(pBuffer, &type, 1);
+
+ writeUINT32(pBuffer+VALUE_TYPEOFFSET, size);
+
+ switch (vType)
+ {
+ case RG_VALUETYPE_NOT_DEFINED:
+ rtl_copyMemory(pBuffer+VALUE_HEADEROFFSET, value, size);
+ break;
+ case RG_VALUETYPE_LONG:
+ writeINT32(pBuffer+VALUE_HEADEROFFSET, *((sal_Int32*)value));
+ break;
+ case RG_VALUETYPE_STRING:
+ writeUtf8(pBuffer+VALUE_HEADEROFFSET, (const sal_Char*)value);
+ break;
+ case RG_VALUETYPE_UNICODE:
+ writeString(pBuffer+VALUE_HEADEROFFSET, (const sal_Unicode*)value);
+ break;
+ case RG_VALUETYPE_BINARY:
+ rtl_copyMemory(pBuffer+VALUE_HEADEROFFSET, value, size);
+ break;
+ }
+
+
+ sal_uInt32 writenBytes;
+ if ( rValue.writeAt(0, pBuffer, VALUE_HEADERSIZE+size, writenBytes) )
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_SET_VALUE_FAILED;
+ }
+ if (writenBytes != (VALUE_HEADERSIZE+size))
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_SET_VALUE_FAILED;
+ }
+
+ rtl_freeMemory(pBuffer);
+ return REG_NO_ERROR;
+}
+
+//*********************************************************************
+// setLongListValue
+//
+RegError ORegKey::setLongListValue(const OUString& valueName, sal_Int32* pValueList, sal_uInt32 len)
+{
+ OStoreStream rValue;
+ sal_uInt8* pBuffer;
+
+ if (m_pRegistry->isReadOnly())
+ {
+ return REG_REGISTRY_READONLY;
+ }
+
+ OUString sImplValueName( RTL_CONSTASCII_USTRINGPARAM(VALUE_PREFIX) );
+ sImplValueName += valueName;
+
+ REG_GUARD(m_pRegistry->m_mutex);
+
+ if (rValue.create(m_storeFile, m_name + m_pRegistry->ROOT, sImplValueName, VALUE_MODE_CREATE) )
+ {
+ return REG_SET_VALUE_FAILED;
+ }
+
+ sal_uInt32 size = 4; // 4 Bytes (sal_uInt32) fuer die Laenge
+
+ size += len * 4;
+
+ sal_uInt8 type = (sal_uInt8)RG_VALUETYPE_LONGLIST;
+ pBuffer = (sal_uInt8*)rtl_allocateMemory(VALUE_HEADERSIZE + size);
+ rtl_copyMemory(pBuffer, &type, 1);
+
+ writeUINT32(pBuffer+VALUE_TYPEOFFSET, size);
+ writeUINT32(pBuffer+VALUE_HEADEROFFSET, len);
+
+ sal_uInt32 offset = 4; // initial 4 Bytes fuer die Laenge des Arrays
+
+ for (int i=0; i < len; i++)
+ {
+ writeINT32(pBuffer+VALUE_HEADEROFFSET+offset, pValueList[i]);
+ offset += 4;
+ }
+
+ sal_uInt32 writenBytes;
+ if ( rValue.writeAt(0, pBuffer, VALUE_HEADERSIZE+size, writenBytes) )
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_SET_VALUE_FAILED;
+ }
+ if (writenBytes != (VALUE_HEADEROFFSET+size))
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_SET_VALUE_FAILED;
+ }
+
+ rtl_freeMemory(pBuffer);
+ return REG_NO_ERROR;
+}
+
+//*********************************************************************
+// setStringListValue
+//
+RegError ORegKey::setStringListValue(const OUString& valueName, sal_Char** pValueList, sal_uInt32 len)
+{
+ OStoreStream rValue;
+ sal_uInt8* pBuffer;
+
+ if (m_pRegistry->isReadOnly())
+ {
+ return REG_REGISTRY_READONLY;
+ }
+
+ OUString sImplValueName( RTL_CONSTASCII_USTRINGPARAM(VALUE_PREFIX) );
+ sImplValueName += valueName;
+
+ REG_GUARD(m_pRegistry->m_mutex);
+
+ if (rValue.create(m_storeFile, m_name + m_pRegistry->ROOT, sImplValueName, VALUE_MODE_CREATE) )
+ {
+ return REG_SET_VALUE_FAILED;
+ }
+
+ sal_uInt32 size = 4; // 4 Bytes (sal_uInt32) fuer die Laenge
+
+ int i;
+ for (i=0; i < len; i++)
+ {
+ size += 4 + strlen(pValueList[i]) + 1;
+ }
+
+ sal_uInt8 type = (sal_uInt8)RG_VALUETYPE_STRINGLIST;
+ pBuffer = (sal_uInt8*)rtl_allocateMemory(VALUE_HEADERSIZE + size);
+ rtl_copyMemory(pBuffer, &type, 1);
+
+ writeUINT32(pBuffer+VALUE_TYPEOFFSET, size);
+ writeUINT32(pBuffer+VALUE_HEADEROFFSET, len);
+
+ sal_uInt32 offset = 4; // initial 4 Bytes fuer die Laenge des Arrays;
+ sal_uInt32 sLen = 0;
+
+ for (i=0; i < len; i++)
+ {
+ sLen = strlen(pValueList[i]) + 1;
+ writeUINT32(pBuffer+VALUE_HEADEROFFSET+offset, sLen);
+
+ offset += 4;
+ writeUtf8(pBuffer+VALUE_HEADEROFFSET+offset, pValueList[i]);
+ offset += sLen;
+ }
+
+ sal_uInt32 writenBytes;
+ if ( rValue.writeAt(0, pBuffer, VALUE_HEADERSIZE+size, writenBytes) )
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_SET_VALUE_FAILED;
+ }
+ if (writenBytes != (VALUE_HEADERSIZE+size))
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_SET_VALUE_FAILED;
+ }
+
+ rtl_freeMemory(pBuffer);
+ return REG_NO_ERROR;
+}
+
+//*********************************************************************
+// setUnicodeListValue
+//
+RegError ORegKey::setUnicodeListValue(const OUString& valueName, sal_Unicode** pValueList, sal_uInt32 len)
+{
+ OStoreStream rValue;
+ sal_uInt8* pBuffer;
+
+ if (m_pRegistry->isReadOnly())
+ {
+ return REG_REGISTRY_READONLY;
+ }
+
+ OUString sImplValueName( RTL_CONSTASCII_USTRINGPARAM(VALUE_PREFIX) );
+ sImplValueName += valueName;
+
+ REG_GUARD(m_pRegistry->m_mutex);
+
+ if (rValue.create(m_storeFile, m_name + m_pRegistry->ROOT, sImplValueName, VALUE_MODE_CREATE) )
+ {
+ return REG_SET_VALUE_FAILED;
+ }
+
+ sal_uInt32 size = 4; // 4 Bytes (sal_uInt32) fuer die Laenge
+
+ int i;
+ for (i=0; i < len; i++)
+ {
+ size += 4 + ((rtl_ustr_getLength(pValueList[i]) +1) * 2);
+ }
+
+ sal_uInt8 type = (sal_uInt8)RG_VALUETYPE_UNICODELIST;
+ pBuffer = (sal_uInt8*)rtl_allocateMemory(VALUE_HEADERSIZE + size);
+ rtl_copyMemory(pBuffer, &type, 1);
+
+ writeUINT32(pBuffer+VALUE_TYPEOFFSET, size);
+ writeUINT32(pBuffer+VALUE_HEADEROFFSET, len);
+
+ sal_uInt32 offset = 4; // initial 4 Bytes fuer die Laenge des Arrays;
+ sal_uInt32 sLen = 0;
+
+ for (i=0; i < len; i++)
+ {
+ sLen = (rtl_ustr_getLength(pValueList[i]) + 1) * 2;
+ writeUINT32(pBuffer+VALUE_HEADEROFFSET+offset, sLen);
+
+ offset += 4;
+ writeString(pBuffer+VALUE_HEADEROFFSET+offset, pValueList[i]);
+ offset += sLen;
+ }
+
+ sal_uInt32 writenBytes;
+ if ( rValue.writeAt(0, pBuffer, VALUE_HEADERSIZE+size, writenBytes) )
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_SET_VALUE_FAILED;
+ }
+ if (writenBytes != (VALUE_HEADERSIZE+size))
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_SET_VALUE_FAILED;
+ }
+
+ rtl_freeMemory(pBuffer);
+ return REG_NO_ERROR;
+}
+
+//*********************************************************************
+// getValue
+//
+RegError ORegKey::getValue(const OUString& valueName, RegValue value) const
+{
+ OStoreStream rValue;
+ sal_uInt8* pBuffer;
+ RegValueType valueType;
+ sal_uInt32 valueSize;
+ storeAccessMode accessMode = VALUE_MODE_OPEN;
+
+ if (m_pRegistry->isReadOnly())
+ {
+ accessMode = VALUE_MODE_OPENREAD;
+ }
+
+ OUString sImplValueName( RTL_CONSTASCII_USTRINGPARAM(VALUE_PREFIX) );
+ sImplValueName += valueName;
+
+ REG_GUARD(m_pRegistry->m_mutex);
+
+ if (rValue.create(m_storeFile, m_name + m_pRegistry->ROOT, sImplValueName, accessMode) )
+ {
+ return REG_VALUE_NOT_EXISTS;
+ }
+
+ pBuffer = (sal_uInt8*)rtl_allocateMemory(VALUE_HEADERSIZE);
+
+ sal_uInt32 readBytes;
+ if ( rValue.readAt(0, pBuffer, VALUE_HEADERSIZE, readBytes) )
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+ if (readBytes != VALUE_HEADERSIZE)
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+
+ sal_uInt8 type = *((sal_uInt8*)pBuffer);
+ valueType = (RegValueType)type;
+ readUINT32(pBuffer+VALUE_TYPEOFFSET, valueSize);
+
+ rtl_freeMemory(pBuffer);
+
+ if (valueType > 4)
+ {
+ return REG_INVALID_VALUE;
+ }
+
+ pBuffer = (sal_uInt8*)rtl_allocateMemory(valueSize);
+
+ if ( rValue.readAt(VALUE_HEADEROFFSET, pBuffer, valueSize, readBytes) )
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+ if (readBytes != valueSize)
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+
+// rtl_copyMemory(value, pBuffer, valueSize);
+ switch (valueType)
+ {
+ case RG_VALUETYPE_NOT_DEFINED:
+ rtl_copyMemory(value, pBuffer, valueSize);
+ break;
+ case RG_VALUETYPE_LONG:
+ readINT32(pBuffer, *((sal_Int32*)value));
+ break;
+ case RG_VALUETYPE_STRING:
+ readUtf8(pBuffer, (sal_Char*)value, valueSize);
+ break;
+ case RG_VALUETYPE_UNICODE:
+ readString(pBuffer, (sal_Unicode*)value, valueSize);
+ break;
+ case RG_VALUETYPE_BINARY:
+ rtl_copyMemory(value, pBuffer, valueSize);
+ break;
+ case RG_VALUETYPE_LONGLIST:
+ case RG_VALUETYPE_STRINGLIST:
+ case RG_VALUETYPE_UNICODELIST:
+ rtl_copyMemory(value, pBuffer, valueSize);
+ break;
+ }
+
+
+ rtl_freeMemory(pBuffer);
+ return REG_NO_ERROR;
+}
+
+//*********************************************************************
+// getLongListValue
+//
+RegError ORegKey::getLongListValue(const OUString& valueName, sal_Int32** pValueList, sal_uInt32* pLen) const
+{
+ OStoreStream rValue;
+ sal_uInt8* pBuffer;
+ RegValueType valueType;
+ sal_uInt32 valueSize;
+ storeAccessMode accessMode = VALUE_MODE_OPEN;
+
+ if (m_pRegistry->isReadOnly())
+ {
+ accessMode = VALUE_MODE_OPENREAD;
+ }
+
+ OUString sImplValueName( RTL_CONSTASCII_USTRINGPARAM(VALUE_PREFIX) );
+ sImplValueName += valueName;
+
+ REG_GUARD(m_pRegistry->m_mutex);
+
+ if (rValue.create(m_storeFile, m_name + m_pRegistry->ROOT, sImplValueName, accessMode) )
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ return REG_VALUE_NOT_EXISTS;
+ }
+
+ pBuffer = (sal_uInt8*)rtl_allocateMemory(VALUE_HEADERSIZE);
+
+ sal_uInt32 readBytes;
+ if ( rValue.readAt(0, pBuffer, VALUE_HEADERSIZE, readBytes) )
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+ if (readBytes != VALUE_HEADERSIZE)
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+
+ sal_uInt8 type = *((sal_uInt8*)pBuffer);
+ valueType = (RegValueType)type;
+
+ if (valueType != RG_VALUETYPE_LONGLIST)
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+
+ readUINT32(pBuffer+VALUE_TYPEOFFSET, valueSize);
+
+ rtl_freeMemory(pBuffer);
+
+ pBuffer = (sal_uInt8*)rtl_allocateMemory(valueSize);
+
+ if ( rValue.readAt(VALUE_HEADEROFFSET, pBuffer, valueSize, readBytes) )
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+ if (readBytes != valueSize)
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+
+ sal_uInt32 len = 0;
+ readUINT32(pBuffer, len);
+
+ *pLen = len;
+ sal_Int32* pVList = (sal_Int32*)rtl_allocateZeroMemory(len * sizeof(sal_Int32));
+
+ sal_uInt32 offset = 4; // initial 4 Bytes fuer die Laenge des Arrays;
+
+ for (int i=0; i < len; i++)
+ {
+ readINT32(pBuffer+offset, pVList[i]);
+ offset += 4;
+ }
+
+ *pValueList = pVList;
+ rtl_freeMemory(pBuffer);
+ return REG_NO_ERROR;
+}
+
+//*********************************************************************
+// getStringListValue
+//
+RegError ORegKey::getStringListValue(const OUString& valueName, sal_Char*** pValueList, sal_uInt32* pLen) const
+{
+ OStoreStream rValue;
+ sal_uInt8* pBuffer;
+ RegValueType valueType;
+ sal_uInt32 valueSize;
+ storeAccessMode accessMode = VALUE_MODE_OPEN;
+
+ if (m_pRegistry->isReadOnly())
+ {
+ accessMode = VALUE_MODE_OPENREAD;
+ }
+
+ OUString sImplValueName( RTL_CONSTASCII_USTRINGPARAM(VALUE_PREFIX) );
+ sImplValueName += valueName;
+
+ REG_GUARD(m_pRegistry->m_mutex);
+
+ if ( rValue.create(m_storeFile, m_name + m_pRegistry->ROOT, sImplValueName, accessMode) )
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ return REG_VALUE_NOT_EXISTS;
+ }
+
+ pBuffer = (sal_uInt8*)rtl_allocateMemory(VALUE_HEADERSIZE);
+
+ sal_uInt32 readBytes;
+ if ( rValue.readAt(0, pBuffer, VALUE_HEADERSIZE, readBytes) )
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+ if (readBytes != VALUE_HEADERSIZE)
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+
+ sal_uInt8 type = *((sal_uInt8*)pBuffer);
+ valueType = (RegValueType)type;
+
+ if (valueType != RG_VALUETYPE_STRINGLIST)
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+
+ readUINT32(pBuffer+VALUE_TYPEOFFSET, valueSize);
+
+ rtl_freeMemory(pBuffer);
+
+ pBuffer = (sal_uInt8*)rtl_allocateMemory(valueSize);
+
+ if ( rValue.readAt(VALUE_HEADEROFFSET, pBuffer, valueSize, readBytes) )
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+ if (readBytes != valueSize)
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+
+ sal_uInt32 len = 0;
+ readUINT32(pBuffer, len);
+
+ *pLen = len;
+ sal_Char** pVList = (sal_Char**)rtl_allocateZeroMemory(len * sizeof(sal_Char*));
+
+ sal_uInt32 offset = 4; // initial 4 Bytes fuer die Laenge des Arrays;
+ sal_uInt32 sLen = 0;
+
+ sal_Char *pValue;
+ for (int i=0; i < len; i++)
+ {
+ readUINT32(pBuffer+offset, sLen);
+
+ offset += 4;
+
+ pValue = (sal_Char*)rtl_allocateMemory(sLen);
+ readUtf8(pBuffer+offset, pValue, sLen);
+ pVList[i] = pValue;
+
+ offset += sLen;
+ }
+
+ *pValueList = pVList;
+ rtl_freeMemory(pBuffer);
+ return REG_NO_ERROR;
+}
+
+//*********************************************************************
+// getUnicodeListValue
+//
+RegError ORegKey::getUnicodeListValue(const OUString& valueName, sal_Unicode*** pValueList, sal_uInt32* pLen) const
+{
+ OStoreStream rValue;
+ sal_uInt8* pBuffer;
+ RegValueType valueType;
+ sal_uInt32 valueSize;
+ storeAccessMode accessMode = VALUE_MODE_OPEN;
+
+ if (m_pRegistry->isReadOnly())
+ {
+ accessMode = VALUE_MODE_OPENREAD;
+ }
+
+ OUString sImplValueName( RTL_CONSTASCII_USTRINGPARAM(VALUE_PREFIX) );
+ sImplValueName += valueName;
+
+ REG_GUARD(m_pRegistry->m_mutex);
+
+ if ( rValue.create(m_storeFile, m_name + m_pRegistry->ROOT, sImplValueName, accessMode) )
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ return REG_VALUE_NOT_EXISTS;
+ }
+
+ pBuffer = (sal_uInt8*)rtl_allocateMemory(VALUE_HEADERSIZE);
+
+ sal_uInt32 readBytes;
+ if ( rValue.readAt(0, pBuffer, VALUE_HEADERSIZE, readBytes) )
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+ if (readBytes != VALUE_HEADERSIZE)
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+
+ sal_uInt8 type = *((sal_uInt8*)pBuffer);
+ valueType = (RegValueType)type;
+
+ if (valueType != RG_VALUETYPE_UNICODELIST)
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+
+ readUINT32(pBuffer+VALUE_TYPEOFFSET, valueSize);
+
+ rtl_freeMemory(pBuffer);
+
+ pBuffer = (sal_uInt8*)rtl_allocateMemory(valueSize);
+
+ if ( rValue.readAt(VALUE_HEADEROFFSET, pBuffer, valueSize, readBytes) )
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+ if (readBytes != valueSize)
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+
+ sal_uInt32 len = 0;
+ readUINT32(pBuffer, len);
+
+ *pLen = len;
+ sal_Unicode** pVList = (sal_Unicode**)rtl_allocateZeroMemory(len * sizeof(sal_Unicode*));
+
+ sal_uInt32 offset = 4; // initial 4 Bytes fuer die Laenge des Arrays;
+ sal_uInt32 sLen = 0;
+
+ sal_Unicode *pValue;
+ for (int i=0; i < len; i++)
+ {
+ readUINT32(pBuffer+offset, sLen);
+
+ offset += 4;
+
+ pValue = (sal_Unicode*)rtl_allocateMemory((sLen / 2) * sizeof(sal_Unicode));
+ readString(pBuffer+offset, pValue, sLen);
+ pVList[i] = pValue;
+
+ offset += sLen;
+ }
+
+ *pValueList = pVList;
+ rtl_freeMemory(pBuffer);
+ return REG_NO_ERROR;
+}
+
+//*********************************************************************
+// getKeyType()
+//
+RegError ORegKey::getKeyType(const OUString& name, RegKeyType* pKeyType) const
+{
+ ORegKey* pKey;
+ RegError _ret = REG_NO_ERROR;
+
+ *pKeyType = RG_KEYTYPE;
+
+ REG_GUARD(m_pRegistry->m_mutex);
+
+ if ( name.getLength() )
+ {
+ if ((_ret = ((ORegKey*)this)->openKey(name, (RegKeyHandle*)&pKey, RESOLVE_PART)))
+ return _ret;
+
+ if (pKey->isLink())
+ *pKeyType = RG_LINKTYPE;
+
+ ((ORegKey*)this)->closeKey((RegKeyHandle)pKey);
+ return _ret;
+ } else
+ {
+ if (m_isLink)
+ *pKeyType = RG_LINKTYPE;
+
+ return _ret;
+ }
+}
+
+//*********************************************************************
+// createLink()
+//
+RegError ORegKey::createLink(const OUString& linkName, const OUString& linkTarget)
+{
+ ORegKey* pKey;
+ RegError _ret = REG_NO_ERROR;
+
+ if ( !linkName.getLength() )
+ return REG_INVALID_LINKNAME;
+
+ if ( !linkTarget.getLength() )
+ return REG_INVALID_LINKTARGET;
+
+ REG_GUARD(m_pRegistry->m_mutex);
+
+ if (m_pRegistry->openKey(this, linkName, (RegKeyHandle*)&pKey, RESOLVE_PART))
+ {
+ if (_ret = m_pRegistry->createKey(this, linkName, (RegKeyHandle*)&pKey))
+ return _ret;
+ } else
+ {
+ if (!pKey->isLink())
+ {
+ m_pRegistry->closeKey(pKey);
+ return REG_INVALID_LINK;
+ }
+ }
+
+ if (_ret = pKey->setValue(OUString( RTL_CONSTASCII_USTRINGPARAM("LINK_TARGET") ),
+ RG_VALUETYPE_UNICODE, (RegValue)linkTarget.getStr(), (linkTarget.getLength()+1)*2))
+ {
+ m_pRegistry->closeKey(pKey);
+ _ret = m_pRegistry->deleteKey(this, linkName);
+ return _ret;
+ }
+
+ return m_pRegistry->closeKey(pKey);
+}
+
+//*********************************************************************
+// deleteLink()
+//
+RegError ORegKey::deleteLink(const OUString& linkName)
+{
+ return (m_pRegistry->deleteLink(this, linkName));
+}
+
+//*********************************************************************
+// getLinkTarget()
+//
+RegError ORegKey::getLinkTarget(const OUString& linkName, OUString& linkTarget) const
+{
+ ORegKey* pKey;
+ RegError _ret = REG_NO_ERROR;
+
+ REG_GUARD(m_pRegistry->m_mutex);
+
+ if ( linkName.getLength() )
+ {
+ if (_ret = ((ORegKey*)this)->openKey(linkName, (RegKeyHandle*)&pKey, RESOLVE_PART))
+ return REG_INVALID_LINK;
+
+ _ret = pKey->getLinkTarget(OUString(), linkTarget);
+ ((ORegKey*)this)->closeKey((RegKeyHandle)pKey);
+ return _ret;
+ } else
+ {
+ if (m_isLink)
+ {
+ linkTarget = m_link;
+ return REG_NO_ERROR;
+ } else
+ return REG_LINKTARGET_NOT_EXIST;
+ }
+}
+
+RegError ORegKey::getResolvedKeyName(const OUString& keyName,
+ OUString& resolvedName,
+ sal_Bool firstLinkOnly)
+{
+ return m_pRegistry->getResolvedKeyName((ORegKey*)this, keyName, resolvedName, firstLinkOnly);
+}
+
+//*********************************************************************
+// countSubKeys()
+//
+sal_uInt32 ORegKey::countSubKeys()
+{
+ REG_GUARD(m_pRegistry->m_mutex);
+
+ OStoreDirectory::iterator iter;
+ OStoreDirectory rStoreDir = getStoreDir();
+ storeError _err = rStoreDir.first(iter);
+ sal_uInt32 count = 0;
+
+ while ( _err == store_E_None )
+ {
+ if ( iter.m_nAttrib & STORE_ATTRIB_ISDIR )
+ {
+ count++;
+ }
+
+ _err = rStoreDir.next(iter);
+ }
+
+ return count;
+}
+
+
+//*********************************************************************
+// checkLink()
+//
+sal_Bool ORegKey::checkLink()
+{
+ RegValueType valueType = RG_VALUETYPE_NOT_DEFINED;
+ sal_uInt32 valueSize = 0;
+
+ OUString linkTarget( OUString( RTL_CONSTASCII_USTRINGPARAM("LINK_TARGET") ));
+ if (!((ORegKey*)this)->getValueInfo( linkTarget, &valueType, &valueSize))
+ {
+ sal_Unicode* value = (sal_Unicode*)rtl_allocateMemory(valueSize);
+ if (!((ORegKey*)this)->getValue( linkTarget, value))
+ {
+ m_link = OUString(value);
+ m_isLink = sal_True;
+ }
+
+ rtl_freeMemory(value);
+
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+OStoreDirectory ORegKey::getStoreDir()
+{
+ OStoreDirectory rStoreDir;
+ OUString fullPath;
+ OUString relativName;
+ storeAccessMode accessMode = KEY_MODE_OPEN;
+
+ if ( m_name.equals(m_pRegistry->ROOT) )
+ {
+ fullPath = OUString();
+ relativName = OUString();
+ } else
+ {
+ fullPath = m_name.copy(0, m_name.lastIndexOf('/') + 1);
+ relativName = m_name.copy(m_name.lastIndexOf('/') + 1);
+ }
+
+ if (m_pRegistry->isReadOnly())
+ {
+ accessMode = KEY_MODE_OPENREAD;
+ }
+
+ rStoreDir.create(m_storeFile, fullPath, relativName, accessMode);
+
+ return rStoreDir;
+}
+
diff --git a/registry/source/keyimpl.hxx b/registry/source/keyimpl.hxx
new file mode 100644
index 000000000000..17a638026980
--- /dev/null
+++ b/registry/source/keyimpl.hxx
@@ -0,0 +1,215 @@
+/*************************************************************************
+ *
+ * $RCSfile: keyimpl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _KEYIMPL_HXX_
+#define _KEYIMPL_HXX_
+
+#ifndef _REGISTRY_REGISTRY_H_
+#include <registry/registry.h>
+#endif
+
+#ifndef _REGIMPL_HXX_
+#include "regimpl.hxx"
+#endif
+
+#ifndef _RTL_STRING_HXX_
+#include <rtl/string.hxx>
+#endif
+
+using namespace rtl;
+using namespace store;
+
+class ORegKey
+{
+public:
+
+ ORegKey(const OUString& keyName, const OStoreDirectory& rStoreDir, ORegistry* pReg);
+ ORegKey(const OUString& keyName, const OUString& linkName,
+ const OStoreDirectory& rStoreDir, ORegistry* pReg);
+
+ sal_uInt32 acquire()
+ { return ++m_refCount; }
+
+ sal_uInt32 release()
+ { return --m_refCount; }
+
+ RegError createKey(const OUString& keyName, RegKeyHandle* phNewKey);
+
+ RegError openKey(const OUString& keyName, RegKeyHandle* phOpenKey,
+ RESOLVE eResolve=RESOLVE_FULL);
+
+ RegError openSubKeys(const OUString& keyName,
+ RegKeyHandle** phOpenSubKeys,
+ sal_uInt32* pnSubKeys);
+
+ RegError getKeyNames(const OUString& keyName,
+ rtl_uString*** pSubKeyNames,
+ sal_uInt32* pnSubKeys);
+
+ RegError closeSubKeys(RegKeyHandle* phSubKeys, sal_uInt32 len);
+
+ RegError closeKey(RegKeyHandle hKey);
+
+ RegError deleteKey(const OUString& keyName);
+
+ RegError getValueInfo(const OUString& valueName,
+ RegValueType* pValueTye,
+ sal_uInt32* pValueSize) const;
+
+ RegError setValue(const OUString& valueName,
+ RegValueType vType,
+ RegValue value,
+ sal_uInt32 vSize);
+
+ RegError setLongListValue(const OUString& valueName,
+ sal_Int32* pValueList,
+ sal_uInt32 len);
+
+ RegError setStringListValue(const OUString& valueName,
+ sal_Char** pValueList,
+ sal_uInt32 len);
+
+ RegError setUnicodeListValue(const OUString& valueName,
+ sal_Unicode** pValueList,
+ sal_uInt32 len);
+
+ RegError getValue(const OUString& valueName, RegValue value) const;
+
+ RegError getLongListValue(const OUString& valueName,
+ sal_Int32** pValueList,
+ sal_uInt32* pLen) const;
+
+ RegError getStringListValue(const OUString& valueName,
+ sal_Char*** pValueList,
+ sal_uInt32* pLen) const;
+
+ RegError getUnicodeListValue(const OUString& valueName,
+ sal_Unicode*** pValueList,
+ sal_uInt32* pLen) const;
+
+ RegError createLink(const OUString& linkName, const OUString& linkTarget);
+
+ RegError deleteLink(const OUString& linkName);
+
+ RegError getKeyType(const OUString& name,
+ RegKeyType* pKeyType) const;
+
+ RegError getLinkTarget(const OUString& linkName,
+ OUString& pLinkTarget) const;
+
+ RegError getResolvedKeyName(const OUString& keyName,
+ OUString& resolvedName,
+ sal_Bool firstLinkOnly=sal_False);
+
+public:
+ ORegKey();
+ virtual ~ORegKey();
+
+
+ sal_Bool isDeleted() const
+ { return m_bDeleted; }
+
+ void setDeleted(sal_Bool bKeyDeleted)
+ { m_bDeleted = bKeyDeleted; }
+
+ sal_Bool isReadOnly() const
+ { return m_pRegistry->isReadOnly(); }
+
+ sal_uInt32 countSubKeys();
+
+ sal_Bool isLink() const
+ { return m_isLink; }
+
+ const OUString& getLinkTarget() const
+ { return m_link; }
+
+ ORegistry* getRegistry() const
+ { return m_pRegistry; }
+
+ const OStoreFile& getStoreFile() const
+ { return m_storeFile; }
+
+ OStoreDirectory getStoreDir();
+
+ const OUString& getName() const
+ { return m_name; }
+
+ sal_uInt32 getRefCount() const
+ { return m_refCount; }
+
+ friend class ORegistry;
+protected:
+ sal_Bool checkLink();
+
+ sal_uInt32 m_refCount;
+ OUString m_name;
+ OUString m_link;
+ sal_Bool m_bDeleted;
+ sal_Bool m_isLink;
+ ORegistry* m_pRegistry;
+ OStoreFile m_storeFile;
+};
+
+
+
+#endif
+
+
diff --git a/registry/source/makefile.mk b/registry/source/makefile.mk
new file mode 100644
index 000000000000..93a3ba530111
--- /dev/null
+++ b/registry/source/makefile.mk
@@ -0,0 +1,97 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=registry
+TARGET=regcpp
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+.INCLUDE : ..$/version.mk
+
+# ------------------------------------------------------------------
+
+SLOFILES= \
+ $(SLO)$/regimpl.obj \
+ $(SLO)$/regkey.obj \
+ $(SLO)$/registry.obj \
+ $(SLO)$/keyimpl.obj \
+ $(SLO)$/reflread.obj \
+ $(SLO)$/reflwrit.obj
+
+
+# NETBSD: somewhere we have to instantiate the static data members.
+# NETBSD-1.2.1 doesn't know about weak symbols so the default mechanism for GCC won't work.
+# SCO and MACOSX: the linker does know about weak symbols, but we can't ignore multiple defined symbols
+.IF "$(OS)"=="NETBSD" || "$(OS)"=="SCO" || "$(OS)$(COM)"=="OS2GCC" || "$(OS)"=="MACOSX"
+SLOFILES+=$(SLO)$/staticmb.obj
+OBJFILES+=$(OBJ)$/staticmb.obj
+.ENDIF
+
+# ------------------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/registry/source/reflcnst.hxx b/registry/source/reflcnst.hxx
new file mode 100644
index 000000000000..a57addcce1cc
--- /dev/null
+++ b/registry/source/reflcnst.hxx
@@ -0,0 +1,268 @@
+/*************************************************************************
+ *
+ * $RCSfile: reflcnst.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef __REFLCNST_HXX__
+#define __REFLCNST_HXX__
+
+#ifndef __REGISTRY_REFLTYPE_HXX__
+#include <registry/refltype.hxx>
+#endif
+
+#include <string.h>
+#include <vos/macros.hxx>
+
+#define REGTYPE_IEEE_NATIVE 1
+
+extern const sal_uInt32 magic;
+extern const sal_uInt16 minorVersion;
+extern const sal_uInt16 majorVersion;
+
+#define OFFSET_MAGIC 0
+#define OFFSET_SIZE (OFFSET_MAGIC + sizeof(magic))
+#define OFFSET_MINOR_VERSION (OFFSET_SIZE + sizeof(sal_uInt32))
+#define OFFSET_MAJOR_VERSION (OFFSET_MINOR_VERSION + sizeof(minorVersion))
+#define OFFSET_TYPE_CLASS (OFFSET_MAJOR_VERSION + sizeof(majorVersion))
+#define OFFSET_THIS_TYPE (OFFSET_TYPE_CLASS + sizeof(sal_uInt16))
+#define OFFSET_SUPER_TYPE (OFFSET_THIS_TYPE + sizeof(sal_uInt16))
+#define OFFSET_UIK (OFFSET_SUPER_TYPE + sizeof(sal_uInt16))
+#define OFFSET_DOKU (OFFSET_UIK + sizeof(sal_uInt16))
+#define OFFSET_FILENAME (OFFSET_DOKU + sizeof(sal_uInt16))
+#define OFFSET_CP_SIZE (OFFSET_FILENAME + sizeof(sal_uInt16))
+#define OFFSET_CP (OFFSET_CP_SIZE + sizeof(sal_uInt16))
+
+#define CP_OFFSET_ENTRY_SIZE 0
+#define CP_OFFSET_ENTRY_TAG (CP_OFFSET_ENTRY_SIZE + sizeof(sal_uInt16))
+#define CP_OFFSET_ENTRY_DATA (CP_OFFSET_ENTRY_TAG + sizeof(sal_uInt16))
+#define CP_OFFSET_ENTRY_UIK1 CP_OFFSET_ENTRY_DATA
+#define CP_OFFSET_ENTRY_UIK2 (CP_OFFSET_ENTRY_UIK1 + sizeof(sal_uInt32))
+#define CP_OFFSET_ENTRY_UIK3 (CP_OFFSET_ENTRY_UIK2 + sizeof(sal_uInt16))
+#define CP_OFFSET_ENTRY_UIK4 (CP_OFFSET_ENTRY_UIK3 + sizeof(sal_uInt16))
+#define CP_OFFSET_ENTRY_UIK5 (CP_OFFSET_ENTRY_UIK4 + sizeof(sal_uInt32))
+
+#define FIELD_OFFSET_ACCESS 0
+#define FIELD_OFFSET_NAME (FIELD_OFFSET_ACCESS + sizeof(sal_uInt16))
+#define FIELD_OFFSET_TYPE (FIELD_OFFSET_NAME + sizeof(sal_uInt16))
+#define FIELD_OFFSET_VALUE (FIELD_OFFSET_TYPE + sizeof(sal_uInt16))
+#define FIELD_OFFSET_DOKU (FIELD_OFFSET_VALUE + sizeof(sal_uInt16))
+#define FIELD_OFFSET_FILENAME (FIELD_OFFSET_DOKU + sizeof(sal_uInt16))
+#define FIELD_ENTRY_SIZE (FIELD_OFFSET_FILENAME + sizeof(sal_uInt16))
+
+#define PARAM_OFFSET_TYPE 0
+#define PARAM_OFFSET_MODE (PARAM_OFFSET_TYPE + sizeof(sal_uInt16))
+#define PARAM_OFFSET_NAME (PARAM_OFFSET_MODE + sizeof(sal_uInt16))
+#define PARAM_ENTRY_SIZE (PARAM_OFFSET_NAME + sizeof(sal_uInt16))
+
+#define METHOD_OFFSET_SIZE 0
+#define METHOD_OFFSET_MODE (METHOD_OFFSET_SIZE + sizeof(sal_uInt16))
+#define METHOD_OFFSET_NAME (METHOD_OFFSET_MODE + sizeof(sal_uInt16))
+#define METHOD_OFFSET_RETURN (METHOD_OFFSET_NAME + sizeof(sal_uInt16))
+#define METHOD_OFFSET_DOKU (METHOD_OFFSET_RETURN + sizeof(sal_uInt16))
+#define METHOD_OFFSET_PARAM_COUNT (METHOD_OFFSET_DOKU + sizeof(sal_uInt16))
+#define METHOD_OFFSET_PARAM(i) (METHOD_OFFSET_PARAM_COUNT + sizeof(sal_uInt16) + (i * PARAM_ENTRY_SIZE))
+
+#define REFERENCE_OFFSET_TYPE 0
+#define REFERENCE_OFFSET_NAME (REFERENCE_OFFSET_TYPE + sizeof(sal_uInt16))
+#define REFERENCE_OFFSET_DOKU (REFERENCE_OFFSET_NAME + sizeof(sal_uInt16))
+#define REFERENCE_OFFSET_ACCESS (REFERENCE_OFFSET_DOKU + sizeof(sal_uInt16))
+#define REFERENCE_ENTRY_SIZE (REFERENCE_OFFSET_ACCESS + sizeof(sal_uInt16))
+
+enum CPInfoTag
+{
+ CP_TAG_INVALID = RT_TYPE_NONE,
+ CP_TAG_CONST_BOOL = RT_TYPE_BOOL,
+ CP_TAG_CONST_BYTE = RT_TYPE_BYTE,
+ CP_TAG_CONST_INT16 = RT_TYPE_INT16,
+ CP_TAG_CONST_UINT16 = RT_TYPE_UINT16,
+ CP_TAG_CONST_INT32 = RT_TYPE_INT32,
+ CP_TAG_CONST_UINT32 = RT_TYPE_UINT32,
+ CP_TAG_CONST_INT64 = RT_TYPE_INT64,
+ CP_TAG_CONST_UINT64 = RT_TYPE_UINT64,
+ CP_TAG_CONST_FLOAT = RT_TYPE_FLOAT,
+ CP_TAG_CONST_DOUBLE = RT_TYPE_DOUBLE,
+ CP_TAG_CONST_STRING = RT_TYPE_STRING,
+ CP_TAG_UTF8_NAME,
+ CP_TAG_UIK
+};
+
+inline sal_uInt32 writeBYTE(sal_uInt8* buffer, sal_uInt8 v)
+{
+ buffer[0] = v;
+
+ return sizeof(sal_uInt8);
+}
+
+inline sal_uInt16 readBYTE(const sal_uInt8* buffer, sal_uInt8& v)
+{
+ v = buffer[0];
+
+ return sizeof(sal_uInt8);
+}
+
+inline sal_uInt32 writeINT16(sal_uInt8* buffer, sal_Int16 v)
+{
+ buffer[0] = (sal_uInt8)((v >> 8) & 0xFF);
+ buffer[1] = (sal_uInt8)((v >> 0) & 0xFF);
+
+ return sizeof(sal_Int16);
+}
+
+inline sal_uInt32 readINT16(const sal_uInt8* buffer, sal_Int16& v)
+{
+ v = ((buffer[0] << 8) | (buffer[1] << 0));
+
+ return sizeof(sal_Int16);
+}
+
+inline sal_uInt32 writeUINT16(sal_uInt8* buffer, sal_uInt16 v)
+{
+ buffer[0] = (sal_uInt8)((v >> 8) & 0xFF);
+ buffer[1] = (sal_uInt8)((v >> 0) & 0xFF);
+
+ return sizeof(sal_uInt16);
+}
+
+inline sal_uInt32 readUINT16(const sal_uInt8* buffer, sal_uInt16& v)
+{
+ v = ((buffer[0] << 8) | (buffer[1] << 0));
+
+ return sizeof(sal_uInt16);
+}
+
+inline sal_uInt32 writeINT32(sal_uInt8* buffer, sal_Int32 v)
+{
+ buffer[0] = (sal_uInt8)((v >> 24) & 0xFF);
+ buffer[1] = (sal_uInt8)((v >> 16) & 0xFF);
+ buffer[2] = (sal_uInt8)((v >> 8) & 0xFF);
+ buffer[3] = (sal_uInt8)((v >> 0) & 0xFF);
+
+ return sizeof(sal_Int32);
+}
+
+inline sal_uInt32 readINT32(const sal_uInt8* buffer, sal_Int32& v)
+{
+ v = (
+ (buffer[0] << 24) |
+ (buffer[1] << 16) |
+ (buffer[2] << 8) |
+ (buffer[3] << 0)
+ );
+
+ return sizeof(sal_Int32);
+}
+
+inline sal_uInt32 writeUINT32(sal_uInt8* buffer, sal_uInt32 v)
+{
+ buffer[0] = (sal_uInt8)((v >> 24) & 0xFF);
+ buffer[1] = (sal_uInt8)((v >> 16) & 0xFF);
+ buffer[2] = (sal_uInt8)((v >> 8) & 0xFF);
+ buffer[3] = (sal_uInt8)((v >> 0) & 0xFF);
+
+ return sizeof(sal_uInt32);
+}
+
+inline sal_uInt32 readUINT32(const sal_uInt8* buffer, sal_uInt32& v)
+{
+ v = (
+ (buffer[0] << 24) |
+ (buffer[1] << 16) |
+ (buffer[2] << 8) |
+ (buffer[3] << 0)
+ );
+
+ return sizeof(sal_uInt32);
+}
+
+inline sal_uInt32 writeUtf8(sal_uInt8* buffer, const sal_Char* v)
+{
+ sal_uInt32 size = strlen(v) + 1;
+
+ memcpy(buffer, v, size);
+
+ return (size);
+}
+
+inline sal_uInt32 readUtf8(const sal_uInt8* buffer, sal_Char* v, sal_uInt32 maxSize)
+{
+ sal_uInt32 size = VOS_MIN(strlen((const sal_Char*) buffer) + 1, maxSize);
+
+ memcpy(v, buffer, size);
+
+ if (size == maxSize) v[size - 1] = '\0';
+
+ return (size);
+}
+
+
+sal_uInt32 writeFloat(sal_uInt8* buffer, float v);
+sal_uInt32 readFloat(const sal_uInt8* buffer, float& v);
+sal_uInt32 writeDouble(sal_uInt8* buffer, double v);
+sal_uInt32 readDouble(const sal_uInt8* buffer, double& v);
+sal_uInt32 writeString(sal_uInt8* buffer, const sal_Unicode* v);
+sal_uInt32 readString(const sal_uInt8* buffer, sal_Unicode* v, sal_uInt32 maxSize);
+
+sal_uInt32 UINT16StringLen(const sal_uInt8* wstring);
+
+#endif
+
+
+
+
+
diff --git a/registry/source/reflread.cxx b/registry/source/reflread.cxx
new file mode 100644
index 000000000000..cb462132db24
--- /dev/null
+++ b/registry/source/reflread.cxx
@@ -0,0 +1,1602 @@
+/*************************************************************************
+ *
+ * $RCSfile: reflread.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef MAC
+#include <memory.h>
+#endif
+#include <osl/types.h>
+
+#include <registry/reflread.hxx>
+#include "reflcnst.hxx"
+
+using namespace vos;
+
+static CPInfoTag aTag;
+
+static sal_Char NULL_STRING[1] = { 0 };
+static sal_Unicode NULL_WSTRING[1] = { 0 };
+
+const sal_uInt32 magic = 0x12345678;
+const sal_uInt16 minorVersion = 0x0000;
+const sal_uInt16 majorVersion = 0x0001;
+
+#if defined ( GCC ) && ( defined ( SCO ) || defined ( NETBSD ) )
+ORealDynamicLoader* ODynamicLoader<RegistryTypeReader_Api>::m_pLoader = NULL;
+#endif
+
+/**************************************************************************
+
+ class BlopObject
+
+ holds any data in a flat memory buffer
+
+**************************************************************************/
+
+class BlopObject
+{
+public:
+ const sal_uInt8* m_pBuffer;
+ sal_uInt32 m_bufferLen;
+ sal_Bool m_isCopied;
+
+ BlopObject(const sal_uInt8* buffer, sal_uInt32 len, sal_Bool copyBuffer);
+ ~BlopObject();
+
+ inline sal_uInt8 readBYTE(sal_uInt32 index) const
+ {
+ return m_pBuffer[index];
+ }
+
+ inline sal_Int16 readINT16(sal_uInt32 index) const
+ {
+ return ((m_pBuffer[index] << 8) | (m_pBuffer[index+1] << 0));
+ }
+
+ inline sal_uInt16 readUINT16(sal_uInt32 index) const
+ {
+ return ((m_pBuffer[index] << 8) | (m_pBuffer[index+1] << 0));
+ }
+
+ inline sal_Int32 readINT32(sal_uInt32 index) const
+ {
+ return (
+ (m_pBuffer[index] << 24) |
+ (m_pBuffer[index+1] << 16) |
+ (m_pBuffer[index+2] << 8) |
+ (m_pBuffer[index+3] << 0)
+ );
+ }
+
+ inline sal_uInt32 readUINT32(sal_uInt32 index) const
+ {
+ return (
+ (m_pBuffer[index] << 24) |
+ (m_pBuffer[index+1] << 16) |
+ (m_pBuffer[index+2] << 8) |
+ (m_pBuffer[index+3] << 0)
+ );
+ }
+};
+
+BlopObject::BlopObject(const sal_uInt8* buffer, sal_uInt32 len, sal_Bool copyBuffer)
+ : m_isCopied(copyBuffer)
+ , m_bufferLen(len)
+{
+ if (m_isCopied)
+ {
+ sal_uInt8* newBuffer = new sal_uInt8[len];
+ memcpy(newBuffer, buffer, len);
+ m_pBuffer = newBuffer;
+ }
+ else
+ {
+ m_pBuffer = buffer;
+ }
+}
+
+BlopObject::~BlopObject()
+{
+ if (m_isCopied && m_pBuffer)
+ {
+#ifdef OS2
+ delete (sal_uInt8 *)m_pBuffer;
+#else
+ delete[] const_cast<sal_uInt8*>(m_pBuffer);
+#endif
+ }
+}
+
+/**************************************************************************
+
+ class StringCache
+
+**************************************************************************/
+
+class StringCache
+{
+public:
+ sal_Unicode** m_stringTable;
+ sal_uInt16 m_numOfStrings;
+ sal_uInt16 m_stringsCopied;
+
+ StringCache(sal_uInt16 size);
+ ~StringCache();
+
+ const sal_Unicode* getString(sal_uInt16 index);
+ sal_uInt16 createString(const sal_uInt8* buffer);
+};
+
+StringCache::StringCache(sal_uInt16 size)
+ : m_numOfStrings(size)
+ , m_stringsCopied(0)
+ , m_stringTable(NULL)
+{
+ m_stringTable = new sal_Unicode*[m_numOfStrings];
+
+ for (sal_uInt16 i = 0; i < m_numOfStrings; i++)
+ {
+ m_stringTable[i] = NULL;
+ }
+}
+
+StringCache::~StringCache()
+{
+ if (m_stringTable)
+ {
+ for (sal_uInt16 i = 0; i < m_stringsCopied; i++)
+ {
+ delete[] m_stringTable[i];
+ }
+
+ delete[] m_stringTable;
+ }
+}
+
+const sal_Unicode* StringCache::getString(sal_uInt16 index)
+{
+ if ((index > 0) && (index <= m_stringsCopied))
+ return m_stringTable[index - 1];
+ else
+ return NULL;
+}
+
+sal_uInt16 StringCache::createString(const sal_uInt8* buffer)
+{
+ if (m_stringsCopied < m_numOfStrings)
+ {
+ sal_uInt32 len = UINT16StringLen(buffer);
+
+ m_stringTable[m_stringsCopied] = new sal_Unicode[len + 1];
+
+ readString(buffer, m_stringTable[m_stringsCopied], (len + 1) * sizeof(sal_Unicode));
+
+ return ++m_stringsCopied;
+ }
+ else
+ return 0;
+}
+
+/**************************************************************************
+
+ class ConstantPool
+
+**************************************************************************/
+
+class ConstantPool : public BlopObject
+{
+public:
+
+ sal_uInt16 m_numOfEntries;
+ sal_Int32* m_pIndex; // index values may be < 0 for cached string constants
+
+ StringCache* m_pStringCache;
+
+ ConstantPool(const sal_uInt8* buffer, sal_uInt16 numEntries)
+ : BlopObject(buffer, 0, sal_False)
+ , m_numOfEntries(numEntries)
+ , m_pIndex(NULL)
+ , m_pStringCache(NULL)
+ {
+ }
+
+ ~ConstantPool();
+
+ sal_uInt32 parseIndex();
+
+ CPInfoTag readTag(sal_uInt16 index);
+
+ const sal_Char* readUTF8NameConstant(sal_uInt16 index);
+ sal_Bool readBOOLConstant(sal_uInt16 index);
+ sal_uInt8 readBYTEConstant(sal_uInt16 index);
+ sal_Int16 readINT16Constant(sal_uInt16 index);
+ sal_uInt16 readUINT16Constant(sal_uInt16 index);
+ sal_Int32 readINT32Constant(sal_uInt16 index);
+ sal_uInt32 readUINT32Constant(sal_uInt16 index);
+ float readFloatConstant(sal_uInt16 index);
+ double readDoubleConstant(sal_uInt16 index);
+ const sal_Unicode* readStringConstant(sal_uInt16 index);
+ void readUIK(sal_uInt16 index, RTUik* uik);
+};
+
+ConstantPool::~ConstantPool()
+{
+ if (m_pIndex) delete[] m_pIndex;
+
+ if (m_pStringCache)
+ {
+ delete m_pStringCache;
+ }
+}
+
+sal_uInt32 ConstantPool::parseIndex()
+{
+ if (m_pIndex)
+ {
+ delete[] m_pIndex;
+ m_pIndex = NULL;
+ }
+
+ if (m_pStringCache)
+ {
+ delete m_pStringCache;
+ m_pStringCache = NULL;
+ }
+
+ sal_uInt32 offset = 0;
+ sal_uInt16 numOfStrings = 0;
+
+ if (m_numOfEntries)
+ {
+ m_pIndex = new sal_Int32[m_numOfEntries];
+
+ for (int i = 0; i < m_numOfEntries; i++)
+ {
+ m_pIndex[i] = (sal_Int32) offset;
+
+ offset += readUINT16(offset);
+
+ if (
+ ((CPInfoTag) readUINT16(m_pIndex[i] + CP_OFFSET_ENTRY_TAG)) ==
+ CP_TAG_CONST_STRING
+ )
+ {
+ numOfStrings++;
+ }
+
+ }
+ }
+
+ if (numOfStrings)
+ {
+ m_pStringCache = new StringCache(numOfStrings);
+ }
+
+ m_bufferLen = offset;
+
+ return offset;
+}
+
+CPInfoTag ConstantPool::readTag(sal_uInt16 index)
+{
+ CPInfoTag tag = CP_TAG_INVALID;
+
+ if (m_pIndex && (index > 0) && (index <= m_numOfEntries))
+ {
+ tag = (CPInfoTag) readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG);
+ }
+
+ return tag;
+}
+
+const sal_Char* ConstantPool::readUTF8NameConstant(sal_uInt16 index)
+{
+ const sal_Char* aName = NULL_STRING;
+
+ if (m_pIndex && (index > 0) && (index <= m_numOfEntries))
+ {
+ if (readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG) == CP_TAG_UTF8_NAME)
+ {
+ aName = (const sal_Char*) (m_pBuffer + m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA);
+ }
+ }
+
+ return aName;
+}
+
+sal_Bool ConstantPool::readBOOLConstant(sal_uInt16 index)
+{
+ sal_Bool aBool = sal_False;
+
+ if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
+ {
+ if (readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG) == CP_TAG_CONST_BOOL)
+ {
+ aBool = (sal_Bool) readBYTE(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA);
+ }
+ }
+
+ return aBool;
+}
+
+sal_uInt8 ConstantPool::readBYTEConstant(sal_uInt16 index)
+{
+ sal_uInt8 aByte = sal_False;
+
+ if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
+ {
+ if (readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG) == CP_TAG_CONST_BYTE)
+ {
+ aByte = readBYTE(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA);
+ }
+ }
+
+ return aByte;
+}
+
+sal_Int16 ConstantPool::readINT16Constant(sal_uInt16 index)
+{
+ sal_Int16 aINT16 = sal_False;
+
+ if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
+ {
+ if (readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG) == CP_TAG_CONST_INT16)
+ {
+ aINT16 = readINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA);
+ }
+ }
+
+ return aINT16;
+}
+
+sal_uInt16 ConstantPool::readUINT16Constant(sal_uInt16 index)
+{
+ sal_uInt16 asal_uInt16 = sal_False;
+
+ if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
+ {
+ if (readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG) == CP_TAG_CONST_UINT16)
+ {
+ asal_uInt16 = readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA);
+ }
+ }
+
+ return asal_uInt16;
+}
+
+sal_Int32 ConstantPool::readINT32Constant(sal_uInt16 index)
+{
+ sal_Int32 aINT32 = sal_False;
+
+ if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
+ {
+ if (readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG) == CP_TAG_CONST_INT32)
+ {
+ aINT32 = readINT32(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA);
+ }
+ }
+
+ return aINT32;
+}
+
+sal_uInt32 ConstantPool::readUINT32Constant(sal_uInt16 index)
+{
+ sal_uInt32 aUINT32 = sal_False;
+
+ if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
+ {
+ if (readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG) == CP_TAG_CONST_UINT32)
+ {
+ aUINT32 = readUINT32(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA);
+ }
+ }
+
+ return aUINT32;
+}
+
+float ConstantPool::readFloatConstant(sal_uInt16 index)
+{
+ union
+ {
+ float v;
+ sal_uInt32 b;
+ } x;
+
+ if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
+ {
+ if (readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG) == CP_TAG_CONST_FLOAT)
+ {
+#ifdef REGTYPE_IEEE_NATIVE
+ x.b = readUINT32(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA);
+#else
+# error no IEEE
+#endif
+ }
+ }
+
+ return x.v;
+}
+
+double ConstantPool::readDoubleConstant(sal_uInt16 index)
+{
+ union
+ {
+ double v;
+ struct
+ {
+ sal_uInt32 b1;
+ sal_uInt32 b2;
+ } b;
+ } x;
+
+ if (m_pIndex && (index> 0) && (index <= m_numOfEntries))
+ {
+ if (readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG) == CP_TAG_CONST_DOUBLE)
+ {
+
+#ifdef REGTYPE_IEEE_NATIVE
+# ifdef OSL_BIGENDIAN
+ x.b.b1 = readUINT32(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA);
+ x.b.b2 = readUINT32(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA + sizeof(sal_uInt32));
+# else
+ x.b.b1 = readUINT32(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA + sizeof(sal_uInt32));
+ x.b.b2 = readUINT32(m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA);
+# endif
+#else
+# error no IEEE
+#endif
+ }
+ }
+
+ return x.v;
+}
+
+const sal_Unicode* ConstantPool::readStringConstant(sal_uInt16 index)
+{
+ const sal_Unicode* aString = NULL_WSTRING;
+
+ if (m_pIndex && (index> 0) && (index <= m_numOfEntries) && m_pStringCache)
+ {
+ if (m_pIndex[index - 1] >= 0)
+ {
+ // create cached string now
+
+ if (readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG) == CP_TAG_CONST_STRING)
+ {
+ m_pIndex[index - 1] = -1 * m_pStringCache->createString(m_pBuffer + m_pIndex[index - 1] + CP_OFFSET_ENTRY_DATA);
+ }
+ }
+
+ aString = m_pStringCache->getString((sal_uInt16) (m_pIndex[index - 1] * -1));
+ }
+
+ return aString;
+}
+
+void ConstantPool::readUIK(sal_uInt16 index, RTUik* uik)
+{
+ if (index == 0)
+ {
+ uik->m_Data1 = 0;
+ uik->m_Data2 = 0;
+ uik->m_Data3 = 0;
+ uik->m_Data4 = 0;
+ uik->m_Data5 = 0;
+ }
+ else if (m_pIndex && (index <= m_numOfEntries))
+ {
+ if (readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_TAG) == CP_TAG_UIK)
+ {
+ uik->m_Data1 = readUINT32(m_pIndex[index - 1] + CP_OFFSET_ENTRY_UIK1);
+ uik->m_Data2 = readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_UIK2);
+ uik->m_Data3 = readUINT16(m_pIndex[index - 1] + CP_OFFSET_ENTRY_UIK3);
+ uik->m_Data4 = readUINT32(m_pIndex[index - 1] + CP_OFFSET_ENTRY_UIK4);
+ uik->m_Data5 = readUINT32(m_pIndex[index - 1] + CP_OFFSET_ENTRY_UIK5);
+ }
+ }
+}
+
+/**************************************************************************
+
+ class FieldList
+
+**************************************************************************/
+
+class FieldList : public BlopObject
+{
+public:
+
+ sal_uInt16 m_numOfEntries;
+ ConstantPool* m_pCP;
+
+ FieldList(const sal_uInt8* buffer, sal_uInt16 numEntries, ConstantPool* pCP)
+ : BlopObject(buffer, 0, sal_False)
+ , m_numOfEntries(numEntries)
+ , m_pCP(pCP)
+ {
+ }
+
+ sal_uInt32 parseIndex();
+
+ const sal_Char* getFieldName(sal_uInt16 index);
+ const sal_Char* getFieldType(sal_uInt16 index);
+ RTFieldAccess getFieldAccess(sal_uInt16 index);
+ RTValueType getFieldConstValue(sal_uInt16 index, RTConstValueUnion* value);
+ const sal_Char* getFieldDoku(sal_uInt16 index);
+ const sal_Char* getFieldFileName(sal_uInt16 index);
+};
+
+sal_uInt32 FieldList::parseIndex()
+{
+ return (m_numOfEntries * (sizeof(sal_uInt16) * 6));
+}
+
+const sal_Char* FieldList::getFieldName(sal_uInt16 index)
+{
+ const sal_Char* aName = NULL;
+
+ if (index <= m_numOfEntries)
+ {
+ aName = m_pCP->readUTF8NameConstant(readUINT16((index * FIELD_ENTRY_SIZE) + FIELD_OFFSET_NAME));
+ }
+
+ return aName;
+}
+
+const sal_Char* FieldList::getFieldType(sal_uInt16 index)
+{
+ const sal_Char* aName = NULL;
+
+ if (index <= m_numOfEntries)
+ {
+ aName = m_pCP->readUTF8NameConstant(readUINT16((index * FIELD_ENTRY_SIZE) + FIELD_OFFSET_TYPE));
+ }
+
+ return aName;
+}
+
+RTFieldAccess FieldList::getFieldAccess(sal_uInt16 index)
+{
+ RTFieldAccess aAccess;
+
+ if (index <= m_numOfEntries)
+ {
+ aAccess = (RTFieldAccess) readUINT16((index * FIELD_ENTRY_SIZE) + FIELD_OFFSET_ACCESS);
+ }
+
+ return aAccess;
+}
+
+RTValueType FieldList::getFieldConstValue(sal_uInt16 index, RTConstValueUnion* value)
+{
+ RTValueType ret = RT_TYPE_NONE;
+
+ if (index <= m_numOfEntries)
+ {
+ sal_uInt16 cpIndex = readUINT16((index * FIELD_ENTRY_SIZE) + FIELD_OFFSET_VALUE);
+
+ switch (m_pCP->readTag(cpIndex))
+ {
+ case CP_TAG_CONST_BOOL:
+ value->aBool = m_pCP->readBOOLConstant(cpIndex);
+ ret = RT_TYPE_BOOL;
+ break;
+ case CP_TAG_CONST_BYTE:
+ value->aByte = m_pCP->readBYTEConstant(cpIndex);
+ ret = RT_TYPE_BYTE;
+ break;
+ case CP_TAG_CONST_INT16:
+ value->aShort = m_pCP->readINT16Constant(cpIndex);
+ ret = RT_TYPE_INT16;
+ break;
+ case CP_TAG_CONST_UINT16:
+ value->aUShort = m_pCP->readUINT16Constant(cpIndex);
+ ret = RT_TYPE_UINT16;
+ break;
+ case CP_TAG_CONST_INT32:
+ value->aLong = m_pCP->readINT32Constant(cpIndex);
+ ret = RT_TYPE_INT32;
+ break;
+ case CP_TAG_CONST_UINT32:
+ value->aULong = m_pCP->readUINT32Constant(cpIndex);
+ ret = RT_TYPE_UINT32;
+ break;
+ case CP_TAG_CONST_INT64:
+// value->aHyper = m_pCP->readINT64Constant(cpIndex);
+ ret = RT_TYPE_INT64;
+ break;
+ case CP_TAG_CONST_UINT64:
+// value->aUHyper = m_pCP->readUINT64Constant(cpIndex);
+ ret = RT_TYPE_UINT64;
+ break;
+ case CP_TAG_CONST_FLOAT:
+ value->aFloat = m_pCP->readFloatConstant(cpIndex);
+ ret = RT_TYPE_FLOAT;
+ break;
+ case CP_TAG_CONST_DOUBLE:
+ value->aDouble = m_pCP->readDoubleConstant(cpIndex);
+ ret = RT_TYPE_DOUBLE;
+ break;
+ case CP_TAG_CONST_STRING:
+ value->aString = m_pCP->readStringConstant(cpIndex);
+ ret = RT_TYPE_STRING;
+ break;
+ default:
+ break;
+ }
+ }
+
+ return ret;
+}
+
+const sal_Char* FieldList::getFieldDoku(sal_uInt16 index)
+{
+ const sal_Char* aDoku = NULL;
+
+ if (index <= m_numOfEntries)
+ {
+ aDoku = m_pCP->readUTF8NameConstant(readUINT16((index * FIELD_ENTRY_SIZE) + FIELD_OFFSET_DOKU));
+ }
+
+ return aDoku;
+}
+
+const sal_Char* FieldList::getFieldFileName(sal_uInt16 index)
+{
+ const sal_Char* aFileName = NULL;
+
+ if (index <= m_numOfEntries)
+ {
+ aFileName = m_pCP->readUTF8NameConstant(readUINT16((index * FIELD_ENTRY_SIZE) + FIELD_OFFSET_FILENAME));
+ }
+
+ return aFileName;
+}
+
+/**************************************************************************
+
+ class ReferenceList
+
+**************************************************************************/
+
+class ReferenceList : public BlopObject
+{
+public:
+
+ sal_uInt16 m_numOfEntries;
+ ConstantPool* m_pCP;
+
+ ReferenceList(const sal_uInt8* buffer, sal_uInt16 numEntries, ConstantPool* pCP)
+ : BlopObject(buffer, 0, sal_False)
+ , m_numOfEntries(numEntries)
+ , m_pCP(pCP)
+ {
+ }
+
+ sal_uInt32 parseIndex();
+
+ const sal_Char* getReferenceName(sal_uInt16 index);
+ RTReferenceType getReferenceType(sal_uInt16 index);
+ const sal_Char* getReferenceDoku(sal_uInt16 index);
+ RTFieldAccess getReferenceAccess(sal_uInt16 index);
+};
+
+sal_uInt32 ReferenceList::parseIndex()
+{
+ return (m_numOfEntries * (sizeof(sal_uInt16) * 4));
+}
+
+const sal_Char* ReferenceList::getReferenceName(sal_uInt16 index)
+{
+ const sal_Char* aName = NULL;
+
+ if (index <= m_numOfEntries)
+ {
+ aName = m_pCP->readUTF8NameConstant(readUINT16((index * REFERENCE_ENTRY_SIZE) + REFERENCE_OFFSET_NAME));
+ }
+
+ return aName;
+}
+
+RTReferenceType ReferenceList::getReferenceType(sal_uInt16 index)
+{
+ RTReferenceType refType;
+
+ if (index <= m_numOfEntries)
+ {
+ refType = (RTReferenceType) readUINT16((index * REFERENCE_ENTRY_SIZE) + REFERENCE_OFFSET_TYPE);
+ }
+
+ return refType;
+}
+
+const sal_Char* ReferenceList::getReferenceDoku(sal_uInt16 index)
+{
+ const sal_Char* aDoku = NULL;
+
+ if (index <= m_numOfEntries)
+ {
+ aDoku = m_pCP->readUTF8NameConstant(readUINT16((index * REFERENCE_ENTRY_SIZE) + REFERENCE_OFFSET_DOKU));
+ }
+
+ return aDoku;
+}
+
+RTFieldAccess ReferenceList::getReferenceAccess(sal_uInt16 index)
+{
+ RTFieldAccess aAccess;
+
+ if (index <= m_numOfEntries)
+ {
+ aAccess = (RTFieldAccess) readUINT16((index * REFERENCE_ENTRY_SIZE) + REFERENCE_OFFSET_ACCESS);
+ }
+
+ return aAccess;
+}
+
+/**************************************************************************
+
+ class MethodList
+
+**************************************************************************/
+
+class MethodList : public BlopObject
+{
+public:
+
+ sal_uInt16 m_numOfEntries;
+ sal_uInt32* m_pIndex;
+ ConstantPool* m_pCP;
+
+ MethodList(const sal_uInt8* buffer, sal_uInt16 numEntries, ConstantPool* pCP)
+ : BlopObject(buffer, 0, sal_False)
+ , m_numOfEntries(numEntries)
+ , m_pIndex(NULL)
+ , m_pCP(pCP)
+ {
+ }
+
+ ~MethodList();
+
+ sal_uInt32 parseIndex();
+
+ const sal_Char* getMethodName(sal_uInt16 index);
+ sal_uInt16 getMethodParamCount(sal_uInt16 index);
+ const sal_Char* getMethodParamType(sal_uInt16 index, sal_uInt16 paramIndex);
+ const sal_Char* getMethodParamName(sal_uInt16 index, sal_uInt16 paramIndex);
+ RTParamMode getMethodParamMode(sal_uInt16 index, sal_uInt16 paramIndex);
+ sal_uInt16 getMethodExcCount(sal_uInt16 index);
+ const sal_Char* getMethodExcType(sal_uInt16 index, sal_uInt16 excIndex);
+ const sal_Char* getMethodReturnType(sal_uInt16 index);
+ RTMethodMode getMethodMode(sal_uInt16 index);
+ const sal_Char* getMethodDoku(sal_uInt16 index);
+};
+
+MethodList::~MethodList()
+{
+ if (m_pIndex) delete[] m_pIndex;
+}
+
+sal_uInt32 MethodList::parseIndex()
+{
+ if (m_pIndex)
+ {
+ delete[] m_pIndex;
+ m_pIndex = NULL;
+ }
+
+ sal_uInt32 offset = 0;
+
+ if (m_numOfEntries)
+ {
+ m_pIndex = new sal_uInt32[m_numOfEntries];
+
+ for (int i = 0; i < m_numOfEntries; i++)
+ {
+ m_pIndex[i] = offset;
+
+ offset += readUINT16(offset);
+ }
+ }
+
+ return offset;
+}
+
+const sal_Char* MethodList::getMethodName(sal_uInt16 index)
+{
+ const sal_Char* aName = NULL;
+
+ if (index <= m_numOfEntries)
+ {
+ aName = m_pCP->readUTF8NameConstant(readUINT16(m_pIndex[index] + METHOD_OFFSET_NAME));
+ }
+
+ return aName;
+}
+
+sal_uInt16 MethodList::getMethodParamCount(sal_uInt16 index)
+{
+ sal_uInt16 aCount = 0;
+
+ if (index <= m_numOfEntries)
+ {
+ aCount = readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT);
+ }
+
+ return aCount;
+}
+
+const sal_Char* MethodList::getMethodParamType(sal_uInt16 index, sal_uInt16 paramIndex)
+{
+ const sal_Char* aName = NULL;
+
+ if ((index <= m_numOfEntries) && (paramIndex <= readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT)))
+ {
+ aName = m_pCP->readUTF8NameConstant(
+ readUINT16(
+ m_pIndex[index] +
+ METHOD_OFFSET_PARAM(paramIndex) +
+ PARAM_OFFSET_TYPE));
+ }
+
+ return aName;
+}
+
+const sal_Char* MethodList::getMethodParamName(sal_uInt16 index, sal_uInt16 paramIndex)
+{
+ const sal_Char* aName = NULL;
+
+ if ((index <= m_numOfEntries) && (paramIndex <= readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT)))
+ {
+ aName = m_pCP->readUTF8NameConstant(
+ readUINT16(
+ m_pIndex[index] +
+ METHOD_OFFSET_PARAM(paramIndex) +
+ PARAM_OFFSET_NAME));
+ }
+
+ return aName;
+}
+
+RTParamMode MethodList::getMethodParamMode(sal_uInt16 index, sal_uInt16 paramIndex)
+{
+ RTParamMode aMode = RT_PARAM_INVALID;
+
+ if ((index <= m_numOfEntries) && (paramIndex <= readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT)))
+ {
+ aMode = (RTParamMode) readUINT16(
+ m_pIndex[index] +
+ METHOD_OFFSET_PARAM(paramIndex) +
+ PARAM_OFFSET_MODE);
+ }
+
+ return aMode;
+}
+
+sal_uInt16 MethodList::getMethodExcCount(sal_uInt16 index)
+{
+ sal_uInt16 aCount = 0;
+
+ if (index <= m_numOfEntries)
+ {
+ aCount = readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM(readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT)));
+ }
+
+ return aCount;
+}
+
+const sal_Char* MethodList::getMethodExcType(sal_uInt16 index, sal_uInt16 excIndex)
+{
+ const sal_Char* aName = NULL;
+
+ if (index <= m_numOfEntries)
+ {
+ sal_uInt32 excOffset = m_pIndex[index] + METHOD_OFFSET_PARAM(readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT));
+
+ if (excIndex <= readUINT16(excOffset))
+ {
+ aName = m_pCP->readUTF8NameConstant(
+ readUINT16(
+ excOffset +
+ sizeof(sal_uInt16) +
+ (excIndex * sizeof(sal_uInt16))));
+ }
+ }
+
+ return aName;
+}
+
+const sal_Char* MethodList::getMethodReturnType(sal_uInt16 index)
+{
+ const sal_Char* aName = NULL;
+
+ if (index <= m_numOfEntries)
+ {
+ aName = m_pCP->readUTF8NameConstant(readUINT16(m_pIndex[index] + METHOD_OFFSET_RETURN));
+ }
+
+ return aName;
+}
+
+RTMethodMode MethodList::getMethodMode(sal_uInt16 index)
+{
+ RTMethodMode aMode = RT_MODE_INVALID;
+
+ if (index <= m_numOfEntries)
+ {
+ aMode = (RTMethodMode) readUINT16(m_pIndex[index] + METHOD_OFFSET_MODE);
+ }
+
+ return aMode;
+}
+
+const sal_Char* MethodList::getMethodDoku(sal_uInt16 index)
+{
+ const sal_Char* aDoku = NULL;
+
+ if (index <= m_numOfEntries)
+ {
+ aDoku = m_pCP->readUTF8NameConstant(readUINT16(m_pIndex[index] + METHOD_OFFSET_DOKU));
+ }
+
+ return aDoku;
+}
+
+/**************************************************************************
+
+ class TypeRegistryEntry
+
+**************************************************************************/
+
+class TypeRegistryEntry : public BlopObject
+{
+
+public:
+
+ ConstantPool* m_pCP;
+ FieldList* m_pFields;
+ MethodList* m_pMethods;
+ ReferenceList* m_pReferences;
+ sal_uInt32 m_refCount;
+
+ TypeRegistryEntry(const sal_uInt8* buffer, sal_uInt32 len, sal_Bool copyBuffer)
+ : BlopObject(buffer, len, copyBuffer)
+ , m_pCP(NULL)
+ , m_pFields(NULL)
+ , m_pMethods(NULL)
+ , m_pReferences(NULL)
+ , m_refCount(1)
+ {
+ }
+
+ ~TypeRegistryEntry();
+
+ void init() const;
+
+};
+
+TypeRegistryEntry::~TypeRegistryEntry()
+{
+ if (m_pCP) delete m_pCP;
+ if (m_pFields) delete m_pFields;
+ if (m_pMethods) delete m_pMethods;
+ if (m_pReferences) delete m_pReferences;
+}
+
+
+void TypeRegistryEntry::init() const
+{
+#ifdef OS2
+ TypeRegistryEntry* _This = (TypeRegistryEntry*)(this);
+#else
+ TypeRegistryEntry* _This = const_cast<TypeRegistryEntry*>(this);
+#endif
+
+ if (m_pCP)
+ {
+ delete _This->m_pCP;
+ _This->m_pCP = NULL;
+ }
+
+ _This->m_pCP = new ConstantPool(m_pBuffer + OFFSET_CP, readUINT16(OFFSET_CP_SIZE));
+
+ sal_uInt32 offset = OFFSET_CP + _This->m_pCP->parseIndex();
+
+ _This->m_pFields = new FieldList(m_pBuffer + offset + sizeof(sal_uInt16), readUINT16(offset), _This->m_pCP);
+
+ offset += sizeof(sal_uInt16) + _This->m_pFields->parseIndex();
+
+ _This->m_pMethods = new MethodList(m_pBuffer + offset + sizeof(sal_uInt16), readUINT16(offset), _This->m_pCP);
+
+ offset += sizeof(sal_uInt16) + _This->m_pMethods->parseIndex();
+
+ _This->m_pReferences = new ReferenceList(m_pBuffer + offset + sizeof(sal_uInt16), readUINT16(offset), _This->m_pCP);
+
+ offset += sizeof(sal_uInt16) + _This->m_pReferences->parseIndex();
+}
+
+
+/**************************************************************************
+
+ C-API
+
+**************************************************************************/
+
+static TypeReaderImpl TYPEREG_CALLTYPE createEntry(const sal_uInt8* buffer, sal_uInt32 len, sal_Bool copyBuffer)
+{
+ TypeRegistryEntry* ret = NULL;
+
+ if (len >= OFFSET_CP)
+ {
+ ret = new TypeRegistryEntry(buffer, len, copyBuffer);
+
+ if (
+ (ret->readUINT32(OFFSET_MAGIC) != magic) ||
+ (ret->readUINT32(OFFSET_SIZE) > len)
+ )
+ {
+ delete ret;
+ ret = NULL;
+ }
+ }
+
+ return ret;
+}
+
+static void TYPEREG_CALLTYPE acquire(TypeReaderImpl hEntry)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry != NULL)
+ pEntry->m_refCount++;
+}
+
+static void TYPEREG_CALLTYPE release(TypeReaderImpl hEntry)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry != NULL)
+ {
+ if (--pEntry->m_refCount == 0)
+ delete pEntry;
+ }
+}
+
+static sal_uInt16 TYPEREG_CALLTYPE getMinorVersion(TypeReaderImpl hEntry)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL) return 0;
+
+ return pEntry->readUINT16(OFFSET_MINOR_VERSION);
+}
+
+static sal_uInt16 TYPEREG_CALLTYPE getMajorVersion(TypeReaderImpl hEntry)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL) return 0;
+
+ return pEntry->readUINT16(OFFSET_MAJOR_VERSION);
+}
+
+static RTTypeClass TYPEREG_CALLTYPE getTypeClass(TypeReaderImpl hEntry)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL) return RT_TYPE_INVALID;
+
+ return (RTTypeClass) pEntry->readUINT16(OFFSET_TYPE_CLASS);
+}
+
+static void TYPEREG_CALLTYPE getTypeName(TypeReaderImpl hEntry, rtl_uString** pTypeName)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL)
+ {
+ rtl_uString_new(pTypeName);
+ return;
+ }
+
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ const sal_Char* pTmp = pEntry->m_pCP->readUTF8NameConstant(pEntry->readUINT16(OFFSET_THIS_TYPE));
+ if ( pTmp )
+ rtl_string2UString( pTypeName, pTmp, rtl_str_getLength(pTmp), RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+}
+
+static void TYPEREG_CALLTYPE getSuperTypeName(TypeReaderImpl hEntry, rtl_uString** pSuperTypeName)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL)
+ {
+ rtl_uString_new(pSuperTypeName);
+ return;
+ }
+
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ const sal_Char* pTmp = pEntry->m_pCP->readUTF8NameConstant(pEntry->readUINT16(OFFSET_SUPER_TYPE));
+ if ( pTmp )
+ rtl_string2UString( pSuperTypeName, pTmp, rtl_str_getLength(pTmp), RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+}
+
+static void TYPEREG_CALLTYPE getUik(TypeReaderImpl hEntry, RTUik* uik)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry != NULL)
+ {
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ pEntry->m_pCP->readUIK(pEntry->readUINT16(OFFSET_UIK), uik);
+ }
+}
+
+static void TYPEREG_CALLTYPE getDoku(TypeReaderImpl hEntry, rtl_uString** pDoku)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL)
+ {
+ rtl_uString_new(pDoku);
+ return;
+ }
+
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ const sal_Char* pTmp = pEntry->m_pCP->readUTF8NameConstant(pEntry->readUINT16(OFFSET_DOKU));
+ if ( pTmp )
+ rtl_string2UString( pDoku, pTmp, rtl_str_getLength(pTmp), RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+}
+
+static void TYPEREG_CALLTYPE getFileName(TypeReaderImpl hEntry, rtl_uString** pFileName)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL)
+ {
+ rtl_uString_new(pFileName);
+ return;
+ }
+
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ const sal_Char* pTmp = pEntry->m_pCP->readUTF8NameConstant(pEntry->readUINT16(OFFSET_FILENAME));
+ if ( pTmp )
+ rtl_string2UString( pFileName, pTmp, rtl_str_getLength(pTmp), RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+}
+
+static sal_uInt32 TYPEREG_CALLTYPE getFieldCount(TypeReaderImpl hEntry)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL) return 0;
+
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ return pEntry->m_pFields->m_numOfEntries;
+}
+
+static void TYPEREG_CALLTYPE getFieldName(TypeReaderImpl hEntry, rtl_uString** pFieldName, sal_uInt16 index)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL)
+ {
+ rtl_uString_new(pFieldName);
+ return;
+ }
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ const sal_Char* pTmp = pEntry->m_pFields->getFieldName(index);
+ if ( pTmp )
+ rtl_string2UString( pFieldName, pTmp, rtl_str_getLength(pTmp), RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+}
+
+static void TYPEREG_CALLTYPE getFieldType(TypeReaderImpl hEntry, rtl_uString** pFieldType, sal_uInt16 index)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL)
+ {
+ rtl_uString_new(pFieldType);
+ return;
+ }
+
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ const sal_Char* pTmp = pEntry->m_pFields->getFieldType(index);
+ if ( pTmp )
+ rtl_string2UString( pFieldType, pTmp, rtl_str_getLength(pTmp), RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+}
+
+static RTFieldAccess TYPEREG_CALLTYPE getFieldAccess(TypeReaderImpl hEntry, sal_uInt16 index)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL) return RT_ACCESS_INVALID;
+
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ return pEntry->m_pFields->getFieldAccess(index);
+}
+
+static RTValueType TYPEREG_CALLTYPE getFieldConstValue(TypeReaderImpl hEntry, sal_uInt16 index, RTConstValueUnion* value)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL) return RT_TYPE_NONE;
+
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ return pEntry->m_pFields->getFieldConstValue(index, value);
+}
+
+static void TYPEREG_CALLTYPE getFieldDoku(TypeReaderImpl hEntry, rtl_uString** pDoku, sal_uInt16 index)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL)
+ {
+ rtl_uString_new(pDoku);
+ return;
+ }
+
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ const sal_Char* pTmp = pEntry->m_pFields->getFieldDoku(index);
+ if ( pTmp )
+ rtl_string2UString( pDoku, pTmp, rtl_str_getLength(pTmp), RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+}
+
+static void TYPEREG_CALLTYPE getFieldFileName(TypeReaderImpl hEntry, rtl_uString** pFieldFileName, sal_uInt16 index)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL)
+ {
+ rtl_uString_new(pFieldFileName);
+ return;
+ }
+
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ const sal_Char* pTmp = pEntry->m_pFields->getFieldFileName(index);
+ if ( pTmp )
+ rtl_string2UString( pFieldFileName, pTmp, rtl_str_getLength(pTmp), RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+}
+
+static sal_uInt32 TYPEREG_CALLTYPE getMethodCount(TypeReaderImpl hEntry)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL) return 0;
+
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ return pEntry->m_pMethods->m_numOfEntries;
+}
+
+static void TYPEREG_CALLTYPE getMethodName(TypeReaderImpl hEntry, rtl_uString** pMethodName, sal_uInt16 index)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL)
+ {
+ rtl_uString_new(pMethodName);
+ return;
+ }
+
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ const sal_Char* pTmp = pEntry->m_pMethods->getMethodName(index);
+ if ( pTmp )
+ rtl_string2UString( pMethodName, pTmp, rtl_str_getLength(pTmp), RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+}
+
+static sal_uInt32 TYPEREG_CALLTYPE getMethodParamCount(TypeReaderImpl hEntry, sal_uInt16 index)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL) return 0;
+
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ return pEntry->m_pMethods->getMethodParamCount(index);
+}
+
+static void TYPEREG_CALLTYPE getMethodParamType(TypeReaderImpl hEntry, rtl_uString** pMethodParamType, sal_uInt16 index, sal_uInt16 paramIndex)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL)
+ {
+ rtl_uString_new(pMethodParamType);
+ return;
+ }
+
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ const sal_Char* pTmp = pEntry->m_pMethods->getMethodParamType(index, paramIndex);
+ if ( pTmp )
+ rtl_string2UString( pMethodParamType, pTmp, rtl_str_getLength(pTmp), RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+}
+
+static void TYPEREG_CALLTYPE getMethodParamName(TypeReaderImpl hEntry, rtl_uString** pMethodParamName, sal_uInt16 index, sal_uInt16 paramIndex)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL)
+ {
+ rtl_uString_new(pMethodParamName);
+ return;
+ }
+
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ const sal_Char* pTmp = pEntry->m_pMethods->getMethodParamName(index, paramIndex);
+ if ( pTmp )
+ rtl_string2UString( pMethodParamName, pTmp, rtl_str_getLength(pTmp), RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+}
+
+static RTParamMode TYPEREG_CALLTYPE getMethodParamMode(TypeReaderImpl hEntry, sal_uInt16 index, sal_uInt16 paramIndex)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL) return RT_PARAM_INVALID;
+
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ return pEntry->m_pMethods->getMethodParamMode(index, paramIndex);
+}
+
+static sal_uInt32 TYPEREG_CALLTYPE getMethodExcCount(TypeReaderImpl hEntry, sal_uInt16 index)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL) return 0;
+
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ return pEntry->m_pMethods->getMethodExcCount(index);
+}
+
+static void TYPEREG_CALLTYPE getMethodExcType(TypeReaderImpl hEntry, rtl_uString** pMethodExcpType, sal_uInt16 index, sal_uInt16 excIndex)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL)
+ {
+ rtl_uString_new(pMethodExcpType);
+ return;
+ }
+
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ const sal_Char* pTmp = pEntry->m_pMethods->getMethodExcType(index, excIndex);
+ if ( pTmp )
+ rtl_string2UString( pMethodExcpType, pTmp, rtl_str_getLength(pTmp), RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+}
+
+static void TYPEREG_CALLTYPE getMethodReturnType(TypeReaderImpl hEntry, rtl_uString** pMethodReturnType, sal_uInt16 index)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL)
+ {
+ rtl_uString_new(pMethodReturnType);
+ return;
+ }
+
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ const sal_Char* pTmp = pEntry->m_pMethods->getMethodReturnType(index);
+ if ( pTmp )
+ rtl_string2UString( pMethodReturnType, pTmp, rtl_str_getLength(pTmp), RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+}
+
+static RTMethodMode TYPEREG_CALLTYPE getMethodMode(TypeReaderImpl hEntry, sal_uInt16 index)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL) return RT_MODE_INVALID;
+
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ return pEntry->m_pMethods->getMethodMode(index);
+}
+
+static void TYPEREG_CALLTYPE getMethodDoku(TypeReaderImpl hEntry, rtl_uString** pMethodDoku, sal_uInt16 index)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL)
+ {
+ rtl_uString_new(pMethodDoku);
+ return;
+ }
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ const sal_Char* pTmp = pEntry->m_pMethods->getMethodDoku(index);
+ if ( pTmp )
+ rtl_string2UString( pMethodDoku, pTmp, rtl_str_getLength(pTmp), RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+}
+
+static sal_uInt32 TYPEREG_CALLTYPE getReferenceCount(TypeReaderImpl hEntry)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL) return 0;
+
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ return pEntry->m_pReferences->m_numOfEntries;
+}
+
+static void TYPEREG_CALLTYPE getReferenceName(TypeReaderImpl hEntry, rtl_uString** pReferenceName, sal_uInt16 index)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL)
+ {
+ rtl_uString_new(pReferenceName);
+ return;
+ }
+
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ const sal_Char* pTmp = pEntry->m_pReferences->getReferenceName(index);
+ if ( pTmp )
+ rtl_string2UString( pReferenceName, pTmp, rtl_str_getLength(pTmp), RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+}
+
+static RTReferenceType TYPEREG_CALLTYPE getReferenceType(TypeReaderImpl hEntry, sal_uInt16 index)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL) return RT_REF_INVALID;
+
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ return pEntry->m_pReferences->getReferenceType(index);
+}
+
+static void TYPEREG_CALLTYPE getReferenceDoku(TypeReaderImpl hEntry, rtl_uString** pReferenceDoku, sal_uInt16 index)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL)
+ {
+ rtl_uString_new(pReferenceDoku);
+ return;
+ }
+
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ const sal_Char* pTmp = pEntry->m_pReferences->getReferenceDoku(index);
+ if ( pTmp )
+ rtl_string2UString( pReferenceDoku, pTmp, rtl_str_getLength(pTmp), RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+}
+
+static RTFieldAccess TYPEREG_CALLTYPE getReferenceAccess(TypeReaderImpl hEntry, sal_uInt16 index)
+{
+ TypeRegistryEntry* pEntry = (TypeRegistryEntry*) hEntry;
+
+ if (pEntry == NULL) return RT_ACCESS_INVALID;
+
+ if (pEntry->m_pCP == NULL) pEntry->init();
+
+ return pEntry->m_pReferences->getReferenceAccess(index);
+}
+
+
+extern "C" RegistryTypeReader_Api* TYPEREG_CALLTYPE initRegistryTypeReader_Api(void)
+{
+ static RegistryTypeReader_Api aApi= {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+ if (!aApi.acquire)
+ {
+ aApi.createEntry = &createEntry;
+ aApi.acquire = &acquire;
+ aApi.release = &release;
+ aApi.getMinorVersion = &getMinorVersion;
+ aApi.getMajorVersion = &getMajorVersion;
+ aApi.getTypeClass = &getTypeClass;
+ aApi.getTypeName = &getTypeName;
+ aApi.getSuperTypeName = &getSuperTypeName;
+ aApi.getUik = &getUik;
+ aApi.getDoku = &getDoku;
+ aApi.getFileName = &getFileName;
+ aApi.getFieldCount = &getFieldCount;
+ aApi.getFieldName = &getFieldName;
+ aApi.getFieldType = &getFieldType;
+ aApi.getFieldAccess = &getFieldAccess;
+ aApi.getFieldConstValue = &getFieldConstValue;
+ aApi.getFieldDoku = &getFieldDoku;
+ aApi.getFieldFileName = &getFieldFileName;
+ aApi.getMethodCount = &getMethodCount;
+ aApi.getMethodName = &getMethodName;
+ aApi.getMethodParamCount = &getMethodParamCount;
+ aApi.getMethodParamType = &getMethodParamType;
+ aApi.getMethodParamName = &getMethodParamName;
+ aApi.getMethodParamMode = &getMethodParamMode;
+ aApi.getMethodExcCount = &getMethodExcCount;
+ aApi.getMethodExcType = &getMethodExcType;
+ aApi.getMethodReturnType = &getMethodReturnType;
+ aApi.getMethodMode = &getMethodMode;
+ aApi.getMethodDoku = &getMethodDoku;
+ aApi.getReferenceCount = &getReferenceCount;
+ aApi.getReferenceName = &getReferenceName;
+ aApi.getReferenceType = &getReferenceType;
+ aApi.getReferenceDoku = &getReferenceDoku;
+ aApi.getReferenceAccess = &getReferenceAccess;
+
+ return (&aApi);
+ }
+ else
+ {
+ return (&aApi);
+ }
+}
+
+
+
diff --git a/registry/source/reflwrit.cxx b/registry/source/reflwrit.cxx
new file mode 100644
index 000000000000..d8e1e2c74350
--- /dev/null
+++ b/registry/source/reflwrit.cxx
@@ -0,0 +1,1452 @@
+/*************************************************************************
+ *
+ * $RCSfile: reflwrit.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <osl/types.h>
+
+#include <rtl/alloc.h>
+#include <registry/reflwrit.hxx>
+
+#include "reflcnst.hxx"
+
+using namespace rtl;
+using namespace vos;
+
+#ifdef MAC
+#define strdup(str) strcpy((sal_Char*)malloc(strlen(str)+1),str)
+#endif
+
+static sal_Char NULL_STRING[1] = { 0 };
+static sal_Unicode NULL_WSTRING[1] = { 0 };
+
+#if defined ( GCC ) && ( defined ( SCO ) || defined ( NETBSD ) || defined ( OS2 ) )
+ORealDynamicLoader* ODynamicLoader<RegistryTypeWriter_Api>::m_pLoader = NULL;
+#endif
+
+#define BLOP_OFFSET_MAGIC 0
+#define BLOP_OFFSET_SIZE (BLOP_OFFSET_MAGIC + sizeof(sal_uInt32))
+#define BLOP_OFFSET_MINOR (BLOP_OFFSET_SIZE + sizeof(sal_uInt32))
+#define BLOP_OFFSET_MAJOR (BLOP_OFFSET_MINOR + sizeof(sal_uInt16))
+#define BLOP_OFFSET_TYPE_CLASS (BLOP_OFFSET_MAJOR + sizeof(sal_uInt16))
+#define BLOP_OFFSET_THIS (BLOP_OFFSET_TYPE_CLASS + sizeof(sal_uInt16))
+#define BLOP_OFFSET_SUPER (BLOP_OFFSET_THIS + sizeof(sal_uInt16))
+#define BLOP_OFFSET_UIK (BLOP_OFFSET_SUPER + sizeof(sal_uInt16))
+#define BLOP_OFFSET_DOKU (BLOP_OFFSET_UIK + sizeof(sal_uInt16))
+#define BLOP_OFFSET_FILENAME (BLOP_OFFSET_DOKU + sizeof(sal_uInt16))
+#define BLOP_HEADER_SIZE (BLOP_OFFSET_FILENAME + sizeof(sal_uInt16))
+
+
+#define BLOP_FIELD_ENTRY_ACCESS 0
+#define BLOP_FIELD_ENTRY_NAME (BLOP_FIELD_ENTRY_ACCESS + sizeof(sal_uInt16))
+#define BLOP_FIELD_ENTRY_TYPE (BLOP_FIELD_ENTRY_NAME + sizeof(sal_uInt16))
+#define BLOP_FIELD_ENTRY_VALUE (BLOP_FIELD_ENTRY_TYPE + sizeof(sal_uInt16))
+#define BLOP_FIELD_ENTRY_DOKU (BLOP_FIELD_ENTRY_VALUE + sizeof(sal_uInt16))
+#define BLOP_FIELD_ENTRY_FILENAME (BLOP_FIELD_ENTRY_DOKU + sizeof(sal_uInt16))
+#define BLOP_FIELD_ENTRY_SIZE (BLOP_FIELD_ENTRY_FILENAME + sizeof(sal_uInt16))
+
+#define BLOP_METHOD_SIZE 0
+#define BLOP_METHOD_MODE (BLOP_METHOD_SIZE + sizeof(sal_uInt16))
+#define BLOP_METHOD_NAME (BLOP_METHOD_MODE + sizeof(sal_uInt16))
+#define BLOP_METHOD_RETURN (BLOP_METHOD_NAME + sizeof(sal_uInt16))
+#define BLOP_METHOD_DOKU (BLOP_METHOD_RETURN + sizeof(sal_uInt16))
+#define BLOP_METHOD_HEADER_SIZE (BLOP_METHOD_DOKU + sizeof(sal_uInt16))
+
+#define BLOP_PARAM_TYPE 0
+#define BLOP_PARAM_MODE (BLOP_PARAM_TYPE + sizeof(sal_uInt16))
+#define BLOP_PARAM_NAME (BLOP_PARAM_MODE + sizeof(sal_uInt16))
+#define BLOP_PARAM_ENTRY_SIZE (BLOP_PARAM_NAME + sizeof(sal_uInt16))
+
+#define BLOP_REFERENCE_TYPE 0
+#define BLOP_REFERENCE_NAME (BLOP_REFERENCE_TYPE + sizeof(sal_uInt16))
+#define BLOP_REFERENCE_DOKU (BLOP_REFERENCE_NAME + sizeof(sal_uInt16))
+#define BLOP_REFERENCE_ACCESS (BLOP_REFERENCE_DOKU + sizeof(sal_uInt16))
+#define BLOP_REFERENCE_ENTRY_SIZE (BLOP_REFERENCE_ACCESS + sizeof(sal_uInt16))
+
+sal_uInt32 UINT16StringLen(const sal_uInt8* wstring)
+{
+ if (!wstring) return 0;
+
+ const sal_uInt8* b = wstring;
+
+ while (b[0] || b[1]) b += sizeof(sal_uInt16);
+
+ return ((b - wstring) / sizeof(sal_uInt16));
+}
+
+sal_uInt32 writeString(sal_uInt8* buffer, const sal_Unicode* v)
+{
+ sal_uInt32 len = rtl_ustr_getLength(v) + 1;
+ sal_uInt32 i;
+ sal_uInt8* buff = buffer;
+
+ for (i = 0; i < len; i++)
+ {
+ buff += writeUINT16(buff, (sal_uInt16) v[i]);
+ }
+
+ return (buff - buffer);
+}
+
+sal_uInt32 readString(const sal_uInt8* buffer, sal_Unicode* v, sal_uInt32 maxSize)
+{
+ sal_uInt32 len = VOS_MIN(UINT16StringLen(buffer) + 1, maxSize / 2);
+ sal_uInt32 i;
+ sal_uInt8* buff = (sal_uInt8*)buffer;
+
+ for (i = 0; i < (len - 1); i++)
+ {
+ sal_uInt16 aChar;
+
+ buff += readUINT16(buff, aChar);
+
+ v[i] = (sal_Unicode) aChar;
+ }
+
+ v[len - 1] = L'\0';
+
+ return (buff - ((sal_uInt8*)buffer));
+}
+
+sal_uInt32 writeFloat(sal_uInt8* buffer, float v)
+{
+ union
+ {
+ float v;
+ sal_uInt32 b;
+ } x;
+
+ x.v = v;
+
+#ifdef REGTYPE_IEEE_NATIVE
+ writeUINT32(buffer, x.b);
+#else
+# error no IEEE
+#endif
+
+ return sizeof(sal_uInt32);
+}
+
+sal_uInt32 readFloat(const sal_uInt8* buffer, float& v)
+{
+ union
+ {
+ float v;
+ sal_uInt32 b;
+ } x;
+
+#ifdef REGTYPE_IEEE_NATIVE
+ readUINT32(buffer, x.b);
+#else
+# error no IEEE
+#endif
+
+ v = x.v;
+
+ return sizeof(sal_uInt32);
+}
+
+sal_uInt32 writeDouble(sal_uInt8* buffer, double v)
+{
+ union
+ {
+ double v;
+ struct
+ {
+ sal_uInt32 b1;
+ sal_uInt32 b2;
+ } b;
+ } x;
+
+ x.v = v;
+
+#ifdef REGTYPE_IEEE_NATIVE
+# ifdef OSL_BIGENDIAN
+ writeUINT32(buffer, x.b.b1);
+ writeUINT32(buffer + sizeof(sal_uInt32), x.b.b2);
+# else
+ writeUINT32(buffer, x.b.b2);
+ writeUINT32(buffer + sizeof(sal_uInt32), x.b.b1);
+# endif
+#else
+# error no IEEE
+#endif
+
+ return (sizeof(sal_uInt32) + sizeof(sal_uInt32));
+}
+
+sal_uInt32 readDouble(const sal_uInt8* buffer, double& v)
+{
+ union
+ {
+ double v;
+ struct
+ {
+ sal_uInt32 b1;
+ sal_uInt32 b2;
+ } b;
+ } x;
+
+#ifdef REGTYPE_IEEE_NATIVE
+# ifdef OSL_BIGENDIAN
+ readUINT32(buffer, x.b.b1);
+ readUINT32(buffer + sizeof(sal_uInt32), x.b.b2);
+# else
+ readUINT32(buffer, x.b.b2);
+ readUINT32(buffer + sizeof(sal_uInt32), x.b.b1);
+# endif
+#else
+# error no IEEE
+#endif
+
+ v = x.v;
+
+ return (sizeof(sal_uInt32) + sizeof(sal_uInt32));
+}
+
+/**************************************************************************
+
+ buffer write functions
+
+**************************************************************************/
+
+
+/**************************************************************************
+
+ struct CPInfo
+
+**************************************************************************/
+
+struct CPInfo
+{
+ CPInfoTag m_tag;
+ union
+ {
+ const sal_Char* aUtf8;
+ RTUik* aUik;
+ RTConstValueUnion aConst;
+/* sal_Bool aBool;
+ sal_uInt8 aByte;
+ sal_Int16 aShort;
+ sal_uInt16 aUShort;
+ sal_Int32 aLong;
+ sal_uInt32 aULong;
+// INT64 aHyper;
+// UINT64 aUHyper;
+ float aFloat;
+ double aDouble;
+ const sal_Unicode* aString;*/
+ } m_value;
+
+ sal_uInt16 m_index;
+ struct CPInfo* m_next;
+
+ CPInfo(CPInfoTag tag, struct CPInfo* prev);
+
+ sal_uInt32 getBlopSize();
+
+ sal_uInt32 toBlop(sal_uInt8* buffer, sal_uInt32 maxLen);
+};
+
+CPInfo::CPInfo(CPInfoTag tag, struct CPInfo* prev)
+ : m_tag(tag)
+ , m_index(0)
+ , m_next(NULL)
+{
+ if (prev)
+ {
+ m_index = prev->m_index + 1;
+ prev->m_next = this;
+ }
+}
+
+sal_uInt32 CPInfo::getBlopSize()
+{
+ sal_uInt32 size = sizeof(sal_uInt16) /* size */ + sizeof(sal_uInt16) /* tag */;
+
+ switch (m_tag)
+ {
+ case CP_TAG_CONST_BOOL:
+ size += sizeof(sal_uInt8);
+ break;
+ case CP_TAG_CONST_BYTE:
+ size += sizeof(sal_uInt8);
+ break;
+ case CP_TAG_CONST_INT16:
+ size += sizeof(sal_Int16);
+ break;
+ case CP_TAG_CONST_UINT16:
+ size += sizeof(sal_uInt16);
+ break;
+ case CP_TAG_CONST_INT32:
+ size += sizeof(sal_Int32);
+ break;
+ case CP_TAG_CONST_UINT32:
+ size += sizeof(sal_uInt32);
+ break;
+ case CP_TAG_CONST_INT64:
+// size += sizeof(sal_Int64);
+ break;
+ case CP_TAG_CONST_UINT64:
+// size += sizeof(sal_uInt64);
+ break;
+ case CP_TAG_CONST_FLOAT:
+ size += sizeof(sal_uInt32);
+ break;
+ case CP_TAG_CONST_DOUBLE:
+ size += sizeof(sal_uInt32) + sizeof(sal_uInt32);
+ break;
+ case CP_TAG_CONST_STRING:
+ size += (rtl_ustr_getLength(m_value.aConst.aString) + 1) * sizeof(sal_uInt16);
+ break;
+ case CP_TAG_UTF8_NAME:
+ size += strlen(m_value.aUtf8) + 1;
+ break;
+ case CP_TAG_UIK:
+ size += sizeof(sal_uInt32) + sizeof(sal_uInt16) + sizeof(sal_uInt16) + sizeof(sal_uInt32) + sizeof(sal_uInt32);
+ break;
+ default:
+ break;
+ }
+
+ return size;
+}
+
+
+sal_uInt32 CPInfo::toBlop(sal_uInt8* buffer, sal_uInt32 maxLen)
+{
+ sal_uInt8* buff = buffer;
+
+ buff += writeUINT16(buff, (sal_uInt16) getBlopSize());
+ buff += writeUINT16(buff, (sal_uInt16) m_tag);
+
+ switch (m_tag)
+ {
+ case CP_TAG_CONST_BOOL:
+ buff += writeBYTE(buff, (sal_uInt8) m_value.aConst.aBool);
+ break;
+ case CP_TAG_CONST_BYTE:
+ buff += writeBYTE(buff, m_value.aConst.aByte);
+ break;
+ case CP_TAG_CONST_INT16:
+ buff += writeINT16(buff, m_value.aConst.aShort);
+ break;
+ case CP_TAG_CONST_UINT16:
+ buff += writeINT16(buff, m_value.aConst.aUShort);
+ break;
+ case CP_TAG_CONST_INT32:
+ buff += writeINT32(buff, m_value.aConst.aLong);
+ break;
+ case CP_TAG_CONST_UINT32:
+ buff += writeUINT32(buff, m_value.aConst.aULong);
+ break;
+ case CP_TAG_CONST_INT64:
+// buff += writeUINT64(buff, m_value.aConst.aHyper);
+ break;
+ case CP_TAG_CONST_UINT64:
+// buff += writeUINT64(buff, m_value.aConst.aUHyper);
+ break;
+ case CP_TAG_CONST_FLOAT:
+ buff += writeFloat(buff, m_value.aConst.aFloat);
+ break;
+ case CP_TAG_CONST_DOUBLE:
+ buff += writeDouble(buff, m_value.aConst.aDouble);
+ break;
+ case CP_TAG_CONST_STRING:
+ buff += writeString(buff, m_value.aConst.aString);
+ break;
+ case CP_TAG_UTF8_NAME:
+ buff += writeUtf8(buff, m_value.aUtf8);
+ break;
+ case CP_TAG_UIK:
+ buff += writeUINT32(buff, m_value.aUik->m_Data1);
+ buff += writeUINT16(buff, m_value.aUik->m_Data2);
+ buff += writeUINT16(buff, m_value.aUik->m_Data3);
+ buff += writeUINT32(buff, m_value.aUik->m_Data4);
+ buff += writeUINT32(buff, m_value.aUik->m_Data5);
+ break;
+ default:
+ break;
+ }
+
+ return (buff - buffer);
+}
+
+
+/**************************************************************************
+
+ class FieldEntry
+
+**************************************************************************/
+
+class FieldEntry
+{
+
+public:
+
+ OString m_name;
+ OString m_typeName;
+ OString m_doku;
+ OString m_fileName;
+ RTFieldAccess m_access;
+ RTValueType m_constValueType;
+ RTConstValueUnion m_constValue;
+
+ FieldEntry();
+ ~FieldEntry();
+
+ void setData(const OString& name,
+ const OString& typeName,
+ const OString& doku,
+ const OString& fileName,
+ RTFieldAccess access,
+ RTValueType constValueType,
+ RTConstValueUnion constValue);
+};
+
+FieldEntry::FieldEntry()
+ : m_access(RT_ACCESS_INVALID)
+ , m_constValueType(RT_TYPE_NONE)
+{
+}
+
+FieldEntry::~FieldEntry()
+{
+ if (
+ (m_constValueType == RT_TYPE_STRING) &&
+ m_constValue.aString &&
+ (m_constValue.aString != NULL_WSTRING)
+ )
+ {
+ delete[] (sal_Unicode*)m_constValue.aString;
+ }
+}
+
+void FieldEntry::setData(const OString& name,
+ const OString& typeName,
+ const OString& doku,
+ const OString& fileName,
+ RTFieldAccess access,
+ RTValueType constValueType,
+ RTConstValueUnion constValue)
+{
+ m_name = name;
+ m_typeName = typeName;
+ m_doku = doku;
+ m_fileName = fileName;
+
+ if (
+ (m_constValueType == RT_TYPE_STRING) &&
+ m_constValue.aString &&
+ (m_constValue.aString != NULL_WSTRING)
+ )
+ {
+ delete[] (sal_Unicode*)m_constValue.aString;
+ }
+
+ m_access = access;
+ m_constValueType = constValueType;
+
+ if (m_constValueType == RT_TYPE_STRING)
+ {
+ if (constValue.aString == NULL)
+ m_constValue.aString = NULL_WSTRING;
+ else
+ {
+ sal_uInt32 len = rtl_ustr_getLength(constValue.aString);
+
+ m_constValue.aString = new sal_Unicode[len + 1];
+ rtl_copyMemory( (sal_Unicode*)m_constValue.aString, constValue.aString, (len+1) * sizeof(sal_Unicode) );
+ }
+ }
+ else
+ {
+ m_constValue = constValue;
+ }
+}
+
+/**************************************************************************
+
+ class ParamEntry
+
+**************************************************************************/
+
+class ParamEntry
+{
+public:
+
+ OString m_typeName;
+ OString m_name;
+ RTParamMode m_mode;
+
+ ParamEntry();
+ ~ParamEntry();
+
+ void setData(const OString& typeName,
+ const OString& name,
+ RTParamMode mode);
+};
+
+ParamEntry::ParamEntry()
+ : m_mode(RT_PARAM_INVALID)
+{
+}
+
+ParamEntry::~ParamEntry()
+{
+}
+
+void ParamEntry::setData(const OString& typeName,
+ const OString& name,
+ RTParamMode mode)
+{
+ m_name = name;
+ m_typeName = typeName;
+ m_mode = mode;
+}
+
+/**************************************************************************
+
+ class ReferenceEntry
+
+**************************************************************************/
+
+class ReferenceEntry
+{
+public:
+
+ OString m_name;
+ OString m_doku;
+ RTReferenceType m_type;
+ RTFieldAccess m_access;
+
+ ReferenceEntry();
+ ~ReferenceEntry();
+
+ void setData(const OString& name,
+ RTReferenceType refType,
+ const OString& doku,
+ RTFieldAccess access);
+};
+
+ReferenceEntry::ReferenceEntry()
+ : m_type(RT_REF_INVALID)
+ , m_access(RT_ACCESS_INVALID)
+{
+}
+
+ReferenceEntry::~ReferenceEntry()
+{
+}
+
+void ReferenceEntry::setData(const OString& name,
+ RTReferenceType refType,
+ const OString& doku,
+ RTFieldAccess access)
+{
+ m_name = name;
+ m_doku = doku;
+ m_type = refType;
+ m_access = access;
+}
+
+/**************************************************************************
+
+ class MethodEntry
+
+**************************************************************************/
+
+class MethodEntry
+{
+public:
+
+ OString m_name;
+ OString m_returnTypeName;
+ RTMethodMode m_mode;
+ sal_uInt16 m_paramCount;
+ ParamEntry* m_params;
+ sal_uInt16 m_excCount;
+ OString* m_excNames;
+ OString m_doku;
+
+ MethodEntry();
+ ~MethodEntry();
+
+ void setData(const OString& name,
+ const OString& returnTypeName,
+ RTMethodMode mode,
+ sal_uInt16 paramCount,
+ sal_uInt16 excCount,
+ const OString& doku);
+
+ void setExcName(sal_uInt16 excIndex, const OString& name);
+
+protected:
+
+ void reallocParams(sal_uInt16 size);
+ void reallocExcs(sal_uInt16 size);
+};
+
+MethodEntry::MethodEntry()
+ : m_mode(RT_MODE_INVALID)
+ , m_paramCount(0)
+ , m_params(NULL)
+ , m_excCount(0)
+ , m_excNames(NULL)
+{
+}
+
+MethodEntry::~MethodEntry()
+{
+ if (m_params)
+ delete[] m_params;
+
+ if (m_excNames)
+ delete[] m_excNames;
+}
+
+void MethodEntry::setData(const OString& name,
+ const OString& returnTypeName,
+ RTMethodMode mode,
+ sal_uInt16 paramCount,
+ sal_uInt16 excCount,
+ const OString& doku)
+{
+ m_name = name;
+ m_returnTypeName = returnTypeName;
+ m_doku = doku;
+
+ m_mode = mode;
+
+ reallocParams(paramCount);
+ reallocExcs(excCount);
+}
+
+void MethodEntry::setExcName(sal_uInt16 excIndex, const OString& name)
+{
+ if (excIndex < m_excCount)
+ {
+ m_excNames[excIndex] = name;
+ }
+}
+
+void MethodEntry::reallocParams(sal_uInt16 size)
+{
+ ParamEntry* newParams;
+
+ if (size)
+ newParams = new ParamEntry[size];
+ else
+ newParams = NULL;
+
+ if (m_paramCount)
+ {
+ sal_uInt16 i;
+
+ for (i = 0; i < VOS_MIN(size, m_paramCount); i++)
+ {
+ newParams[i].setData(m_params[i].m_typeName, m_params[i].m_name, m_params[i].m_mode);
+ }
+
+ delete[] m_params;
+ }
+
+ m_paramCount = size;
+ m_params = newParams;
+}
+
+void MethodEntry::reallocExcs(sal_uInt16 size)
+{
+ OString* newExcNames;
+
+ if (size)
+ newExcNames = new OString[size];
+ else
+ newExcNames = NULL;
+
+ sal_uInt16 i;
+
+ for (i = 0; i < VOS_MIN(size, m_excCount); i++)
+ {
+ newExcNames[i] = m_excNames[i];
+ }
+
+ delete[] m_excNames;
+
+ m_excCount = size;
+ m_excNames = newExcNames;
+}
+
+
+/**************************************************************************
+
+ class TypeRegistryEntry
+
+**************************************************************************/
+
+class TypeWriter
+{
+
+public:
+
+ sal_uInt32 m_refCount;
+ RTTypeClass m_typeClass;
+ OString m_typeName;
+ OString m_superTypeName;
+ RTUik* m_pUik;
+ OString m_doku;
+ OString m_fileName;
+ sal_uInt16 m_fieldCount;
+ FieldEntry* m_fields;
+ sal_uInt16 m_methodCount;
+ MethodEntry* m_methods;
+ sal_uInt16 m_referenceCount;
+ ReferenceEntry* m_references;
+
+ sal_uInt8* m_blop;
+ sal_uInt32 m_blopSize;
+
+ TypeWriter(RTTypeClass RTTypeClass,
+ const OString& typeName,
+ const OString& superTypeName,
+ sal_uInt16 FieldCount,
+ sal_uInt16 methodCount,
+ sal_uInt16 referenceCount);
+
+ ~TypeWriter();
+
+ void createBlop();
+};
+
+TypeWriter::TypeWriter(RTTypeClass RTTypeClass,
+ const OString& typeName,
+ const OString& superTypeName,
+ sal_uInt16 fieldCount,
+ sal_uInt16 methodCount,
+ sal_uInt16 referenceCount)
+ : m_refCount(1)
+ , m_typeClass(RTTypeClass)
+ , m_typeName(typeName)
+ , m_superTypeName(superTypeName)
+ , m_fieldCount(fieldCount)
+ , m_methodCount(methodCount)
+ , m_referenceCount(referenceCount)
+ , m_blop(NULL)
+ , m_blopSize(0)
+ , m_pUik(NULL)
+{
+ if (m_fieldCount)
+ m_fields = new FieldEntry[fieldCount];
+
+ if (m_methodCount)
+ m_methods = new MethodEntry[methodCount];
+
+ if (m_referenceCount)
+ m_references = new ReferenceEntry[referenceCount];
+}
+
+TypeWriter::~TypeWriter()
+{
+ if (m_blop)
+ delete[] m_blop;
+
+ if (m_fieldCount)
+ delete[] m_fields;
+
+ if (m_methodCount)
+ delete[] m_methods;
+
+ if (m_referenceCount)
+ delete[] m_references;
+
+ if (m_pUik)
+ delete m_pUik;
+}
+
+void TypeWriter::createBlop()
+{
+ sal_uInt8* pBlopFields = NULL;
+ sal_uInt8* pBlopMethods = NULL;
+ sal_uInt8* pBlopReferences = NULL;
+ sal_uInt8* pBuffer = NULL;
+ sal_uInt32 blopFieldsSize = 0;
+ sal_uInt32 blopMethodsSize = 0;
+ sal_uInt32 blopReferenceSize = 0;
+ sal_uInt16 i;
+
+ if (m_blop)
+ delete[] m_blop;
+
+ CPInfo root(CP_TAG_INVALID, NULL);
+ sal_uInt16 cpIndexThisName = 0;
+ sal_uInt16 cpIndexSuperName = 0;
+ sal_uInt16 cpIndexUik = 0;
+ sal_uInt16 cpIndexDoku = 0;
+ sal_uInt16 cpIndexFileName = 0;
+ CPInfo* pInfo = NULL;
+
+ m_blopSize = BLOP_HEADER_SIZE;
+
+ // create CP entry for this name
+ pInfo = new CPInfo(CP_TAG_UTF8_NAME, &root);
+ pInfo->m_value.aUtf8 = m_typeName.getStr();
+ cpIndexThisName = pInfo->m_index;
+
+ // create CP entry for super name
+ if (m_superTypeName.getLength())
+ {
+ pInfo = new CPInfo(CP_TAG_UTF8_NAME, pInfo);
+ pInfo->m_value.aUtf8 = m_superTypeName.getStr();
+ cpIndexSuperName = pInfo->m_index;
+ }
+
+ // create CP entry for uik
+ if (m_pUik != NULL)
+ {
+ pInfo = new CPInfo(CP_TAG_UIK, pInfo);
+ pInfo->m_value.aUik = m_pUik;
+ cpIndexUik = pInfo->m_index;
+ }
+
+ // create CP entry for doku
+ if (m_doku.getLength())
+ {
+ pInfo = new CPInfo(CP_TAG_UTF8_NAME, pInfo);
+ pInfo->m_value.aUtf8 = m_doku.getStr();
+ cpIndexDoku = pInfo->m_index;
+ }
+
+ // create CP entry for idl source filename
+ if (m_fileName.getLength())
+ {
+ pInfo = new CPInfo(CP_TAG_UTF8_NAME, pInfo);
+ pInfo->m_value.aUtf8 = m_fileName.getStr();
+ cpIndexFileName = pInfo->m_index;
+ }
+
+ // fields blop
+
+ m_blopSize += sizeof(sal_uInt16); // fieldCount
+
+ if (m_fieldCount)
+ {
+ sal_uInt16 cpIndexName = 0;
+ sal_uInt16 cpIndexTypeName = 0;
+ sal_uInt16 cpIndexValue = 0;
+ sal_uInt16 cpIndexDoku = 0;
+ sal_uInt16 cpIndexFileName = 0;
+
+ blopFieldsSize = m_fieldCount * BLOP_FIELD_ENTRY_SIZE;
+
+ m_blopSize += blopFieldsSize;
+
+ pBlopFields = new sal_uInt8[blopFieldsSize];
+ pBuffer = pBlopFields;
+
+ for (i = 0; i < m_fieldCount; i++)
+ {
+ cpIndexName = 0;
+ cpIndexTypeName = 0;
+ cpIndexValue = 0;
+ cpIndexDoku = 0;
+ cpIndexFileName = 0;
+
+ pBuffer += writeUINT16(pBuffer, m_fields[i].m_access);
+
+ if (m_fields[i].m_name.getLength())
+ {
+ pInfo = new CPInfo(CP_TAG_UTF8_NAME, pInfo);
+ pInfo->m_value.aUtf8 = m_fields[i].m_name.getStr();
+ cpIndexName = pInfo->m_index;
+ }
+ pBuffer += writeUINT16(pBuffer, cpIndexName);
+
+ if (m_fields[i].m_typeName.getLength())
+ {
+ pInfo = new CPInfo(CP_TAG_UTF8_NAME, pInfo);
+ pInfo->m_value.aUtf8 = m_fields[i].m_typeName.getStr();
+ cpIndexTypeName = pInfo->m_index;
+ }
+ pBuffer += writeUINT16(pBuffer, cpIndexTypeName);
+
+ if (m_fields[i].m_constValueType != RT_TYPE_NONE)
+ {
+ pInfo = new CPInfo((CPInfoTag)m_fields[i].m_constValueType, pInfo);
+ pInfo->m_value.aConst = m_fields[i].m_constValue;
+ cpIndexValue = pInfo->m_index;
+ }
+ pBuffer += writeUINT16(pBuffer, cpIndexValue);
+
+ if (m_fields[i].m_doku.getLength())
+ {
+ pInfo = new CPInfo(CP_TAG_UTF8_NAME, pInfo);
+ pInfo->m_value.aUtf8 = m_fields[i].m_doku.getStr();
+ cpIndexDoku = pInfo->m_index;
+ }
+ pBuffer += writeUINT16(pBuffer, cpIndexDoku);
+
+ if (m_fields[i].m_fileName.getLength())
+ {
+ pInfo = new CPInfo(CP_TAG_UTF8_NAME, pInfo);
+ pInfo->m_value.aUtf8 = m_fields[i].m_fileName.getStr();
+ cpIndexFileName = pInfo->m_index;
+ }
+ pBuffer += writeUINT16(pBuffer, cpIndexFileName);
+ }
+ }
+
+ // methods blop
+
+ m_blopSize += sizeof(sal_uInt16); // methodCount
+
+ if (m_methodCount)
+ {
+ sal_uInt16* pMethodEntrySize = new sal_uInt16[m_methodCount];
+ sal_uInt16 cpIndexName = 0;
+ sal_uInt16 cpIndexReturn = 0;
+ sal_uInt16 cpIndexDoku = 0;
+
+ blopMethodsSize = 0;
+
+ for (i = 0; i < m_methodCount; i++)
+ {
+ pMethodEntrySize[i] =
+ BLOP_METHOD_HEADER_SIZE + // header
+ sizeof(sal_uInt16) + // parameterCount
+ (m_methods[i].m_paramCount * BLOP_PARAM_ENTRY_SIZE) + // exceptions
+ sizeof(sal_uInt16) + // exceptionCount
+ (m_methods[i].m_excCount * sizeof(sal_uInt16)); // exceptions
+
+ blopMethodsSize += pMethodEntrySize[i];
+ }
+
+ pBlopMethods = new sal_uInt8[blopMethodsSize];
+
+ m_blopSize += blopMethodsSize;
+
+ pBuffer = pBlopMethods;
+
+ for (i = 0; i < m_methodCount; i++)
+ {
+ cpIndexReturn = 0;
+ cpIndexDoku = 0;
+
+ pBuffer += writeUINT16(pBuffer, pMethodEntrySize[i]);
+ pBuffer += writeUINT16(pBuffer, m_methods[i].m_mode);
+
+ if (m_methods[i].m_name.getLength())
+ {
+ pInfo = new CPInfo(CP_TAG_UTF8_NAME, pInfo);
+ pInfo->m_value.aUtf8 = m_methods[i].m_name.getStr();
+ cpIndexName = pInfo->m_index;
+ }
+ pBuffer += writeUINT16(pBuffer, cpIndexName);
+ cpIndexName = 0;
+
+ if (m_methods[i].m_returnTypeName.getLength())
+ {
+ pInfo = new CPInfo(CP_TAG_UTF8_NAME, pInfo);
+ pInfo->m_value.aUtf8 = m_methods[i].m_returnTypeName.getStr();
+ cpIndexReturn = pInfo->m_index;
+ }
+ pBuffer += writeUINT16(pBuffer, cpIndexReturn);
+
+ if (m_methods[i].m_doku.getLength())
+ {
+ pInfo = new CPInfo(CP_TAG_UTF8_NAME, pInfo);
+ pInfo->m_value.aUtf8 = m_methods[i].m_doku.getStr();
+ cpIndexDoku = pInfo->m_index;
+ }
+ pBuffer += writeUINT16(pBuffer, cpIndexDoku);
+
+ sal_uInt16 j;
+
+ pBuffer += writeUINT16(pBuffer, m_methods[i].m_paramCount);
+
+ for (j = 0; j < m_methods[i].m_paramCount; j++)
+ {
+ if (m_methods[i].m_params[j].m_typeName.getLength())
+ {
+ pInfo = new CPInfo(CP_TAG_UTF8_NAME, pInfo);
+ pInfo->m_value.aUtf8 = m_methods[i].m_params[j].m_typeName.getStr();
+ cpIndexName = pInfo->m_index;
+ }
+ pBuffer += writeUINT16(pBuffer, cpIndexName);
+ cpIndexName = 0;
+
+ pBuffer += writeUINT16(pBuffer, m_methods[i].m_params[j].m_mode);
+
+ if (m_methods[i].m_params[j].m_name.getLength())
+ {
+ pInfo = new CPInfo(CP_TAG_UTF8_NAME, pInfo);
+ pInfo->m_value.aUtf8 = m_methods[i].m_params[j].m_name.getStr();
+ cpIndexName = pInfo->m_index;
+ }
+ pBuffer += writeUINT16(pBuffer, cpIndexName);
+ cpIndexName = 0;
+ }
+
+ pBuffer += writeUINT16(pBuffer, m_methods[i].m_excCount);
+
+ for (j = 0; j < m_methods[i].m_excCount; j++)
+ {
+ if (m_methods[i].m_excNames[j].getLength())
+ {
+ pInfo = new CPInfo(CP_TAG_UTF8_NAME, pInfo);
+ pInfo->m_value.aUtf8 = m_methods[i].m_excNames[j].getStr();
+ cpIndexName = pInfo->m_index;
+ }
+ pBuffer += writeUINT16(pBuffer, cpIndexName);
+ cpIndexName = 0;
+ }
+ }
+
+ delete[] pMethodEntrySize;
+ }
+
+ // reference blop
+
+ m_blopSize += sizeof(sal_uInt16); // referenceCount
+
+ if (m_referenceCount)
+ {
+ sal_uInt16 cpIndexName = 0;
+ sal_uInt16 cpIndexDoku = 0;
+
+ blopReferenceSize = m_referenceCount * BLOP_REFERENCE_ENTRY_SIZE;
+
+ m_blopSize += blopReferenceSize;
+
+ pBlopReferences = new sal_uInt8[blopReferenceSize];
+ pBuffer = pBlopReferences;
+
+ for (i = 0; i < m_referenceCount; i++)
+ {
+ pBuffer += writeUINT16(pBuffer, m_references[i].m_type);
+
+ cpIndexName = 0;
+ cpIndexDoku = 0;
+
+ if (m_references[i].m_name.getLength())
+ {
+ pInfo = new CPInfo(CP_TAG_UTF8_NAME, pInfo);
+ pInfo->m_value.aUtf8 = m_references[i].m_name.getStr();
+ cpIndexName = pInfo->m_index;
+ }
+ pBuffer += writeUINT16(pBuffer, cpIndexName);
+
+ if (m_references[i].m_doku.getLength())
+ {
+ pInfo = new CPInfo(CP_TAG_UTF8_NAME, pInfo);
+ pInfo->m_value.aUtf8 = m_references[i].m_doku.getStr();
+ cpIndexDoku = pInfo->m_index;
+ }
+ pBuffer += writeUINT16(pBuffer, cpIndexDoku);
+
+ pBuffer += writeUINT16(pBuffer, m_references[i].m_access);
+ }
+ }
+
+
+ // CP infos blop-laenge holen
+ pInfo = root.m_next;
+ sal_uInt32 cpBlopSize = 0;
+ sal_uInt16 cpCount = 0;
+
+ while (pInfo)
+ {
+ cpBlopSize += pInfo->getBlopSize();
+ cpCount++;
+ pInfo = pInfo->m_next;
+ }
+
+ m_blopSize += cpBlopSize;
+ m_blopSize += sizeof(sal_uInt16); // constantPoolCount
+
+ // write all in flat buffer
+
+ m_blop = new sal_uInt8[m_blopSize];
+
+ pBuffer = m_blop;
+
+ pBuffer += writeUINT32(pBuffer, magic);
+ pBuffer += writeUINT32(pBuffer, m_blopSize);
+ pBuffer += writeUINT16(pBuffer, minorVersion);
+ pBuffer += writeUINT16(pBuffer, majorVersion);
+ pBuffer += writeUINT16(pBuffer, (sal_uInt16)m_typeClass);
+ pBuffer += writeUINT16(pBuffer, cpIndexThisName);
+ pBuffer += writeUINT16(pBuffer, cpIndexSuperName);
+ pBuffer += writeUINT16(pBuffer, cpIndexUik);
+ pBuffer += writeUINT16(pBuffer, cpIndexDoku);
+ pBuffer += writeUINT16(pBuffer, cpIndexFileName);
+ pBuffer += writeUINT16(pBuffer, cpCount);
+
+ // write and delete CP infos
+ pInfo = root.m_next;
+
+ while (pInfo)
+ {
+ CPInfo* pNextInfo = pInfo->m_next;
+
+ pBuffer += pInfo->toBlop(pBuffer, m_blopSize - (pBuffer - m_blop));
+ delete pInfo;
+
+ pInfo = pNextInfo;
+ }
+
+ // write fields
+ pBuffer += writeUINT16(pBuffer, m_fieldCount);
+ if (blopFieldsSize)
+ {
+ memcpy(pBuffer, pBlopFields, blopFieldsSize);
+ pBuffer += blopFieldsSize;
+ }
+
+ // write methods
+ pBuffer += writeUINT16(pBuffer, m_methodCount);
+ if (blopMethodsSize)
+ {
+ memcpy(pBuffer, pBlopMethods, blopMethodsSize);
+ pBuffer += blopMethodsSize;
+ }
+
+ // write references
+ pBuffer += writeUINT16(pBuffer, m_referenceCount);
+ if (blopReferenceSize)
+ {
+ memcpy(pBuffer, pBlopReferences, blopReferenceSize);
+ pBuffer += blopReferenceSize;
+ }
+
+ delete[] pBlopFields;
+ delete[] pBlopMethods;
+ delete[] pBlopReferences;
+}
+
+
+/**************************************************************************
+
+ C-API
+
+**************************************************************************/
+
+static TypeWriterImpl TYPEREG_CALLTYPE createEntry(RTTypeClass RTTypeClass,
+ rtl_uString* typeName,
+ rtl_uString* superTypeName,
+ sal_uInt16 FieldCount,
+ sal_uInt16 methodCount,
+ sal_uInt16 referenceCount)
+{
+ OString rTypeName, rSuperTypeName;
+
+ rtl_uString2String( &rTypeName.pData, typeName->buffer, typeName->length, RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+ rtl_uString2String( &rSuperTypeName.pData, superTypeName->buffer, superTypeName->length, RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+
+ return new TypeWriter(RTTypeClass,
+ rTypeName,
+ rSuperTypeName,
+ FieldCount,
+ methodCount,
+ referenceCount);
+}
+
+static void TYPEREG_CALLTYPE acquire(TypeWriterImpl hEntry)
+{
+ TypeWriter* pEntry = (TypeWriter*) hEntry;
+
+ if (pEntry != NULL)
+ pEntry->m_refCount++;
+}
+
+static void TYPEREG_CALLTYPE release(TypeWriterImpl hEntry)
+{
+ TypeWriter* pEntry = (TypeWriter*) hEntry;
+
+ if (pEntry != NULL)
+ {
+ if (--pEntry->m_refCount == 0)
+ delete pEntry;
+ }
+}
+
+static void TYPEREG_CALLTYPE setUik(TypeWriterImpl hEntry, const RTUik* uik)
+{
+ TypeWriter* pEntry = (TypeWriter*) hEntry;
+
+ if (pEntry != NULL)
+ {
+ if (pEntry->m_pUik)
+ {
+ pEntry->m_pUik->m_Data1 = uik->m_Data1;
+ pEntry->m_pUik->m_Data2 = uik->m_Data2;
+ pEntry->m_pUik->m_Data3 = uik->m_Data3;
+ pEntry->m_pUik->m_Data4 = uik->m_Data4;
+ pEntry->m_pUik->m_Data5 = uik->m_Data5;
+ }
+ else
+ pEntry->m_pUik = new RTUik(*uik);
+ }
+}
+
+static void TYPEREG_CALLTYPE setDoku(TypeWriterImpl hEntry, rtl_uString* doku)
+{
+ TypeWriter* pEntry = (TypeWriter*) hEntry;
+
+ if (pEntry != NULL)
+ {
+ if (doku)
+ {
+ OString rDoku;
+ rtl_uString2String( &rDoku.pData, doku->buffer, doku->length, RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+ pEntry->m_doku = rDoku;
+ } else
+ {
+ pEntry->m_doku = NULL_STRING;
+ }
+ }
+}
+
+static void TYPEREG_CALLTYPE setFileName(TypeWriterImpl hEntry, rtl_uString* fileName)
+{
+ TypeWriter* pEntry = (TypeWriter*) hEntry;
+
+ if (pEntry != NULL)
+ {
+ if (fileName)
+ {
+ OString rFileName;
+ rtl_uString2String( &rFileName.pData, fileName->buffer, fileName->length, RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+ pEntry->m_fileName = rFileName;
+ } else
+ {
+ pEntry->m_fileName = NULL_STRING;
+ }
+ }
+}
+
+static void TYPEREG_CALLTYPE setFieldData(TypeWriterImpl hEntry,
+ sal_uInt16 index,
+ rtl_uString* name,
+ rtl_uString* typeName,
+ rtl_uString* doku,
+ rtl_uString* fileName,
+ RTFieldAccess access,
+ RTValueType valueType,
+ RTConstValueUnion constValue)
+{
+ TypeWriter* pEntry = (TypeWriter*) hEntry;
+
+ if ((pEntry != NULL) && (index < pEntry->m_fieldCount))
+ {
+ OString rName, rTypeName, rDoku, rFileName;
+ rtl_uString2String( &rName.pData, name->buffer, name->length, RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+ rtl_uString2String( &rTypeName.pData, typeName->buffer, typeName->length, RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+ rtl_uString2String( &rDoku.pData, doku->buffer, doku->length, RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+ rtl_uString2String( &rFileName.pData, fileName->buffer, fileName->length, RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+
+ pEntry->m_fields[index].setData(rName, rTypeName, rDoku, rFileName, access, valueType, constValue);
+ }
+}
+
+static void TYPEREG_CALLTYPE setMethodData(TypeWriterImpl hEntry,
+ sal_uInt16 index,
+ rtl_uString* name,
+ rtl_uString* returnTypeName,
+ RTMethodMode mode,
+ sal_uInt16 paramCount,
+ sal_uInt16 excCount,
+ rtl_uString* doku)
+{
+ TypeWriter* pEntry = (TypeWriter*) hEntry;
+
+ if ((pEntry != NULL) && (index < pEntry->m_methodCount))
+ {
+ OString rName, rReturnTypeName, rDoku;
+ rtl_uString2String( &rName.pData, name->buffer, name->length, RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+ rtl_uString2String( &rReturnTypeName.pData, returnTypeName->buffer, returnTypeName->length, RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+ rtl_uString2String( &rDoku.pData, doku->buffer, doku->length, RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+
+ pEntry->m_methods[index].setData(rName, rReturnTypeName, mode, paramCount, excCount, rDoku);
+ }
+}
+
+static void TYPEREG_CALLTYPE setParamData(TypeWriterImpl hEntry,
+ sal_uInt16 index,
+ sal_uInt16 paramIndex,
+ rtl_uString* type,
+ rtl_uString* name,
+ RTParamMode mode)
+{
+ TypeWriter* pEntry = (TypeWriter*) hEntry;
+
+ if ((pEntry != NULL) &&
+ (index < pEntry->m_methodCount) &&
+ (paramIndex < pEntry->m_methods[index].m_paramCount))
+ {
+ OString rName, rType;
+ rtl_uString2String( &rName.pData, name->buffer, name->length, RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+ rtl_uString2String( &rType.pData, type->buffer, type->length, RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+
+ pEntry->m_methods[index].m_params[paramIndex].setData(rType, rName, mode);
+ }
+}
+
+static void TYPEREG_CALLTYPE setExcData(TypeWriterImpl hEntry,
+ sal_uInt16 index,
+ sal_uInt16 excIndex,
+ rtl_uString* type)
+{
+ TypeWriter* pEntry = (TypeWriter*) hEntry;
+
+ if ((pEntry != NULL) && (index < pEntry->m_methodCount))
+ {
+ OString rType;
+ rtl_uString2String( &rType.pData, type->buffer, type->length, RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+
+ pEntry->m_methods[index].setExcName(excIndex, rType);
+ }
+}
+
+static const sal_uInt8* TYPEREG_CALLTYPE getBlop(TypeWriterImpl hEntry)
+{
+ const sal_uInt8* blop = NULL;
+
+ TypeWriter* pEntry = (TypeWriter*) hEntry;
+
+ if (pEntry != NULL)
+ {
+ if (!pEntry->m_blop)
+ pEntry->createBlop();
+
+ blop = pEntry->m_blop;
+ }
+
+ return blop;
+}
+
+static sal_uInt32 TYPEREG_CALLTYPE getBlopSize(TypeWriterImpl hEntry)
+{
+ sal_uInt32 aSize = 0;
+
+ TypeWriter* pEntry = (TypeWriter*) hEntry;
+
+ if (pEntry != NULL)
+ {
+ if (!pEntry->m_blop)
+ pEntry->createBlop();
+
+ aSize = pEntry->m_blopSize;
+ }
+
+ return aSize;
+}
+
+static void TYPEREG_CALLTYPE setReferenceData(TypeWriterImpl hEntry,
+ sal_uInt16 index,
+ rtl_uString* name,
+ RTReferenceType refType,
+ rtl_uString* doku,
+ RTFieldAccess access)
+{
+ TypeWriter* pEntry = (TypeWriter*) hEntry;
+
+ if ((pEntry != NULL) && (index < pEntry->m_referenceCount))
+ {
+ OString rName, rDoku;
+ rtl_uString2String( &rName.pData, name->buffer, name->length, RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+ rtl_uString2String( &rDoku.pData, doku->buffer, doku->length, RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
+
+ pEntry->m_references[index].setData(rName,
+ refType,
+ rDoku,
+ access);
+ }
+}
+
+
+extern "C" RegistryTypeWriter_Api* TYPEREG_CALLTYPE initRegistryTypeWriter_Api(void)
+{
+ static RegistryTypeWriter_Api aApi= {0,0,0,0,0,0,0,0,0,0,0,0,0};
+ if (!aApi.acquire)
+ {
+ aApi.createEntry = &createEntry;
+ aApi.acquire = &acquire;
+ aApi.release = &release;
+ aApi.setUik = &setUik;
+ aApi.setDoku = &setDoku;
+ aApi.setFileName = &setFileName;
+ aApi.setFieldData = &setFieldData;
+ aApi.setMethodData = &setMethodData;
+ aApi.setParamData = &setParamData;
+ aApi.setExcData = &setExcData;
+ aApi.getBlop = &getBlop;
+ aApi.getBlopSize = &getBlopSize;
+ aApi.setReferenceData = &setReferenceData;
+
+ return (&aApi);
+ }
+ else
+ {
+ return (&aApi);
+ }
+}
+
+
+
+
+
diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx
new file mode 100644
index 000000000000..af8c3809c51a
--- /dev/null
+++ b/registry/source/regimpl.cxx
@@ -0,0 +1,2172 @@
+/*************************************************************************
+ *
+ * $RCSfile: regimpl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+#include <stdio.h>
+#ifdef MAC
+#include <unistd.h>
+#define strdup(str) strcpy((sal_Char*)malloc(strlen(str)+1),str)
+#endif
+#ifdef UNX
+#include <unistd.h>
+#endif
+
+#include "regimpl.hxx"
+
+#ifndef __REGISTRY_REFLREAD_HXX__
+#include <registry/reflread.hxx>
+#endif
+
+#ifndef __REGISTRY_REFLWRIT_HXX__
+#include <registry/reflwrit.hxx>
+#endif
+
+#ifndef __REFLCNST_HXX__
+#include "reflcnst.hxx"
+#endif
+
+#ifndef _KEYIMPL_HXX_
+#include "keyimpl.hxx"
+#endif
+
+#ifndef _RTL_ALLOC_H_
+#include <rtl/alloc.h>
+#endif
+
+#ifndef _RTL_MEMORY_H_
+#include <rtl/memory.h>
+#endif
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#if defined ( GCC ) && ( defined ( SCO ) || defined ( NETBSD ) || defined ( OS2 ) )
+NAMESPACE_VOS(ORealDynamicLoader)* NAMESPACE_VOS(ODynamicLoader)<RegistryTypeReader_Api>::m_pLoader = NULL;
+#endif
+
+
+extern "C" RegistryTypeReader_Api* TYPEREG_CALLTYPE initRegistryTypeReader_Api();
+extern "C" RegistryTypeWriter_Api* TYPEREG_CALLTYPE initRegistryTypeWriter_Api();
+
+
+//*********************************************************************
+// dumpType()
+//
+static sal_Bool dumpType(RegistryTypeReader& reader, const OString& sIndent)
+{
+ sal_uInt16 i, j;
+ sal_Bool ret = sal_True;
+ const sal_Char* indent = sIndent;
+
+ if (reader.isValid())
+ {
+ fprintf(stdout, "minor version: %d\n", reader.getMinorVersion());
+ fprintf(stdout, "%smajor version: %d\n", indent, reader.getMajorVersion());
+ fprintf(stdout, "%s" ,indent);
+ switch (reader.getTypeClass())
+ {
+ case RT_TYPE_INVALID:
+ fprintf(stdout, "type: 'invalid'\n");
+ break;
+ case RT_TYPE_INTERFACE:
+ {
+ fprintf(stdout, "type: 'interface'\n");
+ RTUik uik;
+
+ reader.getUik(uik);
+
+ fprintf(stdout, "%suik: { 0x%.8x-0x%.4x-0x%.4x-0x%.8x-0x%.8x }\n",
+ indent, uik.m_Data1, uik.m_Data2, uik.m_Data3, uik.m_Data4, uik.m_Data5);
+ }
+ break;
+ case RT_TYPE_MODULE:
+ fprintf(stdout, "type: 'module'\n");
+ break;
+ case RT_TYPE_STRUCT:
+ fprintf(stdout, "type: 'struct'\n");
+ break;
+ case RT_TYPE_ENUM:
+ fprintf(stdout, "type: 'enum'\n");
+ break;
+ case RT_TYPE_EXCEPTION:
+ fprintf(stdout, "type: 'exception'\n");
+ break;
+ case RT_TYPE_TYPEDEF:
+ fprintf(stdout, "type: 'typedef'\n");
+ break;
+ case RT_TYPE_SERVICE:
+ fprintf(stdout, "type: 'service'\n");
+ break;
+ case RT_TYPE_CONSTANTS:
+ fprintf(stdout, "type: 'constants'\n");
+ break;
+ default:
+ fprintf(stdout, "type: <unknown>\n");
+ break;
+ }
+
+ fprintf(stdout, "%sname: '%s'\n", indent, OUStringToOString(reader.getTypeName(), RTL_TEXTENCODING_UTF8).getStr());
+ fprintf(stdout, "%ssuper name: '%s'\n", indent, OUStringToOString(reader.getSuperTypeName(), RTL_TEXTENCODING_UTF8).getStr());
+ fprintf(stdout, "%sDoku: \"%s\"\n", indent, OUStringToOString(reader.getDoku(), RTL_TEXTENCODING_UTF8).getStr());
+ fprintf(stdout, "%sIDL source file: \"%s\"\n", indent, OUStringToOString(reader.getFileName(), RTL_TEXTENCODING_UTF8).getStr());
+ fprintf(stdout, "%snumber of fields: %d\n", indent, reader.getFieldCount());
+ sal_uInt16 fieldAccess = RT_ACCESS_INVALID;
+ for (i = 0; i < reader.getFieldCount(); i++)
+ {
+ fprintf(stdout, "%sfield #%d:\n%s name='%s'\n%s type='%s'\n", indent,
+ i, indent, OUStringToOString(reader.getFieldName(i), RTL_TEXTENCODING_UTF8).getStr(),
+ indent, OUStringToOString(reader.getFieldType(i), RTL_TEXTENCODING_UTF8).getStr());
+
+ fieldAccess = reader.getFieldAccess(i);
+ if ( fieldAccess == RT_ACCESS_INVALID )
+ {
+ fprintf(stdout, "%s access=INVALID\n", indent);
+ }
+ if ( (fieldAccess & RT_ACCESS_CONST) == RT_ACCESS_CONST )
+ {
+ fprintf(stdout, "%s access=CONST\n", indent);
+ RTConstValue constVal = reader.getFieldConstValue(i);
+
+ fprintf(stdout, "%s value = ", indent);
+
+ switch (constVal.m_type)
+ {
+ case RT_TYPE_BOOL:
+ if (constVal.m_value.aBool)
+ fprintf(stdout, "TRUE");
+ else
+ fprintf(stdout, "FALSE");
+ break;
+ case RT_TYPE_BYTE:
+ fprintf(stdout, "%d", (int)constVal.m_value.aByte);
+ break;
+ case RT_TYPE_INT16:
+ fprintf(stdout, "%d", constVal.m_value.aShort);
+ break;
+ case RT_TYPE_UINT16:
+ fprintf(stdout, "%u", constVal.m_value.aUShort);
+ break;
+ case RT_TYPE_INT32:
+ fprintf(stdout, "%d", constVal.m_value.aLong);
+ break;
+ case RT_TYPE_UINT32:
+ fprintf(stdout, "%u", constVal.m_value.aULong);
+ break;
+ case RT_TYPE_FLOAT:
+ fprintf(stdout, "%f", constVal.m_value.aFloat);
+ break;
+ case RT_TYPE_DOUBLE:
+ fprintf(stdout, "%f", constVal.m_value.aDouble);
+ break;
+ case RT_TYPE_STRING:
+ fprintf(stdout, "%s", OUStringToOString(constVal.m_value.aString, RTL_TEXTENCODING_UTF8).getStr());
+ break;
+ default:
+ break;
+ }
+ }
+ if ( (fieldAccess & RT_ACCESS_READONLY) == RT_ACCESS_READONLY )
+ {
+ fprintf(stdout, "%s access=READONLY\n", indent);
+ }
+ if ( (fieldAccess & RT_ACCESS_READWRITE) == RT_ACCESS_READWRITE )
+ {
+ fprintf(stdout, "%s access=READWRITE\n", indent);
+ }
+ if ( (fieldAccess & RT_ACCESS_OPTIONAL) == RT_ACCESS_OPTIONAL )
+ {
+ fprintf(stdout, "%s access=OPTIONAL\n", indent);
+ }
+ if ( (fieldAccess & RT_ACCESS_MAYBEVOID) == RT_ACCESS_MAYBEVOID )
+ {
+ fprintf(stdout, "%s access=MAYBEVOID\n", indent);
+ }
+ if ( (fieldAccess & RT_ACCESS_BOUND) == RT_ACCESS_BOUND )
+ {
+ fprintf(stdout, "%s access=BOUND\n", indent);
+ }
+ if ( (fieldAccess & RT_ACCESS_CONSTRAINED) == RT_ACCESS_CONSTRAINED )
+ {
+ fprintf(stdout, "%s access=CONSTRAINED\n", indent);
+ }
+ if ( (fieldAccess & RT_ACCESS_TRANSIENT) == RT_ACCESS_TRANSIENT )
+ {
+ fprintf(stdout, "%s access=TRANSIENT\n", indent);
+ }
+ if ( (fieldAccess & RT_ACCESS_MAYBEAMBIGUOUS) == RT_ACCESS_MAYBEAMBIGUOUS )
+ {
+ fprintf(stdout, "%s access=MAYBEAMBIGUOUS\n", indent);
+ }
+ if ( (fieldAccess & RT_ACCESS_MAYBEDEFAULT) == RT_ACCESS_MAYBEDEFAULT )
+ {
+ fprintf(stdout, "%s access=MAYBEDEFAULT\n", indent);
+ }
+ if ( (fieldAccess & RT_ACCESS_REMOVEABLE) == RT_ACCESS_REMOVEABLE )
+ {
+ fprintf(stdout, "%s access=REMOVEABLE\n", indent);
+ }
+
+/*
+ switch (reader.getFieldAccess(i))
+ {
+ case RT_ACCESS_INVALID:
+ fprintf(stdout, "%s access=INVALID\n", indent);
+ break;
+ case RT_ACCESS_CONST:
+ {
+ fprintf(stdout, "%s access=CONST\n", indent);
+ RTConstValue constVal = reader.getFieldConstValue(i);
+
+ fprintf(stdout, "%s value = ", indent);
+
+ switch (constVal.m_type)
+ {
+ case RT_TYPE_BOOL:
+ if (constVal.m_value.aBool)
+ fprintf(stdout, "TRUE");
+ else
+ fprintf(stdout, "FALSE");
+ break;
+ case RT_TYPE_BYTE:
+ fprintf(stdout, "%d", (int)constVal.m_value.aByte);
+ break;
+ case RT_TYPE_INT16:
+ fprintf(stdout, "%d", constVal.m_value.aShort);
+ break;
+ case RT_TYPE_UINT16:
+ fprintf(stdout, "%u", constVal.m_value.aUShort);
+ break;
+ case RT_TYPE_INT32:
+ fprintf(stdout, "%d", constVal.m_value.aLong);
+ break;
+ case RT_TYPE_UINT32:
+ fprintf(stdout, "%u", constVal.m_value.aULong);
+ break;
+ case RT_TYPE_FLOAT:
+ fprintf(stdout, "%f", constVal.m_value.aFloat);
+ break;
+ case RT_TYPE_DOUBLE:
+ fprintf(stdout, "%f", constVal.m_value.aDouble);
+ break;
+ case RT_TYPE_STRING:
+ fprintf(stdout, "%s", OUStringToOString(constVal.m_value.aString, RTL_TEXTENCODING_UTF8).getStr());
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ case RT_ACCESS_READONLY:
+ fprintf(stdout, "%s access=READONLY ", indent);
+ break;
+ case RT_ACCESS_WRITEONLY:
+ fprintf(stdout, "%s access=WRITEONLY ", indent);
+ break;
+ case RT_ACCESS_READWRITE:
+ fprintf(stdout, "%s access=READWRITE ", indent);
+ break;
+ case RT_ACCESS_READONLY_OPTIONAL:
+ fprintf(stdout, "%s access=READONLY, OPTIONAL ", indent);
+ break;
+ case RT_ACCESS_WRITEONLY_OPTIONAL:
+ fprintf(stdout, "%s access=WRITEONLY, OPTIONAL ", indent);
+ break;
+ case RT_ACCESS_READWRITE_OPTIONAL:
+ fprintf(stdout, "%s access=READWRITE, OPTIONAL ", indent);
+ break;
+ default:
+ fprintf(stdout, "%s access=<unknown> ", indent);
+ break;
+ }
+*/
+ fprintf(stdout, "\n%s Doku: \"%s\"", indent, OUStringToOString(reader.getFieldDoku(i), RTL_TEXTENCODING_UTF8).getStr());
+ fprintf(stdout, "\n%s IDL source file: \"%s\"\n", indent, OUStringToOString(reader.getFieldFileName(i), RTL_TEXTENCODING_UTF8).getStr());
+ }
+
+ fprintf(stdout, "%snumber of methods: %d\n", indent, reader.getMethodCount());
+ for (i = 0; i < reader.getMethodCount(); i++)
+ {
+ fprintf(stdout, "%smethod #%d: ", indent, i);
+
+ switch (reader.getMethodMode(i))
+ {
+ case RT_MODE_INVALID:
+ fprintf(stdout, "<invalid mode> ");
+ break;
+ case RT_MODE_ONEWAY:
+ fprintf(stdout, "[oneway] ");
+ break;
+ case RT_MODE_ONEWAY_CONST:
+ fprintf(stdout, "[oneway, const] ");
+ break;
+ case RT_MODE_TWOWAY:
+ break;
+ case RT_MODE_TWOWAY_CONST:
+ fprintf(stdout, "[const] ");
+ break;
+ default:
+ fprintf(stdout, "<unknown mode> ");
+ break;
+ }
+
+ fprintf(stdout, "%s %s(",
+ OUStringToOString(reader.getMethodReturnType(i), RTL_TEXTENCODING_UTF8).getStr(),
+ OUStringToOString(reader.getMethodName(i), RTL_TEXTENCODING_UTF8).getStr());
+
+ for (j = 0; j < reader.getMethodParamCount(i); j++)
+ {
+ switch (reader.getMethodParamMode(i, j))
+ {
+ case RT_PARAM_INVALID:
+ fprintf(stdout, "<invalid mode> ");
+ break;
+ case RT_PARAM_IN:
+ fprintf(stdout, "[in] ");
+ break;
+ case RT_PARAM_OUT:
+ fprintf(stdout, "[out] ");
+ break;
+ case RT_PARAM_INOUT:
+ fprintf(stdout, "[inout] ");
+ break;
+ default:
+ fprintf(stdout, "<unknown mode> ");
+ break;
+ }
+
+ fprintf(stdout, "%s %s",
+ OUStringToOString(reader.getMethodParamType(i, j), RTL_TEXTENCODING_UTF8).getStr(),
+ OUStringToOString(reader.getMethodParamName(i, j), RTL_TEXTENCODING_UTF8).getStr());
+
+ if (j != reader.getMethodParamCount(i) - 1)
+ fprintf(stdout, ", ");
+ }
+
+ fprintf(stdout, ") ");
+
+ if (reader.getMethodExcCount(i))
+ {
+ fprintf(stdout, "raises ");
+ for (j = 0; j < reader.getMethodExcCount(i); j++)
+ {
+ fprintf(stdout, "%s",
+ OUStringToOString(reader.getMethodExcType(i, j), RTL_TEXTENCODING_UTF8).getStr());
+ if (j != reader.getMethodExcCount(i) - 1)
+ fprintf(stdout, ", ");
+ }
+ }
+
+ fprintf(stdout, "\n%s Doku: \"%s\"\n", indent,
+ OUStringToOString(reader.getMethodDoku(i), RTL_TEXTENCODING_UTF8).getStr());
+ }
+
+ fprintf(stdout, "%snumber of references: %d\n", indent, reader.getReferenceCount());
+ for (i = 0; i < reader.getReferenceCount(); i++)
+ {
+ fprintf(stdout, "%sreference #%d:\n%s name='%s'\n", indent, i, indent,
+ OUStringToOString(reader.getReferenceName(i), RTL_TEXTENCODING_UTF8).getStr());
+ switch (reader.getReferenceType(i))
+ {
+ case RT_REF_INVALID:
+ fprintf(stdout, "%s type=INVALID\n", indent);
+ break;
+ case RT_REF_SUPPORTS:
+ {
+ fprintf(stdout, "%s type=supported interface\n", indent);
+ if (reader.getReferenceAccess(i) == RT_ACCESS_OPTIONAL)
+ {
+ fprintf(stdout, "%s access=optional\n", indent);
+ }
+ }
+ break;
+ case RT_REF_OBSERVES:
+ fprintf(stdout, "%s type=observed interface\n", indent);
+ break;
+ case RT_REF_EXPORTS:
+ fprintf(stdout, "%s type=exported service\n", indent);
+ break;
+ case RT_REF_NEEDS:
+ fprintf(stdout, "%s type=needed service\n", indent);
+ break;
+ default:
+ fprintf(stdout, "%s type=<unknown>\n", indent);
+ break;
+ }
+
+ fprintf(stdout, "%s Doku: \"%s\"\n", indent,
+ OUStringToOString(reader.getReferenceDoku(i), RTL_TEXTENCODING_UTF8).getStr());
+ }
+ }
+ else
+ {
+ ret = sal_False;
+ }
+
+ return ret;
+}
+
+
+//*********************************************************************
+// ORegistry()
+//
+ORegistry::ORegistry()
+ : m_refCount(1)
+ , m_readOnly(sal_False)
+ , m_isOpen(sal_False)
+ , ROOT( RTL_CONSTASCII_USTRINGPARAM("/") )
+{
+}
+
+//*********************************************************************
+// ~ORegistry()
+//
+ORegistry::~ORegistry()
+{
+ if (m_openKeyTable.count(ROOT) > 0)
+ {
+ m_openKeyTable[ROOT]->release();
+ delete(m_openKeyTable[ROOT]);
+ }
+
+ if (m_file.isValid())
+ m_file.close();
+}
+
+
+//*********************************************************************
+// initRegistry
+//
+RegError ORegistry::initRegistry(const OUString& regName, RegAccessMode accessMode)
+{
+ OStoreFile rRegFile;
+ storeAccessMode sAccessMode = REG_MODE_OPEN;
+ storeError errCode;
+
+ if (accessMode & REG_CREATE)
+ {
+ sAccessMode = REG_MODE_CREATE;
+ } else
+ if (accessMode & REG_READONLY)
+ {
+ sAccessMode = REG_MODE_OPENREAD;
+ m_readOnly = sal_True;
+ }
+
+ if (errCode = rRegFile.create(regName, sAccessMode, REG_PAGESIZE))
+ {
+ switch (errCode)
+ {
+ case store_E_NotExists:
+ return REG_REGISTRY_NOT_EXISTS;
+ break;
+ case store_E_LockingViolation:
+ return REG_CANNOT_OPEN_FOR_READWRITE;
+ break;
+ default:
+ return REG_INVALID_REGISTRY;
+ break;
+ }
+ } else
+ {
+ OStoreDirectory rStoreDir;
+ storeError _err = rStoreDir.create(rRegFile, OUString(), OUString(), sAccessMode);
+
+ if ( _err == store_E_None )
+ {
+ m_file = rRegFile;
+ m_name = regName;
+ m_isOpen = sal_True;
+
+
+ m_openKeyTable[ROOT] = new ORegKey(ROOT, rStoreDir, this);
+ return REG_NO_ERROR;
+ } else
+ return REG_INVALID_REGISTRY;
+ }
+}
+
+
+//*********************************************************************
+// closeRegistry
+//
+RegError ORegistry::closeRegistry()
+{
+ REG_GUARD(m_mutex);
+
+ if (m_file.isValid())
+ {
+ closeKey(m_openKeyTable[ROOT]);
+ m_file.close();
+ m_isOpen = sal_False;
+ return REG_NO_ERROR;
+ } else
+ {
+ return REG_REGISTRY_NOT_EXISTS;
+ }
+}
+
+
+//*********************************************************************
+// destroyRegistry
+//
+RegError ORegistry::destroyRegistry(const OUString& regName)
+{
+ REG_GUARD(m_mutex);
+
+ if (regName.getLength())
+ {
+ ORegistry* pReg = new ORegistry();
+
+ if (!pReg->initRegistry(regName, REG_READWRITE))
+ {
+ delete pReg;
+
+ OString name( OUStringToOString(regName, RTL_TEXTENCODING_UTF8) );
+ if (unlink(name) != 0)
+ {
+ return REG_DESTROY_REGISTRY_FAILED;
+ }
+ } else
+ {
+ return REG_DESTROY_REGISTRY_FAILED;
+ }
+ } else
+ {
+ if (m_refCount != 1 || isReadOnly())
+ {
+ return REG_DESTROY_REGISTRY_FAILED;
+ }
+
+ if (m_file.isValid())
+ {
+ closeKey(m_openKeyTable[ROOT]);
+ m_file.close();
+ m_isOpen = sal_False;
+
+ OString name( OUStringToOString(m_name, RTL_TEXTENCODING_UTF8) );
+ if (unlink(name) != 0)
+ {
+ return REG_DESTROY_REGISTRY_FAILED;
+ }
+ } else
+ {
+ return REG_REGISTRY_NOT_EXISTS;
+ }
+ }
+
+ return REG_NO_ERROR;
+}
+
+//*********************************************************************
+// createKey
+//
+RegError ORegistry::createKey(RegKeyHandle hKey, const OUString& keyName,
+ RegKeyHandle* phNewKey)
+{
+ ORegKey* pKey;
+
+ *phNewKey = NULL;
+
+ if ( !keyName.getLength() )
+ return REG_INVALID_KEYNAME;
+
+ REG_GUARD(m_mutex);
+
+ if (hKey)
+ pKey = (ORegKey*)hKey;
+ else
+ pKey = m_openKeyTable[ROOT];
+
+ OUString sFullKeyName = resolveLinks(pKey, keyName);
+
+ if ( !sFullKeyName.getLength() )
+ return REG_DETECT_RECURSION;
+
+ if (m_openKeyTable.count(sFullKeyName) > 0)
+ {
+ *phNewKey = m_openKeyTable[sFullKeyName];
+ ((ORegKey*)*phNewKey)->acquire();
+ ((ORegKey*)*phNewKey)->setDeleted(sal_False);
+ return REG_NO_ERROR;
+ }
+
+ OStoreDirectory rStoreDir;
+ OUStringBuffer sFullPath(sFullKeyName.getLength());
+ sal_Int32 tokenCount = sFullKeyName.getTokenCount('/');
+ OUString token;
+
+ sFullPath.append((sal_Unicode)'/');
+
+ for (sal_Int32 i=0; i < tokenCount; i++)
+ {
+ token = sFullKeyName.getToken(i, '/');
+ if (token.getLength())
+ {
+ if (rStoreDir.create(pKey->getStoreFile(), sFullPath.getStr(), token, KEY_MODE_CREATE))
+ {
+ return REG_CREATE_KEY_FAILED;
+ }
+
+ sFullPath.append(token);
+ sFullPath.append((sal_Unicode)'/');
+ }
+ }
+
+ pKey = new ORegKey(sFullKeyName, rStoreDir, this);
+ *phNewKey = pKey;
+ m_openKeyTable[sFullKeyName] = pKey;
+
+ return REG_NO_ERROR;
+}
+
+
+//*********************************************************************
+// openKey
+//
+RegError ORegistry::openKey(RegKeyHandle hKey, const OUString& keyName,
+ RegKeyHandle* phOpenKey, RESOLVE eResolve)
+{
+ ORegKey* pKey;
+ storeAccessMode accessMode = KEY_MODE_OPEN;
+
+ *phOpenKey = NULL;
+
+ if ( !keyName.getLength() )
+ {
+ return REG_INVALID_KEYNAME;
+ }
+
+ if ( isReadOnly() )
+ {
+ accessMode = KEY_MODE_OPENREAD;
+ }
+
+ REG_GUARD(m_mutex);
+
+ if (hKey)
+ pKey = (ORegKey*)hKey;
+ else
+ pKey = m_openKeyTable[ROOT];
+
+ OUString sFullKeyName;
+ OUString sFullPath;
+ OUString sRelativKey;
+
+ switch (eResolve)
+ {
+ case RESOLVE_FULL:
+ {
+ sFullKeyName = resolveLinks(pKey, keyName);
+
+ if ( !sFullKeyName.getLength() )
+ return REG_DETECT_RECURSION;
+
+ sal_Int32 lastIndex = sFullKeyName.lastIndexOf('/');
+ sRelativKey = sFullKeyName.copy(lastIndex + 1);
+ sFullPath = sFullKeyName.copy(0, lastIndex + 1);
+ }
+ break;
+ case RESOLVE_PART:
+ {
+ sal_Int32 lastIndex = keyName.lastIndexOf('/');
+ if ( lastIndex >= 0 )
+ {
+ OUString sRelativ(keyName.copy(lastIndex));
+ OUString tmpKey(keyName.copy(0, lastIndex + 1));
+ sFullKeyName = resolveLinks(pKey, tmpKey);
+
+ sFullPath = sFullKeyName;
+ sFullPath += ROOT;
+ sFullKeyName += sRelativ;
+ sRelativKey = sRelativ.copy(1);
+ } else
+ {
+ sFullKeyName = pKey->getName();
+ sFullPath = sFullKeyName;
+
+ sRelativKey = keyName;
+
+ if ( sFullKeyName.getLength() > 1 )
+ sFullKeyName += ROOT;
+
+ sFullKeyName += keyName;
+
+ if ( sFullPath.getLength() > 1 )
+ sFullPath += ROOT;
+ }
+ }
+ break;
+ case RESOLVE_NOTHING:
+ {
+ sFullKeyName = pKey->getName();
+ sFullPath = sFullKeyName;
+
+ if (sFullKeyName.getLength() > 1)
+ sFullKeyName += ROOT;
+
+ sal_Int32 lastIndex = keyName.lastIndexOf('/');
+ if ( lastIndex >= 0 && lastIndex < keyName.getLength() )
+ {
+ OUString sRelativ(keyName.copy(lastIndex+1));
+ sRelativKey = sRelativ;
+ sFullKeyName += keyName.copy(1);
+
+ sFullPath = sFullKeyName.copy(0, keyName.lastIndexOf('/') + 1);
+ } else
+ {
+
+ sRelativKey += keyName;
+ sFullKeyName += keyName;
+
+ if ( sFullPath.getLength() > 1 )
+ sFullPath += ROOT;
+ }
+ }
+ break;
+ }
+
+ if (m_openKeyTable.count(sFullKeyName) > 0)
+ {
+ m_openKeyTable[sFullKeyName]->acquire();
+ *phOpenKey = m_openKeyTable[sFullKeyName];
+ return REG_NO_ERROR;
+ }
+
+ OStoreDirectory rStoreDir;
+ storeError _err = rStoreDir.create(pKey->getStoreFile(), sFullPath, sRelativKey, accessMode);
+
+ if (_err == store_E_NotExists)
+ return REG_KEY_NOT_EXISTS;
+ else
+ if (_err == store_E_WrongFormat)
+ return REG_INVALID_KEY;
+
+ pKey = new ORegKey(sFullKeyName, rStoreDir, this);
+
+ *phOpenKey = pKey;
+ m_openKeyTable[sFullKeyName] = pKey;
+
+ return REG_NO_ERROR;
+}
+
+
+//*********************************************************************
+// closeKey
+//
+RegError ORegistry::closeKey(RegKeyHandle hKey)
+{
+ ORegKey* pKey = (ORegKey*)hKey;
+
+ REG_GUARD(m_mutex);
+
+ if (m_openKeyTable.count(pKey->getName()) > 0)
+ {
+ if (pKey->getRefCount() == 1)
+ {
+ m_openKeyTable.erase(pKey->getName());
+ delete(pKey);
+ hKey = NULL;
+ } else
+ {
+ pKey->release();
+ }
+
+ return REG_NO_ERROR;
+ } else
+ {
+ return REG_KEY_NOT_OPEN;
+ }
+}
+
+
+//*********************************************************************
+// deleteKey
+//
+RegError ORegistry::deleteKey(RegKeyHandle hKey, const OUString& keyName)
+{
+ ORegKey* pKey;
+ RegError _ret = REG_NO_ERROR;
+
+ if ( !keyName.getLength() )
+ {
+ return REG_INVALID_KEYNAME;
+ }
+
+ REG_GUARD(m_mutex);
+
+ if (hKey)
+ pKey = (ORegKey*)hKey;
+ else
+ pKey = m_openKeyTable[ROOT];
+
+ OUString sFullKeyName = resolveLinks(pKey, keyName);
+
+ if ( !sFullKeyName.getLength() )
+ return REG_DETECT_RECURSION;
+
+ pKey = m_openKeyTable[ROOT];
+ _ret = eraseKey(pKey, sFullKeyName, RESOLVE_NOTHING);
+
+ return _ret;
+}
+
+RegError ORegistry::eraseKey(ORegKey* pKey, const OUString& keyName, RESOLVE eResolve)
+{
+ RegError _ret = REG_NO_ERROR;
+
+ if ( !keyName.getLength() )
+ {
+ return REG_INVALID_KEYNAME;
+ }
+
+ OUString sFullKeyName(pKey->getName());
+ OUString sFullPath(sFullKeyName);
+ OUString sRelativKey;
+ sal_Int32 lastIndex = keyName.lastIndexOf('/');
+
+ if ( lastIndex >= 0 )
+ {
+ sRelativKey += keyName.copy(lastIndex + 1);
+
+ if (sFullKeyName.getLength() > 1)
+ sFullKeyName += keyName;
+ else
+ sFullKeyName += (keyName+1);
+
+ sFullPath = sFullKeyName.copy(0, keyName.lastIndexOf('/') + 1);
+ } else
+ {
+ if (sFullKeyName.getLength() > 1)
+ sFullKeyName += ROOT;
+
+ sRelativKey += keyName;
+ sFullKeyName += keyName;
+
+ if (sFullPath.getLength() > 1)
+ sFullPath += ROOT;
+ }
+
+ RegKeyHandle hOldKey;
+ if (_ret = pKey->openKey(keyName, &hOldKey, eResolve))
+ {
+ return _ret;
+ }
+
+ if (_ret = deleteSubkeysAndValues((ORegKey*)hOldKey, eResolve))
+ {
+ pKey->closeKey(hOldKey);
+ return _ret;
+ }
+
+ OUString tmpName(sRelativKey);
+ tmpName += ROOT;
+
+ OStoreFile sFile(pKey->getStoreFile());
+
+ if ( sFile.isValid() && sFile.remove(sFullPath, tmpName) )
+ {
+ return REG_DELETE_KEY_FAILED;
+ }
+
+ // set flag deleted !!!
+ ((ORegKey*)hOldKey)->setDeleted(sal_True);
+
+ if (_ret = pKey->closeKey(hOldKey))
+ {
+ return _ret;
+ }
+
+ return REG_NO_ERROR;
+}
+
+
+//*********************************************************************
+// deleteSubKeys
+//
+RegError ORegistry::deleteSubkeysAndValues(ORegKey* pKey, RESOLVE eResolve)
+{
+ OStoreDirectory::iterator iter;
+ OUString keyName;
+ RegError _ret = REG_NO_ERROR;
+ OStoreDirectory rStoreDir(pKey->getStoreDir());
+ storeError _err = rStoreDir.first(iter);
+
+ while ( _err == store_E_None )
+ {
+ keyName = iter.m_pszName;
+
+ if (iter.m_nAttrib & STORE_ATTRIB_ISDIR)
+ {
+ if ((_ret = eraseKey(pKey, keyName, eResolve)))
+ return _ret;
+ } else
+ {
+ OUString sFullPath(pKey->getName());
+
+ if (sFullPath.getLength() > 1)
+ sFullPath += ROOT;
+
+ if ( ((OStoreFile&)pKey->getStoreFile()).remove(sFullPath, keyName) )
+ {
+ return REG_DELETE_VALUE_FAILED;
+ }
+ }
+
+ _err = rStoreDir.next(iter);
+ }
+
+ return REG_NO_ERROR;
+}
+
+
+//*********************************************************************
+// loadKey
+//
+RegError ORegistry::loadKey(RegKeyHandle hKey, const OUString& regFileName,
+ sal_Bool bWarnings, sal_Bool bReport)
+{
+ RegError _ret = REG_NO_ERROR;
+ ORegistry* pReg;
+ ORegKey *pKey, *pRootKey;
+
+ pReg = new ORegistry();
+ if (_ret = pReg->initRegistry(regFileName, REG_READONLY))
+ {
+ return _ret;
+ }
+
+ pKey = (ORegKey*)hKey;
+ pRootKey = pReg->getRootKey();
+
+ REG_GUARD(m_mutex);
+
+ OStoreDirectory::iterator iter;
+ OUString keyName;
+ OStoreDirectory rStoreDir(pRootKey->getStoreDir());
+ storeError _err = rStoreDir.first(iter);
+
+ while ( _err == store_E_None )
+ {
+ keyName = iter.m_pszName;
+
+ if ( iter.m_nAttrib & STORE_ATTRIB_ISDIR )
+ {
+ _ret = loadAndSaveKeys(pKey, pRootKey, keyName, 0, bWarnings, bReport);
+ } else
+ {
+ _ret = loadAndSaveValue(pKey, pRootKey, keyName, 0, bWarnings, bReport);
+ }
+
+ if (_ret == REG_MERGE_ERROR ||
+ (_ret == REG_MERGE_CONFLICT && bWarnings))
+ {
+ rStoreDir = OStoreDirectory();
+ pRootKey->release();
+ delete(pReg);
+ return _ret;
+ }
+
+ _err = rStoreDir.next(iter);
+ }
+
+ rStoreDir = OStoreDirectory();
+ pRootKey->release();
+ delete(pReg);
+ return _ret;
+}
+
+
+//*********************************************************************
+// loadKey
+//
+RegError ORegistry::saveKey(RegKeyHandle hKey, const OUString& regFileName,
+ sal_Bool bWarnings, sal_Bool bReport)
+{
+ RegError _ret = REG_NO_ERROR;
+ ORegistry* pReg;
+ ORegKey *pKey, *pRootKey;
+
+ pReg = new ORegistry();
+ if (_ret = pReg->initRegistry(regFileName, REG_CREATE))
+ {
+ return _ret;
+ }
+
+ pKey = (ORegKey*)hKey;
+ pRootKey = pReg->getRootKey();
+
+ REG_GUARD(m_mutex);
+
+ OStoreDirectory::iterator iter;
+ OUString keyName;
+ OStoreDirectory rStoreDir(pKey->getStoreDir());
+ storeError _err = rStoreDir.first(iter);
+
+ while ( _err == store_E_None )
+ {
+ keyName = iter.m_pszName;
+
+ if ( iter.m_nAttrib & STORE_ATTRIB_ISDIR )
+ {
+ _ret = loadAndSaveKeys(pRootKey, pKey, keyName,
+ pKey->getName().getLength(),
+ bWarnings, bReport);
+ } else
+ {
+ _ret = loadAndSaveValue(pRootKey, pKey, keyName,
+ pKey->getName().getLength(),
+ bWarnings, bReport);
+ }
+
+ if (_ret)
+ {
+ pRootKey->release();
+ delete(pReg);
+ return _ret;
+ }
+
+ _err = rStoreDir.next(iter);
+ }
+
+ pRootKey->release();
+ delete(pReg);
+ return REG_NO_ERROR;
+}
+
+
+//*********************************************************************
+// isKeyOpen()
+//
+sal_Bool ORegistry::isKeyOpen(const OUString& keyName) const
+{
+ return(m_openKeyTable.count(keyName) > 0);
+}
+
+
+
+//*********************************************************************
+// countSubKeys()
+//
+sal_uInt32 ORegistry::countSubKeys(ORegKey* pKey)
+{
+ REG_GUARD(m_mutex);
+
+ OStoreDirectory::iterator iter;
+ sal_uInt32 count = 0;
+ OStoreDirectory rStoreDir(pKey->getStoreDir());
+ storeError _err = rStoreDir.first(iter);
+
+ while ( _err == store_E_None)
+ {
+ if (iter.m_nAttrib & STORE_ATTRIB_ISDIR)
+ {
+ count++;
+ }
+
+ _err = rStoreDir.next(iter);
+ }
+
+ return count;
+}
+
+
+//*********************************************************************
+// loadValue()
+//
+RegError ORegistry::loadAndSaveValue(ORegKey* pTargetKey,
+ ORegKey* pSourceKey,
+ const OUString& valueName,
+ sal_uInt32 nCut,
+ sal_Bool bWarnings,
+ sal_Bool bReport)
+{
+ OStoreStream rValue;
+ sal_uInt8* pBuffer;
+ RegValueType valueType;
+ sal_uInt32 valueSize;
+ sal_uInt32 nSize;
+ storeAccessMode sourceAccess = VALUE_MODE_OPEN;
+ OUString sTargetPath(pTargetKey->getName());
+ OUString sSourcePath(pSourceKey->getName());
+
+ if (pSourceKey->isReadOnly())
+ {
+ sourceAccess = VALUE_MODE_OPENREAD;
+ }
+
+ if (nCut)
+ {
+ sTargetPath = sSourcePath.copy(nCut);
+ } else
+ {
+ if (sTargetPath.getLength() > 1)
+ {
+ if (sSourcePath.getLength() > 1)
+ sTargetPath += sSourcePath;
+ } else
+ sTargetPath = sSourcePath;
+ }
+
+ if (sTargetPath.getLength() > 1) sTargetPath += ROOT;
+ if (sSourcePath.getLength() > 1) sSourcePath += ROOT;
+
+ if (rValue.create(pSourceKey->getStoreFile(), sSourcePath, valueName, sourceAccess))
+ {
+ return REG_VALUE_NOT_EXISTS;
+ }
+
+ pBuffer = (sal_uInt8*)rtl_allocateMemory(VALUE_HEADERSIZE);
+
+ sal_uInt32 rwBytes;
+ if (rValue.readAt(0, pBuffer, VALUE_HEADERSIZE, rwBytes))
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+ if (rwBytes != VALUE_HEADERSIZE)
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+
+ RegError _ret = REG_NO_ERROR;
+ sal_uInt8 type = *((sal_uInt8*)pBuffer);
+ valueType = (RegValueType)type;
+ readUINT32(pBuffer+VALUE_TYPEOFFSET, valueSize);
+ rtl_freeMemory(pBuffer);
+
+ nSize = VALUE_HEADERSIZE + valueSize;
+ pBuffer = (sal_uInt8*)rtl_allocateMemory(nSize);
+
+ if (rValue.readAt(0, pBuffer, nSize, rwBytes))
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+ if (rwBytes != nSize)
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+
+ OStoreFile rTargetFile(pTargetKey->getStoreFile());
+
+ if (!rValue.create(rTargetFile, sTargetPath, valueName, VALUE_MODE_OPEN))
+ {
+ if (valueType == RG_VALUETYPE_BINARY)
+ {
+ if (_ret = checkBlop(rValue, pTargetKey, sTargetPath,
+ valueName, valueSize, pBuffer+VALUE_HEADEROFFSET,
+ bReport))
+ {
+ if (_ret == REG_MERGE_ERROR ||
+ (_ret == REG_MERGE_CONFLICT && bWarnings))
+ {
+ rtl_freeMemory(pBuffer);
+ return _ret;
+ }
+ } else
+ {
+ rtl_freeMemory(pBuffer);
+ return _ret;
+ }
+ }
+ }
+
+ // write
+ if (rValue.create(rTargetFile, sTargetPath, valueName, VALUE_MODE_CREATE))
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+ if (rValue.writeAt(0, pBuffer, nSize, rwBytes))
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+
+ if (rwBytes != nSize)
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+
+ rtl_freeMemory(pBuffer);
+ return _ret;
+}
+
+
+//*********************************************************************
+// checkblop()
+//
+RegError ORegistry::checkBlop(OStoreStream& rValue,
+ ORegKey* pTargetKey,
+ const OUString& sTargetPath,
+ const OUString& valueName,
+ sal_uInt32 srcValueSize,
+ sal_uInt8* pSrcBuffer,
+ sal_Bool bReport)
+{
+ RegistryTypeReader_Api* pReaderApi;
+
+ pReaderApi = initRegistryTypeReader_Api();
+
+ RegistryTypeReader reader(pReaderApi, pSrcBuffer, srcValueSize, sal_False);
+
+ if (reader.getTypeClass() == RT_TYPE_INVALID)
+ {
+ return REG_INVALID_VALUE;
+ }
+
+ sal_uInt8* pBuffer = (sal_uInt8*)rtl_allocateMemory(VALUE_HEADERSIZE);
+ RegValueType valueType;
+ sal_uInt32 valueSize;
+ sal_uInt32 rwBytes;
+ OString targetPath( OUStringToOString(sTargetPath, RTL_TEXTENCODING_UTF8) );
+
+ if (!rValue.readAt(0, pBuffer, VALUE_HEADERSIZE, rwBytes) &&
+ (rwBytes == VALUE_HEADERSIZE))
+ {
+ sal_uInt8 type = *((sal_uInt8*)pBuffer);
+ valueType = (RegValueType)type;
+ readUINT32(pBuffer+VALUE_TYPEOFFSET, valueSize);
+ rtl_freeMemory(pBuffer);
+
+ if (valueType == RG_VALUETYPE_BINARY)
+ {
+ pBuffer = (sal_uInt8*)rtl_allocateMemory(valueSize);
+ if (!rValue.readAt(VALUE_HEADEROFFSET, pBuffer, valueSize, rwBytes) &&
+ (rwBytes == valueSize))
+ {
+ RegistryTypeReader reader2(pReaderApi, pBuffer, valueSize, sal_False);
+
+ if ((reader.getTypeClass() != reader2.getTypeClass())
+ || reader2.getTypeClass() == RT_TYPE_INVALID)
+ {
+ rtl_freeMemory(pBuffer);
+
+ if (bReport)
+ {
+ fprintf(stdout, "ERROR: values of blop from key \"%s\" has different types.\n",
+ targetPath.getStr());
+ }
+ return REG_MERGE_ERROR;
+ }
+
+ if (reader.getTypeClass() == RT_TYPE_MODULE)
+ {
+ if (reader.getFieldCount() > 0 &&
+ reader2.getFieldCount() > 0)
+ {
+ mergeModuleValue(rValue, pTargetKey, sTargetPath,
+ valueName, reader, reader2);
+
+ rtl_freeMemory(pBuffer);
+ return REG_NO_ERROR;
+ } else
+ if (reader2.getFieldCount() > 0)
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_NO_ERROR;
+ } else
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_MERGE_CONFLICT;
+ }
+ } else
+ {
+ rtl_freeMemory(pBuffer);
+
+ if (bReport)
+ {
+ fprintf(stdout, "WARNING: value of key \"%s\" already exists.\n",
+ targetPath.getStr());
+ }
+ return REG_MERGE_CONFLICT;
+ }
+ } else
+ {
+ rtl_freeMemory(pBuffer);
+ if (bReport)
+ {
+ fprintf(stdout, "ERROR: values of key \"%s\" contains bad data.\n",
+ targetPath.getStr());
+ }
+ return REG_MERGE_ERROR;
+ }
+ } else
+ {
+ rtl_freeMemory(pBuffer);
+ if (bReport)
+ {
+ fprintf(stdout, "ERROR: values of key \"%s\" has different types.\n",
+ targetPath.getStr());
+ }
+ return REG_MERGE_ERROR;
+ }
+ } else
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+}
+
+static sal_uInt32 checkTypeReaders(RegistryTypeReader& reader1,
+ RegistryTypeReader& reader2,
+ StringSet& nameSet)
+{
+ sal_uInt32 count=0;
+ sal_uInt32 i;
+ for (i=0 ; i < reader1.getFieldCount(); i++)
+ {
+ nameSet.insert(reader1.getFieldName(i));
+ count++;
+ }
+ for (i=0 ; i < reader2.getFieldCount(); i++)
+ {
+ if (nameSet.find(reader2.getFieldName(i)) == nameSet.end())
+ {
+ nameSet.insert(reader2.getFieldName(i));
+ count++;
+ }
+ }
+ return count;
+}
+
+//*********************************************************************
+// mergeModuleValue()
+//
+RegError ORegistry::mergeModuleValue(OStoreStream& rTargetValue,
+ ORegKey* pTargetKey,
+ const OUString& sTargetPath,
+ const OUString& valueName,
+ RegistryTypeReader& reader,
+ RegistryTypeReader& reader2)
+{
+ sal_uInt16 index = 0;
+ RegistryTypeWriter_Api* pWriterApi;
+
+ StringSet nameSet;
+ sal_uInt32 count = checkTypeReaders(reader, reader2, nameSet);
+
+ if (count != reader.getFieldCount())
+ {
+ pWriterApi = initRegistryTypeWriter_Api();
+
+ RegistryTypeWriter writer(pWriterApi,
+ reader.getTypeClass(),
+ reader.getTypeName(),
+ reader.getSuperTypeName(),
+ count,
+ 0,
+ 0);
+
+ int i;
+ for (i=0 ; i < reader.getFieldCount(); i++)
+ {
+ writer.setFieldData(index,
+ reader.getFieldName(i),
+ reader.getFieldType(i),
+ reader.getFieldDoku(i),
+ reader.getFieldFileName(i),
+ reader.getFieldAccess(i),
+ reader.getFieldConstValue(i));
+ index++;
+ }
+ for (i=0 ; i < reader2.getFieldCount(); i++)
+ {
+ if (nameSet.find(reader2.getFieldName(i)) == nameSet.end())
+ {
+ writer.setFieldData(index,
+ reader2.getFieldName(i),
+ reader2.getFieldType(i),
+ reader2.getFieldDoku(i),
+ reader2.getFieldFileName(i),
+ reader2.getFieldAccess(i),
+ reader2.getFieldConstValue(i));
+ index++;
+ }
+ }
+
+ const sal_uInt8* pBlop = writer.getBlop();
+ sal_uInt32 aBlopSize = writer.getBlopSize();
+
+ sal_uInt8 type = (sal_uInt8)RG_VALUETYPE_BINARY;
+ sal_uInt8* pBuffer = (sal_uInt8*)rtl_allocateMemory(VALUE_HEADERSIZE + aBlopSize);
+
+ rtl_copyMemory(pBuffer, &type, 1);
+ writeUINT32(pBuffer+VALUE_TYPEOFFSET, aBlopSize);
+ rtl_copyMemory(pBuffer+VALUE_HEADEROFFSET, pBlop, aBlopSize);
+
+ sal_uInt32 rwBytes;
+ if (rTargetValue.writeAt(0, pBuffer, VALUE_HEADERSIZE+aBlopSize, rwBytes))
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+
+ if (rwBytes != VALUE_HEADERSIZE+aBlopSize)
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+
+ rtl_freeMemory(pBuffer);
+ }
+ return REG_NO_ERROR;
+}
+
+//*********************************************************************
+// loadKeys()
+//
+RegError ORegistry::loadAndSaveKeys(ORegKey* pTargetKey,
+ ORegKey* pSourceKey,
+ const OUString& keyName,
+ sal_uInt32 nCut,
+ sal_Bool bWarnings,
+ sal_Bool bReport)
+{
+ ORegKey* pTmpKey;
+ RegError _ret = REG_NO_ERROR;
+ OUString sRelPath(pSourceKey->getName().copy(nCut));
+ OUString sFullPath;
+
+ if(pTargetKey->getName().getLength() > 1)
+ sFullPath += pTargetKey->getName();
+ sFullPath += sRelPath;
+ if (sRelPath.getLength() > 1 || sFullPath.getLength() == 0)
+ sFullPath += ROOT;
+
+ OUString sFullKeyName = sFullPath;
+ OStoreDirectory rStoreDir;
+
+ sFullKeyName += keyName;
+
+ if (rStoreDir.create(pTargetKey->getStoreFile(), sFullPath, keyName, KEY_MODE_CREATE))
+ {
+ return REG_CREATE_KEY_FAILED;
+ }
+
+ if (m_openKeyTable.count(sFullKeyName) > 0)
+ {
+ m_openKeyTable[sFullKeyName]->setDeleted(sal_False);
+ }
+
+
+ if (_ret = pSourceKey->openKey(keyName, (RegKeyHandle*)&pTmpKey, RESOLVE_NOTHING))
+ {
+ return _ret;
+ }
+
+ OStoreDirectory::iterator iter;
+ OUString sName;
+ OStoreDirectory rTmpStoreDir(pTmpKey->getStoreDir());
+ storeError _err = rTmpStoreDir.first(iter);
+
+ while ( _err == store_E_None)
+ {
+ sName = iter.m_pszName;
+
+ if (iter.m_nAttrib & STORE_ATTRIB_ISDIR)
+ {
+ _ret = loadAndSaveKeys(pTargetKey, pTmpKey,
+ sName, nCut, bWarnings, bReport);
+ } else
+ {
+ _ret = loadAndSaveValue(pTargetKey, pTmpKey,
+ sName, nCut, bWarnings, bReport);
+ }
+
+ if (_ret == REG_MERGE_ERROR ||
+ (_ret == REG_MERGE_CONFLICT && bWarnings))
+ {
+ pSourceKey->closeKey(pTmpKey);
+ return _ret;
+ }
+
+ _err = rTmpStoreDir.next(iter);
+ }
+
+ pSourceKey->closeKey(pTmpKey);
+ return _ret;
+}
+
+
+//*********************************************************************
+// getRootKey()
+//
+ORegKey* ORegistry::getRootKey()
+{
+ m_openKeyTable[ROOT]->acquire();
+ return m_openKeyTable[ROOT];
+}
+
+
+//*********************************************************************
+// getResolvedKeyName()
+//
+RegError ORegistry::getResolvedKeyName(RegKeyHandle hKey,
+ const OUString& keyName,
+ OUString& resolvedName,
+ sal_Bool firstLinkOnly)
+{
+ ORegKey* pKey;
+
+ if ( !keyName.getLength() )
+ return REG_INVALID_KEYNAME;
+
+ REG_GUARD(m_mutex);
+
+ if (hKey)
+ pKey = (ORegKey*)hKey;
+ else
+ pKey = m_openKeyTable[ROOT];
+
+ resolvedName = resolveLinks(pKey, keyName, firstLinkOnly);
+
+ if ( resolvedName.getLength() )
+ return REG_NO_ERROR;
+ else
+ return REG_DETECT_RECURSION;
+}
+
+//*********************************************************************
+// dumpRegistry()
+//
+RegError ORegistry::dumpRegistry(RegKeyHandle hKey) const
+{
+ ORegKey *pKey = (ORegKey*)hKey;
+ OUString sName;
+ RegError _ret = REG_NO_ERROR;
+ OStoreDirectory::iterator iter;
+ OStoreDirectory rStoreDir(pKey->getStoreDir());
+ storeError _err = rStoreDir.first(iter);
+
+ OString regName( OUStringToOString( getName(), RTL_TEXTENCODING_UTF8 ) );
+ OString keyName( OUStringToOString( pKey->getName(), RTL_TEXTENCODING_UTF8 ) );
+ fprintf(stdout, "Registry \"%s\":\n\n%s\n", regName.getStr(), keyName.getStr());
+
+ while ( _err == store_E_None )
+ {
+ sName = iter.m_pszName;
+
+ if (iter.m_nAttrib & STORE_ATTRIB_ISDIR)
+ {
+ _ret = dumpKey(pKey->getName(), sName, 1);
+ } else
+ {
+ _ret = dumpValue(pKey->getName(), sName, 1);
+ }
+
+ if (_ret)
+ {
+ return _ret;
+ }
+
+ _err = rStoreDir.next(iter);
+ }
+
+ return REG_NO_ERROR;
+}
+
+
+//*********************************************************************
+// dumpValue()
+//
+RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_Int16 nSpc) const
+{
+ OStoreStream rValue;
+ sal_uInt8* pBuffer;
+ sal_uInt32 valueSize;
+ RegValueType valueType;
+ OUString sFullPath(sPath);
+ OString sIndent;
+ storeAccessMode accessMode = VALUE_MODE_OPEN;
+ sal_Bool bLinkValue = sal_False;
+
+ if (isReadOnly())
+ {
+ accessMode = VALUE_MODE_OPENREAD;
+ }
+
+ for (int i= 0; i < nSpc; i++) sIndent += " ";
+
+ if (sFullPath.getLength() > 1)
+ {
+ sFullPath += ROOT;
+ }
+ if (rValue.create(m_file, sFullPath, sName, accessMode))
+ {
+ return REG_VALUE_NOT_EXISTS;
+ }
+
+ OUString tmpName( RTL_CONSTASCII_USTRINGPARAM(VALUE_PREFIX) );
+ tmpName += OUString( RTL_CONSTASCII_USTRINGPARAM("LINK_TARGET") );
+ if (sName == tmpName)
+ {
+ bLinkValue = sal_True;
+ }
+ pBuffer = (sal_uInt8*)rtl_allocateMemory(VALUE_HEADERSIZE);
+
+ sal_uInt32 rwBytes;
+ if (rValue.readAt(0, pBuffer, VALUE_HEADERSIZE, rwBytes))
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+ if (rwBytes != (VALUE_HEADERSIZE))
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+
+ sal_uInt8 type = *((sal_uInt8*)pBuffer);
+ valueType = (RegValueType)type;
+ readUINT32(pBuffer+VALUE_TYPEOFFSET, valueSize);
+
+ pBuffer = (sal_uInt8*)rtl_allocateMemory(valueSize);
+ if (rValue.readAt(VALUE_HEADEROFFSET, pBuffer, valueSize, rwBytes))
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+ if (rwBytes != valueSize)
+ {
+ rtl_freeMemory(pBuffer);
+ return REG_INVALID_VALUE;
+ }
+
+ const sal_Char* indent = sIndent.getStr();
+ switch (valueType)
+ {
+ case 0:
+ fprintf(stdout, "%sValue: Type = VALUETYPE_NOT_DEFINED\n", indent);
+ break;
+ case 1:
+ {
+ fprintf(stdout, "%sValue: Type = RG_VALUETYPE_LONG\n", indent);
+ fprintf(stdout, "%s Size = %d\n", indent, valueSize);
+ fprintf(stdout, "%s Data = ", indent);
+
+ sal_Int32 value;
+ readINT32(pBuffer, value);
+ fprintf(stdout, "%d\n", value);
+ }
+ break;
+ case 2:
+ {
+ sal_Char* value = (sal_Char*)rtl_allocateMemory(valueSize);
+ readUtf8(pBuffer, value, valueSize);
+
+ if (bLinkValue)
+ {
+ fprintf(stdout, "%sKEY: Type = RG_LINKTYPE\n", indent);
+ fprintf(stdout, "%s LinkTarget = \"%s\"\n", indent, value);
+ } else
+ {
+ fprintf(stdout, "%sValue: Type = RG_VALUETYPE_STRING\n", indent);
+ fprintf(stdout, "%s Size = %d\n", indent, valueSize);
+ fprintf(stdout, "%s Data = \"%s\"\n", indent, value);
+ }
+
+ rtl_freeMemory(value);
+ }
+ break;
+ case 3:
+ {
+ sal_uInt32 size = (valueSize / 2) * sizeof(sal_Unicode);
+ fprintf(stdout, "%sValue: Type = RG_VALUETYPE_UNICODE\n", indent);
+ fprintf(stdout, "%s Size = %d\n", indent, valueSize);
+ fprintf(stdout, "%s Data = ", indent);
+
+ sal_Unicode* value = new sal_Unicode[size];
+ readString(pBuffer, value, size);
+
+ OString uStr = OUStringToOString(value, RTL_TEXTENCODING_UTF8);
+ fprintf(stdout, "L\"%s\"\n", uStr.getStr());
+ delete[] value;
+ }
+ break;
+ case 4:
+ {
+ fprintf(stdout, "%sValue: Type = RG_VALUETYPE_BINARY\n", indent);
+ fprintf(stdout, "%s Size = %d\n", indent, valueSize);
+ fprintf(stdout, "%s Data = ", indent);
+
+ RegistryTypeReader_Api* pReaderApi;
+
+ pReaderApi = initRegistryTypeReader_Api();
+
+ RegistryTypeReader reader(pReaderApi, pBuffer, valueSize, sal_False);
+
+ sIndent += " ";
+ if (!dumpType(reader, sIndent))
+ {
+ fprintf(stdout, "<unknown>\n");
+ }
+
+ }
+ break;
+ case 5:
+ {
+ sal_uInt32 offset = 4; // initial 4 Bytes fuer die Laenge des Arrays
+ sal_uInt32 len = 0;
+
+ readUINT32(pBuffer, len);
+
+ fprintf(stdout, "%sValue: Type = RG_VALUETYPE_LONGLIST\n", indent);
+ fprintf(stdout, "%s Size = %d\n", indent, valueSize);
+ fprintf(stdout, "%s Len = %d\n", indent, len);
+ fprintf(stdout, "%s Data = ", indent);
+
+ sal_Int32 longValue;
+ for (int i=0; i < len; i++)
+ {
+ readINT32(pBuffer+offset, longValue);
+
+ if (offset > 4)
+ fprintf(stdout, "%s ", indent);
+
+ fprintf(stdout, "%d = %d\n", i, longValue);
+ offset += 4; // 4 Bytes fuer sal_Int32
+ }
+ }
+ break;
+ case 6:
+ {
+ sal_uInt32 offset = 4; // initial 4 Bytes fuer die Laenge des Arrays
+ sal_uInt32 sLen = 0;
+ sal_uInt32 len = 0;
+
+ readUINT32(pBuffer, len);
+
+ fprintf(stdout, "%sValue: Type = RG_VALUETYPE_STRINGLIST\n", indent);
+ fprintf(stdout, "%s Size = %d\n", indent, valueSize);
+ fprintf(stdout, "%s Len = %d\n", indent, len);
+ fprintf(stdout, "%s Data = ", indent);
+
+ sal_Char *pValue;
+ for (int i=0; i < len; i++)
+ {
+ readUINT32(pBuffer+offset, sLen);
+
+ offset += 4; // 4 Bytes (sal_uInt32) fuer die Groesse des strings in Bytes
+
+ pValue = (sal_Char*)rtl_allocateMemory(sLen);
+ readUtf8(pBuffer+offset, pValue, sLen);
+
+ if (offset > 8)
+ fprintf(stdout, "%s ", indent);
+
+ fprintf(stdout, "%d = \"%s\"\n", i, pValue);
+ offset += sLen;
+ }
+ }
+ break;
+ case 7:
+ {
+ sal_uInt32 offset = 4; // initial 4 Bytes fuer die Laenge des Arrays
+ sal_uInt32 sLen = 0;
+ sal_uInt32 len = 0;
+
+ readUINT32(pBuffer, len);
+
+ fprintf(stdout, "%sValue: Type = RG_VALUETYPE_UNICODELIST\n", indent);
+ fprintf(stdout, "%s Size = %d\n", indent, valueSize);
+ fprintf(stdout, "%s Len = %d\n", indent, len);
+ fprintf(stdout, "%s Data = ", indent);
+
+ sal_Unicode *pValue;
+ OString uStr;
+ for (int i=0; i < len; i++)
+ {
+ readUINT32(pBuffer+offset, sLen);
+
+ offset += 4; // 4 Bytes (sal_uInt32) fuer die Groesse des strings in Bytes
+
+ pValue = (sal_Unicode*)rtl_allocateMemory((sLen / 2) * sizeof(sal_Unicode));
+ readString(pBuffer+offset, pValue, sLen);
+
+ if (offset > 8)
+ fprintf(stdout, "%s ", indent);
+
+ uStr = OUStringToOString(pValue, RTL_TEXTENCODING_UTF8);
+ fprintf(stdout, "%d = L\"%s\"\n", i, uStr.getStr());
+
+ offset += sLen;
+
+ rtl_freeMemory(pValue);
+ }
+ }
+ break;
+ }
+
+ fprintf(stdout, "\n");
+
+ rtl_freeMemory(pBuffer);
+ return REG_NO_ERROR;
+}
+
+//*********************************************************************
+// dumpKey()
+//
+RegError ORegistry::dumpKey(const OUString& sPath, const OUString& sName, sal_Int16 nSpace) const
+{
+ OStoreDirectory rStoreDir;
+ OUString sFullPath(sPath);
+ OString sIndent;
+ storeAccessMode accessMode = KEY_MODE_OPEN;
+ RegError _ret = REG_NO_ERROR;
+
+ if (isReadOnly())
+ {
+ accessMode = KEY_MODE_OPENREAD;
+ }
+
+ for (int i= 0; i < nSpace; i++) sIndent += " ";
+
+ if (sFullPath.getLength() > 1)
+ sFullPath += ROOT;
+
+ storeError _err = rStoreDir.create(m_file, sFullPath, sName, accessMode);
+
+ if (_err == store_E_NotExists)
+ return REG_KEY_NOT_EXISTS;
+ else
+ if (_err == store_E_WrongFormat)
+ return REG_INVALID_KEY;
+
+ fprintf(stdout, "%s/ %s\n", sIndent.getStr(), OUStringToOString(sName, RTL_TEXTENCODING_UTF8).getStr());
+
+ OUString sSubPath(sFullPath);
+ OUString sSubName;
+ sSubPath += sName;
+
+ OStoreDirectory::iterator iter;
+
+ _err = rStoreDir.first(iter);
+
+ while ( _err == store_E_None)
+ {
+ sSubName = iter.m_pszName;
+
+ if ( iter.m_nAttrib & STORE_ATTRIB_ISDIR )
+ {
+ _ret = dumpKey(sSubPath, sSubName, nSpace+2);
+ } else
+ {
+ _ret = dumpValue(sSubPath, sSubName, nSpace+2);
+ }
+
+ if (_ret)
+ {
+ return _ret;
+ }
+
+ _err = rStoreDir.next(iter);
+ }
+
+ return REG_NO_ERROR;
+}
+
+//*********************************************************************
+// createLink()
+//
+RegError ORegistry::createLink(RegKeyHandle hKey,
+ const OUString& linkName,
+ const OUString& linkTarget)
+{
+ ORegKey* pKey;
+
+ if ( !linkName.getLength() )
+ {
+ return REG_INVALID_LINKNAME;
+ }
+
+ REG_GUARD(m_mutex);
+
+ if (hKey)
+ pKey = (ORegKey*)hKey;
+ else
+ pKey = m_openKeyTable[ROOT];
+
+ OUString sFullLinkName = resolveLinks(pKey, linkName, sal_True);
+
+ if (sFullLinkName.getLength() == 0)
+ return REG_DETECT_RECURSION;
+
+ OStoreDirectory rStoreDir;
+ OUString sFullPath(ROOT);
+
+ sal_uInt32 tokenCount = sFullLinkName.getTokenCount('/');
+ sal_uInt32 actToken = 0;
+ OUString token;
+
+ token = sFullLinkName.getToken(actToken, '/');
+
+ while ( actToken < tokenCount && token.getLength() > 0 )
+ {
+ if (rStoreDir.create(pKey->getStoreFile(), sFullPath, token, KEY_MODE_CREATE))
+ {
+ return REG_CREATE_KEY_FAILED;
+ }
+
+ sFullPath += token;
+ sFullPath += ROOT;
+
+ token = sFullLinkName.getToken(++actToken, '/');
+ }
+
+ pKey = new ORegKey(sFullLinkName, linkTarget, rStoreDir, this);
+ delete pKey;
+
+ return REG_NO_ERROR;
+}
+
+//*********************************************************************
+// deleteLink()
+//
+RegError ORegistry::deleteLink(RegKeyHandle hKey, const OUString& linkName)
+{
+ ORegKey* pKey;
+
+ if ( !linkName.getLength() )
+ {
+ return REG_INVALID_LINKNAME;
+ }
+
+ REG_GUARD(m_mutex);
+
+ if (hKey)
+ pKey = (ORegKey*)hKey;
+ else
+ pKey = m_openKeyTable[ROOT];
+
+ OUString tmpPath(linkName);
+ OUString tmpName;
+ OUString resolvedPath;
+ sal_Int32 lastIndex = tmpPath.lastIndexOf('/');
+
+ if ( lastIndex > 0 && tmpPath.getStr()[0] == '/')
+ {
+ tmpName = tmpPath.copy(lastIndex);
+
+ OUString linkPath = tmpPath.copy(0, lastIndex);
+
+ resolvedPath = resolveLinks(pKey, linkPath);
+
+ if ( !resolvedPath.getLength() )
+ {
+ return REG_DETECT_RECURSION;
+ }
+
+ resolvedPath += tmpName;
+ } else
+ {
+ resolvedPath = pKey->getName();
+
+ if (lastIndex != 0 && resolvedPath.getLength() > 1)
+ resolvedPath += ROOT;
+
+ resolvedPath += linkName;
+ }
+
+ pKey = m_openKeyTable[ROOT];
+
+ RegKeyType keyType;
+ RegError ret = REG_NO_ERROR;
+ if (ret = pKey->getKeyType(resolvedPath, &keyType))
+ return ret;
+
+ if (keyType != RG_LINKTYPE)
+ return REG_INVALID_LINK;
+
+ return eraseKey(pKey, resolvedPath, RESOLVE_PART);
+}
+
+//*********************************************************************
+// resolveLinks()
+//
+OUString ORegistry::resolveLinks(ORegKey* pKey, const OUString& path, sal_Bool firstLinkOnly)
+{
+ OUString resolvedPath(pKey->getName());
+ sal_uInt32 tokenCount = path.getTokenCount('/');
+ sal_uInt32 actToken = 0;
+ OUString token;
+ ORegKey* pLink = NULL;
+
+ if (resolvedPath.getLength() > 1)
+ resolvedPath += ROOT;
+
+ if ( path.getStr()[0] == '/' )
+ token = path.getToken(++actToken, '/');
+ else
+ token = path.getToken(actToken, '/');
+
+ while ( actToken < tokenCount && token.getLength() > 0 )
+ {
+ pLink = resolveLink(pKey, resolvedPath, token);
+
+ if (pLink)
+ {
+ OUString tmpName;
+ sal_Int32 lastIndex;
+
+ while(pLink)
+ {
+ if (!insertRecursionLink(pLink))
+ {
+ resetRecursionLinks();
+ delete pLink;
+ return OUString();
+ }
+
+
+ lastIndex = resolvedPath.lastIndexOf('/');
+ tmpName = resolvedPath.copy(lastIndex + 1);
+ resolvedPath = resolvedPath.copy(0, lastIndex + 1);
+
+ pLink = resolveLink(pKey, resolvedPath, tmpName);
+ }
+
+ resetRecursionLinks();
+ }
+
+ token = path.getToken(++actToken, '/');
+ if ( token.getLength() )
+ resolvedPath += ROOT;
+ }
+
+ return resolvedPath;
+}
+
+//*********************************************************************
+// resolveLink()
+//
+ORegKey* ORegistry::resolveLink(ORegKey* pKey, OUString& resolvedPath, const OUString& name)
+{
+ OStoreDirectory rStoreDir;
+ ORegKey* pTmpKey = NULL;
+
+ if ( !rStoreDir.create(pKey->getStoreFile(), resolvedPath,
+ name, KEY_MODE_OPENREAD) )
+ {
+ resolvedPath += name;
+ pTmpKey = new ORegKey(resolvedPath, rStoreDir, pKey->getRegistry());
+ RegKeyType keyType;
+ sal_Bool bIsLink=sal_False;
+ if (!pTmpKey->getKeyType(OUString(), &keyType) && (keyType == RG_LINKTYPE))
+ {
+ resolvedPath = pTmpKey->getLinkTarget();
+ return pTmpKey;
+ }
+
+ delete pTmpKey;
+ return NULL;
+ } else
+ {
+ resolvedPath += name;
+ return NULL;
+ }
+}
+
+sal_Bool ORegistry::insertRecursionLink(ORegKey* pLink)
+{
+ if (m_recursionList.empty())
+ {
+ m_recursionList.push_back(pLink);
+ } else
+ {
+ LinkList::iterator iter = m_recursionList.begin();
+
+ while (iter != m_recursionList.end())
+ {
+ if ((*iter)->getName() == pLink->getName())
+ return sal_False;
+
+ iter++;
+ }
+ m_recursionList.push_back(pLink);
+ }
+
+ return sal_True;
+}
+
+sal_Bool ORegistry::resetRecursionLinks()
+{
+ LinkList::iterator iter = m_recursionList.begin();
+
+ while (iter != m_recursionList.end())
+ {
+ delete *iter;
+ iter++;
+ }
+
+ m_recursionList.erase(m_recursionList.begin(), m_recursionList.end());
+
+ return sal_True;
+}
+
+
diff --git a/registry/source/regimpl.hxx b/registry/source/regimpl.hxx
new file mode 100644
index 000000000000..458766bafe17
--- /dev/null
+++ b/registry/source/regimpl.hxx
@@ -0,0 +1,266 @@
+/*************************************************************************
+ *
+ * $RCSfile: regimpl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _REGIMPL_HXX_
+#define _REGIMPL_HXX_
+
+#include <registry/registry.h>
+
+#ifndef _REGMAP_HXX_
+#include "regmap.hxx"
+#endif
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+#ifndef _STORE_STORE_HXX_
+#include <store/store.hxx>
+#endif
+
+#define REG_PAGESIZE 512
+
+#define REG_MODE_CREATE store_AccessCreate
+#define REG_MODE_OPEN store_AccessReadWrite
+#define REG_MODE_OPENREAD store_AccessReadOnly
+
+#define KEY_MODE_CREATE store_AccessCreate
+#define KEY_MODE_OPEN store_AccessReadWrite
+#define KEY_MODE_OPENREAD store_AccessReadOnly
+
+
+#define VALUE_MODE_CREATE store_AccessCreate
+#define VALUE_MODE_OPEN store_AccessReadWrite
+#define VALUE_MODE_OPENREAD store_AccessReadOnly
+
+#define VALUE_PREFIX "$VL_"
+#define VALUE_LINKTARGET "$VL_LINK_TARGET"
+
+// 5 Bytes = 1 (Byte fuer den Typ) + 4 (Bytes fuer die Groesse der Daten)
+#define VALUE_HEADERSIZE 5
+#define VALUE_TYPEOFFSET 1
+#define VALUE_HEADEROFFSET 5
+
+#define REG_CREATE 0x0004 // allow write accesses
+
+#define REG_GUARD(mutex) \
+ Guard< Mutex > aGuard( mutex );
+
+using namespace rtl;
+using namespace osl;
+using namespace store;
+
+enum RESOLVE
+{
+ // alle Links werden aufgeloest
+ RESOLVE_FULL,
+ // alles bis zum letzten TeilStueck wird aufgeloest
+ RESOLVE_PART,
+ // kein Link wird aufgeloest
+ RESOLVE_NOTHING
+};
+
+class ORegManager;
+class RegistryTypeReader;
+
+class ORegistry
+{
+public:
+ ORegistry();
+
+ sal_uInt32 acquire()
+ { return ++m_refCount; }
+
+ sal_uInt32 release()
+ { return --m_refCount; }
+
+ RegError initRegistry(const OUString& name,
+ RegAccessMode accessMode);
+
+ RegError closeRegistry();
+
+ RegError destroyRegistry(const OUString& name);
+
+ RegError createKey(RegKeyHandle hKey,
+ const OUString& keyName,
+ RegKeyHandle* phNewKey);
+
+ RegError openKey(RegKeyHandle hKey,
+ const OUString& keyName,
+ RegKeyHandle* phOpenKey,
+ RESOLVE eResolve=RESOLVE_FULL);
+
+ RegError closeKey(RegKeyHandle hKey);
+
+ RegError deleteKey(RegKeyHandle hKey, const OUString& keyName);
+
+ RegError loadKey(RegKeyHandle hKey,
+ const OUString& regFileName,
+ sal_Bool bWarings=sal_False,
+ sal_Bool bReport=sal_False);
+
+ RegError saveKey(RegKeyHandle hKey,
+ const OUString& regFileName,
+ sal_Bool bWarings=sal_False,
+ sal_Bool bReport=sal_False);
+
+ RegError dumpRegistry(RegKeyHandle hKey) const;
+
+ RegError createLink(RegKeyHandle hKey,
+ const OUString& linkName,
+ const OUString& linkTarget);
+
+ RegError deleteLink(RegKeyHandle hKey,
+ const OUString& linkName);
+
+public:
+ virtual ~ORegistry();
+
+ sal_Bool isKeyOpen(const OUString& keyName) const;
+ sal_Bool isReadOnly() const
+ { return m_readOnly; }
+
+ sal_Bool isOpen() const
+ { return m_isOpen; }
+
+ ORegKey* getRootKey();
+
+ const OStoreFile& getStoreFile()
+ { return m_file; }
+
+ const OUString& getName() const
+ { return m_name; }
+
+ RegError getResolvedKeyName(RegKeyHandle hKey,
+ const OUString& keyName,
+ OUString& resolvedName,
+ sal_Bool firstLinkOnly=sal_False);
+
+ friend class ORegKey;
+protected:
+ RegError eraseKey(ORegKey* pKey,
+ const OUString& keyName,
+ RESOLVE eResolve=RESOLVE_FULL);
+
+ RegError deleteSubkeysAndValues(ORegKey* pKey,
+ RESOLVE eResolve=RESOLVE_FULL);
+
+ sal_uInt32 countSubKeys(ORegKey* pKey);
+
+ RegError loadAndSaveValue(ORegKey* pTargetKey,
+ ORegKey* pSourceKey,
+ const OUString& valueName,
+ sal_uInt32 nCut,
+ sal_Bool bWarnings=sal_False,
+ sal_Bool bReport=sal_False);
+
+ RegError checkBlop(OStoreStream& rValue,
+ ORegKey* pTargetKey,
+ const OUString& sTargetPath,
+ const OUString& valueName,
+ sal_uInt32 srcValueSize,
+ sal_uInt8* pSrcBuffer,
+ sal_Bool bReport=sal_False);
+
+ RegError mergeModuleValue(OStoreStream& rTargetValue,
+ ORegKey* pTargetKey,
+ const OUString& sTargetPath,
+ const OUString& valueName,
+ RegistryTypeReader& reader,
+ RegistryTypeReader& reader2);
+
+ RegError loadAndSaveKeys(ORegKey* pTargetKey,
+ ORegKey* pSourceKey,
+ const OUString& keyName,
+ sal_uInt32 nCut,
+ sal_Bool bWarnings=sal_False,
+ sal_Bool bReport=sal_False);
+
+ RegError dumpValue(const OUString& sPath,
+ const OUString& sName,
+ sal_Int16 nSpace) const;
+
+ RegError dumpKey(const OUString& sPath,
+ const OUString& sName,
+ sal_Int16 nSpace) const;
+
+ OUString resolveLinks(ORegKey* pKey, const OUString& path, sal_Bool firstLinkOnly=sal_False);
+ ORegKey* resolveLink(ORegKey* pKey, OUString& resolvedPath, const OUString& name);
+
+ sal_Bool insertRecursionLink(ORegKey* pLink);
+ sal_Bool resetRecursionLinks();
+
+protected:
+
+ sal_uInt32 m_refCount;
+ Mutex m_mutex;
+ sal_Bool m_readOnly;
+ sal_Bool m_isOpen;
+ OUString m_name;
+ OStoreFile m_file;
+ KeyMap m_openKeyTable;
+ LinkList m_recursionList;
+
+ const OUString ROOT;
+};
+
+#endif
+
diff --git a/registry/source/registry.cxx b/registry/source/registry.cxx
new file mode 100644
index 000000000000..1e6f4af4335b
--- /dev/null
+++ b/registry/source/registry.cxx
@@ -0,0 +1,793 @@
+/*************************************************************************
+ *
+ * $RCSfile: registry.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <registry/registry.h>
+
+#ifndef _REGISTRY_REGISTRY_HXX_
+#include <registry/registry.hxx>
+#endif
+
+#ifndef _REGIMPL_HXX_
+#include "regimpl.hxx"
+#endif
+
+#ifndef _REGKEY_HXX_
+#include "keyimpl.hxx"
+#endif
+
+#include <vos/process.hxx>
+
+#if defined(WIN32) || defined(WNT) || defined(__OS2__)
+#include <io.h>
+#endif
+
+#if defined(UNX)
+#include <stdlib.h>
+#include <unistd.h>
+#endif
+
+using namespace vos;
+
+#if defined ( GCC ) && ( defined ( SCO ) || defined ( NETBSD ) )
+ORealDynamicLoader* ODynamicLoader<Registry_Api>::m_pLoader = NULL;
+#endif
+
+OString getTempName()
+{
+ OUString uTmpPattern;
+ sal_Char tmpPattern[512] = "";
+ sal_Char *pTmpName = NULL;
+
+ OStartupInfo StartupInfo;
+
+ if (StartupInfo.getEnvironment(OUString( RTL_CONSTASCII_USTRINGPARAM("TMP") ),
+ uTmpPattern) != OStartupInfo::E_None)
+ {
+ if (StartupInfo.getEnvironment( OUString( RTL_CONSTASCII_USTRINGPARAM("TEMP") ),
+ uTmpPattern) != NAMESPACE_VOS(OStartupInfo)::E_None)
+ {
+#if defined(WIN32) || defined(WNT) || defined(OS2)
+ strcpy(tmpPattern, ".");
+#else
+ strcpy(tmpPattern, "/tmp");
+#endif
+ }
+ }
+
+ if ( uTmpPattern.getLength() )
+ {
+ strcpy(tmpPattern, OUStringToOString(uTmpPattern, RTL_TEXTENCODING_UTF8).getStr());
+ }
+
+#if defined(WIN32) || defined(WNT)
+ strcat(tmpPattern, "\\reg_XXXXXX");
+ pTmpName = mktemp(tmpPattern);
+#endif
+
+#ifdef __OS2__
+ strcpy(tmpPattern, tempnam(NULL, "reg_"));
+ pTmpName = tmpPattern;
+#endif
+
+#ifdef UNX
+ strcat(tmpPattern, "/reg_XXXXXX");
+ pTmpName = mktemp(tmpPattern);
+#endif
+
+ return OString(pTmpName);
+}
+
+//*********************************************************************
+// acquire
+//
+static void REGISTRY_CALLTYPE acquire(RegHandle hReg)
+{
+ ORegistry* pReg = (ORegistry*) hReg;
+
+ if (pReg != NULL)
+ pReg->acquire();
+}
+
+
+//*********************************************************************
+// release
+//
+static void REGISTRY_CALLTYPE release(RegHandle hReg)
+{
+ ORegistry* pReg = (ORegistry*) hReg;
+
+ if (pReg)
+ {
+ if (pReg->release() == 0)
+ {
+ delete pReg;
+ hReg = NULL;
+ }
+ }
+}
+
+
+//*********************************************************************
+// getName
+//
+static RegError REGISTRY_CALLTYPE getName(RegHandle hReg, rtl_uString** pName)
+{
+ ORegistry* pReg;
+
+ if (hReg)
+ {
+ pReg = (ORegistry*)hReg;
+ if ( pReg->isOpen() )
+ {
+ rtl_uString_assign(pName, pReg->getName().pData);
+ return REG_NO_ERROR;
+ } else
+ {
+ rtl_uString_new(pName);
+ return REG_REGISTRY_NOT_OPEN;
+ }
+ }
+
+ rtl_uString_new(pName);
+ return REG_INVALID_REGISTRY;
+}
+
+
+//*********************************************************************
+// isReadOnly
+//
+static sal_Bool REGISTRY_CALLTYPE isReadOnly(RegHandle hReg)
+{
+ if (hReg)
+ return ((ORegistry*)hReg)->isReadOnly();
+ else
+ return sal_False;
+}
+
+
+//*********************************************************************
+// createRegistry
+//
+static RegError REGISTRY_CALLTYPE createRegistry(rtl_uString* registryName,
+ RegHandle* phRegistry)
+{
+ RegError ret;
+
+ ORegistry* pReg = new ORegistry();
+ if (ret = pReg->initRegistry(registryName, REG_CREATE))
+ {
+ *phRegistry = NULL;
+ return ret;
+ }
+
+ *phRegistry = pReg;
+
+ return REG_NO_ERROR;
+}
+
+//*********************************************************************
+// openRootKey
+//
+static RegError REGISTRY_CALLTYPE openRootKey(RegHandle hReg,
+ RegKeyHandle* phRootKey)
+{
+ ORegistry* pReg;
+
+ if (hReg)
+ {
+ pReg = (ORegistry*)hReg;
+ if (!pReg->isOpen())
+ return REG_REGISTRY_NOT_OPEN;
+ } else
+ {
+ phRootKey = NULL;
+ return REG_INVALID_REGISTRY;
+ }
+
+ *phRootKey = pReg->getRootKey();
+
+ return REG_NO_ERROR;
+}
+
+
+//*********************************************************************
+// openRegistry
+//
+static RegError REGISTRY_CALLTYPE openRegistry(rtl_uString* registryName,
+ RegHandle* phRegistry,
+ RegAccessMode accessMode)
+{
+ RegError _ret;
+
+ ORegistry* pReg = new ORegistry();
+ if (_ret = pReg->initRegistry(registryName, accessMode))
+ {
+ *phRegistry = NULL;
+ delete pReg;
+ return _ret;
+ }
+
+
+ *phRegistry = pReg;
+
+ return REG_NO_ERROR;
+}
+
+//*********************************************************************
+// closeRegistry
+//
+static RegError REGISTRY_CALLTYPE closeRegistry(RegHandle hReg)
+{
+ ORegistry *pReg;
+
+ if (hReg)
+ {
+ pReg = (ORegistry*)hReg;
+ if (!pReg->isOpen())
+ return REG_REGISTRY_NOT_OPEN;
+
+ RegError ret = REG_NO_ERROR;
+ if (pReg->release() == 0)
+ {
+ delete(pReg);
+ hReg = NULL;
+ }
+ else
+ ret = pReg->closeRegistry();
+
+ return ret;
+ } else
+ {
+ return REG_INVALID_REGISTRY;
+ }
+}
+
+
+//*********************************************************************
+// destroyRegistry
+//
+static RegError REGISTRY_CALLTYPE destroyRegistry(RegHandle hReg,
+ rtl_uString* registryName)
+{
+ ORegistry *pReg;
+
+ if (hReg)
+ {
+ pReg = (ORegistry*)hReg;
+ if (!pReg->isOpen())
+ return REG_INVALID_REGISTRY;
+
+ RegError ret = REG_NO_ERROR;
+ if (!(ret = pReg->destroyRegistry(registryName)))
+ {
+ if (!registryName->length)
+ {
+ delete(pReg);
+ hReg = NULL;
+ }
+ }
+ return ret;
+ } else
+ {
+ return REG_INVALID_REGISTRY;
+ }
+}
+
+
+//*********************************************************************
+// loadRegKey
+//
+static RegError REGISTRY_CALLTYPE loadKey(RegHandle hReg,
+ RegKeyHandle hKey,
+ rtl_uString* keyName,
+ rtl_uString* regFileName)
+{
+ ORegistry *pReg;
+ ORegKey *pKey, *pNewKey;
+ RegError _ret;
+
+ if (hReg)
+ {
+ pReg = (ORegistry*)hReg;
+ if (!pReg->isOpen())
+ return REG_REGISTRY_NOT_OPEN;
+ } else
+ {
+ return REG_INVALID_REGISTRY;
+ }
+
+ if (hKey)
+ {
+ pKey = (ORegKey*)hKey;
+
+ if (pKey->getRegistry() != pReg || pKey->isDeleted())
+ return REG_INVALID_KEY;
+ } else
+ {
+ return REG_INVALID_KEY;
+ }
+
+ if (pKey->isReadOnly())
+ return REG_REGISTRY_READONLY;
+
+ if (!pKey->openKey(keyName, (RegKeyHandle*)&pNewKey))
+ {
+ pKey->closeKey(pNewKey);
+ pKey->deleteKey(keyName);
+ }
+
+ if (_ret = pKey->createKey(keyName, (RegKeyHandle*)&pNewKey))
+ return _ret;
+
+ if (_ret = pReg->loadKey(pNewKey, regFileName))
+ {
+ pKey->closeKey(pNewKey);
+ pKey->deleteKey(keyName);
+ return _ret;
+ }
+
+ return pKey->closeKey(pNewKey);
+}
+
+//*********************************************************************
+// saveKey
+//
+static RegError REGISTRY_CALLTYPE saveKey(RegHandle hReg,
+ RegKeyHandle hKey,
+ rtl_uString* keyName,
+ rtl_uString* regFileName)
+{
+ ORegistry *pReg;
+ ORegKey *pKey, *pNewKey;
+ RegError _ret;
+
+ if (hReg)
+ {
+ pReg = (ORegistry*)hReg;
+ if (!pReg->isOpen())
+ return REG_REGISTRY_NOT_OPEN;
+ } else
+ {
+ return REG_INVALID_REGISTRY;
+ }
+
+ if (hKey)
+ {
+ pKey = (ORegKey*)hKey;
+
+ if (pKey->getRegistry() != pReg || pKey->isDeleted())
+ return REG_INVALID_KEY;
+ } else
+ {
+ return REG_INVALID_KEY;
+ }
+
+ if (_ret = pKey->openKey(keyName, (RegKeyHandle*)&pNewKey))
+ return _ret;
+
+ if (_ret = pReg->saveKey(pNewKey, regFileName))
+ {
+ pKey->closeKey(pNewKey);
+ return _ret;
+ }
+
+ return pKey->closeKey(pNewKey);
+}
+
+//*********************************************************************
+// mergeKey
+//
+static RegError REGISTRY_CALLTYPE mergeKey(RegHandle hReg,
+ RegKeyHandle hKey,
+ rtl_uString* keyName,
+ rtl_uString* regFileName,
+ sal_Bool bWarnings,
+ sal_Bool bReport)
+{
+ ORegistry *pReg;
+ ORegKey *pKey, *pNewKey;
+ RegError _ret;
+
+ if (hReg)
+ {
+ pReg = (ORegistry*)hReg;
+ if (!pReg->isOpen())
+ return(REG_REGISTRY_NOT_OPEN);
+ } else
+ {
+ return REG_INVALID_REGISTRY;
+ }
+
+ if (hKey)
+ {
+ pKey = (ORegKey*)hKey;
+
+ if (pKey->getRegistry() != pReg || pKey->isDeleted())
+ return REG_INVALID_KEY;
+ } else
+ {
+ return REG_INVALID_KEY;
+ }
+
+ if (pKey->isReadOnly())
+ return REG_REGISTRY_READONLY;
+
+ if (keyName->length)
+ {
+ if (_ret = pKey->createKey(keyName, (RegKeyHandle*)&pNewKey) )
+ return _ret;
+ } else
+ {
+ pNewKey = pKey;
+ }
+
+ /*
+ OString tmpName = getTempName();
+ pReg->saveKey(pNewKey, tmpName, sal_False, sal_False);
+ */
+ _ret = pKey->getRegistry()->loadKey(pNewKey, regFileName, bWarnings, bReport);
+ /*
+ if (_ret)
+ {
+ if (_ret == REG_MERGE_ERROR ||
+ (_ret == REG_MERGE_CONFLICT && bWarnings))
+ {
+ pKey->closeKey(pNewKey);
+ pKey->deleteKey(keyName);
+ pKey->createKey(keyName, (RegKeyHandle*)&pNewKey);
+ pReg->loadKey(pNewKey, tmpName, sal_False, sal_False);
+ }
+
+ destroyRegistry(hReg, tmpName);
+
+ pKey->closeKey(pNewKey);
+ return _ret;
+ }
+
+ destroyRegistry(hReg, tmpName);
+ */
+ if ( pKey != pNewKey )
+ _ret = pKey->closeKey(pNewKey);
+
+ return _ret;
+}
+
+
+//*********************************************************************
+// dumpRegistry
+//
+static RegError REGISTRY_CALLTYPE dumpRegistry(RegHandle hReg,
+ RegKeyHandle hKey)
+{
+ ORegistry *pReg;
+ ORegKey *pKey;
+
+ if (hReg)
+ {
+ pReg = (ORegistry*)hReg;
+ if (!pReg->isOpen())
+ return REG_REGISTRY_NOT_OPEN;
+ } else
+ {
+ return REG_INVALID_REGISTRY;
+ }
+
+ if (hKey)
+ {
+ pKey = (ORegKey*)hKey;
+
+ if (pKey->getRegistry() != pReg || pKey->isDeleted())
+ return REG_INVALID_KEY;
+ } else
+ {
+ return REG_INVALID_KEY;
+ }
+
+ return pReg->dumpRegistry(hKey);
+}
+
+
+//*********************************************************************
+// initRegistry_Api
+//
+void REGISTRY_CALLTYPE acquireKey(RegKeyHandle);
+void REGISTRY_CALLTYPE releaseKey(RegKeyHandle);
+sal_Bool REGISTRY_CALLTYPE isKeyReadOnly(RegKeyHandle);
+RegError REGISTRY_CALLTYPE getKeyName(RegKeyHandle, rtl_uString**);
+RegError REGISTRY_CALLTYPE createKey(RegKeyHandle, rtl_uString*, RegKeyHandle*);
+RegError REGISTRY_CALLTYPE openKey(RegKeyHandle, rtl_uString*, RegKeyHandle*);
+RegError REGISTRY_CALLTYPE openSubKeys(RegKeyHandle, rtl_uString*, RegKeyHandle**, sal_uInt32*);
+RegError REGISTRY_CALLTYPE closeSubKeys(RegKeyHandle*, sal_uInt32);
+RegError REGISTRY_CALLTYPE deleteKey(RegKeyHandle, rtl_uString*);
+RegError REGISTRY_CALLTYPE closeKey(RegKeyHandle);
+RegError REGISTRY_CALLTYPE setValue(RegKeyHandle, rtl_uString*, RegValueType, RegValue, sal_uInt32);
+RegError REGISTRY_CALLTYPE setLongListValue(RegKeyHandle, rtl_uString*, sal_Int32*, sal_uInt32);
+RegError REGISTRY_CALLTYPE setStringListValue(RegKeyHandle, rtl_uString*, sal_Char**, sal_uInt32);
+RegError REGISTRY_CALLTYPE setUnicodeListValue(RegKeyHandle, rtl_uString*, sal_Unicode**, sal_uInt32);
+RegError REGISTRY_CALLTYPE getValueInfo(RegKeyHandle, rtl_uString*, RegValueType*, sal_uInt32*);
+RegError REGISTRY_CALLTYPE getValue(RegKeyHandle, rtl_uString*, RegValue);
+RegError REGISTRY_CALLTYPE getLongListValue(RegKeyHandle, rtl_uString*, sal_Int32**, sal_uInt32*);
+RegError REGISTRY_CALLTYPE getStringListValue(RegKeyHandle, rtl_uString*, sal_Char***, sal_uInt32*);
+RegError REGISTRY_CALLTYPE getUnicodeListValue(RegKeyHandle, rtl_uString*, sal_Unicode***, sal_uInt32*);
+RegError REGISTRY_CALLTYPE freeValueList(RegValueType, RegValue, sal_uInt32);
+RegError REGISTRY_CALLTYPE createLink(RegKeyHandle, rtl_uString*, rtl_uString*);
+RegError REGISTRY_CALLTYPE deleteLink(RegKeyHandle, rtl_uString*);
+RegError REGISTRY_CALLTYPE getKeyType(RegKeyHandle, rtl_uString*, RegKeyType*);
+RegError REGISTRY_CALLTYPE getLinkTarget(RegKeyHandle, rtl_uString*, rtl_uString**);
+RegError REGISTRY_CALLTYPE getResolvedKeyName(RegKeyHandle, rtl_uString*, sal_Bool, rtl_uString**);
+RegError REGISTRY_CALLTYPE getKeyNames(RegKeyHandle, rtl_uString*, rtl_uString***, sal_uInt32*);
+RegError REGISTRY_CALLTYPE freeKeyNames(rtl_uString**, sal_uInt32);
+
+
+extern "C" Registry_Api* REGISTRY_CALLTYPE initRegistry_Api(void)
+{
+ static Registry_Api aApi= {&acquire,
+ &release,
+ &isReadOnly,
+ &openRootKey,
+ &getName,
+ &createRegistry,
+ &openRegistry,
+ &closeRegistry,
+ &destroyRegistry,
+ &loadKey,
+ &saveKey,
+ &mergeKey,
+ &dumpRegistry,
+ &acquireKey,
+ &releaseKey,
+ &isKeyReadOnly,
+ &getKeyName,
+ &createKey,
+ &openKey,
+ &openSubKeys,
+ &closeSubKeys,
+ &deleteKey,
+ &closeKey,
+ &setValue,
+ &setLongListValue,
+ &setStringListValue,
+ &setUnicodeListValue,
+ &getValueInfo,
+ &getValue,
+ &getLongListValue,
+ &getStringListValue,
+ &getUnicodeListValue,
+ &freeValueList,
+ &createLink,
+ &deleteLink,
+ &getKeyType,
+ &getLinkTarget,
+ &getResolvedKeyName,
+ &getKeyNames,
+ &freeKeyNames};
+
+ return (&aApi);
+}
+
+
+//*********************************************************************
+// reg_loadRegKey
+//
+RegError REGISTRY_CALLTYPE reg_loadKey(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ rtl_uString* regFileName)
+{
+ ORegKey *pKey;
+
+ if (hKey)
+ pKey = (ORegKey*)hKey;
+ else
+ return REG_INVALID_KEY;
+
+ return loadKey(pKey->getRegistry(), hKey, keyName, regFileName);
+}
+
+//*********************************************************************
+// reg_saveKey
+//
+RegError REGISTRY_CALLTYPE reg_saveKey(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ rtl_uString* regFileName)
+{
+ ORegKey *pKey;
+
+ if (hKey)
+ pKey = (ORegKey*)hKey;
+ else
+ return REG_INVALID_KEY;
+
+ return saveKey(pKey->getRegistry(), hKey, keyName, regFileName);
+}
+
+//*********************************************************************
+// reg_mergeKey
+//
+RegError REGISTRY_CALLTYPE reg_mergeKey(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ rtl_uString* regFileName,
+ sal_Bool bWarnings,
+ sal_Bool bReport)
+{
+ ORegKey *pKey;
+
+ if (hKey)
+ pKey = (ORegKey*)hKey;
+ else
+ return REG_INVALID_KEY;
+
+ return mergeKey(pKey->getRegistry(), hKey, keyName, regFileName, bWarnings, bReport);
+}
+
+//*********************************************************************
+// reg_createRegistry
+//
+RegError REGISTRY_CALLTYPE reg_createRegistry(rtl_uString* registryName,
+ RegHandle* phRegistry)
+{
+ RegError ret;
+
+ ORegistry* pReg = new ORegistry();
+ if (ret = pReg->initRegistry(registryName, REG_CREATE))
+ {
+ *phRegistry = NULL;
+ return ret;
+ }
+
+ *phRegistry = pReg;
+
+ return REG_NO_ERROR;
+}
+
+//*********************************************************************
+// reg_openRootKey
+//
+RegError REGISTRY_CALLTYPE reg_openRootKey(RegHandle hRegistry,
+ RegKeyHandle* phRootKey)
+{
+ return openRootKey(hRegistry, phRootKey);
+}
+
+
+//*********************************************************************
+// reg_getName
+//
+const RegError REGISTRY_CALLTYPE reg_getName(RegHandle hRegistry, rtl_uString** pName)
+{
+ return getName(hRegistry, pName);
+}
+
+
+//*********************************************************************
+// reg_isReadOnly
+//
+sal_Bool REGISTRY_CALLTYPE reg_isReadOnly(RegHandle hRegistry)
+{
+ return isReadOnly(hRegistry);
+}
+
+
+//*********************************************************************
+// reg_openRegistry
+//
+RegError REGISTRY_CALLTYPE reg_openRegistry(rtl_uString* registryName,
+ RegHandle* phRegistry,
+ RegAccessMode accessMode)
+{
+ RegError _ret;
+
+ ORegistry* pReg = new ORegistry();
+ if (_ret = pReg->initRegistry(registryName, accessMode))
+ {
+ *phRegistry = NULL;
+ return _ret;
+ }
+
+ *phRegistry = pReg;
+
+ return REG_NO_ERROR;
+}
+
+//*********************************************************************
+// reg_closeRegistry
+//
+RegError REGISTRY_CALLTYPE reg_closeRegistry(RegHandle hRegistry)
+{
+ ORegistry* pReg;
+
+ if (hRegistry)
+ {
+ pReg = (ORegistry*)hRegistry;
+ delete(pReg);
+ return REG_NO_ERROR;
+ } else
+ {
+ return REG_REGISTRY_NOT_OPEN;
+ }
+}
+
+
+//*********************************************************************
+// reg_destroyRegistry
+//
+RegError REGISTRY_CALLTYPE reg_destroyRegistry(RegHandle hRegistry,
+ rtl_uString* registryName)
+{
+ return destroyRegistry(hRegistry, registryName);
+}
+
+
+//*********************************************************************
+// reg_dumpRegistry
+//
+RegError REGISTRY_CALLTYPE reg_dumpRegistry(RegKeyHandle hKey)
+{
+ ORegKey *pKey;
+
+ if (hKey)
+ pKey = (ORegKey*)hKey;
+ else
+ return REG_INVALID_KEY;
+
+ return dumpRegistry(pKey->getRegistry(), hKey);
+}
+
+
diff --git a/registry/source/regkey.cxx b/registry/source/regkey.cxx
new file mode 100644
index 000000000000..7da6044705a2
--- /dev/null
+++ b/registry/source/regkey.cxx
@@ -0,0 +1,1298 @@
+/*************************************************************************
+ *
+ * $RCSfile: regkey.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _REGISTRY_REGISTRY_HXX_
+#include <registry/registry.hxx>
+#endif
+
+#ifndef _RTL_ALLOC_H_
+#include <rtl/alloc.h>
+#endif
+
+#ifndef _REGIMPL_HXX_
+#include "regimpl.hxx"
+#endif
+
+#ifndef _KEYIMPL_HXX_
+#include "keyimpl.hxx"
+#endif
+
+
+//*********************************************************************
+// acquireKey
+//
+void REGISTRY_CALLTYPE acquireKey(RegKeyHandle hKey)
+{
+ ORegKey* pKey = (ORegKey*) hKey;
+
+ if (pKey != NULL)
+ pKey->acquire();
+}
+
+
+//*********************************************************************
+// releaseKey
+//
+void REGISTRY_CALLTYPE releaseKey(RegKeyHandle hKey)
+{
+ ORegKey* pKey = (ORegKey*) hKey;
+
+ if (pKey)
+ {
+ if (pKey->release() == 0)
+ delete pKey;
+ }
+}
+
+
+//*********************************************************************
+// isKeyReadOnly
+//
+sal_Bool REGISTRY_CALLTYPE isKeyReadOnly(RegKeyHandle hKey)
+{
+ if (hKey)
+ {
+ return ((ORegKey*)hKey)->isReadOnly();
+ } else
+ {
+ return sal_False;
+ }
+}
+
+
+//*********************************************************************
+// getKeyName
+//
+RegError REGISTRY_CALLTYPE getKeyName(RegKeyHandle hKey, rtl_uString** pKeyName)
+{
+ if (hKey)
+ {
+ rtl_uString_assign( pKeyName, ((ORegKey*)hKey)->getName().pData );
+ return REG_NO_ERROR;
+ } else
+ {
+ rtl_uString_new(pKeyName);
+ return REG_INVALID_KEY;
+ }
+}
+
+
+//*********************************************************************
+// createKey
+//
+RegError REGISTRY_CALLTYPE createKey(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegKeyHandle* phNewKey)
+{
+ ORegKey* pKey;
+
+ if (hKey)
+ {
+ pKey = (ORegKey*)hKey;
+
+ if (pKey->isDeleted())
+ {
+ phNewKey = NULL;
+ return REG_INVALID_KEY;
+ }
+ } else
+ {
+ phNewKey = NULL;
+ return REG_INVALID_KEY;
+ }
+
+ if (pKey->isReadOnly())
+ return REG_REGISTRY_READONLY;
+
+ return pKey->createKey(keyName, phNewKey);
+}
+
+//*********************************************************************
+// openKey
+//
+RegError REGISTRY_CALLTYPE openKey(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegKeyHandle* phOpenKey)
+{
+ ORegKey* pKey;
+
+ if (hKey)
+ {
+ pKey = (ORegKey*)hKey;
+
+ if (pKey->isDeleted())
+ {
+ phOpenKey = NULL;
+ return REG_INVALID_KEY;
+ }
+ } else
+ {
+ phOpenKey = NULL;
+ return REG_INVALID_KEY;
+ }
+
+ return pKey->openKey(keyName, phOpenKey);
+}
+
+//*********************************************************************
+// openSubKeys
+//
+RegError REGISTRY_CALLTYPE openSubKeys(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegKeyHandle** pphSubKeys,
+ sal_uInt32* pnSubKeys)
+{
+ ORegKey* pKey;
+
+ if (hKey)
+ {
+ pKey = (ORegKey*)hKey;
+
+ if (pKey->isDeleted())
+ {
+ pphSubKeys = NULL;
+ return REG_INVALID_KEY;
+ }
+ } else
+ {
+ pphSubKeys = NULL;
+ return REG_INVALID_KEY;
+ }
+
+ return pKey->openSubKeys(keyName, pphSubKeys, pnSubKeys);
+}
+
+//*********************************************************************
+// closeSubKeys
+//
+RegError REGISTRY_CALLTYPE closeSubKeys(RegKeyHandle* phSubKeys,
+ sal_uInt32 nSubKeys)
+{
+ RegError _ret = REG_NO_ERROR;
+
+ if (phSubKeys)
+ {
+ ORegistry* pReg = NULL;
+
+ pReg = ((ORegKey*)phSubKeys[0])->getRegistry();
+
+ for (int i=0; (i < nSubKeys) && (_ret == REG_NO_ERROR); i++)
+ {
+ _ret = pReg->closeKey(phSubKeys[i]);
+ }
+
+ rtl_freeMemory(phSubKeys);
+ }
+ else
+ _ret = REG_INVALID_KEY;
+
+ return _ret;
+}
+
+
+//*********************************************************************
+// deleteKey
+//
+RegError REGISTRY_CALLTYPE deleteKey(RegKeyHandle hKey,
+ rtl_uString* keyName)
+{
+ ORegKey* pKey;
+
+ if (hKey)
+ {
+ pKey = (ORegKey*)hKey;
+
+ if (pKey->isDeleted())
+ return REG_INVALID_KEY;
+ } else
+ return REG_INVALID_KEY;
+
+ if (pKey->isReadOnly())
+ return REG_REGISTRY_READONLY;
+
+ return pKey->deleteKey(keyName);
+}
+
+//*********************************************************************
+// closeKey
+//
+RegError REGISTRY_CALLTYPE closeKey(RegKeyHandle hKey)
+{
+ ORegKey* pKey;
+ ORegistry* pReg;
+
+ if (hKey)
+ {
+ pKey = (ORegKey*)hKey;
+
+ pReg = pKey->getRegistry();
+
+ if (pReg->closeKey(hKey))
+ return REG_INVALID_KEY;
+ } else
+ return REG_INVALID_KEY;
+
+ return REG_NO_ERROR;
+}
+
+
+//*********************************************************************
+// setValue
+//
+RegError REGISTRY_CALLTYPE setValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegValueType valueType,
+ RegValue pData,
+ sal_uInt32 valueSize)
+{
+ ORegKey* pKey;
+
+ if (hKey)
+ {
+ pKey = (ORegKey*)hKey;
+
+ if (pKey->isDeleted())
+ return REG_INVALID_KEY;
+ } else
+ return REG_INVALID_KEY;
+
+ if (pKey->isReadOnly())
+ return REG_REGISTRY_READONLY;
+
+ OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
+ if (keyName->length)
+ {
+ RegKeyHandle hSubKey;
+ ORegKey* pSubKey;
+ RegError _ret1, _ret2;
+ if (_ret1 = pKey->openKey(keyName, &hSubKey))
+ return _ret1;
+
+ pSubKey = (ORegKey*)hSubKey;
+ if (_ret1 = pSubKey->setValue(valueName, valueType, pData, valueSize))
+ {
+ if (_ret2 = pKey->closeKey(hSubKey))
+ return _ret2;
+ else
+ return _ret1;
+ }
+
+ return pKey->closeKey(hSubKey);
+ }
+
+ return pKey->setValue(valueName, valueType, pData, valueSize);
+}
+
+//*********************************************************************
+// setLongValueList
+//
+RegError REGISTRY_CALLTYPE setLongListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Int32* pValueList,
+ sal_uInt32 len)
+{
+ ORegKey* pKey;
+
+ if (hKey)
+ {
+ pKey = (ORegKey*)hKey;
+
+ if (pKey->isDeleted())
+ return REG_INVALID_KEY;
+ } else
+ return REG_INVALID_KEY;
+
+ if (pKey->isReadOnly())
+ return REG_REGISTRY_READONLY;
+
+ OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
+ if (keyName->length)
+ {
+ RegKeyHandle hSubKey;
+ ORegKey* pSubKey;
+ RegError _ret1, _ret2;
+ if (_ret1 = pKey->openKey(keyName, &hSubKey))
+ return _ret1;
+
+ pSubKey = (ORegKey*)hSubKey;
+ if (_ret1 = pSubKey->setLongListValue(valueName, pValueList, len))
+ {
+ if (_ret2 = pKey->closeKey(hSubKey))
+ return _ret2;
+ else
+ return _ret1;
+ }
+
+ return pKey->closeKey(hSubKey);
+ }
+
+ return pKey->setLongListValue(valueName, pValueList, len);
+}
+
+//*********************************************************************
+// setStringValueList
+//
+RegError REGISTRY_CALLTYPE setStringListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Char** pValueList,
+ sal_uInt32 len)
+{
+ ORegKey* pKey;
+
+ if (hKey)
+ {
+ pKey = (ORegKey*)hKey;
+
+ if (pKey->isDeleted())
+ return REG_INVALID_KEY;
+ } else
+ return REG_INVALID_KEY;
+
+ if (pKey->isReadOnly())
+ return REG_REGISTRY_READONLY;
+
+ OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
+ if (keyName->length)
+ {
+ RegKeyHandle hSubKey;
+ ORegKey* pSubKey;
+ RegError _ret1, _ret2;
+ if (_ret1 = pKey->openKey(keyName, &hSubKey))
+ return _ret1;
+
+ pSubKey = (ORegKey*)hSubKey;
+ if (_ret1 = pSubKey->setStringListValue(valueName, pValueList, len))
+ {
+ if (_ret2 = pKey->closeKey(hSubKey))
+ return _ret2;
+ else
+ return _ret1;
+ }
+
+ return pKey->closeKey(hSubKey);
+ }
+
+ return pKey->setStringListValue(valueName, pValueList, len);
+}
+
+//*********************************************************************
+// setUnicodeValueList
+//
+RegError REGISTRY_CALLTYPE setUnicodeListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Unicode** pValueList,
+ sal_uInt32 len)
+{
+ ORegKey* pKey;
+
+ if (hKey)
+ {
+ pKey = (ORegKey*)hKey;
+
+ if (pKey->isDeleted())
+ return REG_INVALID_KEY;
+ } else
+ return REG_INVALID_KEY;
+
+ if (pKey->isReadOnly())
+ return REG_REGISTRY_READONLY;
+
+ OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
+ if (keyName->length)
+ {
+ RegKeyHandle hSubKey;
+ ORegKey* pSubKey;
+ RegError _ret1, _ret2;
+ if (_ret1 = pKey->openKey(keyName, &hSubKey))
+ return _ret1;
+
+ pSubKey = (ORegKey*)hSubKey;
+ if (_ret1 = pSubKey->setUnicodeListValue(valueName, pValueList, len))
+ {
+ if (_ret2 = pKey->closeKey(hSubKey))
+ return _ret2;
+ else
+ return _ret1;
+ }
+
+ return pKey->closeKey(hSubKey);
+ }
+
+ return pKey->setUnicodeListValue(valueName, pValueList, len);
+}
+
+//*********************************************************************
+// getValueInfo
+//
+RegError REGISTRY_CALLTYPE getValueInfo(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegValueType* pValueType,
+ sal_uInt32* pValueSize)
+{
+ ORegKey* pKey;
+ RegValueType valueType;
+ sal_uInt32 valueSize;
+
+ *pValueType = RG_VALUETYPE_NOT_DEFINED;
+ *pValueSize = 0;
+
+ if (hKey)
+ {
+ pKey = (ORegKey*)hKey;
+
+ if (pKey->isDeleted())
+ return REG_INVALID_KEY;
+ } else
+ return REG_INVALID_KEY;
+
+ OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
+ if (keyName->length)
+ {
+ RegKeyHandle hSubKey;
+ ORegKey* pSubKey;
+ RegError _ret;
+ if (_ret = pKey->openKey(keyName, &hSubKey))
+ return _ret;
+
+ pSubKey = (ORegKey*)hSubKey;
+ if (pSubKey->getValueInfo(valueName, &valueType, &valueSize))
+ {
+ if (_ret = pKey->closeKey(hSubKey))
+ return _ret;
+ else
+ return REG_INVALID_VALUE;
+ }
+
+ *pValueType = valueType;
+ *pValueSize = valueSize;
+
+ return pKey->closeKey(hSubKey);
+ }
+
+
+ if (pKey->getValueInfo(valueName, &valueType, &valueSize))
+ {
+ return REG_INVALID_VALUE;
+ }
+
+ *pValueType = valueType;
+ *pValueSize = valueSize;
+
+ return REG_NO_ERROR;
+}
+
+//*********************************************************************
+// getValueInfo
+//
+RegError REGISTRY_CALLTYPE getValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegValue pValue)
+{
+ ORegKey* pKey;
+
+ if (hKey)
+ {
+ pKey = (ORegKey*)hKey;
+
+ if (pKey->isDeleted())
+ {
+ pValue = NULL;
+ return REG_INVALID_KEY;
+ }
+ } else
+ {
+ pValue = NULL;
+ return REG_INVALID_KEY;
+ }
+
+ OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
+ if (keyName->length)
+ {
+ RegKeyHandle hSubKey;
+ ORegKey* pSubKey;
+ RegError _ret1, _ret2;
+ if (_ret1 = pKey->openKey(keyName, &hSubKey))
+ {
+ pValue = NULL;
+ return _ret1;
+ }
+
+ pSubKey = (ORegKey*)hSubKey;
+ if (_ret1 = pSubKey->getValue(valueName, pValue))
+ {
+ if (_ret2 = pKey->closeKey(hSubKey))
+ {
+ pValue = NULL;
+ return _ret2;
+ } else
+ {
+ pValue = NULL;
+ return _ret1;
+ }
+ }
+
+ return pKey->closeKey(hSubKey);
+ }
+
+ return pKey->getValue(valueName, pValue);
+}
+
+//*********************************************************************
+// getLongValueList
+//
+RegError REGISTRY_CALLTYPE getLongListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Int32** pValueList,
+ sal_uInt32* pLen)
+{
+ ORegKey* pKey;
+
+ if (hKey)
+ {
+ pKey = (ORegKey*)hKey;
+
+ if (pKey->isDeleted())
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ return REG_INVALID_KEY;
+ }
+ } else
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ return REG_INVALID_KEY;
+ }
+
+ OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
+ if (keyName->length)
+ {
+ RegKeyHandle hSubKey;
+ ORegKey* pSubKey;
+ RegError _ret1, _ret2;
+ if (_ret1 = pKey->openKey(keyName, &hSubKey))
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ return _ret1;
+ }
+
+ pSubKey = (ORegKey*)hSubKey;
+
+ if (_ret1 = pSubKey->getLongListValue(valueName, pValueList, pLen))
+ {
+ if (_ret2 = pKey->closeKey(hSubKey))
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ return _ret2;
+ } else
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ return _ret1;
+ }
+ }
+
+ return pKey->closeKey(hSubKey);
+ }
+
+ return pKey->getLongListValue(valueName, pValueList, pLen);
+}
+
+//*********************************************************************
+// getStringValueList
+//
+RegError REGISTRY_CALLTYPE getStringListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Char*** pValueList,
+ sal_uInt32* pLen)
+{
+ ORegKey* pKey;
+
+ if (hKey)
+ {
+ pKey = (ORegKey*)hKey;
+
+ if (pKey->isDeleted())
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ return REG_INVALID_KEY;
+ }
+ } else
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ return REG_INVALID_KEY;
+ }
+
+ OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
+ if (keyName->length)
+ {
+ RegKeyHandle hSubKey;
+ ORegKey* pSubKey;
+ RegError _ret1, _ret2;
+ if ((_ret1 = pKey->openKey(keyName, &hSubKey)))
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ return _ret1;
+ }
+
+ pSubKey = (ORegKey*)hSubKey;
+
+ if (_ret1 = pSubKey->getStringListValue(valueName, pValueList, pLen))
+ {
+ if (_ret2 = pKey->closeKey(hSubKey))
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ return _ret2;
+ } else
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ return _ret1;
+ }
+ }
+
+ return pKey->closeKey(hSubKey);
+ }
+
+ return pKey->getStringListValue(valueName, pValueList, pLen);
+}
+
+//*********************************************************************
+// getUnicodeListValue
+//
+RegError REGISTRY_CALLTYPE getUnicodeListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Unicode*** pValueList,
+ sal_uInt32* pLen)
+{
+ ORegKey* pKey;
+
+ if (hKey)
+ {
+ pKey = (ORegKey*)hKey;
+
+ if (pKey->isDeleted())
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ return REG_INVALID_KEY;
+ }
+ } else
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ return REG_INVALID_KEY;
+ }
+
+ OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
+ if (keyName->length)
+ {
+ RegKeyHandle hSubKey;
+ ORegKey* pSubKey;
+ RegError _ret1, _ret2;
+ if (_ret1 = pKey->openKey(keyName, &hSubKey))
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ return _ret1;
+ }
+
+ pSubKey = (ORegKey*)hSubKey;
+
+ if (_ret1 = pSubKey->getUnicodeListValue(valueName, pValueList, pLen))
+ {
+ if (_ret2 = pKey->closeKey(hSubKey))
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ return _ret2;
+ } else
+ {
+ pValueList = NULL;
+ *pLen = 0;
+ return _ret1;
+ }
+ }
+
+ return pKey->closeKey(hSubKey);
+ }
+
+ return pKey->getUnicodeListValue(valueName, pValueList, pLen);
+}
+
+//*********************************************************************
+// freeValueList
+//
+RegError REGISTRY_CALLTYPE freeValueList(RegValueType valueType,
+ RegValue pValueList,
+ sal_uInt32 len)
+{
+ switch (valueType)
+ {
+ case 5:
+ {
+ sal_Int32* pVList = (sal_Int32*)pValueList;
+ rtl_freeMemory(pValueList);
+ }
+ break;
+ case 6:
+ {
+ sal_Char** pVList = (sal_Char**)pValueList;
+ for (int i=0; i < len; i++)
+ {
+ rtl_freeMemory(pVList[i]);
+ }
+
+ rtl_freeMemory(pVList);
+ }
+ break;
+ case 7:
+ {
+ sal_Unicode** pVList = (sal_Unicode**)pValueList;
+ for (int i=0; i < len; i++)
+ {
+ rtl_freeMemory(pVList[i]);
+ }
+
+ rtl_freeMemory(pVList);
+ }
+ break;
+ default:
+ return REG_INVALID_VALUE;
+ }
+
+ pValueList = NULL;
+ return REG_NO_ERROR;
+}
+
+
+//*********************************************************************
+// createLink
+//
+RegError REGISTRY_CALLTYPE createLink(RegKeyHandle hKey,
+ rtl_uString* linkName,
+ rtl_uString* linkTarget)
+{
+ ORegKey* pKey;
+
+ if (hKey)
+ {
+ pKey = (ORegKey*)hKey;
+
+ if (pKey->isDeleted())
+ return REG_INVALID_KEY;
+ } else
+ return REG_INVALID_KEY;
+
+ if (pKey->isReadOnly())
+ return REG_REGISTRY_READONLY;
+
+ return pKey->createLink(linkName, linkTarget);
+}
+
+//*********************************************************************
+// deleteLink
+//
+RegError REGISTRY_CALLTYPE deleteLink(RegKeyHandle hKey,
+ rtl_uString* linkName)
+{
+ ORegKey* pKey;
+
+ if (hKey)
+ {
+ pKey = (ORegKey*)hKey;
+
+ if (pKey->isDeleted())
+ return REG_INVALID_KEY;
+ } else
+ return REG_INVALID_KEY;
+
+ if (pKey->isReadOnly())
+ return REG_REGISTRY_READONLY;
+
+ return pKey->deleteLink(linkName);
+}
+
+//*********************************************************************
+// getKeyType
+//
+RegError REGISTRY_CALLTYPE getKeyType(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegKeyType* pKeyType)
+{
+ ORegKey* pKey;
+
+ if (hKey)
+ {
+ pKey = (ORegKey*)hKey;
+
+ if (pKey->isDeleted())
+ return REG_INVALID_KEY;
+ } else
+ return REG_INVALID_KEY;
+
+ return pKey->getKeyType(keyName, pKeyType);
+}
+
+//*********************************************************************
+// getLinkTarget
+//
+RegError REGISTRY_CALLTYPE getLinkTarget(RegKeyHandle hKey,
+ rtl_uString* linkName,
+ rtl_uString** pLinkTarget)
+{
+ ORegKey* pKey;
+
+ if (hKey)
+ {
+ pKey = (ORegKey*)hKey;
+
+ if (pKey->isDeleted())
+ return REG_INVALID_KEY;
+ } else
+ return REG_INVALID_KEY;
+
+ OUString linkTarget;
+ RegError ret = pKey->getLinkTarget(linkName, linkTarget);
+ if (!ret)
+ rtl_uString_assign(pLinkTarget, linkTarget.pData);
+ return ret;
+}
+
+
+//*********************************************************************
+// getName
+//
+RegError REGISTRY_CALLTYPE getResolvedKeyName(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Bool firstLinkOnly,
+ rtl_uString** pResolvedName)
+{
+ ORegKey *pKey;
+ RegError _ret = REG_NO_ERROR;
+
+ if (hKey)
+ {
+ pKey = (ORegKey*)hKey;
+
+ if (pKey->isDeleted())
+ return REG_INVALID_KEY;
+ } else
+ return REG_INVALID_KEY;
+
+ OUString resolvedName;
+ _ret = pKey->getResolvedKeyName(keyName, resolvedName, firstLinkOnly);
+ if (!_ret)
+ rtl_uString_assign(pResolvedName, resolvedName.pData);
+ return _ret;
+}
+
+
+//*********************************************************************
+// getKeyNames
+//
+RegError REGISTRY_CALLTYPE getKeyNames(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ rtl_uString*** pSubKeyNames,
+ sal_uInt32* pnSubKeys)
+{
+ ORegKey* pKey;
+
+ if (hKey)
+ {
+ pKey = (ORegKey*)hKey;
+
+ if (pKey->isDeleted())
+ return REG_INVALID_KEY;
+ } else
+ return REG_INVALID_KEY;
+
+ return pKey->getKeyNames(keyName, pSubKeyNames, pnSubKeys);
+}
+
+//*********************************************************************
+// freeKeyNames
+//
+RegError REGISTRY_CALLTYPE freeKeyNames(rtl_uString** pKeyNames,
+ sal_uInt32 nKeys)
+{
+ for (int i=0; i <nKeys; i++)
+ {
+ rtl_uString_release(pKeyNames[i]);
+ }
+
+ rtl_freeMemory(pKeyNames);
+
+ return REG_NO_ERROR;
+}
+
+//*********************************************************************
+// C API
+//
+
+//*********************************************************************
+// reg_createKey
+//
+RegError REGISTRY_CALLTYPE reg_createKey(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegKeyHandle* phNewKey)
+{
+ if (!hKey)
+ return REG_INVALID_KEY;
+
+ return createKey(hKey, keyName, phNewKey);
+}
+
+//*********************************************************************
+// reg_openKey
+//
+RegError REGISTRY_CALLTYPE reg_openKey(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegKeyHandle* phOpenKey)
+{
+ if (!hKey)
+ return REG_INVALID_KEY;
+
+ return openKey(hKey, keyName, phOpenKey);
+}
+
+//*********************************************************************
+// reg_openSubKeys
+//
+RegError REGISTRY_CALLTYPE reg_openSubKeys(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegKeyHandle** pphSubKeys,
+ sal_uInt32* pnSubKeys)
+{
+ if (!hKey)
+ return REG_INVALID_KEY;
+
+ return openSubKeys(hKey, keyName, pphSubKeys, pnSubKeys);
+}
+
+//*********************************************************************
+// reg_closeSubKeys
+//
+RegError REGISTRY_CALLTYPE reg_closeSubKeys(RegKeyHandle* pphSubKeys,
+ sal_uInt32 nSubKeys)
+{
+ if (!pphSubKeys)
+ return REG_INVALID_KEY;
+
+ return closeSubKeys(pphSubKeys, nSubKeys);
+}
+
+//*********************************************************************
+// reg_deleteKey
+//
+RegError REGISTRY_CALLTYPE reg_deleteKey(RegKeyHandle hKey,
+ rtl_uString* keyName)
+{
+ if (!hKey)
+ return REG_INVALID_KEY;
+
+ return deleteKey(hKey, keyName);
+}
+
+//*********************************************************************
+// reg_closeKey
+//
+RegError REGISTRY_CALLTYPE reg_closeKey(RegKeyHandle hKey)
+{
+ if (!hKey)
+ return REG_INVALID_KEY;
+
+ return closeKey(hKey);
+}
+
+
+//*********************************************************************
+// reg_getKeyName
+//
+const RegError REGISTRY_CALLTYPE reg_getKeyName(RegKeyHandle hKey, rtl_uString** pKeyName)
+{
+ if (hKey)
+ {
+ rtl_uString_assign( pKeyName, ((ORegKey*)hKey)->getName().pData );
+ return REG_NO_ERROR;
+ } else
+ {
+ rtl_uString_new( pKeyName );
+ return REG_INVALID_KEY;
+ }
+}
+
+//*********************************************************************
+// reg_setValue
+//
+RegError REGISTRY_CALLTYPE reg_setValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegValueType valueType,
+ RegValue pData,
+ sal_uInt32 valueSize)
+{
+ if (!hKey)
+ return REG_INVALID_KEY;
+
+ return setValue(hKey, keyName, valueType, pData, valueSize);
+}
+
+//*********************************************************************
+// reg_setLongListValue
+//
+RegError REGISTRY_CALLTYPE reg_setLongListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Int32* pValueList,
+ sal_uInt32 len)
+{
+ if (!hKey)
+ return REG_INVALID_KEY;
+
+ return setLongListValue(hKey, keyName, pValueList, len);
+}
+
+//*********************************************************************
+// reg_setStringListValue
+//
+RegError REGISTRY_CALLTYPE reg_setStringListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Char** pValueList,
+ sal_uInt32 len)
+{
+ if (!hKey)
+ return REG_INVALID_KEY;
+
+ return setStringListValue(hKey, keyName, pValueList, len);
+}
+
+//*********************************************************************
+// reg_setUnicodeListValue
+//
+RegError REGISTRY_CALLTYPE reg_setUnicodeListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Unicode** pValueList,
+ sal_uInt32 len)
+{
+ if (!hKey)
+ return REG_INVALID_KEY;
+
+ return setUnicodeListValue(hKey, keyName, pValueList, len);
+}
+
+//*********************************************************************
+// reg_getValueInfo
+//
+RegError REGISTRY_CALLTYPE reg_getValueInfo(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegValueType* pValueType,
+ sal_uInt32* pValueSize)
+{
+ if (!hKey)
+ return REG_INVALID_KEY;
+
+ return getValueInfo(hKey, keyName, pValueType, pValueSize);
+}
+
+//*********************************************************************
+// reg_getValueInfo
+//
+RegError REGISTRY_CALLTYPE reg_getValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegValue pData)
+{
+ if (!hKey)
+ return REG_INVALID_KEY;
+
+ return getValue(hKey, keyName, pData);
+}
+
+//*********************************************************************
+// reg_getLongListValue
+//
+RegError REGISTRY_CALLTYPE reg_getLongListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Int32** pValueList,
+ sal_uInt32* pLen)
+{
+ if (!hKey)
+ return REG_INVALID_KEY;
+
+ return getLongListValue(hKey, keyName, pValueList, pLen);
+}
+
+//*********************************************************************
+// reg_getStringListValue
+//
+RegError REGISTRY_CALLTYPE reg_getStringListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Char*** pValueList,
+ sal_uInt32* pLen)
+{
+ if (!hKey)
+ return REG_INVALID_KEY;
+
+ return getStringListValue(hKey, keyName, pValueList, pLen);
+}
+
+//*********************************************************************
+// reg_getUnicodeListValue
+//
+RegError REGISTRY_CALLTYPE reg_getUnicodeListValue(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Unicode*** pValueList,
+ sal_uInt32* pLen)
+{
+ if (!hKey)
+ return REG_INVALID_KEY;
+
+ return getUnicodeListValue(hKey, keyName, pValueList, pLen);
+}
+
+//*********************************************************************
+// reg_freeValueList
+//
+RegError REGISTRY_CALLTYPE reg_freeValueList(RegValueType valueType,
+ RegValue pValueList,
+ sal_uInt32 len)
+{
+ if (pValueList)
+ return freeValueList(valueType, pValueList, len);
+ else
+ return REG_INVALID_VALUE;
+}
+
+//*********************************************************************
+// reg_createLink
+//
+RegError REGISTRY_CALLTYPE reg_createLink(RegKeyHandle hKey,
+ rtl_uString* linkName,
+ rtl_uString* linkTarget)
+{
+ if (!hKey)
+ return REG_INVALID_KEY;
+
+ return createLink(hKey, linkName, linkTarget);
+}
+
+//*********************************************************************
+// reg_deleteLink
+//
+RegError REGISTRY_CALLTYPE reg_deleteLink(RegKeyHandle hKey,
+ rtl_uString* linkName)
+{
+ if (!hKey)
+ return REG_INVALID_KEY;
+
+ return deleteLink(hKey, linkName);
+}
+
+//*********************************************************************
+// reg_getKeyType
+//
+RegError REGISTRY_CALLTYPE reg_getKeyType(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ RegKeyType* pKeyType)
+{
+ if (!hKey)
+ return REG_INVALID_KEY;
+
+ return getKeyType(hKey, keyName, pKeyType);
+}
+
+//*********************************************************************
+// reg_getLinkTarget
+//
+RegError REGISTRY_CALLTYPE reg_getLinkTarget(RegKeyHandle hKey,
+ rtl_uString* linkName,
+ rtl_uString** pLinkTarget)
+{
+ if (!hKey)
+ return REG_INVALID_KEY;
+
+ return getLinkTarget(hKey, linkName, pLinkTarget);
+}
+
+
+//*********************************************************************
+// reg_getResolvedKeyName
+//
+RegError REGISTRY_CALLTYPE reg_getResolvedKeyName(RegKeyHandle hKey,
+ rtl_uString* keyName,
+ sal_Bool firstLinkOnly,
+ rtl_uString** pResolvedName)
+{
+ ORegKey *pKey;
+
+ if (hKey)
+ pKey = (ORegKey*)hKey;
+ else
+ return REG_INVALID_KEY;
+
+ return getResolvedKeyName(hKey, keyName, firstLinkOnly, pResolvedName);
+}
+
+
diff --git a/registry/source/regmap.hxx b/registry/source/regmap.hxx
new file mode 100644
index 000000000000..1bf07bb3a69a
--- /dev/null
+++ b/registry/source/regmap.hxx
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * $RCSfile: regmap.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _REGMAP_HXX_
+#define _REGMAP_HXX_
+
+#if STLPORT_VERSION<321
+#include <hash_map.h>
+#include <list.h>
+#include <set.h>
+#else
+#include <hash_map>
+#include <list>
+#include <set>
+#endif
+
+#ifndef _VOS_MACROS_HXX_
+#include <vos/macros.hxx>
+#endif
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+using namespace rtl;
+
+class ORegKey;
+
+struct EqualString
+{
+ bool operator()(const OUString& str1, const OUString& str2) const
+ {
+ return (str1 == str2);
+ }
+};
+
+struct HashString
+{
+ size_t operator()(const OUString& str) const
+ {
+ return str.hashCode();
+ }
+};
+
+struct LessString
+{
+ bool operator()(const OUString& str1, const OUString& str2) const
+ {
+ return (str1 < str2);
+ }
+};
+
+typedef NAMESPACE_STD(hash_map) <OUString, ORegKey*, HashString, EqualString> KeyMap;
+
+typedef NAMESPACE_STD(list) <ORegKey*> LinkList;
+
+typedef NAMESPACE_STD(set) <OUString, LessString> StringSet;
+
+#endif
diff --git a/registry/test/makefile.mk b/registry/test/makefile.mk
new file mode 100644
index 000000000000..c3dddd2b3a54
--- /dev/null
+++ b/registry/test/makefile.mk
@@ -0,0 +1,133 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 15:18:43 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=registry
+TARGET=regtest
+
+USE_LDUMP2=TRUE
+#LDUMP2=LDUMP3
+
+
+# --- Settings -----------------------------------------------------
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+
+# ------------------------------------------------------------------
+CDEFS += -DDLL_VERSION=\"$(UPD)$(DLLPOSTFIX)\"
+
+CXXFILES= \
+ testregcpp.cxx \
+ testmerge.cxx
+
+
+LIB1TARGET= $(SLB)$/$(TARGET).lib
+
+LIB1OBJFILES= \
+ $(SLO)$/testregcpp.obj \
+ $(SLO)$/testmerge.obj
+
+
+SHL1TARGET= rgt$(UPD)$(DLLPOSTFIX)
+SHL1IMPLIB= rgt
+SHL1STDLIBS= \
+ $(SALLIB) \
+ $(VOSLIB) \
+ $(STDLIBCPP)
+
+.IF "$(GUI)" == "WNT"
+SHL1STDLIBS += \
+ $(LIBCMT) \
+ $(LIBCIMT)
+.ENDIF
+
+
+SHL1LIBS= $(LIB1TARGET)
+SHL1DEPN= $(LIB1TARGET)
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+DEF1NAME= $(SHL1TARGET)
+
+DEF1DEPN =$(MISC)$/rgt$(UPD)$(DLLPOSTFIX).flt $(SLOFILES)
+DEFLIB1NAME =$(TARGET)
+DEF1DES =Registry Runtime - TestDll
+
+# --- Targets ------------------------------------------------------
+
+#all: \
+# ALLTAR
+
+.INCLUDE : target.mk
+
+# --- SO2-Filter-Datei ---
+
+
+$(MISC)$/rgt$(UPD)$(DLLPOSTFIX).flt:
+ @echo ------------------------------
+ @echo Making: $@
+ @echo WEP>$@
+ @echo LIBMAIN>>$@
+ @echo LibMain>>$@
+
+
diff --git a/registry/test/testmerge.cxx b/registry/test/testmerge.cxx
new file mode 100644
index 000000000000..f277535890e0
--- /dev/null
+++ b/registry/test/testmerge.cxx
@@ -0,0 +1,492 @@
+/*************************************************************************
+ *
+ * $RCSfile: testmerge.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <iostream.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "registry/registry.hxx"
+#include "registry/reflread.hxx"
+#include "registry/reflwrit.hxx"
+
+#ifndef _VOS_MODULE_HXX
+#include <vos/module.hxx>
+#endif
+
+#ifndef _VOS_DIAGNOSE_HXX
+#include <vos/diagnose.hxx>
+#endif
+
+#ifndef _RTL_ALLOC_H_
+#include <rtl/alloc.h>
+#endif
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+
+using namespace rtl;
+
+sal_Int32 lValue1 = 123456789;
+sal_Int32 lValue2 = 54321;
+sal_Int32 lValue3 = 111333111;
+sal_Int32 lValue4 = 333111333;
+sal_Char* sValue = "string Value";
+OUString wValue = rtl::OUString::createFromAscii( "unicode Value" );
+
+
+void test_generateMerge1()
+{
+ RegistryLoader* pLoader = new RegistryLoader();
+
+ if (!pLoader->isLoaded())
+ {
+ delete pLoader;
+ return;
+ }
+
+ Registry *myRegistry = new Registry(*pLoader);
+ delete pLoader;
+
+ RegistryKey rootKey, key1, key2, key3, key4, key5, key6, key7, key8, key9;
+
+ VOS_ENSHURE(!myRegistry->create(OUString::createFromAscii("merge1.rdb")), "testGenerateMerge1 error 1");
+ VOS_ENSHURE(!myRegistry->openRootKey(rootKey), "testGenerateMerge1 error 2");
+
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("MergeKey1"), key1), "testGenerateMerge1 error 3");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1/MK1SubKey1"), key2), "testGenerateMerge1 error 4");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1/MK1SubKey1/KeyWithLongValue"), key3), "testGenerateMerge1 error 5");
+ VOS_ENSHURE(!key3.setValue(OUString(), RG_VALUETYPE_LONG, &lValue1, sizeof(sal_Int32)), "testGenerateMerge1 error 5a");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1/MK1SubKey2"), key4), "testGenerateMerge1 error 6");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1/MK1SubKey2/KeyWithStringValue"), key5), "testGenerateMerge1 error 7");
+ VOS_ENSHURE(!key5.setValue(OUString(), RG_VALUETYPE_STRING, sValue, strlen(sValue)+1), "testGenerateMerge1 error 7a");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1/MK1SubKey3"), key6), "testGenerateMerge1 error 8");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1/MK1SubKey3/KeyWithUnicodeValue"), key7), "testGenerateMerge1 error 9");
+ VOS_ENSHURE(!key7.setValue(OUString(), RG_VALUETYPE_UNICODE, (void*)wValue.getStr(), ((wValue.getLength()+1)*sizeof(sal_Unicode))), "testGenerateMerge1 error 9a");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1/MK1SubKey4"), key8), "testGenerateMerge1 error 10");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1/MK1SubKey4/KeyWithBinaryValue"), key9), "testGenerateMerge1 error 11");
+ VOS_ENSHURE(!key9.setValue(OUString(), RG_VALUETYPE_BINARY, "abcdefghijklmnopqrstuvwxyz", 27), "testGenerateMerge1 error 11a");
+
+
+ VOS_ENSHURE(!key1.closeKey() &&
+ !key2.closeKey() &&
+ !key3.closeKey() &&
+ !key4.closeKey() &&
+ !key5.closeKey() &&
+ !key6.closeKey() &&
+ !key7.closeKey() &&
+ !key8.closeKey() &&
+ !key9.closeKey(), "testGenerateMerge1 error 12");
+
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("MergeKey1u2"), key1), "testGenerateMerge1 error 13");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey11"), key2), "testGenerateMerge1 error 14");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey11/KeyWithLongValue"), key3), "testGenerateMerge1 error 15");
+ VOS_ENSHURE(!key3.setValue(OUString(), RG_VALUETYPE_LONG, &lValue2, sizeof(sal_Int32)), "testGenerateMerge1 error 15a");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey12"), key4), "testGenerateMerge1 error 16");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey12/KeyWithStringValue"), key5), "testGenerateMerge1 error 17");
+ VOS_ENSHURE(!key5.setValue(OUString(), RG_VALUETYPE_STRING, sValue, strlen(sValue)+1), "testGenerateMerge1 error 17a");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey13"), key6), "testGenerateMerge1 error 18");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey13/KeyWithUnicodeValue"), key7), "testGenerateMerge1 error 19");
+ VOS_ENSHURE(!key7.setValue(OUString(), RG_VALUETYPE_UNICODE, (void*)wValue.getStr(), ((wValue.getLength()+1)*sizeof(sal_Unicode))), "testGenerateMerge1 error 19a");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK12SubKey1u2"), key8), "testGenerateMerge1 error 20");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK12SubKey1u2/KeyWithLongValue"), key9), "testGenerateMerge1 error 21");
+ VOS_ENSHURE(!key9.setValue(OUString(), RG_VALUETYPE_LONG, &lValue3, sizeof(sal_Int32)), "testGenerateMerge1 error 21a");
+
+ VOS_ENSHURE(!rootKey.closeKey() &&
+ !key1.closeKey() &&
+ !key2.closeKey() &&
+ !key3.closeKey() &&
+ !key4.closeKey() &&
+ !key5.closeKey() &&
+ !key6.closeKey() &&
+ !key7.closeKey() &&
+ !key8.closeKey() &&
+ !key9.closeKey(), "testGenerateMerge1 error 22");
+
+
+ delete myRegistry;
+
+ cout << "test_generateMerge1() Ok!\n";
+ return;
+}
+
+void test_generateMerge2()
+{
+ RegistryLoader* pLoader = new RegistryLoader();
+
+ if (!pLoader->isLoaded())
+ {
+ delete pLoader;
+ return;
+ }
+
+ Registry *myRegistry = new Registry(*pLoader);
+ delete pLoader;
+
+ RegistryKey rootKey, key1, key2, key3, key4, key5, key6, key7, key8, key9;
+
+ VOS_ENSHURE(!myRegistry->create(OUString::createFromAscii("merge2.rdb")), "testGenerateMerge2 error 1");
+ VOS_ENSHURE(!myRegistry->openRootKey(rootKey), "testGenerateMerge2 error 2");
+
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("MergeKey2"), key1), "testGenerateMerge2 error 3");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey2/MK2SubKey1"), key2), "testGenerateMerge2 error 4");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey2/MK2SubKey1/KeyWithBinaryValue"), key3), "testGenerateMerge2 error 5");
+ VOS_ENSHURE(!key3.setValue(OUString(), RG_VALUETYPE_BINARY, "1234567890", 11), "testGenerateMerge1 error 5a");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey2/MK2SubKey2"), key4), "testGenerateMerge2 error 6");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey2/MK2SubKey2/KeyWithUnicodeValue"), key5), "testGenerateMerge2 error 7");
+ VOS_ENSHURE(!key5.setValue(OUString(), RG_VALUETYPE_UNICODE, (void*)wValue.getStr(), ((wValue.getLength()+1)*sizeof(sal_Unicode))), "testGenerateMerge1 error 7a");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey2/MK2SubKey3"), key6), "testGenerateMerge2 error 8");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey2/MK2SubKey3/KeyWithStringValue"), key7), "testGenerateMerge2 error 9");
+ VOS_ENSHURE(!key7.setValue(OUString(), RG_VALUETYPE_STRING, sValue, strlen(sValue)+1), "testGenerateMerge1 error 9a");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey2/MK2SubKey4"), key8), "testGenerateMerge2 error 10");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey2/MK2SubKey4/KeyWithLongValue"), key9), "testGenerateMerge2 error 11");
+ VOS_ENSHURE(!key9.setValue(OUString(), RG_VALUETYPE_LONG, &lValue1, sizeof(sal_Int32)), "testGenerateMerge1 error 11a");
+
+ VOS_ENSHURE(!key1.closeKey() &&
+ !key2.closeKey() &&
+ !key3.closeKey() &&
+ !key4.closeKey() &&
+ !key5.closeKey() &&
+ !key6.closeKey() &&
+ !key7.closeKey() &&
+ !key8.closeKey() &&
+ !key9.closeKey(), "testGenerateMerge2 error 12");
+
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("MergeKey1u2"), key1), "testGenerateMerge2 error 13");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey21"), key2), "testGenerateMerge2 error 14");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey21/KeyWithBinaryValue"), key3), "testGenerateMerge2 error 15");
+ VOS_ENSHURE(!key3.setValue(OUString(), RG_VALUETYPE_BINARY, "a1b2c3d4e5f6g7h8i9", 19), "testGenerateMerge1 error 15a");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey22"), key4), "testGenerateMerge2 error 16");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey22/KeyWithLongValue"), key5), "testGenerateMerge2 error 17");
+ VOS_ENSHURE(!key5.setValue(OUString(), RG_VALUETYPE_LONG, &lValue2, sizeof(sal_Int32)), "testGenerateMerge1 error 17a");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey23"), key6), "testGenerateMerge2 error 18");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey23/KeyWithStringValue"), key7), "testGenerateMerge2 error 19");
+ VOS_ENSHURE(!key7.setValue(OUString(), RG_VALUETYPE_STRING, sValue, strlen(sValue)+1), "testGenerateMerge1 error 19a");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK12SubKey1u2"), key8), "testGenerateMerge2 error 20");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK12SubKey1u2/KeyWithLongValue"), key9), "testGenerateMerge2 error 21");
+ VOS_ENSHURE(!key9.setValue(OUString(), RG_VALUETYPE_LONG, &lValue4, sizeof(sal_Int32)), "testGenerateMerge1 error 21a");
+
+ VOS_ENSHURE(!rootKey.closeKey() &&
+ !key1.closeKey() &&
+ !key2.closeKey() &&
+ !key3.closeKey() &&
+ !key4.closeKey() &&
+ !key5.closeKey() &&
+ !key6.closeKey() &&
+ !key7.closeKey() &&
+ !key8.closeKey() &&
+ !key9.closeKey(), "testGenerateMerge2 error 22");
+
+
+ delete myRegistry;
+
+ cout << "test_generateMerge2() Ok!\n";
+ return;
+}
+
+void test_merge()
+{
+ RegistryLoader* pLoader = new RegistryLoader();
+
+ if (!pLoader->isLoaded())
+ {
+ delete pLoader;
+ return;
+ }
+
+ Registry *myRegistry = new Registry(*pLoader);
+ delete pLoader;
+
+ RegistryKey rootKey, key1, mkey1, key2, mkey2, key1u2, mkey1u2;
+
+ VOS_ENSHURE(!myRegistry->create(OUString::createFromAscii("mergetest.rdb")), "testMerge error 1");
+ VOS_ENSHURE(myRegistry->getName().equals(OUString::createFromAscii("mergetest.rdb")), "testMerge error 1.a)");
+ VOS_ENSHURE(!myRegistry->openRootKey(rootKey), "testMerge error 2");
+ VOS_ENSHURE(!myRegistry->loadKey(rootKey, OUString::createFromAscii("/stardiv/IchbineinMergeKey"),
+ OUString::createFromAscii("merge1.rdb")), "testMerge error 3");
+ VOS_ENSHURE(!myRegistry->mergeKey(rootKey, OUString::createFromAscii("/stardiv/IchbineinMergeKey"),
+ OUString::createFromAscii("merge2.rdb")), "testMerge error 4");
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ VOS_ENSHURE(!rootKey.openKey(OUString::createFromAscii("/stardiv/IchbineinMergeKey"), key1), "testMerge error 5");
+
+ VOS_ENSHURE(!key1.openKey(OUString::createFromAscii("MergeKey1"), mkey1), "testMerge error 6");
+ VOS_ENSHURE(!mkey1.closeKey(), "testMerge error 7");
+
+ VOS_ENSHURE(!key1.openKey(OUString::createFromAscii("/MergeKey1/MK1SubKey1"), mkey1), "testMerge error 8");
+ VOS_ENSHURE(!mkey1.closeKey(), "testMerge error 9");
+ VOS_ENSHURE(!key1.openKey(OUString::createFromAscii("/MergeKey1/MK1SubKey1/KeyWithLongValue"), mkey1), "testMerge error 10");
+ VOS_ENSHURE(!mkey1.closeKey(), "testMerge error 11");
+
+ VOS_ENSHURE(!key1.openKey(OUString::createFromAscii("/MergeKey1/MK1SubKey2"), mkey1), "testMerge error 12");
+ VOS_ENSHURE(!mkey1.closeKey(), "testMerge error 13");
+ VOS_ENSHURE(!key1.openKey(OUString::createFromAscii("/MergeKey1/MK1SubKey2/KeyWithStringValue"), mkey1), "testMerge error 14");
+ VOS_ENSHURE(!mkey1.closeKey(), "testMerge error 15");
+
+ VOS_ENSHURE(!key1.openKey(OUString::createFromAscii("/MergeKey1/MK1SubKey3"), mkey1), "testMerge error 16");
+ VOS_ENSHURE(!mkey1.closeKey(), "testMerge error 17");
+ VOS_ENSHURE(!key1.openKey(OUString::createFromAscii("/MergeKey1/MK1SubKey3/KeyWithUnicodeValue"), mkey1), "testMerge error 18");
+ VOS_ENSHURE(!mkey1.closeKey(), "testMerge error 19");
+
+ VOS_ENSHURE(!key1.openKey(OUString::createFromAscii("/MergeKey1/MK1SubKey4"), mkey1), "testMerge error 20");
+ VOS_ENSHURE(!mkey1.closeKey(), "testMerge error 21");
+ VOS_ENSHURE(!key1.openKey(OUString::createFromAscii("/MergeKey1/MK1SubKey4/KeyWithBinaryValue"), mkey1), "testMerge error 22");
+ VOS_ENSHURE(!mkey1.closeKey(), "testMerge error 23");
+
+ VOS_ENSHURE(!key1.closeKey(), "testMerge error 24");
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ VOS_ENSHURE(!rootKey.openKey(OUString::createFromAscii("/stardiv/IchbineinMergeKey"), key2), "testMerge error 25");
+
+ VOS_ENSHURE(!key2.openKey(OUString::createFromAscii("MergeKey2"), mkey2), "testMerge error 26");
+ VOS_ENSHURE(!mkey2.closeKey(), "testMerge error 27");
+
+ VOS_ENSHURE(!key2.openKey(OUString::createFromAscii("/MergeKey2/MK2SubKey1"), mkey2), "testMerge error 28");
+ VOS_ENSHURE(!mkey2.closeKey(), "testMerge error 29");
+ VOS_ENSHURE(!key2.openKey(OUString::createFromAscii("/MergeKey2/MK2SubKey1/KeyWithBinaryValue"), mkey2), "testMerge error 30");
+ VOS_ENSHURE(!mkey2.closeKey(), "testMerge error 31");
+
+ VOS_ENSHURE(!key2.openKey(OUString::createFromAscii("/MergeKey2/MK2SubKey2"), mkey2), "testMerge error 31");
+ VOS_ENSHURE(!mkey2.closeKey(), "testMerge error 33");
+ VOS_ENSHURE(!key2.openKey(OUString::createFromAscii("/MergeKey2/MK2SubKey2/KeyWithUnicodeValue"), mkey2), "testMerge error 34");
+ VOS_ENSHURE(!mkey2.closeKey(), "testMerge error 35");
+
+ VOS_ENSHURE(!key2.openKey(OUString::createFromAscii("/MergeKey2/MK2SubKey3"), mkey2), "testMerge error 36");
+ VOS_ENSHURE(!mkey2.closeKey(), "testMerge error 37");
+ VOS_ENSHURE(!key2.openKey(OUString::createFromAscii("/MergeKey2/MK2SubKey3/KeyWithStringValue"), mkey2), "testMerge error 38");
+ VOS_ENSHURE(!mkey2.closeKey(), "testMerge error 39");
+
+ VOS_ENSHURE(!key2.openKey(OUString::createFromAscii("/MergeKey2/MK2SubKey4"), mkey2), "testMerge error 40");
+ VOS_ENSHURE(!mkey2.closeKey(), "testMerge error 41");
+ VOS_ENSHURE(!key2.openKey(OUString::createFromAscii("/MergeKey2/MK2SubKey4/KeyWithLongValue"), mkey2), "testMerge error 42");
+ VOS_ENSHURE(!mkey2.closeKey(), "testMerge error 43");
+
+ VOS_ENSHURE(!key2.closeKey(), "testMerge error 44");
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ VOS_ENSHURE(!rootKey.openKey(OUString::createFromAscii("/stardiv/IchbineinMergeKey"), key1u2), "testMerge error 40");
+
+ VOS_ENSHURE(!key1u2.openKey(OUString::createFromAscii("MergeKey1u2"), mkey1u2), "testMerge error 41");
+ VOS_ENSHURE(!mkey1u2.closeKey(), "testMerge error 42");
+
+ VOS_ENSHURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey11"), mkey1u2), "testMerge error 43");
+ VOS_ENSHURE(!mkey1u2.closeKey(), "testMerge error 44");
+ VOS_ENSHURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey11/KeyWithLongValue"), mkey1u2), "testMerge error 45");
+ VOS_ENSHURE(!mkey1u2.closeKey(), "testMerge error 46");
+
+ VOS_ENSHURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey12"), mkey1u2), "testMerge error 47");
+ VOS_ENSHURE(!mkey1u2.closeKey(), "testMerge error 48");
+ VOS_ENSHURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey12/KeyWithStringValue"), mkey1u2), "testMerge error 49");
+ VOS_ENSHURE(!mkey1u2.closeKey(), "testMerge error 50");
+
+ VOS_ENSHURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey13"), mkey1u2), "testMerge error 51");
+ VOS_ENSHURE(!mkey1u2.closeKey(), "testMerge error 52");
+ VOS_ENSHURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey13/KeyWithUnicodeValue"), mkey1u2), "testMerge error 53");
+ VOS_ENSHURE(!mkey1u2.closeKey(), "testMerge error 54");
+
+ VOS_ENSHURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey21"), mkey1u2), "testMerge error 55");
+ VOS_ENSHURE(!mkey1u2.closeKey(), "testMerge error 56");
+ VOS_ENSHURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey21/KeyWithBinaryValue"), mkey1u2), "testMerge error 57");
+ VOS_ENSHURE(!mkey1u2.closeKey(), "testMerge error 58");
+
+ VOS_ENSHURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey22"), mkey1u2), "testMerge error 59");
+ VOS_ENSHURE(!mkey1u2.closeKey(), "testMerge error 60");
+ VOS_ENSHURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey22/KeyWithLongValue"), mkey1u2), "testMerge error 61");
+ VOS_ENSHURE(!mkey1u2.closeKey(), "testMerge error 62");
+
+ VOS_ENSHURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey23"), mkey1u2), "testMerge error 63");
+ VOS_ENSHURE(!mkey1u2.closeKey(), "testMerge error 64");
+ VOS_ENSHURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey23/KeyWithStringValue"), mkey1u2), "testMerge error 65");
+ VOS_ENSHURE(!mkey1u2.closeKey(), "testMerge error 66");
+
+ VOS_ENSHURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK12SubKey1u2"), mkey1u2), "testMerge error 67");
+ VOS_ENSHURE(!mkey1u2.closeKey(), "testMerge error 68");
+ VOS_ENSHURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK12SubKey1u2/KeyWithLongValue"), mkey1u2), "testMerge error 69");
+ VOS_ENSHURE(!mkey1u2.closeKey(), "testMerge error 70");
+
+ VOS_ENSHURE(!key1u2.closeKey(), "testMerge error 71");
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ RegValueType valueType;
+ sal_uInt32 valueSize;
+ sal_Int32 int32Value;
+ sal_uInt8 *Value;
+
+ VOS_ENSHURE(!rootKey.openKey(OUString::createFromAscii("/stardiv/IchbineinMergeKey"), key1), "testMerge error 72");
+
+ VOS_ENSHURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1/MK1SubKey1/KeyWithLongValue"), &valueType, &valueSize), "testMerge error 73");
+ VOS_ENSHURE(valueType == RG_VALUETYPE_LONG && valueSize == sizeof(sal_Int32), "testMerge error 74");
+ VOS_ENSHURE(!key1.getValue(OUString::createFromAscii("/MergeKey1/MK1SubKey1/KeyWithLongValue"), (RegValue)&int32Value), "testMerge error 74.a)");
+ VOS_ENSHURE(int32Value == lValue1, "testMerge error 74.b)");
+
+ VOS_ENSHURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1/MK1SubKey2/KeyWithStringValue"), &valueType, &valueSize), "testMerge error 75");
+ VOS_ENSHURE(valueType == RG_VALUETYPE_STRING && valueSize == strlen(sValue)+1, "testMerge error 76");
+ Value = new sal_uInt8[valueSize];
+ VOS_ENSHURE(!key1.getValue(OUString::createFromAscii("/MergeKey1/MK1SubKey2/KeyWithStringValue"), (RegValue)Value), "testMerge error 76.a)");
+ VOS_ENSHURE(strcmp((const sal_Char*)Value, sValue) == 0, "testMerge error 76.b)");
+ delete(Value);
+
+ VOS_ENSHURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1/MK1SubKey3/KeyWithUnicodeValue"), &valueType, &valueSize), "testMerge error 77");
+ VOS_ENSHURE(valueType == RG_VALUETYPE_UNICODE && valueSize == (wValue.getLength()+1)*sizeof(sal_Unicode), "testMerge error 78");
+ Value = new sal_uInt8[valueSize];
+ VOS_ENSHURE(!key1.getValue(OUString::createFromAscii("/MergeKey1/MK1SubKey3/KeyWithUnicodeValue"), (RegValue)Value), "testMerge error 78.a)");
+ VOS_ENSHURE(wValue.equals( (const sal_Unicode*)Value ), "testMerge error 78.b)");
+ delete(Value);
+
+ VOS_ENSHURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1/MK1SubKey4/KeyWithBinaryValue"), &valueType, &valueSize), "testMerge error 79");
+ VOS_ENSHURE(valueType == RG_VALUETYPE_BINARY && valueSize == 27, "testMerge error 80");
+ Value = new sal_uInt8[valueSize];
+ VOS_ENSHURE(!key1.getValue(OUString::createFromAscii("/MergeKey1/MK1SubKey4/KeyWithBinaryValue"), (RegValue)Value), "testMerge error 80.a)");
+ VOS_ENSHURE(strcmp((const sal_Char*)Value, "abcdefghijklmnopqrstuvwxyz") == 0, "testMerge error 80.b)");
+ delete(Value);
+
+ VOS_ENSHURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey2/MK2SubKey1/KeyWithBinaryValue"), &valueType, &valueSize), "testMerge error 81");
+ VOS_ENSHURE(valueType == RG_VALUETYPE_BINARY && valueSize == 11, "testMerge error 82");
+ Value = new sal_uInt8[valueSize];
+ VOS_ENSHURE(!key1.getValue(OUString::createFromAscii("/MergeKey2/MK2SubKey1/KeyWithBinaryValue"), (RegValue)Value), "testMerge error 82.a)");
+ VOS_ENSHURE(strcmp((const sal_Char*)Value, "1234567890") == 0, "testMerge error 82.b)");
+ delete(Value);
+
+ VOS_ENSHURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey2/MK2SubKey2/KeyWithUnicodeValue"), &valueType, &valueSize), "testMerge error 83");
+ VOS_ENSHURE(valueType == RG_VALUETYPE_UNICODE&& valueSize == (wValue.getLength()+1)*sizeof(sal_Unicode), "testMerge error 84");
+ Value = new sal_uInt8[valueSize];
+ VOS_ENSHURE(!key1.getValue(OUString::createFromAscii("/MergeKey2/MK2SubKey2/KeyWithUnicodeValue"), (RegValue)Value), "testMerge error 84.a)");
+ VOS_ENSHURE(wValue.equals( (const sal_Unicode*)Value ), "testMerge error 84.b)");
+ delete(Value);
+
+ VOS_ENSHURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey2/MK2SubKey3/KeyWithStringValue"), &valueType, &valueSize), "testMerge error 85");
+ VOS_ENSHURE(valueType == RG_VALUETYPE_STRING && valueSize == strlen(sValue)+1, "testMerge error 86");
+ Value = new sal_uInt8[valueSize];
+ VOS_ENSHURE(!key1.getValue(OUString::createFromAscii("/MergeKey2/MK2SubKey3/KeyWithStringValue"), (RegValue)Value), "testMerge error 86.a)");
+ VOS_ENSHURE(strcmp((const sal_Char*)Value, sValue) == 0, "testMerge error 86.b)");
+ delete(Value);
+
+ VOS_ENSHURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey2/MK2SubKey4/KeyWithLongValue"), &valueType, &valueSize), "testMerge error 87");
+ VOS_ENSHURE(valueType == RG_VALUETYPE_LONG && valueSize == sizeof(sal_Int32), "testMerge error 88");
+ VOS_ENSHURE(!key1.getValue(OUString::createFromAscii("/MergeKey2/MK2SubKey4/KeyWithLongValue"), (RegValue)&int32Value), "testMerge error 88.a)");
+ VOS_ENSHURE(int32Value == lValue1, "testMerge error 88.b)");
+
+ VOS_ENSHURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1u2/MK1SubKey11/KeyWithLongValue"), &valueType, &valueSize), "testMerge error 89");
+ VOS_ENSHURE(valueType == RG_VALUETYPE_LONG && valueSize == sizeof(sal_Int32), "testMerge error 90");
+ VOS_ENSHURE(!key1.getValue(OUString::createFromAscii("/MergeKey1u2/MK1SubKey11/KeyWithLongValue"), (RegValue)&int32Value), "testMerge error 90.a)");
+ VOS_ENSHURE(int32Value == lValue2, "testMerge error 90.b)");
+
+ VOS_ENSHURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1u2/MK1SubKey12/KeyWithStringValue"), &valueType, &valueSize), "testMerge error 91");
+ VOS_ENSHURE(valueType == RG_VALUETYPE_STRING && valueSize == strlen(sValue)+1, "testMerge error 92");
+ Value = new sal_uInt8[valueSize];
+ VOS_ENSHURE(!key1.getValue(OUString::createFromAscii("/MergeKey1u2/MK1SubKey12/KeyWithStringValue"), (RegValue)Value), "testMerge error 92.a)");
+ VOS_ENSHURE(strcmp((const sal_Char*)Value, sValue) == 0, "testMerge error 92.b)");
+ delete(Value);
+
+ VOS_ENSHURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1u2/MK1SubKey13/KeyWithUnicodeValue"), &valueType, &valueSize), "testMerge error 93");
+ VOS_ENSHURE(valueType == RG_VALUETYPE_UNICODE && valueSize == (wValue.getLength()+1)*sizeof(sal_Unicode), "testMerge error 94");
+ Value = new sal_uInt8[valueSize];
+ VOS_ENSHURE(!key1.getValue(OUString::createFromAscii("/MergeKey1u2/MK1SubKey13/KeyWithUnicodeValue"), (RegValue)Value), "testMerge error 94.a)");
+ VOS_ENSHURE(wValue.equals( (const sal_Unicode*)Value ), "testMerge error 94.b)");
+ delete(Value);
+
+ VOS_ENSHURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1u2/MK2SubKey21/KeyWithBinaryValue"), &valueType, &valueSize), "testMerge error 95");
+ VOS_ENSHURE(valueType == RG_VALUETYPE_BINARY && valueSize == 19, "testMerge error 96");
+ Value = new sal_uInt8[valueSize];
+ VOS_ENSHURE(!key1.getValue(OUString::createFromAscii("/MergeKey1u2/MK2SubKey21/KeyWithBinaryValue"), (RegValue)Value), "testMerge error 96.a)");
+ VOS_ENSHURE(strcmp((const sal_Char*)Value, "a1b2c3d4e5f6g7h8i9") == 0, "testMerge error 96.b)");
+ delete(Value);
+
+ VOS_ENSHURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1u2/MK2SubKey22/KeyWithLongValue"), &valueType, &valueSize), "testMerge error 97");
+ VOS_ENSHURE(valueType == RG_VALUETYPE_LONG && valueSize == sizeof(sal_Int32), "testMerge error 98");
+ VOS_ENSHURE(!key1.getValue(OUString::createFromAscii("/MergeKey1u2/MK2SubKey22/KeyWithLongValue"), (RegValue)&int32Value), "testMerge error 98.a)");
+ VOS_ENSHURE(int32Value == lValue2, "testMerge error 98.b)");
+
+ VOS_ENSHURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1u2/MK2SubKey23/KeyWithStringValue"), &valueType, &valueSize), "testMerge error 99");
+ VOS_ENSHURE(valueType == RG_VALUETYPE_STRING && valueSize == strlen(sValue)+1, "testMerge error 100");
+ Value = new sal_uInt8[valueSize];
+ VOS_ENSHURE(!key1.getValue(OUString::createFromAscii("/MergeKey1u2/MK2SubKey23/KeyWithStringValue"), (RegValue)Value), "testMerge error 100.a)");
+ VOS_ENSHURE(strcmp((const sal_Char*)Value, sValue) == 0, "testMerge error 100.b)");
+ delete(Value);
+
+ VOS_ENSHURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1u2/MK12SubKey1u2/KeyWithLongValue"), &valueType, &valueSize), "testMerge error 101");
+ VOS_ENSHURE(valueType == RG_VALUETYPE_LONG && valueSize == sizeof(sal_Int32), "testMerge error 102");
+ VOS_ENSHURE(!key1.getValue(OUString::createFromAscii("/MergeKey1u2/MK12SubKey1u2/KeyWithLongValue"), (RegValue)&int32Value), "testMerge error 102.a)");
+ VOS_ENSHURE(int32Value == lValue4, "testMerge error 102.b)");
+
+
+ VOS_ENSHURE(!key1.closeKey(), "testMerge error 24");
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ VOS_ENSHURE(!rootKey.closeKey(), "testMerge error 10");
+
+ VOS_ENSHURE(!myRegistry->destroy( OUString::createFromAscii("merge1.rdb") ), "test_registry_CppApi error 11");
+ VOS_ENSHURE(!myRegistry->destroy( OUString::createFromAscii("merge2.rdb") ), "test_registry_CppApi error 12");
+ VOS_ENSHURE(!myRegistry->destroy( OUString() ), "test_registry_CppApi error 13");
+
+ delete(myRegistry);
+
+ cout << "test_merge() Ok!\n";
+ return;
+}
+
+
diff --git a/registry/test/testregcpp.cxx b/registry/test/testregcpp.cxx
new file mode 100644
index 000000000000..ffdbdb8d721e
--- /dev/null
+++ b/registry/test/testregcpp.cxx
@@ -0,0 +1,738 @@
+/*************************************************************************
+ *
+ * $RCSfile: testregcpp.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <iostream.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "registry/registry.hxx"
+#include "registry/reflread.hxx"
+#include "registry/reflwrit.hxx"
+
+
+#ifndef _VOS_MODULE_HXX
+#include <vos/module.hxx>
+#endif
+
+#ifndef _VOS_DIAGNOSE_HXX
+#include <vos/diagnose.hxx>
+#endif
+
+#ifndef _RTL_ALLOC_H_
+#include <rtl/alloc.h>
+#endif
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+using namespace rtl;
+
+void test_coreReflection()
+{
+ RegistryLoader* pLoader = new RegistryLoader();
+
+ if (!pLoader->isLoaded())
+ {
+ delete pLoader;
+ return;
+ }
+
+ RegistryTypeWriterLoader* pWriterLoader = new RegistryTypeWriterLoader();
+
+ if (!pWriterLoader->isLoaded())
+ {
+ delete pWriterLoader;
+ return;
+ }
+
+ RegistryTypeReaderLoader* pReaderLoader = new RegistryTypeReaderLoader();
+
+ if (!pReaderLoader->isLoaded())
+ {
+ delete pReaderLoader;
+ return;
+ }
+
+ Registry *myRegistry = new Registry(*pLoader);
+ delete pLoader;
+
+ RegistryKey rootKey, key1, key2, key3, key4 ,key5, key6, key7, key8;
+
+ VOS_ENSHURE(!myRegistry->create(OUString::createFromAscii("ucrtest.rdb")), "testCoreReflection error 1");
+ VOS_ENSHURE(!myRegistry->openRootKey(rootKey), "testCoreReflection error 2");
+
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("UCR"), key1), "testCoreReflection error 3");
+ VOS_ENSHURE(!key1.createKey(OUString::createFromAscii("ModuleA"), key2), "testCoreReflection error 4");
+ VOS_ENSHURE(!key2.createKey(OUString::createFromAscii("StructA"), key3), "testCoreReflection error 5");
+ VOS_ENSHURE(!key2.createKey(OUString::createFromAscii("EnumA"), key4), "testCoreReflection error 6");
+ VOS_ENSHURE(!key2.createKey(OUString::createFromAscii("XInterfaceA"), key5), "testCoreReflection error 7");
+ VOS_ENSHURE(!key2.createKey(OUString::createFromAscii("ExceptionA"), key6), "testCoreReflection error 8");
+ VOS_ENSHURE(!key2.createKey(OUString::createFromAscii("ServiceA"), key7), "testCoreReflection error 8a");
+ VOS_ENSHURE(!key2.createKey(OUString::createFromAscii("ConstantsA"), key8), "testCoreReflection error 8b");
+
+ {
+ RegistryTypeWriter writer(*pWriterLoader,
+ RT_TYPE_MODULE,
+ OUString::createFromAscii("ModuleA"),
+ OUString(), 9, 0, 0);
+
+ RTConstValue aConst;
+
+ writer.setDoku(OUString::createFromAscii("Hallo ich bin ein Modul"));
+ writer.setFileName(OUString::createFromAscii("DummyFile"));
+
+ aConst.m_type = RT_TYPE_BOOL;
+ aConst.m_value.aBool = sal_True;
+ writer.setFieldData(0, OUString::createFromAscii("aConstBool"),
+ OUString::createFromAscii("boolean"),
+ OUString::createFromAscii("ich bin ein boolean"),
+ OUString::createFromAscii("DummyFile"), RT_ACCESS_CONST, aConst);
+ aConst.m_type = RT_TYPE_BYTE;
+ aConst.m_value.aByte = 127;
+ writer.setFieldData(1, OUString::createFromAscii("aConstByte"),
+ OUString::createFromAscii("byte"),
+ OUString::createFromAscii("ich bin ein byte"),
+ OUString::createFromAscii("DummyFile"), RT_ACCESS_CONST, aConst);
+ aConst.m_type = RT_TYPE_INT16;
+ aConst.m_value.aShort = -10;
+ writer.setFieldData(2, OUString::createFromAscii("aConstShort"),
+ OUString::createFromAscii("short"),
+ OUString::createFromAscii("ich bin ein short"),
+ OUString::createFromAscii("DummyFile"), RT_ACCESS_CONST, aConst);
+ aConst.m_type = RT_TYPE_UINT16;
+ aConst.m_value.aUShort = 10;
+ writer.setFieldData(3, OUString::createFromAscii("aConstUShort"),
+ OUString::createFromAscii("unsigned short"),
+ OUString::createFromAscii("ich bin ein unsigned short"),
+ OUString::createFromAscii("DummyFile"), RT_ACCESS_CONST, aConst);
+ aConst.m_type = RT_TYPE_INT32;
+ aConst.m_value.aLong = -100000;
+ writer.setFieldData(4, OUString::createFromAscii("aConstLong"),
+ OUString::createFromAscii("long"),
+ OUString::createFromAscii("ich bin ein long"),
+ OUString::createFromAscii("DummyFile"), RT_ACCESS_CONST, aConst);
+ aConst.m_type = RT_TYPE_UINT32;
+ aConst.m_value.aULong = 100000;
+ writer.setFieldData(5, OUString::createFromAscii("aConstULong"),
+ OUString::createFromAscii("unsigned long"),
+ OUString::createFromAscii("ich bin ein unsigned long"),
+ OUString::createFromAscii("DummyFile"), RT_ACCESS_CONST, aConst);
+ aConst.m_type = RT_TYPE_FLOAT;
+ aConst.m_value.aFloat = -2e-10f;
+ writer.setFieldData(6, OUString::createFromAscii("aConstFloat"),
+ OUString::createFromAscii("float"),
+ OUString::createFromAscii("ich bin ein float"),
+ OUString::createFromAscii("DummyFile"), RT_ACCESS_CONST, aConst);
+ aConst.m_type = RT_TYPE_DOUBLE;
+ aConst.m_value.aDouble = -2e-100; writer.setFieldData(7, OUString::createFromAscii("aConstDouble"),
+ OUString::createFromAscii("double"),
+ OUString::createFromAscii("ich bin ein double"),
+ OUString::createFromAscii("DummyFile"), RT_ACCESS_CONST, aConst);
+ aConst.m_type = RT_TYPE_STRING;
+ OUString tmpStr(OUString::createFromAscii( "dies ist ein unicode string" ));
+ aConst.m_value.aString = tmpStr.getStr();
+
+ writer.setFieldData(8, OUString::createFromAscii("aConstString"),
+ OUString::createFromAscii("string"),
+ OUString::createFromAscii("ich bin ein string"),
+ OUString::createFromAscii("DummyFile"), RT_ACCESS_CONST, aConst);
+
+ const sal_uInt8* pBlop = writer.getBlop();
+ sal_uInt32 aBlopSize = writer.getBlopSize();
+
+ VOS_ENSHURE(!key2.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9");
+
+ sal_uInt8* readBlop = (sal_uInt8*)rtl_allocateMemory(aBlopSize);
+ VOS_ENSHURE(!key2.getValue(OUString(), (void*)readBlop) , "testCoreReflection error 9a");
+
+ RegistryTypeReader reader(*pReaderLoader, readBlop, aBlopSize, sal_True);
+
+ if (reader.isValid())
+ {
+ RTConstValue aReadConst = reader.getFieldConstValue(8);
+ OString aConstStr = OUStringToOString(aConst.m_value.aString, RTL_TEXTENCODING_ASCII_US);
+ VOS_ENSHURE(aConstStr.equals("dies ist ein unicode string"), "testCoreReflection error 9b");
+ }
+
+ }
+
+ {
+ RegistryTypeWriter writer(*pWriterLoader,
+ RT_TYPE_STRUCT,
+ OUString::createFromAscii("ModuleA/StructA"),
+ OUString(), 3, 0, 0);
+
+ writer.setDoku(OUString::createFromAscii("Hallo ich bin eine Struktur"));
+ writer.setFileName(OUString::createFromAscii("DummyFile"));
+
+ writer.setFieldData(0, OUString::createFromAscii("asal_uInt32"),
+ OUString::createFromAscii("unsigned long"),
+ OUString(), OUString(), RT_ACCESS_READWRITE);
+ writer.setFieldData(1, OUString::createFromAscii("aXInterface"),
+ OUString::createFromAscii("stardiv/uno/XInterface"),
+ OUString(), OUString(), RT_ACCESS_READWRITE);
+ writer.setFieldData(2, OUString::createFromAscii("aSequence"),
+ OUString::createFromAscii("[]ModuleA/EnumA"),
+ OUString(), OUString(), RT_ACCESS_READWRITE);
+
+ const sal_uInt8* pBlop = writer.getBlop();
+ sal_uInt32 aBlopSize = writer.getBlopSize();
+
+ VOS_ENSHURE(!key3.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9a");
+ }
+
+ {
+ RegistryTypeWriter writer(*pWriterLoader,
+ RT_TYPE_ENUM,
+ OUString::createFromAscii("ModuleA/EnumA"),
+ OUString(), 2, 0, 0);
+
+ RTConstValue aConst;
+
+ aConst.m_type = RT_TYPE_UINT32;
+ aConst.m_value.aULong = 10;
+
+ writer.setDoku(OUString::createFromAscii("Hallo ich bin ein Enum"));
+ writer.setFileName(OUString::createFromAscii("DummyFile"));
+
+ writer.setFieldData(0, OUString::createFromAscii("ENUM_VAL_1"),
+ OUString(), OUString::createFromAscii("ich bin ein enum value"),
+ OUString(), RT_ACCESS_CONST, aConst);
+
+ aConst.m_value.aULong = 10;
+ writer.setFieldData(1, OUString::createFromAscii("ENUM_VAL_2"),
+ OUString(), OUString(), OUString(), RT_ACCESS_CONST, aConst);
+
+ const sal_uInt8* pBlop = writer.getBlop();
+ sal_uInt32 aBlopSize = writer.getBlopSize();
+
+ VOS_ENSHURE(!key4.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9b");
+ }
+
+ {
+ RegistryTypeWriter writer(*pWriterLoader,
+ RT_TYPE_INTERFACE,
+ OUString::createFromAscii("ModuleA/XInterfaceA"),
+ OUString::createFromAscii("stardiv/uno/XInterface"),
+ 4, 1, 0);
+ RTConstValue aConst;
+
+ RTUik aUik = {1,2,3,4,5};
+
+ writer.setUik(aUik);
+ writer.setDoku(OUString::createFromAscii("Hallo ich bin ein Interface"));
+ writer.setFileName(OUString::createFromAscii("DummyFile"));
+
+ writer.setFieldData(0, OUString::createFromAscii("aString"),
+ OUString::createFromAscii("string"), OUString(), OUString(), RT_ACCESS_READWRITE);
+ writer.setFieldData(1, OUString::createFromAscii("aStruct"),
+ OUString::createFromAscii("ModuleA/StructA"),
+ OUString(), OUString(), RT_ACCESS_READONLY);
+ writer.setFieldData(2, OUString::createFromAscii("aEnum"),
+ OUString::createFromAscii("ModuleA/EnumA"), OUString(), OUString(), RT_ACCESS_BOUND);
+ aConst.m_type = RT_TYPE_UINT16;
+ aConst.m_value.aUShort = 12;
+ writer.setFieldData(3, OUString::createFromAscii("aConstUShort"),
+ OUString::createFromAscii("unsigned short"), OUString(),
+ OUString::createFromAscii("DummyFile"), RT_ACCESS_CONST, aConst);
+
+ writer.setMethodData(0, OUString::createFromAscii("methodA"),
+ OUString::createFromAscii("double"), RT_MODE_TWOWAY, 2, 1,
+ OUString::createFromAscii("Hallo ich bin die methodA"));
+ writer.setParamData(0, 0, OUString::createFromAscii("ModuleA/StructA"),
+ OUString::createFromAscii("aStruct"), RT_PARAM_IN);
+ writer.setParamData(0, 1, OUString::createFromAscii("unsigned short"),
+ OUString::createFromAscii("aShort"), RT_PARAM_INOUT);
+ writer.setExcData(0, 0, OUString::createFromAscii("ModuleA/ExceptionA"));
+
+ const sal_uInt8* pBlop = writer.getBlop();
+ sal_uInt32 aBlopSize = writer.getBlopSize();
+
+ VOS_ENSHURE(!key5.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9c");
+ }
+
+ {
+ RegistryTypeWriter writer(*pWriterLoader,
+ RT_TYPE_EXCEPTION,
+ OUString::createFromAscii("ModuleA/ExceptionA"),
+ OUString(), 1, 0, 0);
+
+ writer.setDoku(OUString::createFromAscii("Hallo ich bin eine Exception"));
+
+ writer.setFieldData(0, OUString::createFromAscii("aSource"),
+ OUString::createFromAscii("stardiv/uno/XInterface"),
+ OUString::createFromAscii("ich bin ein interface member"),
+ OUString(), RT_ACCESS_READWRITE);
+
+ const sal_uInt8* pBlop = writer.getBlop();
+ sal_uInt32 aBlopSize = writer.getBlopSize();
+
+ VOS_ENSHURE(!key6.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9d");
+ }
+
+ {
+ RegistryTypeWriter writer(*pWriterLoader,
+ RT_TYPE_SERVICE,
+ OUString::createFromAscii("ModuleA/ServiceA"),
+ OUString(), 1, 0, 4);
+
+ writer.setDoku(OUString::createFromAscii("Hallo ich bin ein Service"));
+ writer.setFileName(OUString::createFromAscii("DummyFile"));
+
+ writer.setFieldData(0, OUString::createFromAscii("aProperty"),
+ OUString::createFromAscii("stardiv/uno/XInterface"),
+ OUString::createFromAscii("ich bin eine property"),
+ OUString(), RT_ACCESS_READWRITE);
+
+ writer.setReferenceData(0, OUString::createFromAscii("ModuleA/XInterfaceA"), RT_REF_SUPPORTS,
+ OUString::createFromAscii("Hallo ich eine Reference auf ein supported interface"),
+ RT_ACCESS_OPTIONAL);
+ writer.setReferenceData(1, OUString::createFromAscii("ModuleA/XInterfaceA"), RT_REF_OBSERVES,
+ OUString::createFromAscii("Hallo ich eine Reference auf ein observed interface"));
+ writer.setReferenceData(2, OUString::createFromAscii("ModuleA/ServiceB"), RT_REF_EXPORTS,
+ OUString::createFromAscii("Hallo ich eine Reference auf einen exported service"));
+ writer.setReferenceData(3, OUString::createFromAscii("ModuleA/ServiceB"), RT_REF_NEEDS,
+ OUString::createFromAscii("Hallo ich eine Reference auf einen needed service"));
+
+ const sal_uInt8* pBlop = writer.getBlop();
+ sal_uInt32 aBlopSize = writer.getBlopSize();
+
+ VOS_ENSHURE(!key7.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9e");
+ }
+
+ {
+ RegistryTypeWriter writer(*pWriterLoader,
+ RT_TYPE_CONSTANTS,
+ OUString::createFromAscii("ModuleA/ConstansA"),
+ OUString(), 3, 0, 0);
+
+ RTConstValue aConst;
+
+ writer.setDoku(OUString::createFromAscii("Hallo ich bin eine Constants Group"));
+ writer.setFileName(OUString::createFromAscii("DummyFile"));
+
+ aConst.m_type = RT_TYPE_BOOL;
+ aConst.m_value.aBool = sal_True;
+ writer.setFieldData(0, OUString::createFromAscii("ConstantsA_aConstBool"),
+ OUString::createFromAscii("boolean"),
+ OUString::createFromAscii("ich bin ein boolean"),
+ OUString::createFromAscii("DummyFile"), RT_ACCESS_CONST, aConst);
+ aConst.m_type = RT_TYPE_BYTE;
+ aConst.m_value.aByte = 127;
+ writer.setFieldData(1, OUString::createFromAscii("ConstantsA_aConstByte"),
+ OUString::createFromAscii("byte"),
+ OUString::createFromAscii("ich bin ein byte"),
+ OUString::createFromAscii("DummyFile"), RT_ACCESS_CONST, aConst);
+ aConst.m_type = RT_TYPE_INT16;
+ aConst.m_value.aShort = -10;
+ writer.setFieldData(2, OUString::createFromAscii("ConstantsA_aConstShort"),
+ OUString::createFromAscii("short"),
+ OUString::createFromAscii("ich bin ein short"),
+ OUString::createFromAscii("DummyFile"), RT_ACCESS_CONST, aConst);
+
+ const sal_uInt8* pBlop = writer.getBlop();
+ sal_uInt32 aBlopSize = writer.getBlopSize();
+
+ VOS_ENSHURE(!key8.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9f");
+ }
+
+ delete pWriterLoader;
+
+// VOS_ENSHURE(!myRegistry->destroy(NULL), "testCoreReflection error 10");
+ delete myRegistry;
+
+ cout << "test_coreReflection() Ok!\n";
+}
+
+void test_registry_CppApi()
+{
+ RegistryLoader* pLoader = new RegistryLoader();
+
+ if (!pLoader->isLoaded())
+ {
+ delete pLoader;
+ return;
+ }
+
+ Registry *myRegistry = new Registry(*pLoader);
+ delete pLoader;
+
+ RegistryKey rootKey, key1, key2, key3, key4 ,key5, key6, key7, key8, key9;
+
+ VOS_ENSHURE(!myRegistry->create(OUString::createFromAscii("test.rdb")), "test_registry_CppApi error 1");
+ VOS_ENSHURE(!myRegistry->openRootKey(rootKey), "test_registry_CppApi error 2");
+
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("myFirstKey"), key1), "test_registry_CppApi error 3");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("mySecondKey"), key2), "test_registry_CppApi error 4");
+ VOS_ENSHURE(!key1.createKey(OUString::createFromAscii("X"), key3), "test_registry_CppApi error 5");
+ VOS_ENSHURE(!key1.createKey(OUString::createFromAscii("mySecondSubKey"), key4), "test_registry_CppApi error 6");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("myThirdKey"), key5), "test_registry_CppApi error 6a");
+
+ VOS_ENSHURE(!key5.createKey(OUString::createFromAscii("1"), key4), "test_registry_CppApi error 6b");
+ VOS_ENSHURE(!key4.createKey(OUString::createFromAscii("2"), key3), "test_registry_CppApi error 6c");
+ VOS_ENSHURE(!key5.openKey(OUString::createFromAscii("1"), key4), "test_registry_CppApi error 6d");
+ VOS_ENSHURE(!rootKey.openKey(OUString::createFromAscii("/myThirdKey/1"), key4), "test_registry_CppApi error 6e");
+ VOS_ENSHURE(key4.getName().equals(OUString::createFromAscii("/myThirdKey/1")), "test_registry_CppApi error 6f");
+
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("myFourthKey"), key6), "test_registry_CppApi error 7");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("myFifthKey"), key6), "test_registry_CppApi error 7a");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("mySixthKey"), key6), "test_registry_CppApi error 7b");
+
+ // Link Test
+ //
+
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/myFourthKey/X"), key7), "test_registry_CppApi error 7c)");;
+ VOS_ENSHURE(!key6.createLink(OUString::createFromAscii("myFirstLink"), OUString::createFromAscii("/myFourthKey/X")), "test_registry_CppApi error 7d");
+ VOS_ENSHURE(!key6.createKey(OUString::createFromAscii("mySixthSubKey"), key7), "test_registry_CppApi error 7e");
+
+ OUString linkTarget;
+ VOS_ENSHURE(!key6.getLinkTarget(OUString::createFromAscii("myFirstLink"), linkTarget), "test_registry_CppApi error 7f");
+ VOS_ENSHURE(linkTarget.equals(OUString::createFromAscii("/myFourthKey/X")), "test_registry_CppApi error 7g");
+
+ RegistryKeyNames* pSubKeyNames = new RegistryKeyNames();
+ sal_uInt32 nSubKeys=0;
+
+ VOS_ENSHURE(!rootKey.getKeyNames(OUString::createFromAscii("mySixthKey"), *pSubKeyNames), "test_registry_CppApi error 7h)");
+ VOS_ENSHURE(pSubKeyNames->getLength() == 2, "test_registry_CppApi error 7i)");
+
+ for (sal_uInt32 i=0; i < pSubKeyNames->getLength(); i++)
+ {
+ if (pSubKeyNames->getElement(i).equals(OUString::createFromAscii("/mySixthKey/myFirstLink")))
+ {
+ RegKeyType keyType;
+ VOS_ENSHURE(!rootKey.getKeyType(pSubKeyNames->getElement(i), &keyType), "test_registry_CppApi error 7j");
+ VOS_ENSHURE(keyType == RG_LINKTYPE, "test_registry_CppApi error 7k");
+ }
+ }
+
+ VOS_ENSHURE(!key7.closeKey(), "test_registry_CppApi error 7k1");
+ delete pSubKeyNames;
+
+ VOS_ENSHURE(!rootKey.openKey(OUString::createFromAscii("/mySixthKey/myFirstLink"), key6), "test_registry_CppApi error 7l");
+ VOS_ENSHURE(key6.getName().equals(OUString::createFromAscii("/myFourthKey/X")), "test_registry_CppApi error 7m");
+
+ VOS_ENSHURE(!rootKey.openKey(OUString::createFromAscii("myFifthKey"), key6), "test_registry_CppApi error 7m1");
+ VOS_ENSHURE(!key6.createLink(OUString::createFromAscii("mySecondLink"),
+ OUString::createFromAscii("/mySixthKey/myFirstLink")), "test_registry_CppApi error 7m2");
+
+ VOS_ENSHURE(!rootKey.openKey(OUString::createFromAscii("/myFifthKey/mySecondLink"), key6), "test_registry_CppApi error 7m3");
+ VOS_ENSHURE(key6.getName().equals(OUString::createFromAscii("/myFourthKey/X")), "test_registry_CppApi error 7m4");
+
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/myFifthKey/mySecondLink/myFirstLinkSubKey"), key7), "test_registry_CppApi error 7m5");
+ VOS_ENSHURE(key7.getName().equals(OUString::createFromAscii("/myFourthKey/X/myFirstLinkSubKey")), "test_registry_CppApi error 7m6");
+
+ VOS_ENSHURE(!key7.createLink(OUString::createFromAscii("myThirdLink"), OUString::createFromAscii("/myFifthKey/mySecondLink")), "test_registry_CppApi error 7m7");
+ VOS_ENSHURE(!rootKey.openKey(OUString::createFromAscii("/myFourthKey/X/myFirstLinkSubKey/myThirdLink"), key7), "test_registry_CppApi error 7m8");
+ VOS_ENSHURE(!key7.openKey(OUString::createFromAscii("/myFirstLinkSubKey/myThirdLink/myFirstLinkSubKey/myThirdLink"), key6), "test_registry_CppApi error 7m9");
+ VOS_ENSHURE(key7.getName().equals(OUString::createFromAscii("/myFourthKey/X")), "test_registry_CppApi error 7m10");
+ VOS_ENSHURE(!key7.closeKey(), "test_registry_CppApi error 7m11");
+
+ VOS_ENSHURE(!rootKey.deleteLink(OUString::createFromAscii("/myFifthKey/mySecondLink")), "test_registry_CppApi error 7m12");
+
+ VOS_ENSHURE(!rootKey.createLink(OUString::createFromAscii("/myFifthKey/mySecondLink"),
+ OUString::createFromAscii("/myFourthKey/X/myFirstLinkSubKey/myThirdLink")),
+ "test_registry_CppApi error 7m13");
+
+ VOS_ENSHURE(rootKey.openKey(OUString::createFromAscii("/myFourthKey/X/myFirstLinkSubKey/myThirdLink"), key7) == REG_DETECT_RECURSION,
+ "test_registry_CppApi error 7m14");
+
+ VOS_ENSHURE(key7.closeKey() == REG_INVALID_KEY, "test_registry_CppApi error 7m11");
+
+ RegistryKeyNames subKeyNames;
+ nSubKeys=0;
+
+ VOS_ENSHURE(!rootKey.getKeyNames(OUString::createFromAscii("mySixthKey"), subKeyNames), "test_registry_CppApi error 7n");
+
+ nSubKeys = subKeyNames.getLength();
+ VOS_ENSHURE(nSubKeys == 2, "test_registry_CppApi error 7n1");
+ VOS_ENSHURE(subKeyNames.getElement(0).equals(OUString::createFromAscii("/mySixthKey/myFirstLink")), "test_registry_CppApi error 7p1)");
+ VOS_ENSHURE(subKeyNames.getElement(1).equals(OUString::createFromAscii("/mySixthKey/mySixthSubKey")), "test_registry_CppApi error 7p2");
+
+
+ RegistryKeyArray subKeys;
+ nSubKeys=0;
+
+ VOS_ENSHURE(!rootKey.openSubKeys(OUString::createFromAscii("myFirstKey"), subKeys), "test_registry_CppApi error 7o");
+
+ nSubKeys = subKeys.getLength();
+ VOS_ENSHURE(nSubKeys == 2, "test_registry_CppApi error 7o1");
+ VOS_ENSHURE(subKeys.getElement(0).getName().equals(OUString::createFromAscii("/myFirstKey/mySecondSubKey")), "test_registry_CppApi error 7p1)");
+ VOS_ENSHURE(subKeys.getElement(1).getName().equals(OUString::createFromAscii("/myFirstKey/X")), "test_registry_CppApi error 7p2");
+
+ VOS_ENSHURE(!rootKey.closeSubKeys(subKeys), "test_registry_CppApi error 7q)");
+
+
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/TEST"), key8), "test_registry_CppApi error 8");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/TEST/Child1"), key8), "test_registry_CppApi error 8a");
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("/TEST/Child2"), key8), "test_registry_CppApi error 8a1");
+ VOS_ENSHURE(!rootKey.openKey(OUString::createFromAscii("/TEST"), key9), "test_registry_CppApi error 8b");
+ VOS_ENSHURE(!key8.closeKey() && !key9.closeKey(), "test_registry_CppApi error 8b1");
+ VOS_ENSHURE(!rootKey.openKey(OUString::createFromAscii("/TEST"), key8), "test_registry_CppApi error 8b");
+ VOS_ENSHURE(!key8.closeKey(), "test_registry_CppApi error 8c");
+ VOS_ENSHURE(!rootKey.openKey(OUString::createFromAscii("TEST"), key8), "test_registry_CppApi error 8c");
+ VOS_ENSHURE(!key8.closeKey(), "test_registry_CppApi error 8d");
+
+
+ sal_Char* Value="Mein erster Value";
+ VOS_ENSHURE(!rootKey.setValue(OUString::createFromAscii("mySecondKey"), RG_VALUETYPE_STRING, Value, 18), "test_registry_CppApi error 9");
+
+ RegValueType valueType;
+ sal_uInt32 valueSize;
+ sal_Char* readValue;
+ VOS_ENSHURE(!rootKey.getValueInfo(OUString::createFromAscii("mySecondKey"), &valueType, &valueSize), "test_registry_CppApi error 9a");
+
+ readValue = (sal_Char*)rtl_allocateMemory(valueSize);
+ VOS_ENSHURE(!key2.getValue(OUString(), readValue), "test_registry_CppApi error 10");
+
+ VOS_ENSHURE(valueType == RG_VALUETYPE_STRING, "test_registry_CppApi error 11");
+ VOS_ENSHURE(valueSize == 18, "test_registry_CppApi error 12");
+ VOS_ENSHURE(strcmp(readValue, Value) == 0, "test_registry_CppApi error 13");
+ rtl_freeMemory(readValue);
+
+ const sal_Char* pList[3];
+ const sal_Char* n1= "Hallo";
+ const sal_Char* n2= "jetzt komm";
+ const sal_Char* n3= "ich";
+
+ pList[0]=n1;
+ pList[1]=n2;
+ pList[2]=n3;
+
+ VOS_ENSHURE(!rootKey.setStringListValue(OUString::createFromAscii("myFourthKey"), (sal_Char**)pList, 3), "test_registry_CppApi error 13a");
+
+ RegistryValueList<sal_Char*> valueList;
+ VOS_ENSHURE(!rootKey.getStringListValue(OUString::createFromAscii("myFourthKey"), valueList), "test_registry_CppApi error 13b");
+
+ VOS_ENSHURE(strcmp(n1, valueList.getElement(0)) == 0, "test_registry_CppApi error 13c");
+ VOS_ENSHURE(strcmp(n2, valueList.getElement(1)) == 0, "test_registry_CppApi error 13d");
+ VOS_ENSHURE(strcmp(n3, valueList.getElement(2)) == 0, "test_registry_CppApi error 13e");
+
+ VOS_ENSHURE(!rootKey.getValueInfo(OUString::createFromAscii("myFourthKey"), &valueType, &valueSize), "test_registry_CppApi error 13e1");
+ VOS_ENSHURE(valueType == RG_VALUETYPE_STRINGLIST, "test_registry_CppApi error 13e2");
+ VOS_ENSHURE(valueSize == 3, "test_registry_CppApi error 13e3");
+
+ sal_Int32 pLong[3];
+ pLong[0] = 123;
+ pLong[1] = 456;
+ pLong[2] = 789;
+
+ VOS_ENSHURE(!rootKey.setLongListValue(OUString::createFromAscii("myFifthKey"), pLong, 3), "test_registry_CppApi error 13f");
+
+ RegistryValueList<sal_Int32> longList;
+ VOS_ENSHURE(!rootKey.getLongListValue(OUString::createFromAscii("myFifthKey"), longList), "test_registry_CppApi error 13g");
+
+ VOS_ENSHURE(pLong[0] == longList.getElement(0), "test_registry_CppApi error 13h");
+ VOS_ENSHURE(pLong[1] == longList.getElement(1), "test_registry_CppApi error 13i");
+ VOS_ENSHURE(pLong[2] == longList.getElement(2), "test_registry_CppApi error 13j");
+
+
+ OUString sWTestValue(OUString::createFromAscii( "Mein erster Unicode Value" ));
+ const sal_Unicode* wTestValue= sWTestValue.getStr();
+ VOS_ENSHURE(!rootKey.setValue(OUString::createFromAscii("mySixthKey"), RG_VALUETYPE_UNICODE, (void*)wTestValue,
+ (rtl_ustr_getLength(wTestValue)+1)*sizeof(sal_Unicode)), "test_registry_CppApi error 13j1");
+
+ VOS_ENSHURE(!rootKey.getValueInfo(OUString::createFromAscii("mySixthKey"), &valueType, &valueSize), "test_registry_CppApi error 13j2");
+ sal_Unicode* pTmpValue = (sal_Unicode*)rtl_allocateMemory(valueSize);
+ VOS_ENSHURE(!rootKey.getValue(OUString::createFromAscii("mySixthKey"), pTmpValue), "test_registry_CppApi error 13j3");
+ VOS_ENSHURE(rtl_ustr_getLength(wTestValue) == rtl_ustr_getLength(pTmpValue), "test_registry_CppApi error 13j4");
+ VOS_ENSHURE(rtl_ustr_compare(wTestValue, pTmpValue) == 0, "test_registry_CppApi error 13j4");
+
+ const sal_Unicode* pUnicode[3];
+ OUString w1(OUString::createFromAscii( "Hallo" ));
+ OUString w2(OUString::createFromAscii( "jetzt komm" ));
+ OUString w3(OUString::createFromAscii( "ich als unicode" ));
+
+ pUnicode[0]=w1.getStr();
+ pUnicode[1]=w2.getStr();
+ pUnicode[2]=w3.getStr();
+
+ VOS_ENSHURE(!rootKey.setUnicodeListValue(OUString::createFromAscii("mySixthKey"), (sal_Unicode**)pUnicode, 3), "test_registry_CppApi error 13k");
+
+ RegistryValueList<sal_Unicode*> unicodeList;
+ VOS_ENSHURE(!rootKey.getUnicodeListValue(OUString::createFromAscii("mySixthKey"), unicodeList), "test_registry_CppApi error 13l");
+
+ VOS_ENSHURE(rtl_ustr_compare(w1, unicodeList.getElement(0)) == 0, "test_registry_CppApi error 13m");
+ VOS_ENSHURE(rtl_ustr_compare(w2, unicodeList.getElement(1)) == 0, "test_registry_CppApi error 13n");
+ VOS_ENSHURE(rtl_ustr_compare(w3, unicodeList.getElement(2)) == 0, "test_registry_CppApi error 13o");
+
+ VOS_ENSHURE(!key6.closeKey(), "test_registry_CppApi error 14");
+
+ VOS_ENSHURE(!key1.closeKey() &&
+ !key3.closeKey() &&
+ !key4.closeKey(), "test_registry_CppApi error 14");
+
+ VOS_ENSHURE(!rootKey.deleteKey(OUString::createFromAscii("myFirstKey")), "test_registry_CppApi error 15");
+
+ VOS_ENSHURE(!key2.closeKey(), "test_registry_CppApi error 16");
+ VOS_ENSHURE(!rootKey.openKey(OUString::createFromAscii("mySecondKey"), key2), "test_registry_CppApi error 17");
+
+ VOS_ENSHURE(!key5.closeKey(), "test_registry_CppApi error 18");
+
+ VOS_ENSHURE(!rootKey.deleteKey(OUString::createFromAscii("myThirdKey")), "test_registry_CppApi error 19");
+
+ VOS_ENSHURE(rootKey.openKey(OUString::createFromAscii("myThirdKey"), key5), "test_registry_CppApi error 20");
+
+ VOS_ENSHURE(!key2.closeKey() &&
+ !rootKey.closeKey(), "test_registry_CppApi error 21");
+
+ VOS_ENSHURE(!myRegistry->close(), "test_registry_CppApi error 22");
+
+ // Test loadkey
+ RegistryKey rootKey2, key21, key22, key23, key24 , key25;
+
+ VOS_ENSHURE(!myRegistry->create(OUString::createFromAscii("test2.rdb")), "test_registry_CppApi error 23");
+ VOS_ENSHURE(!myRegistry->openRootKey(rootKey2), "test_registry_CppApi error 24");
+
+ VOS_ENSHURE(!rootKey2.createKey(OUString::createFromAscii("reg2FirstKey"), key21), "test_registry_CppApi error 25");
+ VOS_ENSHURE(!rootKey2.createKey(OUString::createFromAscii("reg2SecondKey"), key22), "test_registry_CppApi error 26");
+ VOS_ENSHURE(!key21.createKey(OUString::createFromAscii("reg2FirstSubKey"), key23), "test_registry_CppApi error 27");
+ VOS_ENSHURE(!key21.createKey(OUString::createFromAscii("reg2SecondSubKey"), key24), "test_registry_CppApi error 28");
+ VOS_ENSHURE(!rootKey2.createKey(OUString::createFromAscii("reg2ThirdKey"), key25), "test_registry_CppApi error 29");
+
+ sal_uInt32 nValue= 123456789;
+ VOS_ENSHURE(!key23.setValue(OUString(), RG_VALUETYPE_LONG, &nValue, sizeof(sal_uInt32)), "test_registry_CppApi error 30");
+
+ VOS_ENSHURE(!key21.closeKey() &&
+ !key22.closeKey() &&
+ !key23.closeKey() &&
+ !key24.closeKey() &&
+ !key25.closeKey() &&
+ !rootKey2.closeKey(), "test_registry_CppApi error 31");
+
+ VOS_ENSHURE(!myRegistry->close(), "test_registry_CppApi error 32");
+
+ VOS_ENSHURE(!myRegistry->open(OUString::createFromAscii("test.rdb"), REG_READWRITE), "test_registry_CppApi error 33");
+ VOS_ENSHURE(!myRegistry->openRootKey(rootKey), "test_registry_CppApi error 34");
+
+ VOS_ENSHURE(!myRegistry->loadKey(rootKey, OUString::createFromAscii("allFromTest2"),
+ OUString::createFromAscii("test2.rdb")), "test_registry_CppApi error 35");
+ VOS_ENSHURE(!myRegistry->saveKey(rootKey, OUString::createFromAscii("allFromTest2"),
+ OUString::createFromAscii("test3.rdb")), "test_registry_CppApi error 36");
+
+ VOS_ENSHURE(!rootKey.createKey(OUString::createFromAscii("allFromTest3"), key1), "test_registry_CppApi error 37");
+ VOS_ENSHURE(!key1.createKey(OUString::createFromAscii("myFirstKey2"), key2), "test_registry_CppApi error 38");
+ VOS_ENSHURE(!key1.createKey(OUString::createFromAscii("mySecondKey2"), key3), "test_registry_CppApi error 39");
+
+ VOS_ENSHURE(!myRegistry->mergeKey(rootKey, OUString::createFromAscii("allFromTest3"),
+ OUString::createFromAscii("test3.rdb")), "test_registry_CppApi error 40");
+ VOS_ENSHURE(!myRegistry->mergeKey(rootKey, OUString::createFromAscii("allFromTest3"),
+ OUString::createFromAscii("ucrtest.rdb"), sal_True), "test_registry_CppApi error 40.a)");
+
+ VOS_ENSHURE(myRegistry->mergeKey(rootKey, OUString::createFromAscii("allFromTest3"), OUString::createFromAscii("ucrtest.rdb"), sal_True)
+ == REG_NO_ERROR/*REG_MERGE_CONFLICT*/, "test_registry_CppApi error 40.b)");
+
+ VOS_ENSHURE(!key1.closeKey() &&
+ !key2.closeKey(), "test_registry_CppApi error 41");
+
+ const sal_Unicode* wValue= OUString::createFromAscii( "Mein erster Unicode Value" ).getStr();
+ VOS_ENSHURE(!key3.setValue(OUString(), RG_VALUETYPE_UNICODE, (void*)wValue,
+ (rtl_ustr_getLength(wValue)+1)*sizeof(sal_Unicode)), "test_registry_CppApi error 42");
+
+ VOS_ENSHURE(!key3.closeKey(), "test_registry_CppApi error 43");
+
+ VOS_ENSHURE(!rootKey.openKey(OUString::createFromAscii("/allFromTest3/reg2FirstKey/reg2FirstSubKey"), key1),
+ "test_registry_CppApi error 43.a)");
+ VOS_ENSHURE(!rootKey.deleteKey(OUString::createFromAscii("/allFromTest3/reg2FirstKey/reg2FirstSubKey")), "test_registry_CppApi error 44");
+ VOS_ENSHURE(key1.getValueInfo(OUString(), &valueType, &valueSize) == REG_INVALID_KEY,
+ "test_registry_CppApi error 44.a)");
+ VOS_ENSHURE(!key1.closeKey(), "test_registry_CppApi error 44.b)");
+
+ VOS_ENSHURE(!rootKey.closeKey(), "test_registry_CppApi error 45");
+
+ VOS_ENSHURE(!myRegistry->close(), "test_registry_CppApi error 46");
+
+ VOS_ENSHURE(!myRegistry->open(OUString::createFromAscii("test.rdb"), REG_READWRITE), "test_registry_CppApi error 47");
+
+ VOS_ENSHURE(!myRegistry->destroy(OUString::createFromAscii("test2.rdb")), "test_registry_CppApi error 48");
+// VOS_ENSHURE(!myRegistry->destroy("test3.rdb"), "test_registry_CppApi error 49");
+
+ Registry *myRegistry2 = new Registry(*myRegistry);
+
+ VOS_ENSHURE(myRegistry->destroy(OUString()), "test_registry_CppApi error 50");
+
+ delete(myRegistry2);
+
+ VOS_ENSHURE(!myRegistry->create(OUString::createFromAscii("destroytest.rdb")), "test_registry_CppApi error 51");
+ VOS_ENSHURE(!myRegistry->close(), "test_registry_CppApi error 52");
+ VOS_ENSHURE(!myRegistry->open(OUString::createFromAscii("destroytest.rdb"), REG_READONLY), "test_registry_CppApi error 53");
+ VOS_ENSHURE(!myRegistry->openRootKey(rootKey), "test_registry_CppApi error 54");
+
+ VOS_ENSHURE(myRegistry->mergeKey(rootKey, OUString::createFromAscii("allFromTest3"),
+ OUString::createFromAscii("test3.rdb")), "test_registry_CppApi error 55");
+ VOS_ENSHURE(!myRegistry->destroy(OUString::createFromAscii("test3.rdb")), "test_registry_CppApi error 56");
+
+ VOS_ENSHURE(!rootKey.closeKey(), "test_registry_CppApi error 57");
+ VOS_ENSHURE(!myRegistry->close(), "test_registry_CppApi error 58");
+ VOS_ENSHURE(!myRegistry->open(OUString::createFromAscii("destroytest.rdb"), REG_READWRITE), "test_registry_CppApi error 59");
+ VOS_ENSHURE(!myRegistry->destroy(OUString()), "test_registry_CppApi error 60");
+
+ VOS_ENSHURE(!myRegistry->open(OUString::createFromAscii("test.rdb"), REG_READWRITE), "test_registry_CppApi error 61");
+ VOS_ENSHURE(!myRegistry->destroy(OUString::createFromAscii("ucrtest.rdb")), "test_registry_CppApi error 62");
+ VOS_ENSHURE(!myRegistry->destroy(OUString()), "test_registry_CppApi error 63");
+ delete(myRegistry);
+
+ cout << "test_registry_CppApi() Ok!\n";
+
+ return;
+}
+
+
diff --git a/registry/tools/makefile.mk b/registry/tools/makefile.mk
new file mode 100644
index 000000000000..d08b710076eb
--- /dev/null
+++ b/registry/tools/makefile.mk
@@ -0,0 +1,111 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 15:18:43 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=registry
+TARGET=regmerge
+TARGETTYPE=CUI
+LIBTARGET=NO
+
+# --- Settings -----------------------------------------------------
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+.INCLUDE : ..$/version.mk
+
+# --- Files --------------------------------------------------------
+CDEFS += -DDLL_VERSION=\"$(UPD)$(DLLPOSTFIX)\"
+
+CXXFILES= regview.cxx \
+ regmerge.cxx
+
+
+APP1TARGET= $(TARGET)
+APP1OBJS= $(OBJ)$/regmerge.obj
+
+APP1STDLIBS=\
+ $(SALLIB) \
+ $(VOSLIB) \
+ $(REGLIB)
+
+.IF "$(GUI)"=="WNT"
+APP1STDLIBS+= \
+ $(LIBCIMT) $(LIBCMT)
+.ENDIF
+
+
+APP2TARGET= regview
+APP2OBJS= $(OBJ)$/regview.obj
+
+APP2STDLIBS=\
+ $(SALLIB) \
+ $(VOSLIB) \
+ $(REGLIB)
+
+.IF "$(GUI)"=="WNT"
+APP2STDLIBS+= \
+ $(LIBCIMT) $(LIBCMT)
+.ENDIF
+
+.INCLUDE : target.mk
diff --git a/registry/tools/regmerge.cxx b/registry/tools/regmerge.cxx
new file mode 100644
index 000000000000..73f530dafceb
--- /dev/null
+++ b/registry/tools/regmerge.cxx
@@ -0,0 +1,217 @@
+/*************************************************************************
+ *
+ * $RCSfile: regmerge.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+
+#include "registry/registry.h"
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+#ifndef _RTL_ALLOC_H_
+#include <rtl/alloc.h>
+#endif
+
+int realargc;
+char* realargv[2048];
+
+static void checkCommandFile(char* cmdfile)
+{
+ FILE *commandfile;
+ char option[256];
+
+ commandfile = fopen(cmdfile+1, "r");
+ if( commandfile == NULL )
+ {
+ fprintf(stderr, "ERROR: Can't open command file \"%s\"\n", cmdfile);
+ } else
+ {
+ while ( fscanf(commandfile, "%s", option) != EOF )
+ {
+ if (option[0]== '@')
+ {
+ checkCommandFile(option);
+ } else
+ {
+ realargv[realargc]= strdup(option);
+ realargc++;
+ }
+
+ if (realargc == 2047)
+ {
+ fprintf(stderr, "ERROR: more than 2048 arguments.\n");
+ break;
+ }
+ }
+ fclose(commandfile);
+ }
+}
+
+static void checkCommandArgs(int argc, char **argv)
+{
+ realargc = 0;
+
+ for (int i=0; i<argc; i++)
+ {
+ if (argv[i][0]== '@')
+ {
+ checkCommandFile(argv[i]);
+ } else
+ {
+ realargv[i]= strdup(argv[i]);
+ realargc++;
+ }
+ }
+}
+
+static void cleanCommandArgs()
+{
+ for (int i=0; i<realargc; i++)
+ {
+ free(realargv[i]);
+ }
+}
+
+
+
+#if (defined UNX) || (defined OS2)
+int main( int argc, char * argv[] )
+#else
+int _cdecl main( int argc, char * argv[] )
+#endif
+{
+ RegHandle hReg;
+ RegKeyHandle hRootKey;
+
+ checkCommandArgs(argc, argv);
+
+ if (realargc < 4)
+ {
+ fprintf(stderr, "using: regmerge mergefile mergeKeyName regfile_1 ... regfile_n\n");
+ fprintf(stderr, " regmerge @regcmds\n");
+
+ cleanCommandArgs();
+ exit(1);
+ }
+
+ ::rtl::OUString regName( ::rtl::OUString::createFromAscii(realargv[1]) );
+ if (reg_openRegistry(regName.pData, &hReg, REG_READWRITE))
+ {
+ if (reg_createRegistry(regName.pData, &hReg))
+ {
+ fprintf(stderr, "open registry \"%s\" failed\n", realargv[1]);
+ cleanCommandArgs();
+ exit(-1);
+ }
+ }
+
+ if (!reg_openRootKey(hReg, &hRootKey))
+ {
+ ::rtl::OUString mergeKeyName( ::rtl::OUString::createFromAscii(realargv[2]) );
+ ::rtl::OUString targetRegName;
+ RegError _ret = REG_NO_ERROR;
+ for (int i = 3; i < realargc; i++)
+ {
+ targetRegName = ::rtl::OUString::createFromAscii(realargv[i]);
+ if (_ret = reg_mergeKey(hRootKey, mergeKeyName.pData, targetRegName.pData, sal_False, sal_True))
+ {
+ if (_ret == REG_MERGE_CONFLICT)
+ {
+ fprintf(stderr, "merging registry \"%s\" under key \"%s\" in registry \"%s\".\n",
+ realargv[i], realargv[2], realargv[1]);
+ } else
+ {
+ fprintf(stderr, "ERROR: merging registry \"%s\" under key \"%s\" in registry \"%s\" failed.\n",
+ realargv[i], realargv[2], realargv[1]);
+ exit(-2);
+ }
+ } else
+ {
+ fprintf(stderr, "merging registry \"%s\" under key \"%s\" in registry \"%s\".\n",
+ realargv[i], realargv[2], realargv[1]);
+ }
+ }
+
+ if (reg_closeKey(hRootKey))
+ {
+ fprintf(stderr, "closing root key of registry \"%s\" failed\n", realargv[1]);
+ exit(-3);
+ }
+ } else
+ {
+ fprintf(stderr, "open root key of registry \"%s\" failed\n", realargv[1]);
+ exit(-4);
+ }
+
+ if (reg_closeRegistry(hReg))
+ {
+ fprintf(stderr, "closing registry \"%s\" failed\n", realargv[1]);
+ cleanCommandArgs();
+ exit(-5);
+ }
+
+ cleanCommandArgs();
+ return(0);
+}
+
+
diff --git a/registry/tools/regview.cxx b/registry/tools/regview.cxx
new file mode 100644
index 000000000000..d488630f6180
--- /dev/null
+++ b/registry/tools/regview.cxx
@@ -0,0 +1,144 @@
+/*************************************************************************
+ *
+ * $RCSfile: regview.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+
+#include "registry/registry.h"
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+#ifndef _RTL_ALLOC_H_
+#include <rtl/alloc.h>
+#endif
+
+#if (defined UNX) || (defined OS2)
+int main( int argc, char * argv[] )
+#else
+int _cdecl main( int argc, char * argv[] )
+#endif
+{
+ RegHandle hReg;
+ RegKeyHandle hRootKey, hKey;
+
+ if (argc < 2 || argc > 3)
+ {
+ fprintf(stderr, "using: regview registryfile [keyName]\n");
+ exit(1);
+ }
+
+ ::rtl::OUString regName( ::rtl::OUString::createFromAscii(argv[1]) );
+ if (reg_openRegistry(regName.pData, &hReg, REG_READONLY))
+ {
+ fprintf(stderr, "open registry \"%s\" failed\n", argv[1]);
+ exit(1);
+ }
+
+ if (!reg_openRootKey(hReg, &hRootKey))
+ {
+ if (argc == 3)
+ {
+ ::rtl::OUString keyName( ::rtl::OUString::createFromAscii(argv[2]) );
+ if (!reg_openKey(hRootKey, keyName.pData, &hKey))
+ {
+ if (reg_dumpRegistry(hKey))
+ {
+ fprintf(stderr, "dumping registry \"%s\" failed\n", argv[1]);
+ }
+
+ if (reg_closeKey(hKey))
+ {
+ fprintf(stderr, "closing key \"%s\" of registry \"%s\" failed\n",
+ argv[2], argv[1]);
+ }
+ } else
+ {
+ fprintf(stderr, "key \"%s\" not exists in registry \"%s\"\n",
+ argv[2], argv[1]);
+ }
+ } else
+ {
+ if (reg_dumpRegistry(hRootKey))
+ {
+ fprintf(stderr, "dumping registry \"%s\" failed\n", argv[1]);
+ }
+ }
+
+ if (reg_closeKey(hRootKey))
+ {
+ fprintf(stderr, "closing root key of registry \"%s\" failed\n", argv[1]);
+ }
+ } else
+ {
+ fprintf(stderr, "open root key of registry \"%s\" failed\n", argv[1]);
+ }
+
+ if (reg_closeRegistry(hReg))
+ {
+ fprintf(stderr, "closing registry \"%s\" failed\n", argv[1]);
+ exit(1);
+ }
+
+ return(0);
+}
+
+
diff --git a/registry/util/makefile.mk b/registry/util/makefile.mk
new file mode 100644
index 000000000000..b9c9a7384a0d
--- /dev/null
+++ b/registry/util/makefile.mk
@@ -0,0 +1,199 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 15:18:43 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=registry
+TARGET=reg
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+.INCLUDE : ..$/version.mk
+
+# ------------------------------------------------------------------
+
+USE_LDUMP2=TRUE
+#USE_DEFFILE=TRUE
+LDUMP2=LDUMP3
+
+DOCPPFILES= $(INC)$/registry$/registry.hxx \
+ $(INC)$/registry$/registry.h \
+ $(INC)$/registry$/regtype.h \
+ $(INC)$/registry$/reflread.hxx \
+ $(INC)$/registry$/reflwrit.hxx \
+ $(INC)$/registry$/refltype.hxx \
+
+LIB1TARGET= $(SLB)$/$(TARGET).lib
+
+LIB1FILES= $(SLB)$/$(TARGET)cpp.lib
+
+SHL1TARGET= $(REGISTRY_TARGET)$(REGISTRY_MAJOR)
+SHL1IMPLIB= ireg
+SHL1STDLIBS= \
+ $(VOSLIB) \
+ $(SALLIB) \
+ $(STORELIB) \
+ $(LIBCIMT)
+
+
+SHL1LIBS=$(LIB1TARGET)
+SHL1DEPN= $(LIB1TARGET)
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+DEF1NAME =$(SHL1TARGET)
+
+DEF1DEPN =$(MISC)$/$(SHL1TARGET).flt
+
+
+DEFLIB1NAME =$(TARGET)
+DEF1DES =RegistryRuntime
+
+.IF "$(COM)"!="ICC" || "$(GUI)"=="OS2"
+.IF "$(GUI)"!="MAC"
+DEF1EXPORT1 =initRegistry_Api @1000
+DEF1EXPORT3 =initRegistryTypeWriter_Api @1001
+DEF1EXPORT4 =initRegistryTypeReader_Api @1002
+.ELSE
+DEF1EXPORT1 =initRegistry_Api
+DEF1EXPORT3 =initRegistryTypeWriter_Api
+DEF1EXPORT4 =initRegistryTypeReader_Api
+.ENDIF
+.ELSE
+DEF1EXPORT1 =_initRegistry_Api @1000
+DEF1EXPORT3 =_initRegistryTypeWriter_Api @1001
+DEF1EXPORT4 =_initRegistryTypeReader_Api @1002
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.IF "$(GUI)"=="WIN"
+ALL: $(LIB1TARGET) \
+ $(MISC)$/implib.cmd
+ ALLTAR
+.ENDIF
+
+.INCLUDE : target.mk
+
+makedocpp: $(DOCPPFILES)
+ + docpp -H -m -f -u -d $(OUT)$/doc$/$(PRJNAME) $(DOCPPFILES)
+
+# --- SO2-Filter-Datei ---
+
+$(MISC)$/$(SHL1TARGET).flt: makefile.mk
+ @echo ------------------------------
+ @echo Making: $@
+ @echo WEP > $@
+ @echo LIBMAIN >> $@
+ @echo LibMain >> $@
+ @echo _Impl >> $@
+ @echo ORegistry >> $@
+ @echo ORegKey >> $@
+ @echo ORegManager >> $@
+ @echo CntStoreFile >> $@
+ @echo CntStoreDirectory >> $@
+ @echo CntStorePageLockBytes >> $@
+ @echo initRegistry >> $@
+ @echo _alloc >> $@
+ @echo malloc >> $@
+ @echo _lower_bound >> $@
+ @echo _stl_prime >> $@
+ @echo _stl_hash >> $@
+ @echo _C >> $@
+ @echo _TI2 >> $@
+ @echo _TI3 >> $@
+ @echo 1Reg >> $@
+ @echo 1OGuard >> $@
+ @echo _E >> $@
+ @echo _H >> $@
+ @echo _B >> $@
+ @echo _I >> $@
+ @echo next >> $@
+ @echo HashString >> $@
+ @echo distance >> $@
+ @echo iterator >> $@
+ @echo lower_bound >> $@
+ @echo endl >> $@
+ @echo flush >> $@
+ @echo String >> $@
+ @echo Const >> $@
+ @echo read >> $@
+ @echo write >> $@
+ @echo Blop >> $@
+ @echo parse >> $@
+ @echo Version >> $@
+ @echo Entry >> $@
+ @echo Type >> $@
+ @echo Field >> $@
+ @echo magic >> $@
+ @echo Pool >> $@
+ @echo Method >> $@
+ @echo 0CPI >> $@
+ @echo exception::exception >> $@
+
+
+
+
+
+
diff --git a/registry/version.mk b/registry/version.mk
new file mode 100644
index 000000000000..d97e6ecfec8e
--- /dev/null
+++ b/registry/version.mk
@@ -0,0 +1,74 @@
+#*************************************************************************
+#
+# $RCSfile: version.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+# target
+REGISTRY_TARGET=reg
+
+# the major
+REGISTRY_MAJOR=2
+# the minor
+REGISTRY_MINOR=0
+# the micro
+REGISTRY_MICRO=0
+
+# this is a c++ compatible library
+REGISTRY_CPP=0
diff --git a/registry/workben/makefile.mk b/registry/workben/makefile.mk
new file mode 100644
index 000000000000..edadeb34e988
--- /dev/null
+++ b/registry/workben/makefile.mk
@@ -0,0 +1,134 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 15:18:43 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=registry
+TARGET=regtest
+TARGETTYPE=CUI
+LIBTARGET=NO
+
+# --- Settings -----------------------------------------------------
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+CDEFS += -DDLL_VERSION=\"$(UPD)$(DLLPOSTFIX)\"
+
+RGTLIB = rgt.lib
+.IF "$(GUI)"=="UNX"
+RGTLIB = -lrgt$(UPD)$(DLLPOSTFIX)
+.ENDIF
+
+
+CXXFILES= regtest.cxx \
+ test.cxx \
+ regspeed.cxx
+
+
+APP1TARGET= $(TARGET)
+APP1OBJS= $(OBJ)$/regtest.obj
+
+APP1STDLIBS=\
+ $(SALLIB) \
+ $(REGLIB)
+
+.IF "$(GUI)"=="WNT"
+APP1STDLIBS+= \
+ $(LIBCIMT) $(LIBCMT)
+.ENDIF
+
+
+APP2TARGET= test
+APP2OBJS= $(OBJ)$/test.obj
+
+APP2STDLIBS=\
+ $(RGTLIB)
+
+
+.IF "$(GUI)"=="WNT"
+APP2STDLIBS+= \
+ $(LIBCIMT) $(LIBCMT)
+.ENDIF
+
+
+APP3TARGET= regspeed
+APP3OBJS= $(OBJ)$/regspeed.obj
+
+APP3STDLIBS=\
+ $(SALLIB) \
+ $(REGLIB)
+
+.IF "$(GUI)"=="WNT"
+APP3STDLIBS+= \
+ $(LIBCIMT) $(LIBCMT)
+.ENDIF
+
+
+
+#.IF "$(COM)"=="ICC"
+#ENVCFLAGS=$(ENVCFLAGS) -D_STD_NO_NAMESPACE -D_VOS_NO_NAMESPACE -D_UNO_NO_NAMESPACE
+#.ENDIF
+
+
+.INCLUDE : target.mk
diff --git a/registry/workben/regspeed.cxx b/registry/workben/regspeed.cxx
new file mode 100644
index 000000000000..dee8f61f9f15
--- /dev/null
+++ b/registry/workben/regspeed.cxx
@@ -0,0 +1,307 @@
+/*************************************************************************
+ *
+ * $RCSfile: regspeed.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <iostream.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <sys/timeb.h>
+#include <sys/types.h>
+
+#include "registry/registry.h"
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+#ifndef _RTL_ALLOC_H_
+#include <rtl/alloc.h>
+#endif
+
+
+/*****************************************************************
+ MyTimer
+*****************************************************************/
+#ifndef UNX
+class MyTimer
+{
+public:
+ void start() { _ftime( &m_start ); };
+ void stop()
+ {
+ _ftime( &m_stop );
+ m_diff = difftime(m_stop.time, m_start.time);
+ if (m_stop.millitm > m_start.millitm)
+ {
+ m_diff += ((double)(m_stop.millitm - m_start.millitm)) / 1000;
+ }
+ else
+ {
+ m_diff -= 1;
+ m_diff += ((double)(1000 - (m_start.millitm - m_stop.millitm))) / 1000;
+ }
+ printf(" %.4f Sekunden\n", m_diff);
+ };
+
+protected:
+#ifdef OS2
+ struct timeb m_start, m_stop;
+#else
+ struct _timeb m_start, m_stop;
+#endif
+ double m_diff;
+};
+#else
+extern "C" int ftime(struct timeb *pt);
+
+class MyTimer
+{
+public:
+ void start() { ftime( &m_start ); };
+ void stop()
+ {
+ ftime( &m_stop );
+ m_diff = difftime(m_stop.time, m_start.time);
+ if (m_stop.millitm > m_start.millitm)
+ {
+ m_diff += ((double)(m_stop.millitm - m_start.millitm)) / 1000;
+ }
+ else
+ {
+ m_diff -= 1;
+ m_diff += ((double)(1000 - (m_start.millitm - m_stop.millitm))) / 1000;
+ }
+ printf(" %.4f Sekunden\n", m_diff);
+ };
+
+protected:
+ struct timeb m_start, m_stop;
+ double m_diff;
+};
+#endif
+
+using namespace rtl;
+
+#if (defined UNX) || (defined OS2)
+int main( int argc, char * argv[] )
+#else
+int _cdecl main( int argc, char * argv[] )
+#endif
+{
+ RegHandle hReg;
+ RegKeyHandle hRootKey, hKey, hSubKey, hSubSubKey;
+ OUString sName1(RTL_CONSTASCII_USTRINGPARAM("regkey"));
+ OUString sName2(RTL_CONSTASCII_USTRINGPARAM("regSubkey"));
+ OUString sName3(RTL_CONSTASCII_USTRINGPARAM("regSubSubkey"));
+ OUString keyName1;
+ OUString keyName2;
+ OUString keyName3;
+ int S1 = 10;
+ int S2 = 10;
+ int S3 = 10;
+ MyTimer aTimer;
+
+ if (argc < 4)
+ {
+ cerr << "using regspeed count1 count2 count3\n";
+ exit(1);
+ }
+
+ S1 = atoi(argv[1]);
+ S2 = atoi(argv[2]);
+ S3 = atoi(argv[3]);
+
+ OUString speedReg( RTL_CONSTASCII_USTRINGPARAM("speed.reg"));
+ if (reg_createRegistry(speedReg.pData, &hReg))
+ {
+ cout << "creating registry \"test.reg\" failed\n";
+ } else
+ {
+ if (reg_openRootKey(hReg, &hRootKey))
+ {
+ cout << "open root key \"test.reg\" failed\n";
+ } else
+ {
+ printf("\n %d keys anlegen, oeffnen und schliessen dauert ... ", (S1 * S2 * S3));
+ aTimer.start();
+
+ for (sal_Int32 i=0; i < S1; i++)
+ {
+ keyName1 = sName1;
+ keyName1 += OUString().valueOf(i);
+ if (reg_createKey(hRootKey, keyName1.pData, &hKey))
+ cout << "creating key \"" << OUStringToOString(keyName1, RTL_TEXTENCODING_ASCII_US).getStr()
+ << "\" failed\n";
+
+ for (sal_Int32 j=0; j < S2; j++)
+ {
+ keyName2 = sName2;
+ keyName2 += OUString().valueOf(j);
+ if (reg_createKey(hKey, keyName2.pData, &hSubKey))
+ cout << "creating key \"" << OUStringToOString(keyName2, RTL_TEXTENCODING_ASCII_US).getStr()
+ << "\" failed\n";
+
+ for (sal_Int32 n=0; n < S3; n++)
+ {
+ keyName3 = sName3;
+ keyName3 += OUString().valueOf(n);
+ if (reg_createKey(hSubKey, keyName3.pData, &hSubSubKey))
+ cout << "creating key \"" << OUStringToOString(keyName3, RTL_TEXTENCODING_ASCII_US).getStr()
+ << "\" failed\n";
+
+ if (reg_closeKey(hSubSubKey))
+ cout << "closing key \"" << OUStringToOString(keyName3, RTL_TEXTENCODING_ASCII_US).getStr()
+ << "\" failed\n";
+ }
+
+ if (reg_closeKey(hSubKey))
+ cout << "closing key \"" << OUStringToOString(keyName2, RTL_TEXTENCODING_ASCII_US).getStr()
+ << "\" failed\n";
+ }
+
+ if (reg_closeKey(hKey))
+ cout << "closing key \"" << OUStringToOString(keyName1, RTL_TEXTENCODING_ASCII_US).getStr()
+ << "\" failed\n";
+ }
+
+ aTimer.stop();
+
+ printf("\n %d keys oeffnen und schliessen dauert ... ", (S1 * S2 * S3));
+ aTimer.start();
+
+ for (i=0; i < S1; i++)
+ {
+ keyName1 = OUString::createFromAscii("/");
+ keyName1 += sName1;
+ keyName1 += OUString().valueOf(i);
+ if (reg_openKey(hRootKey, keyName1.pData, &hKey))
+ cout << "open key \"" << OUStringToOString(keyName1, RTL_TEXTENCODING_ASCII_US).getStr()
+ << "\" failed\n";
+
+ for (sal_Int32 j=0; j < S2; j++)
+ {
+ keyName2 = OUString::createFromAscii("/");
+ keyName2 += sName1;
+ keyName2 += OUString().valueOf(i);
+ keyName2 += OUString::createFromAscii("/");
+ keyName2 += sName2;
+ keyName2 += OUString().valueOf(j);
+ if (reg_openKey(hRootKey, keyName2.pData, &hSubKey))
+ cout << "open key \"" << OUStringToOString(keyName2, RTL_TEXTENCODING_ASCII_US).getStr()
+ << "\" failed\n";
+
+ for (sal_Int32 n=0; n < S3; n++)
+ {
+ keyName3 = OUString::createFromAscii("/");
+ keyName3 += sName1;
+ keyName3 += OUString().valueOf(i);
+ keyName3 += OUString::createFromAscii("/");
+ keyName3 += sName2;
+ keyName3 += OUString().valueOf(j);
+ keyName3 += OUString::createFromAscii("/");
+ keyName3 += sName3;
+ keyName3 += OUString().valueOf(n);
+ if (reg_openKey(hRootKey, keyName3.pData, &hSubSubKey))
+ cout << "open key \"" << OUStringToOString(keyName3, RTL_TEXTENCODING_ASCII_US).getStr()
+ << "\" failed\n";
+
+ if (reg_closeKey(hSubSubKey))
+ cout << "open key \"" << OUStringToOString(keyName3, RTL_TEXTENCODING_ASCII_US).getStr()
+ << "\" failed\n";
+ }
+
+ if (reg_closeKey(hSubKey))
+ cout << "closing key \"" << OUStringToOString(keyName2, RTL_TEXTENCODING_ASCII_US).getStr()
+ << "\" failed\n";
+ }
+
+ if (reg_closeKey(hKey))
+ cout << "closing key \"" << OUStringToOString(keyName1, RTL_TEXTENCODING_ASCII_US).getStr()
+ << "\" failed\n";
+ }
+
+ aTimer.stop();
+
+ printf("\n 1 key oeffnen und schliessen dauert ... ");
+ aTimer.start();
+
+ if (reg_openKey(hRootKey, keyName3.pData, &hSubSubKey))
+ cout << "open key \"" << OUStringToOString(keyName3, RTL_TEXTENCODING_ASCII_US).getStr()
+ << "\" failed\n";
+
+ if (reg_closeKey(hSubSubKey))
+ cout << "open key \"" << OUStringToOString(keyName3, RTL_TEXTENCODING_ASCII_US).getStr()
+ << "\" failed\n";
+
+ aTimer.stop();
+
+ }
+
+ if (reg_closeKey(hRootKey))
+ cout << "closing root key failed\n";
+ if (reg_closeRegistry(hReg))
+ cout << "\t41. closing registry \"test.reg\" failed\n";
+ }
+
+ return(0);
+}
+
+
diff --git a/registry/workben/regtest.cxx b/registry/workben/regtest.cxx
new file mode 100644
index 000000000000..a39f34fe2c80
--- /dev/null
+++ b/registry/workben/regtest.cxx
@@ -0,0 +1,376 @@
+/*************************************************************************
+ *
+ * $RCSfile: regtest.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <iostream.h>
+#include <stdio.h>
+
+#include "registry/registry.h"
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+#ifndef _RTL_ALLOC_H_
+#include <rtl/alloc.h>
+#endif
+
+using namespace rtl;
+
+#if (defined UNX) || (defined OS2)
+int main( int argc, char * argv[] )
+#else
+int _cdecl main( int argc, char * argv[] )
+#endif
+{
+ RegHandle hReg;
+ RegKeyHandle hRootKey, hKey1, hKey2, hKey3, hKey4, hKey5;
+
+ cout << "\n Simple Registry Test !!! \n\n";
+
+ if (reg_createRegistry(OUString::createFromAscii("test4.rdb").pData, &hReg))
+ cout << "\t0. creating registry \"test4.rdb\" failed\n";
+ else
+ cout << "0. registry test4.rdb is created\n";
+
+ if (reg_openRootKey(hReg, &hRootKey))
+ cout << "1. open root key \"test4.rdb\" failed\n";
+ else
+ cout << "1. root key of \"test4.rdb\" is opened\n";
+
+ if (reg_createKey(hRootKey, OUString::createFromAscii("myFirstKey").pData, &hKey1))
+ cout << "\t2. creating key \"myFirstKey\" failed\n";
+ else
+ cout << "2. key \"myFirstKey\" is created\n";
+ if (reg_createKey(hRootKey, OUString::createFromAscii("mySecondKey").pData, &hKey2))
+ cout << "\t3. creating key \"mySecondKey\" failed\n";
+ else
+ cout << "3. key \"mySecondKey\" is created\n";
+ if (reg_createKey(hKey1, OUString::createFromAscii("myFirstSubKey").pData, &hKey3))
+ cout << "\t4. creating subkey \"myFirstSubKey\" failed\n";
+ else
+ cout << "4. subkey \"myFirstSubKey\" is created\n";
+ if (reg_createKey(hKey1, OUString::createFromAscii("mySecondSubKey").pData, &hKey4))
+ cout << "\t5. creating subkey \"mySecondSubKey\" failed\n";
+ else
+ cout << "5. subkey \"mySecondSubKey\" is created\n";
+ if (reg_createKey(hRootKey, OUString::createFromAscii("myThirdKey").pData, &hKey5))
+ cout << "\t6. creating key \"myThirdKey\" is created\n\n";
+ else
+ cout << "6. key \"myThirdKey\" is created\n\n";
+
+
+ RegKeyHandle* phSubKeys;
+ sal_uInt32 nSubKeys;
+ if (reg_openSubKeys(hRootKey, OUString::createFromAscii("myFirstKey").pData, &phSubKeys, &nSubKeys))
+ cout << "\t7. open subkeys of \"myfirstKey\" failed\n";
+ else
+ cout << "7. open " << nSubKeys << "subkeys of \"myfirstKey\"\n";
+
+ OUString keyName;
+ if (reg_getKeyName(phSubKeys[0], &keyName.pData))
+ cout << "\tname of subkey 1 = " << OUStringToOString(keyName, RTL_TEXTENCODING_ASCII_US).getStr() << "\n";
+ if (reg_getKeyName(phSubKeys[1], &keyName.pData))
+ cout << "\tname of subkey 2 = " << OUStringToOString(keyName, RTL_TEXTENCODING_ASCII_US).getStr() << "\n";
+
+ if (reg_closeSubKeys(phSubKeys, nSubKeys))
+ cout << "\t8. close subkeys of \"myfirstKey\" failed\n\n";
+ else
+ cout << "8. close " << nSubKeys << "subkeys of \"myfirstKey\"\n\n";
+
+
+ char* Value="Mein erster Value";
+ if (reg_setValue(hRootKey, OUString::createFromAscii("mySecondKey").pData, RG_VALUETYPE_STRING, Value, 18))
+ cout << "\t9. setValue of key \"mySecondKey\" failed\n";
+ else
+ cout << "9. setValue (string Value) of key \"mySecondKey\"\n";
+
+ RegValueType valueType;
+ sal_uInt32 valueSize;
+ sal_Char* readValue;
+ if (reg_getValueInfo(hRootKey, OUString::createFromAscii("mySecondKey").pData, &valueType, &valueSize))
+ cout << "\t10. getValueInfo of key \"mySecondKey\" failed\n";
+ else
+ cout << "10. getValueInfo of key \"mySecondKey\"\n";
+
+ readValue = (sal_Char*)rtl_allocateMemory(valueSize);
+ if (reg_getValue(hKey2, OUString().pData, readValue))
+ cout << "\t11. getValue of key \"mySecondKey\" failed\n";
+ else
+ {
+ cout << "11. getValue of key \"mySecondKey\"\n";
+
+ cout << "read Value,\n\tvalueType = " << (long)valueType
+ << "\n\tvalueSize = " << valueSize
+ << "\n\tvalue = " << readValue << "\n\n";
+ }
+ rtl_freeMemory(readValue);
+
+ if (reg_closeKey(hKey1) ||
+ reg_closeKey(hKey3) ||
+ reg_closeKey(hKey4))
+ cout << "\t12. closing \"myFirstKey\" \"myfistSubKey\" \"mySecondSubKey\" failed\n";
+ else
+ cout << "12. keys \"myFirstKey\" \"myfistSubKey\" \"mySecondSubKey\" are closed\n";
+
+ if (reg_deleteKey(hRootKey, OUString::createFromAscii("myFirstKey").pData))
+ cout << "13.\t delete key \"myFirstKey\" failed\n";
+ else
+ cout << "13. key \"myFirstKey\" is deleted\n";
+
+ if (reg_closeKey(hKey2))
+ cout << "\t14. closing key \"mySecondKey\" failed\n";
+ else
+ cout << "14. key \"mySecondKey\" is closed\n";
+
+ if (reg_openKey(hRootKey, OUString::createFromAscii("mySecondKey").pData, &hKey2))
+ cout << "\n15. open key \"mySecondKey\" failed\n";
+ else
+ cout << "15. key \"mySecondKey\" is opended\n";
+
+ if (reg_closeKey(hKey5))
+ cout << "\t15. closing key \"myThirdSubKey\" failed\n";
+ else
+ cout << "15. key \"myThirdSubKey\" is closed\n";
+ if (reg_deleteKey(hRootKey, OUString::createFromAscii("myThirdKey").pData))
+ cout << "\t16. delete key \"myThirdKey\" failed\n";
+ else
+ cout << "16. key \"myThirdKey\" is deleted\n";
+
+ if (reg_openKey(hRootKey, OUString::createFromAscii("myThirdKey").pData, &hKey5))
+ cout << "\t17. open key \"myThirdKey\" failed\n";
+ else
+ cout << "17. key \"myThirdKey\" is opened\n";
+
+ cout << "\n close open keys\n\n";
+
+ if (reg_closeKey(hKey2))
+ cout << "\t18. closing key \"mySecondKey\" failed\n";
+ else
+ cout << "18. key \"mySecondKey\" is closed\n";
+
+ if (reg_closeKey(hRootKey))
+ cout << "\t19. closing root key failed\n";
+ else
+ cout << "19. root key is closed\n";
+
+ if (reg_closeRegistry(hReg))
+ cout << "\t20. closing registry \"test4.rdb\" failed\n";
+ else
+ cout << "20. registry \"test4.rdb\" is closed\n";
+
+ // Test loadkey
+ cout << "\nTest load key\n\n";
+
+ RegHandle hReg2;
+ RegKeyHandle hRootKey2, h2Key1, h2Key2, h2Key3, h2Key4, h2Key5;
+
+ if (reg_createRegistry(OUString::createFromAscii("test5.rdb").pData, &hReg2))
+ cout << "\t21. creating registry \"test5.rdb\" failed\n";
+ else
+ cout << "21. registry \"test5.rdb\" is created\n";
+
+ if (reg_openRootKey(hReg2, &hRootKey2))
+ cout << "\t22. open root key of \"test5.rdb\" failed\n";
+ else
+ cout << "22. root key of \"test5.rdb\" is opened\n";
+
+ if (reg_createKey(hRootKey2, OUString::createFromAscii("reg2FirstKey").pData, &h2Key1))
+ cout << "\t23. creating key \"reg2FirstKey\" failed\n";
+ else
+ cout << "23. key \"reg2FirstKey\" is created\n";
+ if (reg_createKey(hRootKey2, OUString::createFromAscii("reg2SecondKey").pData, &h2Key2))
+ cout << "\t24. creating key \"reg2SecondKey\" failed\n";
+ else
+ cout << "24. key \"reg2SecondKey\" is created\n";
+ if (reg_createKey(h2Key1, OUString::createFromAscii("reg2FirstSubKey").pData, &h2Key3))
+ cout << "\t25. creating key \"reg2FirstSubKey\" failed\n";
+ else
+ cout << "25. key \"reg2FirstSubKey\" is created\n";
+ if (reg_createKey(h2Key1, OUString::createFromAscii("reg2SecondSubKey").pData, &h2Key4))
+ cout << "\26. creating key \"reg2SecondSubKey\" failed\n";
+ else
+ cout << "26. key \"reg2SecondSubKey\" is created\n";
+ if (reg_createKey(hRootKey2, OUString::createFromAscii("reg2ThirdKey").pData, &h2Key5))
+ cout << "\n27. creating key \"reg2ThirdKey\" failed\n";
+ else
+ cout << "27. key \"reg2ThirdKey\" is created\n";
+
+ sal_uInt32 nValue= 123456789;
+ if (reg_setValue(h2Key3, OUString().pData, RG_VALUETYPE_LONG, &nValue, sizeof(sal_uInt32)))
+ cout << "\t27.b) setValue of key \"reg2FirstSubKey\" failed\n";
+ else
+ cout << "27.b). setValue (long Value) of key \"reg2FirstSubKey\"\n";
+
+ if (reg_closeKey(h2Key1) ||
+ reg_closeKey(h2Key2) ||
+ reg_closeKey(h2Key3) ||
+ reg_closeKey(h2Key4) ||
+ reg_closeKey(h2Key5))
+ cout << "\n\t28. closing keys of \"test5.rdb\" failed\n";
+ else
+ cout << "\n28. all keys of \"test5.rdb\" closed\n";
+
+ if (reg_closeKey(hRootKey2))
+ cout << "\t29. root key of \"test5.rdb\" failed\n";
+ else
+ cout << "29. root key of \"test5.rdb\" is closed\n";
+
+ if (reg_closeRegistry(hReg2))
+ cout << "\t30. registry test5.rdb is closed\n";
+ else
+ cout << "30. registry test5.rdb is closed\n";
+
+ if (reg_openRegistry(OUString::createFromAscii("test4.rdb").pData, &hReg, REG_READWRITE))
+ cout << "\t31. registry test4.rdb is opened\n";
+ else
+ cout << "31. registry test4.rdb is opened\n";
+
+ if (reg_openRootKey(hReg, &hRootKey))
+ cout << "\t32. open root key of \"test4.rdb\" is failed\n";
+ else
+ cout << "32. root key of \"test4.rdb\" is opened\n";
+
+ if (reg_loadKey(hRootKey, OUString::createFromAscii("allFromTest2").pData,
+ OUString::createFromAscii("test5.rdb").pData))
+ cout << "\n\t33. load all keys from \"test5.rdb\" under key \"allFromTest2\" failed\n";
+ else
+ cout << "\n33. load all keys from test5.rdb under key \"allFromTest2\"\n";
+
+ if (reg_saveKey(hRootKey, OUString::createFromAscii("allFromTest2").pData,
+ OUString::createFromAscii("test6.rdb").pData))
+ cout << "\n\t34. save all keys under \"allFromTest2\" in test6.rdb\n";
+ else
+ cout << "\n34. save all keys under \"allFromTest2\" in test6.rdb\n";
+
+
+ if (reg_createKey(hRootKey, OUString::createFromAscii("allFromTest3").pData, &hKey1))
+ cout << "\t35. creating key \"allFromTest3\" failed\n";
+ else
+ cout << "36. key \"allFromTest3\" is created\n";
+ if (reg_createKey(hKey1, OUString::createFromAscii("myFirstKey2").pData, &hKey2))
+ cout << "\t37. creating key \"myFirstKey2\" failed\n";
+ else
+ cout << "37. key \"myFirstKey2\" is created\n";
+ if (reg_createKey(hKey1, OUString::createFromAscii("mySecondKey2").pData, &hKey3))
+ cout << "\t38. creating key \"mySecondKey2\" failed\n";
+ else
+ cout << "38. key \"mySecondKey2\" is created\n";
+
+ if (reg_mergeKey(hRootKey, OUString::createFromAscii("allFromTest3").pData,
+ OUString::createFromAscii("test6.rdb").pData, sal_False, sal_False))
+ cout << "\n\t39. merge all keys under \"allFromTest2\" with all in test6.rdb\n";
+ else
+ cout << "\n39. merge all keys under \"allFromTest2\" with all in test6.rdb\n";
+
+ if (reg_closeKey(hKey1))
+ cout << "\n\t40. closing key \"allFromTest3\" of \"test5.rdb\" failed\n";
+ else
+ cout << "\n40. closing key \"allFromTest3\" of \"test5.rdb\"\n";
+ if (reg_closeKey(hKey2))
+ cout << "\n\t41. closing key \"myFirstKey2\" of \"test5.rdb\" failed\n";
+ else
+ cout << "\n41. closing key \"myFirstKey2\" of \"test5.rdb\"\n";
+ if (reg_closeKey(hKey3))
+ cout << "\n\t42. closing key \"mySecondKey2\" of \"test5.rdb\" failed\n";
+ else
+ cout << "\n42. closing key \"mySecondKey2\" of \"test5.rdb\"\n";
+
+
+ if (reg_deleteKey(hRootKey, OUString::createFromAscii("/allFromTest3/reg2FirstKey/reg2FirstSubKey").pData))
+ cout << "\n\t43. delete key \"/allFromTest3/reg2FirstKey/reg2FirstSubKey\" failed\n";
+ else
+ cout << "\n43. key \"/allFromTest3/reg2FirstKey/reg2FirstSubKey\" is deleted\n";
+
+ if (reg_openRegistry(OUString::createFromAscii("test4.rdb").pData, &hReg2, REG_READONLY))
+ cout << "\n\t44. registry test4.rdb is opened for read only\n";
+ else
+ cout << "\n44. registry test4.rdb is opened for read only\n";
+
+ RegHandle hReg3;
+ if (reg_openRegistry(OUString::createFromAscii("test4.rdb").pData, &hReg3, REG_READONLY))
+ cout << "\n\t44.a). registry test4.rdb is opened for read only\n";
+ else
+ cout << "\n44.a). registry test4.rdb is opened for read only\n";
+
+ if (reg_closeRegistry(hReg2))
+ cout << "\t45. closing registry \"test4.rdb\" failed\n";
+ else
+ cout << "45. registry \"test4.rdb\" is closed\n";
+
+ if (reg_closeKey(hRootKey))
+ cout << "\n\t46. closing root key of \"test4.rdb\" failed\n";
+ else
+ cout << "\n46. root key of \"test4.rdb\" is closed\n";
+
+ if (reg_closeRegistry(hReg))
+ cout << "\t47. closing registry \"test4.rdb\" failed\n";
+ else
+ cout << "47. registry \"test4.rdb\" is closed\n";
+
+ if (reg_closeRegistry(hReg3))
+ cout << "\t47.a). closing registry \"test4.rdb\" failed\n";
+ else
+ cout << "47.a). registry \"test4.rdb\" is closed\n";
+
+ return(0);
+}
+
+
diff --git a/registry/workben/test.cxx b/registry/workben/test.cxx
new file mode 100644
index 000000000000..2ba0c6661750
--- /dev/null
+++ b/registry/workben/test.cxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * $RCSfile: test.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:18:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+
+#if (defined UNX) || (defined OS2)
+int main( int argc, char * argv[] )
+#else
+int _cdecl main( int argc, char * argv[] )
+#endif
+{
+ void test_coreReflection();
+ void test_registry_CppApi();
+ void test_generateMerge1();
+ void test_generateMerge2();
+ void test_merge();
+
+ test_coreReflection();
+ test_registry_CppApi();
+ test_generateMerge1();
+ test_generateMerge2();
+ test_merge();
+
+ return(0);
+}
+
+
diff --git a/sal/inc/osl/conditn.h b/sal/inc/osl/conditn.h
new file mode 100644
index 000000000000..88fec4967bc7
--- /dev/null
+++ b/sal/inc/osl/conditn.h
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * $RCSfile: conditn.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:12 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _OSL_CONDITION_H_
+#define _OSL_CONDITION_H_
+
+#ifndef _OSL_TYPES_H_
+# include <osl/types.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void* oslCondition;
+
+typedef enum {
+ osl_cond_result_ok, /* successful completion */
+ osl_cond_result_error, /* error occured, check osl_getLastSocketError() for details */
+ osl_cond_result_timeout, /* blocking operation timed out */
+ osl_cond_result_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslConditionResult;
+
+/** Creates a condition.
+ @returns 0 if condition could not be created.
+*/
+oslCondition SAL_CALL osl_createCondition(void);
+
+/** Free the memory used by the condition.
+ @param Condition the condition handle.
+*/
+void SAL_CALL osl_destroyCondition(oslCondition Condition);
+
+/** Sets condition to True => wait() will not block, check() returns True.
+ NOTE: ALL threads waiting on this condition are unblocked!
+ @param Condition handle to a created condition.
+ @return False if system-call failed.
+*/
+sal_Bool SAL_CALL osl_setCondition(oslCondition Condition);
+
+/** Sets condition to False => wait() will block, check() returns False
+ @param Condition handle to a created condition.
+ @return False if system-call failed.
+*/
+sal_Bool SAL_CALL osl_resetCondition(oslCondition Condition);
+
+/** Blocks if condition is not set<BR>
+ If condition has been destroyed prematurely, wait() will
+ return with False.
+ @param Condition handle to a created condition.
+ @param pTimeout Tiemout value or NULL for infinite waiting
+ @return False if system-call failed.
+*/
+oslConditionResult SAL_CALL osl_waitCondition(oslCondition Condition, const TimeValue* pTimeout);
+
+/** Queries the state of the condition without blocking.
+ @param Condition handle to a created condition.
+ @return True: condition is set. <BR>
+ False: condition is not set. <BR>
+*/
+sal_Bool SAL_CALL osl_checkCondition(oslCondition Condition);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OSL_CONDITION_H_ */
+
diff --git a/sal/inc/osl/conditn.hxx b/sal/inc/osl/conditn.hxx
new file mode 100644
index 000000000000..d736df281a6d
--- /dev/null
+++ b/sal/inc/osl/conditn.hxx
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * $RCSfile: conditn.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:12 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_CONDITN_HXX_
+#define _OSL_CONDITN_HXX_
+
+#ifdef __cplusplus
+
+#include <osl/macros.hxx>
+
+#include <osl/conditn.h>
+
+
+#ifdef _USE_NAMESPACE
+namespace osl
+{
+#endif
+
+ class Condition
+ {
+ public:
+
+ enum Result
+ {
+ result_ok = osl_cond_result_ok,
+ result_error = osl_cond_result_error,
+ result_timeout = osl_cond_result_timeout
+ };
+
+ /* Create a condition.
+ */
+ Condition()
+ {
+ condition = osl_createCondition();
+ }
+
+ /* Release the OS-structures and free condition data-structure.
+ */
+ ~Condition()
+ {
+ osl_destroyCondition(condition);
+ }
+
+ /* Release all waiting threads, check returns sal_True.
+ */
+ void set()
+ {
+ osl_setCondition(condition);
+ }
+
+ /* Reset condition to false: wait() will block, check() returns sal_False.
+ */
+ void reset() {
+ osl_resetCondition(condition);
+ }
+
+ /** Blocks the calling thread until condition is set.
+ */
+ Result wait(const TimeValue *pTimeout = 0)
+ {
+ return (Result) osl_waitCondition(condition, pTimeout);
+ }
+
+ /** Checks if the condition is set without blocking.
+ */
+ sal_Bool check()
+ {
+ return osl_checkCondition(condition);
+ }
+
+
+ private:
+ oslCondition condition;
+
+ Condition(oslCondition condition)
+ {
+ this->condition = condition;
+ }
+ };
+
+#ifdef _USE_NAMESPACE
+}
+#endif
+
+#endif /* __cplusplus */
+#endif /* _OSL_CONDITN_HXX_ */
+
diff --git a/sal/inc/osl/diagnose.h b/sal/inc/osl/diagnose.h
new file mode 100644
index 000000000000..ca48805f90ba
--- /dev/null
+++ b/sal/inc/osl/diagnose.h
@@ -0,0 +1,163 @@
+/*************************************************************************
+ *
+ * $RCSfile: diagnose.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:12 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _OSL_DIAGNOSE_H_
+#define _OSL_DIAGNOSE_H_
+
+#ifndef _OSL_TYPES_H_
+# include <osl/types.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* //////////////////////////////////////////////////////////////////////////
+ Diagnostic support
+*/
+
+void SAL_CALL osl_breakDebug(void);
+sal_Bool SAL_CALL osl_assertFailedLine(const sal_Char* pszFileName, sal_Int32 nLine, const sal_Char* pszMessage);
+void SAL_CALL osl_trace(const sal_Char* pszFormat, ...);
+sal_Int32 SAL_CALL osl_reportError(sal_uInt32 nType, const sal_Char* pszErrorMessage);
+
+#ifdef __cplusplus
+}
+#endif
+
+#define OSL_THIS_FILE __FILE__
+
+#define OSL_DEBUG_ONLY(s) _OSL_DEBUG_ONLY(s)
+#define OSL_TRACE _OSL_TRACE
+#define OSL_ASSERT(c) _OSL_ASSERT(c, OSL_THIS_FILE, __LINE__)
+#define OSL_VERIFY(c) _OSL_VERIFY(c, OSL_THIS_FILE, __LINE__)
+#define OSL_ENSHURE(c, m) _OSL_ENSHURE(c, OSL_THIS_FILE, __LINE__, m)
+#define OSL_ENSURE(c, m) _OSL_ENSHURE(c, OSL_THIS_FILE, __LINE__, m)
+
+#define OSL_PRECOND(c, m) OSL_ENSHURE(c, m)
+#define OSL_POSTCOND(c, m) OSL_ENSHURE(c, m)
+
+
+#ifdef __cplusplus
+#define _OSL_GLOBAL ::
+#else
+#define _OSL_GLOBAL
+#endif /* __cplusplus */
+
+#ifdef _WIN16
+#ifdef _DEBUG
+#undef _DEBUG
+#endif
+#endif
+
+
+
+#ifdef _DEBUG
+
+#define _OSL_DEBUG_ONLY(f) (f)
+#define _OSL_TRACE _OSL_GLOBAL osl_trace
+#define _OSL_ASSERT(c, f, l) \
+ do \
+ { \
+ if (!(c) && _OSL_GLOBAL osl_assertFailedLine(f, l, 0)) \
+ _OSL_GLOBAL osl_breakDebug(); \
+ } while (0)
+#define _OSL_VERIFY(c, f, l) \
+ do \
+ { \
+ if (!(c) && _OSL_GLOBAL osl_assertFailedLine(f, l, 0)) \
+ _OSL_GLOBAL osl_breakDebug(); \
+ } while (0)
+#define _OSL_ENSHURE(c, f, l, m) \
+ do \
+ { \
+ if (!(c) && _OSL_GLOBAL osl_assertFailedLine(f, l, m)) \
+ _OSL_GLOBAL osl_breakDebug(); \
+ } while (0)
+#define _OSL_ENSHURE(c, f, l, m) \
+ do \
+ { \
+ if (!(c) && _OSL_GLOBAL osl_assertFailedLine(f, l, m)) \
+ _OSL_GLOBAL osl_breakDebug(); \
+ } while (0)
+#define _OSL_ENSURE(c, f, l, m) \
+ do \
+ { \
+ if (!(c) && _OSL_GLOBAL osl_assertFailedLine(f, l, m)) \
+ _OSL_GLOBAL osl_breakDebug(); \
+ } while (0)
+
+#else
+
+#define _OSL_DEBUG_ONLY(f) ((void)0)
+#define _OSL_TRACE 1 ? ((void)0) : _OSL_GLOBAL osl_trace
+#define _OSL_ASSERT(c, f, l) ((void)0)
+#define _OSL_VERIFY(c, f, l) ((void)(c))
+#define _OSL_ENSHURE(c, f, l, m) ((void)0)
+#define _OSL_ENSURE(c, f, l, m) ((void)0)
+
+#endif /* !_DEBUG */
+
+#endif /* _OSL_DIAGNOSE_H_ */
+
+
+
diff --git a/sal/inc/osl/file.h b/sal/inc/osl/file.h
new file mode 100644
index 000000000000..1151b7bd69d7
--- /dev/null
+++ b/sal/inc/osl/file.h
@@ -0,0 +1,1066 @@
+/*************************************************************************
+ *
+ * $RCSfile: file.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:12 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _OSL_FILE_H_
+#define _OSL_FILE_H_
+
+#ifndef _OSL_TYPES_H_
+# include <osl/types.h>
+#endif
+
+#ifndef _RTL_USTRING_H
+# include <rtl/ustring.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @name Main goals and usage hints
+
+The main intentention of this interface is to provide an universal portable and
+high performance access to file system issues on any operating system.<p>
+
+There are a few main goals:<p>
+
+1.The path specifications always have to be absolut. Any usage of relative path
+specifications is forbidden. Most operating systems provide a
+"Current Directory" per process. This is the reason why relative path
+specifications can cause problems in multithreading environments.<p>
+
+2.Proprietary notations of file paths are not supported. Every path notation
+must follow the UNC notation. The directory divider is the slash character.<p>
+
+3.The caller cannot get any information whether a file system is case sensitive,
+case preserving or not. The operating system implementation itself should
+determine if it can map case-insensitive paths. The case correct notation of
+a filename or file path is part of the "File Info". This case correct name
+can be used as a unique key if neccessary.<p>
+
+4. Obtaining information about files or volumes is controlled by a
+bitmask which specifies which fields are of interest. Due to performance
+issues it is not recommended to obtain information which is not needed.
+But if the operating system provides more information anyway the
+implementation can set more fields on output as were requested. It is in the
+responsibility of the caller to decide if he uses this additional information
+or not. But he should do so to prevent further unnecessary calls if the information
+is already there.<br>
+
+The input bitmask supports a flag <code>osl_FileStatus_Mask_Validate</code> which
+can be used to force retrieving uncached validated information. Setting this flag
+when calling <code>osl_getFileStatus</code> in combination with no other flag is
+a synonym for a "FileExists". This should only be done when processing a single file
+(f.e. before opening) and NEVER during enumeration of directory contents on any step
+of information processing. This would change the runtime behaviour from O(n) to
+O(n*n/2) on nearly every file system.<br>
+On Windows NT reading the contents of an directory with 7000 entries and
+getting full information about every file only takes 0.6 seconds. Specifying the
+flag <code>osl_FileStatus_Mask_Validate</code> for each entry will increase the
+time to 180 seconds (!!!).
+
+*/
+
+
+
+/* Error codes according to errno */
+
+typedef enum {
+ osl_File_E_None,
+ osl_File_E_PERM,
+ osl_File_E_NOENT,
+ osl_File_E_SRCH,
+ osl_File_E_INTR,
+ osl_File_E_IO,
+ osl_File_E_NXIO,
+ osl_File_E_2BIG,
+ osl_File_E_NOEXEC,
+ osl_File_E_BADF,
+ osl_File_E_CHILD,
+ osl_File_E_AGAIN,
+ osl_File_E_NOMEM,
+ osl_File_E_ACCES,
+ osl_File_E_FAULT,
+ osl_File_E_BUSY,
+ osl_File_E_EXIST,
+ osl_File_E_XDEV,
+ osl_File_E_NODEV,
+ osl_File_E_NOTDIR,
+ osl_File_E_ISDIR,
+ osl_File_E_INVAL,
+ osl_File_E_NFILE,
+ osl_File_E_MFILE,
+ osl_File_E_NOTTY,
+ osl_File_E_FBIG,
+ osl_File_E_NOSPC,
+ osl_File_E_SPIPE,
+ osl_File_E_ROFS,
+ osl_File_E_MLINK,
+ osl_File_E_PIPE,
+ osl_File_E_DOM,
+ osl_File_E_RANGE,
+ osl_File_E_DEADLK,
+ osl_File_E_NAMETOOLONG,
+ osl_File_E_NOLCK,
+ osl_File_E_NOSYS,
+ osl_File_E_NOTEMPTY,
+ osl_File_E_LOOP,
+ osl_File_E_ILSEQ,
+ osl_File_E_NOLINK,
+ osl_File_E_MULTIHOP,
+ osl_File_E_USERS,
+ osl_File_E_OVERFLOW,
+ osl_File_E_invalidError, /* unmapped error: always last entry in enum! */
+ osl_File_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslFileError;
+
+typedef void *oslDirectory;
+typedef void *oslDirectoryItem;
+
+/** Opens a directory for enumerating its contents.
+
+ @param strDirenctoryPath [in] Denotes the full qualified path of the directory follwing the UNC
+ notation. The path devider is '/'. Relative path specifications are not allowed.
+ @param pDirectory [out] on success it receives a handle used for subsequent calls by <code>osl_getNextDirectoryItem</code>
+ on error it receives NULL. The handle has to be released by a call to <code>osl_closeDirectory</code>.
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+ osl_File_E_NOENT the specified path doesn't exist<br>
+ osl_File_E_NOTDIR the specified path is not an directory <br>
+ osl_File_E_NOMEM not enough memory for allocating structures <br>
+ osl_File_E_ACCES permission denied<br>
+ osl_File_E_MFILE too many open files used by the process<br>
+ osl_File_E_NFILE too many open files in the system<br>
+ osl_File_E_NAMETOOLONG File name too long<br>
+ osl_File_E_LOOP Too many symbolic links encountered<p>
+
+ @see osl_getNextDirectoryItem
+ @see osl_closeDirectory
+*/
+
+oslFileError SAL_CALL osl_openDirectory( rtl_uString *strDirectoryPath, oslDirectory *pDirectory);
+
+/** Retrieves the next item(s) of a previously openend directory. All handles have an initial
+ refcount of 1.
+
+ @param Directory [in] is the directory handle received from a previous call to <code>osl_openDirectory</code>.
+ @param pItem [out] On success it receives a handle that can be used for subsequent calls to <code>osl_getFileStatus</code>.
+ The handle has to be released by a call to <code>osl_releaseDirectoryItem</code>.
+ @param uHint [in] With this parameter the caller can tell the implementation that (s)he
+ is going to call this function uHint times afterwards. This enables the implementation to
+ get the information for more than one file and cache it until the next calls.
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+ osl_File_E_NOMEM not enough memory for allocating structures <br>
+ osl_File_E_NOENT No more entries in this directory<p>
+
+ These errorcodes can (eventually) be returned:<p>
+ osl_File_E_BADF oslDirectory parameter is not valid<br>
+ osl_File_E_OVERFLOW Value too large for defined data type<p>
+
+ @see osl_releaseDirectoryItem
+ @see osl_acquireDirectoryItem
+ @see osl_getDirectoryItem
+ @see osl_getFileStatus
+ @see osl_createDirectoryItemFromHandle
+*/
+
+oslFileError SAL_CALL osl_getNextDirectoryItem(
+ oslDirectory Directory,
+ oslDirectoryItem *pItem,
+ sal_uInt32 uHint
+ );
+
+
+/** Releases a directory handle
+
+ @param Directory [in] a handle received by a call to <code>osl_openDirectory</code>.
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+ osl_File_E_NOMEM not enough memory for allocating structures <p>
+
+ These errorcodes can (eventually) be returned:<p>
+ osl_File_E_BADF Invalid oslDirectory parameter<br>
+ osl_File_E_INTR function call was interrupted<p>
+
+ @see osl_openDirectory
+*/
+
+oslFileError SAL_CALL osl_closeDirectory(
+ oslDirectory Directory
+ );
+
+
+/** Retrieves a single directory item handle with an initial refcount of 1.
+
+ @param strFilePath [in] absolute file path following the notation explained in the documentation for
+ <code>osl_openDirectory</code>. Due to performance issues it is not recommended to use this function
+ while enumerating the contents of a directory. In this case use <code>osl_getNextDirectoryItem</code> instead.
+ @param pItem [out] on success it receives a handle which can be used for subsequent calls to <code>osl_getFileStatus</code>.
+ The handle has to be released by a call to <code>osl_releaseDirectoryItem</code>.
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+ osl_File_E_NOMEM not enough memory for allocating structures <br>
+ osl_File_E_ACCES permission denied<br>
+ osl_File_E_MFILE too many open files used by the process<br>
+ osl_File_E_NFILE too many open files in the system<br>
+ osl_File_E_NOENT No such file or directory<br>
+ osl_File_E_LOOP Too many symbolic links encountered<br>
+ osl_File_E_NAMETOOLONG File name too long<br>
+ osl_File_E_NOTDIR A component of the path prefix of path is not a directory<p>
+
+ These errorcodes can (eventually) be returned:<p>
+ osl_File_E_IO I/O error<br>
+ osl_File_E_MULTIHOP Multihop attempted<br>
+ osl_File_E_NOLINK Link has been severed<br>
+ osl_File_E_FAULT Bad address<br>
+ osl_File_E_INTR function call was interrupted<p>
+
+
+ @see osl_releaseDirectoryItem
+ @see osl_acquireDirectoryItem
+ @see osl_getFileStatus
+ @see osl_getNextDirectoryItem
+ @see osl_createDirectoryItemFromHandle
+*/
+
+oslFileError SAL_CALL osl_getDirectoryItem(
+ rtl_uString *strFilePath,
+ oslDirectoryItem *pItem
+ );
+
+
+/** Increases the refcount of a directory item handle
+
+ @param Item [in] a handle received by a call to <code>osl_getDirectoryItem</code>, <code>osl_getNextDirectoryItem</code> or
+ <code>osl_createDirectoryItemFromHandle</code>.
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_NOMEM not enough memory for allocating structures <br>
+ osl_File_E_INVAL the format of the parameters was not valid<p>
+
+ @see osl_getDirectoryItem
+ @see osl_getNextDirectoryItem
+ @see osl_createDirectoryItemFromHandle
+ @see osl_releaseDirectoryItem
+*/
+
+oslFileError SAL_CALL osl_acquireDirectoryItem( oslDirectoryItem Item );
+
+/** Decreases the refcount of a directory item handle and releases the data if the
+ refcount reaches 0.
+
+ @param Item [in] a handle received by a call to <code>osl_getDirectoryItem</code>, <code>osl_getNextDirectoryItem</code> or
+ <code>osl_createDirectoryItemFromHandle</code>.
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_NOMEM not enough memory for allocating structures <br>
+ osl_File_E_INVAL the format of the parameters was not valid<p>
+
+ @see osl_getDirectoryItem
+ @see osl_getNextDirectoryItem
+ @see osl_acquireDirectoryItemosl_createDirectoryItemFromHandle
+ @see osl_acquireDirectoryItem
+*/
+
+oslFileError SAL_CALL osl_releaseDirectoryItem( oslDirectoryItem Item );
+
+/* File types */
+
+typedef enum {
+ osl_File_Type_Directory,
+ osl_File_Type_Volume,
+ osl_File_Type_Regular,
+ osl_File_Type_Fifo,
+ osl_File_Type_Socket,
+ osl_File_Type_Link,
+ osl_File_Type_Special,
+ osl_File_Type_Unknown
+} oslFileType;
+
+/* File attributes */
+#define osl_File_Attribute_ReadOnly 0x00000001
+#define osl_File_Attribute_Hidden 0x00000002
+#define osl_File_Attribute_Executable 0x00000010
+#define osl_File_Attribute_GrpWrite 0x00000020
+#define osl_File_Attribute_GrpRead 0x00000040
+#define osl_File_Attribute_GrpExe 0x00000080
+#define osl_File_Attribute_OwnWrite 0x00000100
+#define osl_File_Attribute_OwnRead 0x00000200
+#define osl_File_Attribute_OwnExe 0x00000400
+#define osl_File_Attribute_OthWrite 0x00000800
+#define osl_File_Attribute_OthRead 0x00001000
+#define osl_File_Attribute_OthExe 0x00002000
+
+/* Flags specifying which fields to retreive by osl_getFileStatus */
+
+#define osl_FileStatus_Mask_Type 0x00000001
+#define osl_FileStatus_Mask_Attributes 0x00000002
+#define osl_FileStatus_Mask_CreationTime 0x00000010
+#define osl_FileStatus_Mask_AccessTime 0x00000020
+#define osl_FileStatus_Mask_ModifyTime 0x00000040
+#define osl_FileStatus_Mask_FileSize 0x00000080
+#define osl_FileStatus_Mask_FileName 0x00000100
+#define osl_FileStatus_Mask_FilePath 0x00000200
+#define osl_FileStatus_Mask_NativePath 0x00000400
+#define osl_FileStatus_Mask_All 0x7FFFFFFF
+#define osl_FileStatus_Mask_Validate 0x80000000
+
+
+typedef
+
+/** Structure containing information about files and directories
+
+ @see osl_getFileStatus
+ @see oslFileType
+*/
+
+struct _oslFileStatus {
+/** Must be initialized with the size in bytes of the structure before passing it to any function */
+ sal_uInt32 uStructSize;
+/** Determines which members of the structure contain valid data */
+ sal_uInt32 uValidFields;
+/** The type of the file (file, directory, volume). */
+ oslFileType eType;
+/** File attributes */
+ sal_uInt64 uAttributes;
+/** First creation time in nanoseconds since 1/1/1970. Can be the last modify time depending on
+ platform or file system. */
+ TimeValue aCreationTime;
+/** Last access time in nanoseconds since 1/1/1970. Can be the last modify time depending on
+ platform or file system. */
+ TimeValue aAccessTime;
+/** Last modify time in nanoseconds since 1/1/1970. */
+ TimeValue aModifyTime;
+/** Size in bytes of the file. Zero for directories and volumes. */
+ sal_uInt64 uFileSize;
+/** Case correct name of the file. Should be set to zero before calling <code>osl_getFileStatus</code>
+ and released after usage. */
+ rtl_uString *strFileName;
+/** Full path of the file in UNC notation. Should be set to zero before calling <code>osl_getFileStatus</code>
+ and released after usage. */
+ rtl_uString **pstrFilePath;
+/** Full path of the file in platform depending notation. This is for displaying the path in the UI.
+ Should be set to zero before calling <code>osl_getFileStatus</code>
+ and released after usage. */
+ rtl_uString **pstrNativePath;
+} oslFileStatus;
+
+/** Retrieves information about a single file or directory
+
+ @param Item [in] a handle received by a previous call to <code>osl_getDirectoryItem</code>,
+ <code>osl_getNextDirectoryItem</code> or <code>osl_createDirectoryItemFromHandle</code>.
+ @param pStatus [in/out] points to a structure which receives the information of the file or directory
+ represented by the handle <code>Item</code>. The member <code>uStructSize</code> has to be initialized to
+ <code>sizeof(oslFileStatus)</code> before calling this function.
+ @param uFieldMask [in] specifies which fields of the structure pointed to by <code>pStatus</code>
+ are of interest to the caller.
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_NOMEM not enough memory for allocating structures <br>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+ osl_File_E_LOOP Too many symbolic links encountered<br>
+ osl_File_E_ACCES Permission denied<br>
+ osl_File_E_NOENT No such file or directory<br>
+ osl_File_E_NAMETOOLONG file name too long<p>
+
+ These errorcodes can (eventually) be returned:<p>
+ osl_File_E_BADF Invalid oslDirectoryItem parameter<br>
+ osl_File_E_FAULT Bad address<br>
+ osl_File_E_OVERFLOW Value too large for defined data type<br>
+ osl_File_E_INTR function call was interrupted<br>
+ osl_File_E_NOLINK Link has been severed<br>
+ osl_File_E_MULTIHOP Components of path require hopping to multiple remote machines and the file system does not allow it<br>
+ osl_File_E_MFILE too many open files used by the process<br>
+ osl_File_E_NFILE too many open files in the system<br>
+ osl_File_E_NOSPC No space left on device<br>
+ osl_File_E_NXIO No such device or address<br>
+ osl_File_E_IO I/O error<br>
+ osl_File_E_NOSYS Function not implemented<p>
+
+ @see osl_getDirectoryItem
+ @see osl_getNextDirectoryItem
+ @see osl_createDirectoryItemFromHandle
+ @see oslFileStatus
+*/
+
+oslFileError SAL_CALL osl_getFileStatus( oslDirectoryItem Item, oslFileStatus *pStatus, sal_uInt32 uFieldMask );
+
+
+typedef void *oslVolumeDeviceHandle;
+
+
+oslFileError SAL_CALL osl_unmountVolumeDevice( oslVolumeDeviceHandle Handle );
+
+oslFileError SAL_CALL osl_automountVolumeDevice( oslVolumeDeviceHandle Handle );
+
+oslFileError SAL_CALL osl_releaseVolumeDeviceHandle( oslVolumeDeviceHandle Handle );
+
+oslFileError SAL_CALL osl_acquireVolumeDeviceHandle( oslVolumeDeviceHandle Handle );
+
+/** Gets the normalized absolute file system path where a device is mounted to.
+
+ @param Handle [in] Device handle of the volume retrieved with <code>osl_getVolumeInformation</code>.
+ @param pstrPath [out] Receives the path where the device is mounted to.
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_NOMEM not enough memory for allocating structures <br>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+ osl_File_E_ACCES permission denied<br>
+ osl_File_E_NXIO No such device or address<br>
+ osl_File_E_NODEV No such device<br>
+ osl_File_E_NOENT No such file or directory<br>
+
+ These errorcodes can (eventually) be returned:<p>
+ osl_File_E_FAULT Bad address<br>
+ osl_FilE_E_INTR function call was interrupted<br>
+ osl_File_E_IO I/O error<br>
+ osl_File_E_MULTIHOP Multihop attempted<br>
+ osl_File_E_NOLINK Link has been severed<br>
+ osl_File_E_EOVERFLOW Value too large for defined data type<p>
+
+ @see osl_getVolumeInformation
+ @see osl_automountVolumeDevice
+ @see osl_unmountVolumeDevice
+*/
+
+oslFileError SAL_CALL osl_getVolumeDeviceMountPath( oslVolumeDeviceHandle Handle, rtl_uString **pstrPath );
+
+/* Volume attributes */
+
+#define osl_Volume_Attribute_Removeable 0x00000001L
+#define osl_Volume_Attribute_Remote 0x00000002L
+
+/* Flags specifying which fields to retreive by osl_getVolumeInfo */
+
+#define osl_VolumeInfo_Mask_Attributes 0x00000001L
+#define osl_VolumeInfo_Mask_TotalSpace 0x00000002L
+#define osl_VolumeInfo_Mask_UsedSpace 0x00000004L
+#define osl_VolumeInfo_Mask_FreeSpace 0x00000008L
+#define osl_VolumeInfo_Mask_MaxNameLength 0x00000010L
+#define osl_VolumeInfo_Mask_MaxPathLength 0x00000020L
+#define osl_VolumeInfo_Mask_FileSystemName 0x00000040L
+#define osl_VolumeInfo_Mask_DeviceHandle 0x00000080L
+
+typedef
+
+/** Structure containing information about volumes
+
+ @see osl_getVolumeInformation
+ @see oslFileType
+*/
+
+struct _oslVolumeInfo {
+/** Must be initialized with the size in bytes of the structure before passing it to any function */
+ sal_uInt32 uStructSize;
+/** Determines which members of the structure contain valid data */
+ sal_uInt32 uValidFields;
+/** Attributes of the volume (remote and/or removable) */
+ sal_uInt32 uAttributes;
+/** Total availiable space on the volume for the current process/user */
+ sal_uInt64 uTotalSpace;
+/** Used space on the volume for the current process/user */
+ sal_uInt64 uUsedSpace;
+/** Free space on the volume for the current process/user */
+ sal_uInt64 uFreeSpace;
+/** Maximum length of file name of a single item */
+ sal_uInt32 uMaxNameLength;
+/** Maximum length of a full quallified path in UNC notation */
+ sal_uInt32 uMaxPathLength;
+/** Name of the file system type. Should be set to zero before calling <code>osl_getVolumeInformation</code>
+ and released after usage. */
+ rtl_uString **pstrFileSystemName;
+/** Handle of underlying device */
+ oslVolumeDeviceHandle *pDeviceHandle;
+} oslVolumeInfo;
+
+
+/** Retrieves information about a volume. A volume can either be a mount point, a network
+ resource or a drive depending on operating system and file system. Before calling this
+ function <code>osl_getFileStatus</code> should be called to determine if the type is
+ <code>osl_file_Type_Volume</code>.
+
+ @param strDirectory [in] Full qualified UNC path to the volume
+ @param pInfo [out] On success it receives information about the volume.
+ @param uFieldMask [in] Specifies which members of the structure should be filled
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_NOMEM not enough memory for allocating structures <br>
+ osl_File_E_INVAL the format of the parameters was not valid<p>
+
+ These errorcodes can (eventually) be returned:<p>
+ osl_File_E_NOTDIR Not a directory<br>
+ osl_File_E_NAMETOOLONG File name too long<br>
+ osl_File_E_NOENT No such file or directory<br>
+ osl_File_E_ACCES permission denied<br>
+ osl_File_E_LOOP Too many symbolic links encountered<br>
+ ols_File_E_FAULT Bad address<br>
+ osl_File_E_IO I/O error<br>
+ osl_File_E_NOSYS Function not implemented<br>
+ osl_File_E_MULTIHOP Multihop attempted<br>
+ osl_File_E_NOLINK Link has been severed<br>
+ osl_File_E_INTR function call was interrupted<p>
+
+ @see osl_getFileStatus
+ @see oslVolumeInfo
+*/
+
+oslFileError SAL_CALL osl_getVolumeInformation( rtl_uString *strDirectory, oslVolumeInfo *pInfo, sal_uInt32 uFieldMask );
+
+typedef void *oslFileHandle;
+
+/* Open flags */
+
+#define osl_File_OpenFlag_Read 0x00000001L
+#define osl_File_OpenFlag_Write 0x00000002L
+#define osl_File_OpenFlag_Create 0x00000004L
+
+/** Opens a file.
+
+ @param strPath [in] Full qualified path to the file to open. Only regular files
+ can be openend.
+ @param pHandle [out] On success it receives a handle to the open file.
+ @param uFlags [in] Specifies the open mode.
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_NOMEM not enough memory for allocating structures <br>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+ osl_File_E_NAMETOOLONG pathname was too long<br>
+ osl_File_E_NOENT No such file or directory<br>
+ osl_File_E_ACCES permission denied<p>
+
+ These errorcodes can (eventually) be returned:<p>
+ osl_File_E_NOTDIR Not a directory<br>
+ osl_File_E_NXIO No such device or address<br>
+ osl_File_E_NODEV No such device<br>
+ osl_File_E_ROFS Read-only file system<br>
+ osl_File_E_TXTBSY Text file busy<br>
+ osl_File_E_FAULT Bad address<br>
+ osl_File_E_LOOP Too many symbolic links encountered<br>
+ osl_File_E_NOSPC No space left on device<br>
+ osl_File_E_ISDIR Is a directory<br>
+ osl_File_E_MFILE too many open files used by the process<br>
+ osl_File_E_NFILE too many open files in the system<br>
+ osl_File_E_DQUOT Quota exceeded<br>
+ osl_File_E_EXIST File exists<br>
+ osl_FilE_E_INTR function call was interrupted<br>
+ osl_File_E_IO I/O error<br>
+ osl_File_E_MULTIHOP Multihop attempted<br>
+ osl_File_E_NOLINK Link has been severed<br>
+ osl_File_E_EOVERFLOW Value too large for defined data type<p>
+
+ @see osl_closeFile
+ @see osl_setFilePos
+ @see osl_getFilePos
+ @see osl_readFile
+ @see osl_writeFile
+ @see osl_setFileSize
+ @see osl_createDirectoryItemFromHandle
+*/
+
+oslFileError SAL_CALL osl_openFile( rtl_uString *strPath, oslFileHandle *pHandle, sal_uInt32 uFlags );
+
+#define osl_Pos_Absolut 1
+#define osl_Pos_Current 2
+#define osl_Pos_End 3
+
+/** Sets the internal position pointer of an open file.
+ @param Handle [in] Handle of an open file received by a previous call to <code>osl_openFile</code>.
+ @param uHow [in] Distance to move the internal position pointer (from uPos).
+ @param uPos [in] Absolute position from the beginning of the file.
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+ osl_File_E_OVERFLOW The resulting file offset would be a value which cannot
+ be represented correctly for regular files<p>
+
+ @see osl_openFile
+ @see osl_getFilePos
+*/
+
+oslFileError SAL_CALL osl_setFilePos( oslFileHandle Handle, sal_uInt32 uHow, sal_uInt64 uPos );
+
+
+/** Retrieves the current position of the internal pointer of an open file.
+ @param Handle [in] Handle to an open file.
+ @param pPos [out] On Success it receives the current position of the file pointer.
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+ osl_File_E_OVERFLOW The resulting file offset would be a value which cannot
+ be represented correctly for regular files<p>
+
+ @see osl_openFile
+ @see osl_setFilePos
+ @see osl_readFile
+ @see osl_writeFile
+*/
+
+oslFileError SAL_CALL osl_getFilePos( oslFileHandle Handle, sal_uInt64 *pPos );
+
+
+/** Sets the file size of an open file. The file can be truncated or enlarged by the function.
+ The position of the file pointer is not affeced by this function.
+ @param Handle [in] Handle to an open file.
+ @param uSize [int] New size in bytes.
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+ osl_File_E_OVERFLOW The resulting file offset would be a value which cannot
+ be represented correctly for regular files<p>
+
+ @see osl_openFile
+ @see osl_setFilePos
+ @see osl_getFileStatus
+*/
+
+oslFileError SAL_CALL osl_setFileSize( oslFileHandle Handle, sal_uInt64 uSize );
+
+
+/** Reads a number of bytes from a file. The internal file pointer is increased by the number of bytes
+ read.
+ @param Handle [in] Handle to an open file.
+ @param pBuffer [out] Points to a buffer which receives data. The buffer must be large enough
+ to hold <code>uBytesRequested</code> bytes.
+ @param uBytesRequested [in] Number of bytes which should be retrieved.
+ @param pBytesRead [out] On success the number of bytes which have actually been retrieved.
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+
+ These errorcodes can (eventually) be returned:<p>
+ osl_File_E_INTR function call was interrupted<br>
+ osl_File_E_IO I/O error<br>
+ osl_File_E_ISDIR Is a directory<br>
+ osl_File_E_BADF Bad file<br>
+ osl_File_E_FAULT Bad address<br>
+ osl_File_E_AGAIN Operation would block<br>
+ osl_File_E_NOLINK Link has been severed<p>
+
+ @see osl_openFile
+ @see osl_writeFile
+ @see osl_setFilePos
+*/
+
+oslFileError SAL_CALL osl_readFile( oslFileHandle Handle, void *pBuffer, sal_uInt64 uBytesRequested, sal_uInt64 *pBytesRead );
+
+
+/** Writes a number of bytes to a file. The internal file pointer is increased by the number of bytes
+ read.
+ @param Handle [in] Handle to an open file.
+ @param pBuffer [int] Points to a buffer which contains the data.
+ @param uBytesToWrite [in] Number of bytes which should be written.
+ @param pBytesWritten [out] On success the number of bytes which have actually been written.
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+ osl_File_E_FBIG File too large<br>
+ osl_File_E_DQUOT Quota exceeded<p>
+
+ These errorcodes can (eventually) be returned:<p>
+ osl_File_E_AGAIN Operation would block<br>
+ osl_File_E_BADF Bad file<br>
+ osl_File_E_FAULT Bad address<br>
+ osl_File_E_INTR function call was interrupted<br>
+ osl_File_E_IO I/O error<br>
+ osl_File_E_NOLCK No record locks available<br>
+ osl_File_E_NOLINK Link has been severed<br>
+ osl_File_E_NOSPC No space left on device<br>
+ osl_File_E_NXIO No such device or address<p>
+
+ @see osl_openFile
+ @see osl_readFile
+ @see osl_setFilePos
+*/
+
+oslFileError SAL_CALL osl_writeFile( oslFileHandle Handle, const void *pBuffer, sal_uInt64 uBytesToWrite, sal_uInt64 *pBytesWritten );
+
+
+/** Closes an open file.
+ @param Handle [in] Handle to a file previously open by a call to <code>osl_openFile</code>.
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<p>
+
+ These errorcodes can (eventually) be returned:<p>
+ osl_File_E_BADF Bad file<br>
+ osl_File_E_INTR function call was interrupted<br>
+ osl_File_E_NOLINK Link has been severed<br>
+ osl_File_E_NOSPC No space left on device<br>
+ osl_File_E_IO I/O error<p>
+*/
+
+oslFileError SAL_CALL osl_closeFile( oslFileHandle Handle );
+
+
+/** Get a directory item handle from an open file with an initial refcount of 1.
+ @param Handle [in] A Hdnale to an open file.
+ @param pItem [out] On success it receives a handle to a directory item which can be used
+ in subsequent calls to <code>osl_getFileStatus</code>.
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<p>
+
+ @see osl_openFile
+ @see osl_getFileStatus
+ @see osl_acquireDirectoryItem
+ @see osl_releaseDirectoryItem
+*/
+
+oslFileError SAL_CALL osl_createDirectoryItemFromHandle( oslFileHandle Handle, oslDirectoryItem *pItem );
+
+
+/** Creates a directory.
+ @param strPatg [in] Full qualified UNC path of the directory to create.
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+ osl_File_E_NOMEM not enough memory for allocating structures <br>
+ osl_File_E_EXIST File exists<br>
+ osl_File_E_ACCES Permission denied<br>
+ osl_File_E_NAMETOOLONG File name too long<br>
+ osl_File_E_NOENT No such file or directory<br>
+ osl_File_E_NOTDIR Not a directory<br>
+ osl_File_E_ROFS Read-only file system<br>
+ osl_File_E_NOSPC No space left on device<br>
+ osl_File_E_DQUOT Quota exceeded<p>
+
+ These errorcodes can (eventually) be returned:<p>
+ osl_File_E_LOOP Too many symbolic links encountered<br>
+ osl_File_E_FAULT Bad address<br>
+ osl_FileE_IO I/O error<br>
+ osl_File_E_MLINK Too many links<br>
+ osl_File_E_MULTIHOP Multihop attempted<br>
+ osl_File_E_NOLINK Link has been severed<p>
+
+ @see osl_removeDirectory
+*/
+
+oslFileError SAL_CALL osl_createDirectory( rtl_uString* strPath );
+
+/** Removes an empty directory.
+
+ @param strPath [in] Full qualified UNC path of the directory.
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+ osl_File_E_NOMEM not enough memory for allocating structures <br>
+ osl_File_E_PERM Operation not permitted<br>
+ osl_File_E_ACCES Permission denied<br>
+ osl_File_E_NOENT No such file or directory<br>
+ osl_File_E_NOTDIR Not a directory<br>
+ osl_File_E_NOTEMPTY Directory not empty<p>
+
+ These errorcodes can (eventually) be returned:<p>
+ osl_File_E_FAULT Bad address<br>
+ osl_File_E_NAMETOOLONG File name too long<br>
+ osl_File_E_BUSY Device or resource busy<br>
+ osl_File_E_ROFS Read-only file system<br>
+ osl_File_E_LOOP Too many symbolic links encountered<br>
+ osl_File_E_BUSY Device or resource busy<br>
+ osl_File_E_EXIST File exists<br>
+ osl_File_E_IO I/O error<br>
+ osl_File_E_MULTIHOP Multihop attempted<br>
+ osl_File_E_NOLINK Link has been severed<p>
+
+ @see osl_createDirectory
+*/
+
+oslFileError SAL_CALL osl_removeDirectory( rtl_uString* strPath );
+
+
+/** Removes (erases) a regular file.
+
+ @param strPath [in] Full qualified UNC path of the directory.
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+ osl_File_E_NOMEM not enough memory for allocating structures <br>
+ osl_File_E_ACCES Permission denied<br>
+ osl_File_E_PERM Operation not permitted<br>
+ osl_File_E_NAMETOOLONG File name too long<br>
+ osl_File_E_NOENT No such file or directory<br>
+ osl_File_E_ISDIR Is a directory<br>
+ osl_File_E_ROFS Read-only file system<p>
+
+ These errorcodes can (eventually) be returned:<p>
+ osl_File_E_FAULT Bad address<br>
+ osl_File_E_LOOP Too many symbolic links encountered<br>
+ osl_File_E_IO I/O error<br>
+ osl_File_E_BUSY Device or resource busy<br>
+ osl_File_E_INTR function call was interrupted<br>
+ osl_File_E_LOOP Too many symbolic links encountered<br>
+ osl_File_E_MULTIHOP Multihop attempted<br>
+ osl_File_E_NOLINK Link has been severed<br>
+ osl_File_E_TXTBSY Text file busy<p>
+*/
+
+oslFileError SAL_CALL osl_removeFile( rtl_uString* strPath );
+
+
+/** Copies a file to a new destination. Copies only files not directories. No assumptions should
+ be made about preserving attributes or file time.
+ @param strPath [in] Full qualified UNC path of the source file.
+ @param strDestPath [in] Full qualified UNC path of the destination file. A directory is
+ NOT a valid destination file !
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+ osl_File_E_NOMEM not enough memory for allocating structures <br>
+ osl_File_E_ACCES Permission denied<br>
+ osl_File_E_PERM Operation not permitted<br>
+ osl_File_E_NAMETOOLONG File name too long<br>
+ osl_File_E_NOENT No such file or directory<br>
+ osl_File_E_ISDIR Is a directory<br>
+ osl_File_E_ROFS Read-only file system<p>
+
+ @see osl_moveFile
+ @see osl_removeFile
+ @see osl_createDirectory
+*/
+
+oslFileError SAL_CALL osl_copyFile( rtl_uString* strPath, rtl_uString *strDestPath );
+
+
+/** Moves a file or directory to a new destination or renames it. File time and attributes
+ are preserved.
+ @param strPath [in] Full qualified UNC path of the source file.
+ @param strDestPath [in] Full qualified UNC path of the destination file. An existing directory
+ is NOT a valid destination !
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+ osl_File_E_NOMEM not enough memory for allocating structures <br>
+ osl_File_E_ACCES Permission denied<br>
+ osl_File_E_PERM Operation not permitted<br>
+ osl_File_E_NAMETOOLONG File name too long<br>
+ osl_File_E_NOENT No such file or directory<br>
+ osl_File_E_ROFS Read-only file system<p>
+
+ @see osl_copyFile
+*/
+
+oslFileError SAL_CALL osl_moveFile( rtl_uString* strPath, rtl_uString *strDestPath );
+
+
+/** Determines a valid unused canonical name for a requested name. Depending on file system and operation system
+ the illegal characters are replaced by valid ones. If a file or directory with the requested name
+ already exists a new name is generated following the common rules on the actual file system and
+ operating system.
+
+ @param strRequested [in] Requested name of a file or directory.
+ @param strValid [out] On success receives a name which is unused and valid on the actual operating system and
+ file system.
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+
+ @see osl_getFileStatus
+*/
+
+oslFileError SAL_CALL osl_getCanonicalName( rtl_uString *strRequested, rtl_uString **strValid);
+
+
+/** Converts a path relative to a given directory into an full qualified UNC path.
+
+ @param strDirBase [in] Base directory to which the relative path is related to.
+ @param strRelative[in] Path of a file or directory relative to the directory path
+ specified by <code>strDirBase</code>.
+ @param strAbsolute [out] On success it receives the full qualified UNC path of the
+ requested relative path.
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+ osl_File_E_NOMEM not enough memory for allocating structures <br>
+ osl_File_E_NOTDIR Not a directory<br>
+ osl_File_E_ACCES Permission denied<br>
+ osl_File_E_NOENT No such file or directory<br>
+ osl_File_E_NAMETOOLONG File name too long<p>
+
+
+ These errorcodes can (eventually) be returned:<p>
+ osl_File_E_OVERFLOW Value too large for defined data type<p>
+ osl_File_E_FAULT Bad address<br>
+ osl_File_E_INTR function call was interrupted<br>
+ osl_File_E_LOOP Too many symbolic links encountered<br>
+ osl_File_E_MULTIHOP Multihop attempted<br>
+ osl_File_E_NOLINK Link has been severed<p>
+
+ @see osl_getFileStatus
+*/
+
+
+oslFileError SAL_CALL osl_getAbsolutePath( rtl_uString* strDirBase, rtl_uString *strRelative, rtl_uString **strAbsolute );
+
+
+/** Converts a system dependent path into a full qualified UNC path
+
+ @param strSysPath[in] System dependent path of a file or a directory
+ @param strPath[out] On success it receives the full qualified UNC path
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+
+ @see osl_getCanonicalName
+
+*/
+
+oslFileError SAL_CALL osl_normalizePath( rtl_uString *strSysPath, rtl_uString **strPath );
+
+
+/** Converts a File URL into a full qualified UNC path
+
+ @param urlPath[in] System dependent path of a file or a directory
+ @param strPath[out] On success it receives the full qualified UNC path
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+
+ @see osl_normalizePath
+
+*/
+
+oslFileError SAL_CALL osl_getNormalizedPathFromFileURL( rtl_uString *urlPath, rtl_uString **strPath );
+
+
+/** Converts a full qualified UNC path into a FileURL
+
+ @param dir[in] System dependent path of a file or a directory
+ @param strPath[out] On success it receives the full qualified UNC path
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+
+ @see osl_normalizePath
+ @see osl_getNormalizedPathFromFileURL
+
+*/
+
+oslFileError SAL_CALL osl_getFileURLFromNormalizedPath( rtl_uString *normPath, rtl_uString **strPath);
+
+
+/** Searches a full qualified UNC-Path/File
+
+ @param filePath[in] System dependent path / Normalized Path / File-URL or file or relative directory
+ @param searchPath[in] Paths, in which a given file has to be searched. These paths are only for the search of a
+ file or a relative path, otherwise it will be ignored. If it is set to NULL or while using the
+ search path the search failed the function searches for a matching file in all system directories and in the directories
+ listed in the PATH environment variable
+ @param strPath[out] On success it receives the full qualified UNC path
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+ osl_File_E_NOTDIR Not a directory<br>
+ osl_File_E_NOENT No such file or directory not found<br>
+ @see osl_normalizePath
+
+*/
+
+/** Converts a full qualified UNC path into a system dependend path
+
+ @param dir[in] Full qualified UNC path
+ @param strPath[out] On success it receives the system dependent path of a file or a directory
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+
+ @see osl_normalizePath
+ @see osl_getNormalizedPathFromFileURL
+
+*/
+
+oslFileError SAL_CALL osl_getSystemPathFromNormalizedPath( rtl_uString *normPath, rtl_uString **strPath);
+
+oslFileError SAL_CALL osl_searchNormalizedPath( rtl_uString *filePath, rtl_uString *searchPath, rtl_uString **strPath );
+
+
+/** Sets file-attributes
+
+ @param filePath[in] Path of the file
+ @param uAttributes[in] Attributes of the file to be set
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+ @see osl_getFileStatus
+
+*/
+
+oslFileError SAL_CALL osl_setFileAttributes( rtl_uString *filePath, sal_uInt64 uAttributes );
+
+
+/** Sets file-Time
+
+ @param filePath[in] Path of the file
+ @param aCreationTime[in] creation time of the given file
+ @param aLastAccessTime[in] time of the last access of the given file
+ @param aLastWriteTime[in] time of the last modifying of the given file
+
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+ osl_File_E_NOENT No such file or directory not found<br>
+ @see osl_getFileStatus
+
+*/
+
+oslFileError SAL_CALL osl_setFileTime( rtl_uString *filePath, TimeValue *aCreationTime,
+ TimeValue *aLastAccessTime,
+ TimeValue *aLastWriteTime);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OSL_FILE_H_ */
+
+
diff --git a/sal/inc/osl/file.hxx b/sal/inc/osl/file.hxx
new file mode 100644
index 000000000000..b852debb57e8
--- /dev/null
+++ b/sal/inc/osl/file.hxx
@@ -0,0 +1,1408 @@
+/*************************************************************************
+ *
+ * $RCSfile: file.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:12 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _OSL_FILE_HXX_
+#define _OSL_FILE_HXX_
+
+#ifdef __cplusplus
+
+#ifndef _RTL_MEMORY_H_
+# include <rtl/memory.h>
+#endif
+
+#ifndef _RTL_USTRING_
+# include <rtl/ustring>
+#endif
+
+#include <osl/file.h>
+#include <osl/macros.hxx>
+
+
+#ifdef _USE_NAMESPACE
+namespace osl
+{
+#endif
+
+
+/** The VolumeInfo class
+
+ @see Directory::getVolumeInfo
+*/
+
+#define VolumeInfoMask_Attributes osl_VolumeInfo_Mask_Attributes
+#define VolumeInfoMask_TotalSpace osl_VolumeInfo_Mask_TotalSpace
+#define VolumeInfoMask_UsedSpace osl_VolumeInfo_Mask_UsedSpace
+#define VolumeInfoMask_FreeSpace osl_VolumeInfo_Mask_FreeSpace
+#define VolumeInfoMask_MaxNameLength osl_VolumeInfo_Mask_MaxNameLength
+#define VolumeInfoMask_MaxPathLength osl_VolumeInfo_Mask_MaxPathLengt
+#define VolumeInfoMask_FileSystemName osl_VolumeInfo_Mask_FileSystemName
+
+class Directory;
+
+class VolumeInfo
+{
+ oslVolumeInfo _aInfo;
+ sal_uInt32 _nMask;
+ rtl_uString *_strFileSystemName;
+
+ /** define copy c'tor and assginment operator privat
+ */
+
+ VolumeInfo( VolumeInfo& );
+ VolumeInfo& operator = ( VolumeInfo& );
+
+public:
+
+ /** C'tor
+
+ @param nMask set of flaggs decribing the demanded information.
+ */
+
+ VolumeInfo( sal_uInt32 nMask ): _nMask( nMask )
+ {
+ _aInfo.uStructSize = sizeof( oslVolumeInfo );
+ rtl_fillMemory( &_aInfo.uValidFields, sizeof( oslVolumeInfo ) - sizeof( sal_uInt32 ), 0 );
+ _strFileSystemName=NULL;
+ _aInfo.pstrFileSystemName = &_strFileSystemName;
+ }
+
+ /** D'tor
+ */
+
+ ~VolumeInfo()
+ {
+ if (_strFileSystemName!=NULL)
+ rtl_uString_release(_strFileSystemName);
+ }
+
+ /** check if specified fields are valid
+
+ @param set of flags for the fields to check
+ @return sal_True if all fields are valid, sal_False otherwise.
+ */
+
+ inline sal_Bool isValid( sal_uInt32 nMask ) const
+ {
+ return ( nMask & _aInfo.uValidFields ) == nMask;
+ }
+
+ /** @return sal_True if Attributes are valid and the volume is remote,
+ sal_False otherwise.
+ */
+
+ inline sal_Bool getRemoteFlag() const
+ {
+ return (sal_Bool) (_aInfo.uAttributes & osl_Volume_Attribute_Remote);
+ }
+
+ /** @return sal_True if attributes are valid and the volume is removable,
+ sal_False otherwise.
+ */
+
+ inline sal_Bool getRemoveableFlag() const
+ {
+ return (sal_Bool) (_aInfo.uAttributes & osl_Volume_Attribute_Removeable);
+ }
+
+ /** @return the total diskspace of this volume if this information is valid,
+ 0 otherwise.
+ */
+
+ inline sal_uInt64 getTotalSpace() const
+ {
+ return _aInfo.uTotalSpace;
+ }
+
+ /** @return the free diskspace of this volume if this information is valid,
+ 0 otherwise.
+ */
+
+ inline sal_uInt64 getFreeSpace() const
+ {
+ return _aInfo.uFreeSpace;
+ }
+
+ /** @return the used diskspace of this volume if this information is valid,
+ 0 otherwise.
+ */
+
+ inline sal_uInt64 getUsedSpace() const
+ {
+ return _aInfo.uUsedSpace;
+ }
+
+ /** @return the maximal length of a file name if this information is valid,
+ 0 otherwise.
+ */
+
+ inline sal_uInt32 getMaxNameLength() const
+ {
+ return _aInfo.uMaxNameLength;
+ }
+
+ /** @return the maximal length of a path if this information is valid,
+ 0 otherwise.
+ */
+
+ inline sal_uInt32 getMaxPathLength() const
+ {
+ return _aInfo.uMaxPathLength;
+ }
+
+ /** @return the name of the volume's fielsystem if this information is valid,
+ otherwise an empty string.
+ */
+
+ inline ::rtl::OUString getFileSystemName() const
+ {
+ return _strFileSystemName;
+ }
+
+ friend class Directory;
+};
+
+// -----------------------------------------------------------------------------
+
+/** The FileStatus class
+
+ @see DirectoryItem::getFileStatus
+*/
+
+#define FileStatusMask_Type osl_FileStatus_Mask_Type
+#define FileStatusMask_Attributes osl_FileStatus_Mask_Attributes
+#define FileStatusMask_CreationTime osl_FileStatus_Mask_CreationTime
+#define FileStatusMask_AccessTime osl_FileStatus_Mask_AccessTime
+#define FileStatusMask_ModifyTime osl_FileStatus_Mask_ModifyTime
+#define FileStatusMask_FileSize osl_FileStatus_Mask_FileSize
+#define FileStatusMask_FileName osl_FileStatus_Mask_FileName
+#define FileStatusMask_FilePath osl_FileStatus_Mask_FilePath
+#define FileStatusMask_NativePath osl_FileStatus_Mask_NativePath
+#define FileStatusMask_All osl_FileStatus_Mask_All
+#define FileStatusMask_Validate osl_FileStatus_Mask_Validate
+
+#define Attribute_ReadOnly osl_File_Attribute_ReadOnly
+#define Attribute_Hidden osl_File_Attribute_Hidden
+#define Attribute_Executable osl_File_Attribute_Executable
+#define Attribute_GrpWrite osl_File_Attribute_GrpWrite
+#define Attribute_GrpRead osl_File_Attribute_GrpRead
+#define Attribute_GrpExe osl_File_Attribute_GrpExe
+#define Attribute_OwnWrite osl_File_Attribute_OwnWrite
+#define Attribute_OwnRead osl_File_Attribute_OwnRead
+#define Attribute_OwnExe osl_File_Attribute_OwnExe
+#define Attribute_OthWrite osl_File_Attribute_OthWrite
+#define Attribute_OthRead osl_File_Attribute_OthRead
+#define Attribute_OthExe osl_File_Attribute_OthExe
+
+class DirectoryItem;
+
+class FileStatus
+{
+ oslFileStatus _aStatus;
+ sal_uInt32 _nMask;
+ rtl_uString *_strNativePath;
+ rtl_uString *_strFilePath;
+
+ /** define copy c'tor and assginment operator privat
+ */
+
+ FileStatus( FileStatus& );
+ FileStatus& operator = ( FileStatus& );
+
+public:
+
+ enum Type {
+ Directory = osl_File_Type_Directory,
+ Volume = osl_File_Type_Volume,
+ Regular = osl_File_Type_Regular,
+ Fifo = osl_File_Type_Fifo,
+ Socket = osl_File_Type_Socket,
+ Link = osl_File_Type_Link,
+ Special = osl_File_Type_Special,
+ Unknown = osl_File_Type_Unknown
+ };
+
+ /** C'tor
+
+ @param nMask set of flaggs decribing the demanded information.
+ */
+
+ FileStatus( sal_uInt32 nMask ): _nMask( nMask ), _strNativePath( NULL ), _strFilePath( NULL )
+ {
+ _aStatus.uStructSize = sizeof( oslFileStatus );
+ rtl_fillMemory( &_aStatus.uValidFields, sizeof( oslFileStatus ) - sizeof( sal_uInt32 ), 0 );
+ _aStatus.pstrNativePath = &_strNativePath;
+ _aStatus.pstrFilePath = &_strFilePath;
+ }
+
+ /** D'tor
+ */
+
+ ~FileStatus()
+ {
+ if ( _strFilePath )
+ rtl_uString_release( _strFilePath );
+ if ( _strNativePath )
+ rtl_uString_release( _strNativePath );
+ if ( _aStatus.strFileName )
+ rtl_uString_release( _aStatus.strFileName );
+ }
+
+ /** check if specified fields are valid
+
+ @param set of flags for the fields to check
+ @return sal_True if all fields are valid, sal_False otherwise.
+ */
+ inline sal_Bool isValid( sal_uInt32 nMask ) const
+ {
+ return ( nMask & _aStatus.uValidFields ) == nMask;
+ }
+
+ /** @return the file type if this information is valid,
+ Unknown otherwise.
+ */
+ inline Type getFileType() const
+ {
+ return (_aStatus.uValidFields & FileStatusMask_Type) ? (Type) _aStatus.eType : Unknown;
+ }
+
+ /** @return the set of attribute flags of this file
+ */
+
+ inline sal_uInt64 getAttributes() const
+ {
+ return _aStatus.uAttributes;
+ }
+
+ /** @return the creation time if this information is valid,
+ an uninitialized TimeValue otherwise.
+ */
+
+ inline TimeValue getCreationTime() const
+ {
+ return _aStatus.aCreationTime;
+ }
+
+ /** @return the last access time if this information is valid,
+ an uninitialized TimeValue otherwise.
+ */
+
+ inline TimeValue getAccessTime() const
+ {
+ return _aStatus.aAccessTime;
+ }
+
+ /** @return the last modified time if this information is valid,
+ an uninitialized TimeValue otherwise.
+ */
+
+ inline TimeValue getModifyTime() const
+ {
+ return _aStatus.aModifyTime;
+ }
+
+ /** @return the actual file size if this information is valid,
+ 0 otherwise.
+ */
+
+ inline sal_uInt64 getFileSize() const
+ {
+ return _aStatus.uFileSize;
+ }
+
+ /** @return the file name if this information is valid, an empty
+ string otherwise.
+ */
+
+ inline ::rtl::OUString getFileName() const
+ {
+ return _aStatus.strFileName ? ::rtl::OUString(_aStatus.strFileName) : ::rtl::OUString();
+ }
+
+ /** @return the file path in UNC notation if this information is valid,
+ an empty string otherwise.
+ */
+
+ inline ::rtl::OUString getFilePath() const
+ {
+ return _strFilePath ? ::rtl::OUString(_strFilePath) : ::rtl::OUString();
+ }
+
+ /** @return the file path in host notation if this information is valid,
+ an empty string otherwise.
+ */
+
+ inline ::rtl::OUString getNativePath() const
+ {
+ return _strNativePath ? ::rtl::OUString(_strNativePath) : ::rtl::OUString();
+ }
+
+ friend class DirectoryItem;
+};
+
+// -----------------------------------------------------------------------------
+
+/** Base class for all filesystem specific objects
+
+ @see Directory
+ @see DirectoryItem
+ @see File
+ */
+
+class FileBase
+{
+public:
+
+ enum RC {
+ E_None = osl_File_E_None,
+ E_PERM = osl_File_E_PERM,
+ E_NOENT = osl_File_E_NOENT,
+ E_SRCH = osl_File_E_SRCH,
+ E_INTR = osl_File_E_INTR,
+ E_IO = osl_File_E_IO,
+ E_NXIO = osl_File_E_NXIO,
+ E_2BIG = osl_File_E_2BIG,
+ E_NOEXEC = osl_File_E_NOEXEC,
+ E_BADF = osl_File_E_BADF,
+ E_CHILD = osl_File_E_CHILD,
+ E_AGAIN = osl_File_E_AGAIN,
+ E_NOMEM = osl_File_E_NOMEM,
+ E_ACCES = osl_File_E_ACCES,
+ E_FAULT = osl_File_E_FAULT,
+ E_BUSY = osl_File_E_BUSY,
+ E_EXIST = osl_File_E_EXIST,
+ E_XDEV = osl_File_E_XDEV,
+ E_NODEV = osl_File_E_NODEV,
+ E_NOTDIR = osl_File_E_NOTDIR,
+ E_ISDIR = osl_File_E_ISDIR,
+ E_INVAL = osl_File_E_INVAL,
+ E_NFILE = osl_File_E_NFILE,
+ E_MFILE = osl_File_E_MFILE,
+ E_NOTTY = osl_File_E_NOTTY,
+ E_FBIG = osl_File_E_FBIG,
+ E_NOSPC = osl_File_E_NOSPC,
+ E_SPIPE = osl_File_E_SPIPE,
+ E_ROFS = osl_File_E_ROFS,
+ E_MLINK = osl_File_E_MLINK,
+ E_PIPE = osl_File_E_PIPE,
+ E_DOM = osl_File_E_DOM,
+ E_RANGE = osl_File_E_RANGE,
+ E_DEADLK = osl_File_E_DEADLK,
+ E_NAMETOOLONG = osl_File_E_NAMETOOLONG,
+ E_NOLCK = osl_File_E_NOLCK,
+ E_NOSYS = osl_File_E_NOSYS,
+ E_NOTEMPTY = osl_File_E_NOTEMPTY,
+ E_LOOP = osl_File_E_LOOP,
+ E_ILSEQ = osl_File_E_ILSEQ,
+ E_NOLINK = osl_File_E_NOLINK,
+ E_MULTIHOP = osl_File_E_MULTIHOP,
+ E_USERS = osl_File_E_USERS,
+ E_OVERFLOW = osl_File_E_OVERFLOW,
+ E_invalidError = osl_File_E_invalidError /* unmapped error: always last entry in enum! */
+ };
+
+
+public:
+
+ /** Determines a valid unused canonical name for a requested name. Depending on file system and operation system
+ the illegal characters are replaced by valid ones. If a file or directory with the requested name
+ already exists a new name is generated following the common rules on the actual file system and
+ operating system.
+
+ @param strRequested [in] Requested name of a file or directory.
+ @param strValid [out] On success receives a name which is unused and valid on the actual operating system and
+ file system.
+
+ @return osl_File_E_None on success otherwise one of the following errorcodes:<p>
+ osl_File_E_INVAL the format of the parameters was not valid<br>
+
+ @see osl_getFileStatus
+ */
+
+ static inline RC getCanonicalName( const ::rtl::OUString& strRequested, ::rtl::OUString& strValid )
+ {
+ return (RC) osl_getCanonicalName( strRequested.pData, &strValid.pData );
+ }
+
+ /** Converts a path relative to a given directory into an full qualified UNC path.
+
+ @param strDirBase [in] Base directory to which the relative path is related to.
+ @param strRelative[in] Path of a file or directory relative to the directory path
+ specified by <code>strDirBase</code>.
+ @param strAbsolute [out] On success it receives the full qualified UNC path of the
+ requested relative path.
+
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_INVAL the format of the parameters was not valid<br>
+ E_NOMEM not enough memory for allocating structures <br>
+ E_NOTDIR Not a directory<br>
+ E_ACCES Permission denied<br>
+ E_NOENT No such file or directory<br>
+ E_NAMETOOLONG File name too long<p>
+
+
+ These errorcodes can (eventually) be returned:<p>
+ E_OVERFLOW Value too large for defined data type<p>
+ E_FAULT Bad address<br>
+ E_INTR function call was interrupted<br>
+ E_LOOP Too many symbolic links encountered<br>
+ E_MULTIHOP Multihop attempted<br>
+ E_NOLINK Link has been severed<p>
+
+ @see getStatus
+ */
+
+ static inline RC getAbsolutePath( const ::rtl::OUString& strDirBase, const ::rtl::OUString& strRelative, ::rtl::OUString& strAbsolute )
+ {
+ return (RC) osl_getAbsolutePath( strDirBase.pData, strRelative.pData, &strAbsolute.pData );
+ }
+
+ /** Converts a system dependent path into a full qualified UNC path
+
+ @param strSysPath[in] System dependent path of a file or a directory
+ @param strPath[out] On success it receives the full qualified UNC path
+
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_INVAL the format of the parameters was not valid<br>
+
+ @see getCanonicalName
+ */
+
+ static inline RC normalizePath( const ::rtl::OUString& strSysPath, ::rtl::OUString& strPath )
+ {
+ return (RC) osl_normalizePath( strSysPath.pData, &strPath.pData );
+ }
+
+ /** Converts a File URL into a full qualified UNC path
+
+ @param urlPath[in] System dependent path of a file or a directory
+ @param strPath[out] On success it receives the full qualified UNC path
+
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_INVAL the format of the parameters was not valid<br>
+
+ @see normalizePath
+ */
+
+ static inline RC getNormalizedPathFromFileURL( const ::rtl::OUString& strPath, ::rtl::OUString& normPath )
+ {
+ return (RC) osl_getNormalizedPathFromFileURL( strPath.pData, &normPath.pData );
+ }
+
+ /** Converts a full qualified UNC path into a FileURL
+
+ @param dir[in] System dependent path of a file or a directory
+ @param strPath[out] On success it receives the full qualified UNC path
+
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_INVAL the format of the parameters was not valid<br>
+
+ @see normalizePath
+ @see getNormalizedPathFromFileURL
+ */
+
+ static inline RC getFileURLFromNormalizedPath( const ::rtl::OUString& normPath, ::rtl::OUString& strPath )
+ {
+ return (RC) osl_getFileURLFromNormalizedPath( normPath.pData, &strPath.pData );
+ }
+
+ /** Converts a full qualified UNC path into a system depended path
+
+ @param dir[in] Full qualified UNC path
+ @param strPath[out] On success it receives the System dependent path of a file or a directory
+
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_INVAL the format of the parameters was not valid<br>
+
+ @see normalizePath
+ @see getNormalizedPathFromFileURL
+ */
+
+ static inline RC getSystemPathFromNormalizedPath( const ::rtl::OUString& normPath, ::rtl::OUString& strPath )
+ {
+ return (RC)osl_getSystemPathFromNormalizedPath( normPath.pData, &strPath.pData );
+ }
+
+ /** Searches a full qualified UNC-Path/File
+
+ @param filePath[in] System dependent path / Normalized Path / File-URL or file or relative directory
+ @param searchPath[in] Paths, in which a given file has to be searched. These paths are only for the search of a
+ file or a relative path, otherwise it will be ignored. If it is set to NULL or while using the
+ search path the search failed the function searches for a matching file in all system directories and in the directories
+ listed in the PATH environment variable
+ @param strPath[out] On success it receives the full qualified UNC path
+
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_INVAL the format of the parameters was not valid<br>
+ E_NOTDIR Not a directory<br>
+ E_NOENT No such file or directory not found<br>
+ @see normalizePath
+ */
+
+ static inline RC searchNormalizedPath( const ::rtl::OUString& filePath, const ::rtl::OUString& searchPath, ::rtl::OUString& strPath )
+ {
+ return (RC) osl_searchNormalizedPath( filePath.pData, searchPath.pData, &strPath.pData );
+ }
+};
+
+// -----------------------------------------------------------------------------
+
+/** The VolumeDevice class
+
+ @see VolumeInfo
+*/
+
+class VolumeDevice : public FileBase
+{
+ oslVolumeDeviceHandle _aHandle;
+
+public:
+ VolumeDevice() : _aHandle( NULL )
+ {
+ }
+
+ VolumeDevice( const VolumeDevice & rDevice )
+ {
+ _aHandle = rDevice._aHandle;
+ if ( _aHandle )
+ osl_acquireVolumeDeviceHandle( _aHandle );
+ }
+
+ ~VolumeDevice()
+ {
+ if ( _aHandle )
+ osl_releaseVolumeDeviceHandle( _aHandle );
+ }
+
+
+ inline VolumeDevice & operator =( const VolumeDevice & rDevice )
+ {
+ oslVolumeDeviceHandle newHandle = rDevice._aHandle;
+
+ if ( newHandle )
+ osl_acquireVolumeDeviceHandle( _aHandle );
+
+ if ( _aHandle )
+ osl_releaseVolumeDeviceHandle( _aHandle );
+
+ _aHandle = newHandle;
+
+ return *this;
+ }
+
+ inline RC automount()
+ {
+ return (RC)osl_automountVolumeDevice( _aHandle );
+ }
+
+ inline RC unmount()
+ {
+ return (RC)osl_unmountVolumeDevice( _aHandle );
+ }
+
+ inline rtl::OUString getMountPath()
+ {
+ rtl::OUString aPath;
+ osl_getVolumeDeviceMountPath( _aHandle, &aPath.pData );
+ return aPath;
+ }
+
+ friend class VolumeInfo;
+};
+
+// -----------------------------------------------------------------------------
+
+/** The file class object provides access to file contents and attributes
+
+ @see Directory
+ @see DirectoryItem
+ */
+
+class File: public FileBase
+{
+ oslFileHandle _pData;
+ ::rtl::OUString _aPath;
+
+ /** define copy c'tor and assginment operator privat
+ */
+
+ File( File& );
+ File& operator = ( File& );
+
+public:
+
+ /** C'tor
+
+ @param strPath [in] The full qualified path of the file in UNC notation.
+ The path delimiter is '/'. Relative paths are not allowed.
+ */
+
+ File( const ::rtl::OUString& strPath ): _pData( 0 ), _aPath( strPath ) {};
+
+ /** D'tor
+ */
+
+ inline ~File()
+ {
+ close();
+ }
+
+ /** Opens a file.
+ @param uFlags [in] Specifies the open mode.
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_NOMEM not enough memory for allocating structures <br>
+ E_INVAL the format of the parameters was not valid<br>
+ E_NAMETOOLONG pathname was too long<br>
+ E_NOENT No such file or directory<br>
+ E_ACCES permission denied<P>
+ E_ISDIR Is a directory<p>
+
+ These errorcodes can (eventually) be returned:<p>
+ E_NOTDIR Not a directory<br>
+ E_NXIO No such device or address<br>
+ E_NODEV No such device<br>
+ E_ROFS Read-only file system<br>
+ E_TXTBSY Text file busy<br>
+ E_ISDIR Is a directory<br>
+ E_FAULT Bad address<br>
+ E_LOOP Too many symbolic links encountered<br>
+ E_NOSPC No space left on device<br>
+ E_MFILE too many open files used by the process<br>
+ E_NFILE too many open files in the system<br>
+ E_DQUOT Quota exceeded<br>
+ E_EXIST File exists<br>
+ E_INTR function call was interrupted<br>
+ E_IO I/O error<br>
+ E_MULTIHOP Multihop attempted<br>
+ E_NOLINK Link has been severed<br>
+ E_EOVERFLOW Value too large for defined data type<p>
+
+ @see close
+ @see setPos
+ @see getPos
+ @see read
+ @see write
+ @see setSize
+ */
+
+ #define OpenFlag_Read osl_File_OpenFlag_Read
+ #define OpenFlag_Write osl_File_OpenFlag_Write
+ #define OpenFlag_Create osl_File_OpenFlag_Create
+
+ inline RC open( sal_uInt32 uFlags )
+ {
+ return (RC) osl_openFile( _aPath.pData, &_pData, uFlags );
+ }
+
+ /** Closes an open file.
+
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_INVAL the format of the parameters was not valid<p>
+
+ These errorcodes can (eventually) be returned:<p>
+ E_BADF Bad file<br>
+ E_INTR function call was interrupted<br>
+ E_NOLINK Link has been severed<br>
+ E_NOSPC No space left on device<br>
+ E_IO I/O error<p>
+ */
+
+ inline RC close()
+ {
+ oslFileError Error = osl_File_E_BADF;
+
+ if( _pData )
+ {
+ Error=osl_closeFile( _pData );
+ _pData = NULL;
+ }
+
+ return (RC) Error;
+ };
+
+
+ /** Sets the internal position pointer of an open file.
+ @param uHow [in] Distance to move the internal position pointer (from uPos).
+ @param uPos [in] Absolute position from the beginning of the file.
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_INVAL the format of the parameters was not valid<br>
+ E_OVERFLOW The resulting file offset would be a value which cannot
+ be represented correctly for regular files<p>
+
+ @see open
+ @see getPos
+ */
+
+ #define Pos_Absolut osl_Pos_Absolut
+ #define Pos_Current osl_Pos_Current
+ #define Pos_End osl_Pos_End
+
+ inline RC setPos( sal_uInt32 uHow, sal_uInt64 uPos )
+ {
+ return (RC) osl_setFilePos( _pData, uHow, uPos );
+ }
+
+ /** Retrieves the current position of the internal pointer of an open file.
+ @param pPos [out] On Success it receives the current position of the file pointer.
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_INVAL the format of the parameters was not valid<br>
+ E_OVERFLOW The resulting file offset would be a value which cannot
+ be represented correctly for regular files<p>
+
+ @see open
+ @see setPos
+ @see read
+ @see write
+ */
+
+ inline RC getPos( sal_uInt64& uPos )
+ {
+ return (RC) osl_getFilePos( _pData, &uPos );
+ }
+
+
+ /** Sets the file size of an open file. The file can be truncated or enlarged by the function.
+ The position of the file pointer is not affeced by this function.
+ @param uSize [int] New size in bytes.
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_INVAL the format of the parameters was not valid<br>
+ E_OVERFLOW The resulting file offset would be a value which cannot
+ be represented correctly for regular files<p>
+
+ @see open
+ @see setPos
+ @see getStatus
+ */
+
+ inline RC setSize( sal_uInt64 uSize )
+ {
+ return (RC) osl_setFileSize( _pData, uSize );
+ }
+
+ /** Reads a number of bytes from a file. The internal file pointer is increased by the number of bytes
+ read.
+ @param pBuffer [out] Points to a buffer which receives data. The buffer must be large enough
+ to hold <code>uBytesRequested</code> bytes.
+ @param uBytesRequested [in] Number of bytes which should be retrieved.
+ @param rBytesRead [out] On success the number of bytes which have actually been retrieved.
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_INVAL the format of the parameters was not valid<br>
+
+ These errorcodes can (eventually) be returned:<p>
+ E_INTR function call was interrupted<br>
+ E_IO I/O error<br>
+ E_ISDIR Is a directory<br>
+ E_BADF Bad file<br>
+ E_FAULT Bad address<br>
+ E_AGAIN Operation would block<br>
+ E_NOLINK Link has been severed<p>
+
+ @see open
+ @see write
+ @see setPos
+ */
+
+ inline RC read( void *pBuffer, sal_uInt64 uBytesRequested, sal_uInt64& rBytesRead )
+ {
+ return (RC) osl_readFile( _pData, pBuffer, uBytesRequested, &rBytesRead );
+ }
+
+ /** Writes a number of bytes to a file. The internal file pointer is increased by the number of bytes
+ read.
+ @param pBuffer [in] Points to a buffer which contains the data.
+ @param uBytesToWrite [in] Number of bytes which should be written.
+ @param rBytesWritten [out] On success the number of bytes which have actually been written.
+
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_INVAL the format of the parameters was not valid<br>
+ E_FBIG File too large<br>
+ E_DQUOT Quota exceeded<p>
+
+ These errorcodes can (eventually) be returned:<p>
+ E_AGAIN Operation would block<br>
+ E_BADF Bad file<br>
+ E_FAULT Bad address<br>
+ E_INTR function call was interrupted<br>
+ E_IO I/O error<br>
+ E_NOLCK No record locks available<br>
+ E_NOLINK Link has been severed<br>
+ E_NOSPC No space left on device<br>
+ E_NXIO No such device or address<p>
+
+ @see openFile
+ @see readFile
+ @see setFilePos
+ */
+
+ inline RC write(const void *pBuffer, sal_uInt64 uBytesToWrite, sal_uInt64& rBytesWritten)
+ {
+ return (RC) osl_writeFile( _pData, pBuffer, uBytesToWrite, &rBytesWritten );
+ }
+
+ /** Copies a file to a new destination. Copies only files not directories. No assumptions should
+ be made about preserving attributes or file time.
+ @param strPath [in] Full qualified UNC path of the source file.
+ @param strDestPath [in] Full qualified UNC path of the destination file. A directory is
+ NOT a valid destination file !
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_INVAL the format of the parameters was not valid<br>
+ E_NOMEM not enough memory for allocating structures <br>
+ E_ACCES Permission denied<br>
+ E_PERM Operation not permitted<br>
+ E_NAMETOOLONG File name too long<br>
+ E_NOENT No such file or directory<br>
+ E_ISDIR Is a directory<br>
+ E_ROFS Read-only file system<p>
+
+ @see move
+ @see remove
+ */
+ inline static RC copy( const ::rtl::OUString& strPath, const ::rtl::OUString& strDestPath )
+ {
+ return (RC) osl_copyFile( strPath.pData, strDestPath.pData );
+ }
+
+ /** Moves a file or directory to a new destination or renames it. File time and attributes
+ are preserved.
+ @param strPath [in] Full qualified UNC path of the source file.
+ @param strDestPath [in] Full qualified UNC path of the destination file. An existing directory
+ is NOT a valid destination !
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_INVAL the format of the parameters was not valid<br>
+ E_NOMEM not enough memory for allocating structures <br>
+ E_ACCES Permission denied<br>
+ E_PERM Operation not permitted<br>
+ E_NAMETOOLONG File name too long<br>
+ E_NOENT No such file or directory<br>
+ E_ROFS Read-only file system<p>
+
+ @see copy
+ */
+
+ inline static RC move( const ::rtl::OUString& strPath, const ::rtl::OUString& strDestPath )
+ {
+ return (RC) osl_moveFile( strPath.pData, strDestPath.pData );
+ }
+
+ /** Removes (erases) a regular file.
+
+ @param strPath [in] Full qualified UNC path of the directory.
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_INVAL the format of the parameters was not valid<br>
+ E_NOMEM not enough memory for allocating structures <br>
+ E_ACCES Permission denied<br>
+ E_PERM Operation not permitted<br>
+ E_NAMETOOLONG File name too long<br>
+ E_NOENT No such file or directory<br>
+ E_ISDIR Is a directory<br>
+ E_ROFS Read-only file system<p>
+
+ These errorcodes can (eventually) be returned:<p>
+ E_FAULT Bad address<br>
+ E_LOOP Too many symbolic links encountered<br>
+ E_IO I/O error<br>
+ E_BUSY Device or resource busy<br>
+ E_INTR function call was interrupted<br>
+ E_LOOP Too many symbolic links encountered<br>
+ E_MULTIHOP Multihop attempted<br>
+ E_NOLINK Link has been severed<br>
+ E_TXTBSY Text file busy<p>
+ */
+
+ inline static RC remove( const ::rtl::OUString& strPath )
+ {
+ return (RC) osl_removeFile( strPath.pData );
+ }
+
+ /** Sets file-attributes
+
+ @param filePath[in] Path of the file
+ @param uAttributes[in] Attributes of the file to be set
+
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_INVAL the format of the parameters was not valid<br>
+ @see getStatus
+ */
+
+ inline static RC setAttributes( const ::rtl::OUString& strPath, sal_uInt64 uAttributes )
+ {
+ return (RC) osl_setFileAttributes( strPath.pData, uAttributes );
+ }
+
+ /** Sets file-Time
+
+ @param filePath[in] Path of the file
+ @param aCreationTime[in] creation time of the given file
+ @param aLastAccessTime[in] time of the last access of the given file
+ @param aLastWriteTime[in] time of the last modifying of the given file
+
+
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_INVAL the format of the parameters was not valid<br>
+ E_NOENT No such file or directory not found<br>
+ @see getStatus
+ */
+
+ inline static RC setTime( const ::rtl::OUString& strPath, TimeValue& rCreationTime,
+ TimeValue& rLastAccessTime,
+ TimeValue& rLastWriteTime )
+ {
+ return (RC) osl_setFileTime( strPath.pData, &rCreationTime,
+ &rLastAccessTime,
+ &rLastWriteTime );
+ }
+
+ friend class DirectoryItem;
+};
+
+// -----------------------------------------------------------------------------
+
+/** The directory item class object provides access to file status information.
+
+ @see FileStatus
+ */
+
+class DirectoryItem: public FileBase
+{
+ oslDirectoryItem _pData;
+
+
+public:
+
+ /** default c'tor
+ */
+
+ DirectoryItem(): _pData( NULL )
+ {
+ }
+
+ /** Copy C'tor
+ */
+
+ DirectoryItem( DirectoryItem& rItem ): _pData( rItem._pData)
+ {
+ osl_acquireDirectoryItem( _pData );
+ }
+
+
+ /** D'tor
+ */
+
+ ~DirectoryItem()
+ {
+ if( _pData )
+ osl_releaseDirectoryItem( _pData );
+ }
+
+ /** assignment operator
+ */
+
+ DirectoryItem& operator = ( DirectoryItem& rItem )
+ {
+ if( _pData )
+ osl_releaseDirectoryItem( _pData );
+
+ _pData = rItem._pData;
+ osl_acquireDirectoryItem( _pData );
+ return *this;
+ };
+
+ /** @return sal_True if object is valid directory item,
+ sal_False otherwise.
+ */
+
+ inline sal_Bool is()
+ {
+ return _pData != NULL;
+ }
+
+ /** fills a single directory item object
+
+ @param strFilePath [in] absolute file path following the notation explained in the documentation for
+ <code>osl_openDirectory</code>. Due to performance issues it is not recommended to use this function
+ while enumerating the contents of a directory. In this case use <code>osl_getNextDirectoryItem</code> instead.
+ @param rItem [out] on success it receives a valid directory item object.
+
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_INVAL the format of the parameters was not valid<br>
+ E_NOMEM not enough memory for allocating structures <br>
+ E_ACCES permission denied<br>
+ E_MFILE too many open files used by the process<br>
+ E_NFILE too many open files in the system<br>
+ E_NOENT No such file or directory<br>
+ E_LOOP Too many symbolic links encountered<br>
+ E_NAMETOOLONG File name too long<br>
+ E_NOTDIR A component of the path prefix of path is not a directory<p>
+
+ These errorcodes can (eventually) be returned:<p>
+ E_IO I/O error<br>
+ E_MULTIHOP Multihop attempted<br>
+ E_NOLINK Link has been severed<br>
+ E_FAULT Bad address<br>
+ E_INTR function call was interrupted<p>
+
+
+ @see getFileStatus
+ @see Directory::getNextItem
+ */
+
+ static inline RC get( const ::rtl::OUString& strPath, DirectoryItem& rItem )
+ {
+ if( rItem._pData)
+ osl_releaseDirectoryItem( rItem._pData );
+
+ return (RC) osl_getDirectoryItem( strPath.pData, &rItem._pData );
+ }
+
+ /** Get a directory item handle from an open file.
+ @param rItem [out] On success it receives a handle to a directory item which can be used
+ in subsequent calls to <code>getStatus</code>.
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_INVAL the format of the parameters was not valid<p>
+
+ @see File
+ @see getStatus
+ */
+
+ static inline RC get( const File& rFile, DirectoryItem& rItem )
+ {
+ if( rItem._pData)
+ osl_releaseDirectoryItem( rItem._pData );
+
+ return (RC) osl_createDirectoryItemFromHandle( rFile._pData, &rItem._pData );
+ }
+
+
+ /** Retrieves information about a single file or directory
+
+ @param rStatus [in/out] reference of FileStatus class object that should be filled.
+
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_NOMEM not enough memory for allocating structures <br>
+ E_INVAL the format of the parameters was not valid<br>
+ E_LOOP Too many symbolic links encountered<br>
+ E_ACCES Permission denied<br>
+ E_NOENT No such file or directory<br>
+ E_NAMETOOLONG file name too long<p>
+
+ These errorcodes can (eventually) be returned:<p>
+ E_BADF Invalid oslDirectoryItem parameter<br>
+ E_FAULT Bad address<br>
+ E_OVERFLOW Value too large for defined data type<br>
+ E_INTR function call was interrupted<br>
+ E_NOLINK Link has been severed<br>
+ E_MULTIHOP Components of path require hopping to multiple remote machines and the file system does not allow it<br>
+ E_MFILE too many open files used by the process<br>
+ E_NFILE too many open files in the system<br>
+ E_NOSPC No space left on device<br>
+ E_NXIO No such device or address<br>
+ E_IO I/O error<br>
+ E_NOSYS Function not implemented<p>
+
+ @see DirectoryItem::get
+ @see Directory::getNextItem
+ */
+
+ inline RC getFileStatus( FileStatus& rStatus )
+ {
+ return (RC) osl_getFileStatus( _pData, &rStatus._aStatus, rStatus._nMask );
+ }
+
+ friend class Directory;
+};
+
+// -----------------------------------------------------------------------------
+
+/** The directory class object provides a enumeration of DirectoryItems.
+
+ @see DirectoryItem
+ @see File
+ */
+
+class Directory: public FileBase
+{
+ oslDirectory _pData;
+ ::rtl::OUString _aPath;
+
+ /** define copy c'tor and assginment operator privat
+ */
+ Directory( Directory& );
+ Directory& operator = ( Directory& );
+
+
+public:
+
+ /** C'tor
+
+ @param strPath [in] The full qualified path of the directory in UNC notation.
+ The path delimiter is '/'. Relative paths are not allowed.
+ */
+
+ Directory( const ::rtl::OUString& strPath ): _pData( 0 ), _aPath( strPath )
+ {
+ };
+
+ /** D'tor
+ */
+
+ ~Directory()
+ {
+ close();
+ }
+
+ /** Opens a directory for enumerating its contents.
+
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_INVAL the format of the parameters was not valid<br>
+ E_NOENT the specified path doesn't exist<br>
+ E_NOTDIR the specified path is not an directory <br>
+ E_NOMEM not enough memory for allocating structures <br>
+ E_ACCES permission denied<br>
+ E_MFILE too many open files used by the process<br>
+ E_NFILE too many open files in the system<br>
+ E_NAMETOOLONG File name too long<br>
+ E_LOOP Too many symbolic links encountered<p>
+
+ @see getNextItem
+ @see close
+ */
+
+ inline RC open()
+ {
+ return (RC) osl_openDirectory( _aPath.pData, &_pData );
+ }
+
+ /** query if directory item enumeration is valid.
+
+ @return sal_True if enumeration is valid (opened), sal_False otherwise
+
+ @see open
+ @see close
+ */
+
+ inline sal_Bool isOpen() { return _pData != NULL; };
+
+ /** closes a directory item enumeration
+
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_INVAL the format of the parameters was not valid<br>
+ E_NOMEM not enough memory for allocating structures <p>
+
+ These errorcodes can (eventually) be returned:<p>
+ E_BADF Invalid oslDirectory parameter<br>
+ E_INTR function call was interrupted<p>
+
+ @see open
+ */
+
+ inline RC close()
+ {
+ oslFileError Error = osl_File_E_BADF;
+
+ if( _pData )
+ {
+ Error=osl_closeDirectory( _pData );
+ _pData = NULL;
+ }
+
+ return (RC) Error;
+ }
+
+
+ /** resets the directory item enumeration to the beginning.
+
+ @return the same as open
+ @see open
+ */
+
+ inline RC reset()
+ {
+ close();
+ return open();
+ }
+
+ /** Retrieves the next item of a previously openend directory
+ @param rItem [out] The class that receives the next item's data.
+ @param nHint [in] With this parameter the caller can tell the implementation that one
+ is going to call this function uHint times afterwards. This enables the implementation to
+ get the information for more than one file and cache it until the next calls.
+
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_INVAL the format of the parameters was not valid<br>
+ E_NOMEM not enough memory for allocating structures <br>
+ E_NOENT No more entries in this directory<p>
+
+ These errorcodes can (eventually) be returned:<p>
+ E_BADF oslDirectory parameter is not valid<br>
+ E_OVERFLOW Value too large for defined data type<p>
+
+ @see DirectoryItem::get
+ */
+
+ inline RC getNextItem( DirectoryItem& rItem, sal_uInt32 nHint = 0 )
+ {
+ return ( RC) osl_getNextDirectoryItem( _pData, &rItem._pData, nHint );
+ }
+
+ /** Retrieves information about a volume. A volume can either be a mount point, a network
+ resource or a drive depending on operating system and file system. Before calling this
+ function <code>File::getStatus</code> should be called to determine if the type is
+ <code>Type_Volume</code>.
+
+ @param strDirectory [in] Full qualified UNC path to the volume
+ @param rInfo [out] On success it receives information about the volume.
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_NOMEM not enough memory for allocating structures <br>
+ E_INVAL the format of the parameters was not valid<p>
+
+ These errorcodes can (eventually) be returned:<p>
+ E_NOTDIR Not a directory<br>
+ E_NAMETOOLONG File name too long<br>
+ E_NOENT No such file or directory<br>
+ E_ACCES permission denied<br>
+ E_LOOP Too many symbolic links encountered<br>
+ E_FAULT Bad address<br>
+ E_IO I/O error<br>
+ E_NOSYS Function not implemented<br>
+ E_MULTIHOP Multihop attempted<br>
+ E_NOLINK Link has been severed<br>
+ E_INTR function call was interrupted<p>
+
+ @see getFileStatus
+ @see VolumeInfo
+ */
+
+ inline static RC getVolumeInfo( const ::rtl::OUString& strPath, VolumeInfo& rInfo )
+ {
+ return (RC) osl_getVolumeInformation( strPath.pData, &rInfo._aInfo, rInfo._nMask );
+ }
+
+ /** Creates a directory.
+
+ @param strPath [in] Full qualified UNC path of the directory to create.
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_INVAL the format of the parameters was not valid<br>
+ E_NOMEM not enough memory for allocating structures <br>
+ E_EXIST File exists<br>
+ E_ACCES Permission denied<br>
+ E_NAMETOOLONG File name too long<br>
+ E_NOENT No such file or directory<br>
+ E_NOTDIR Not a directory<br>
+ E_ROFS Read-only file system<br>
+ E_NOSPC No space left on device<br>
+ E_DQUOT Quota exceeded<p>
+
+ These errorcodes can (eventually) be returned:<p>
+ E_LOOP Too many symbolic links encountered<br>
+ E_FAULT Bad address<br>
+ E_IO I/O error<br>
+ E_MLINK Too many links<br>
+ E_MULTIHOP Multihop attempted<br>
+ E_NOLINK Link has been severed<p>
+
+ @see remove
+ */
+
+ inline static RC create( const ::rtl::OUString& strPath )
+ {
+ return (RC) osl_createDirectory( strPath.pData );
+ }
+
+ /** Removes an empty directory.
+
+ @param strPath [in] Full qualified UNC path of the empty directory to remove.
+ @return E_None on success otherwise one of the following errorcodes:<p>
+ E_INVAL the format of the parameters was not valid<br>
+ E_NOMEM not enough memory for allocating structures <br>
+ E_PERM Operation not permitted<br>
+ E_ACCES Permission denied<br>
+ E_NOENT No such file or directory<br>
+ E_NOTDIR Not a directory<br>
+ E_NOTEMPTY Directory not empty<p>
+
+ These errorcodes can (eventually) be returned:<p>
+ E_FAULT Bad address<br>
+ E_NAMETOOLONG File name too long<br>
+ E_BUSY Device or resource busy<br>
+ E_ROFS Read-only file system<br>
+ E_LOOP Too many symbolic links encountered<br>
+ E_BUSY Device or resource busy<br>
+ E_EXIST File exists<br>
+ E_IO I/O error<br>
+ E_MULTIHOP Multihop attempted<br>
+ E_NOLINK Link has been severed<p>
+
+ @see create
+ */
+
+ inline static RC remove( const ::rtl::OUString& strPath )
+ {
+ return (RC) osl_removeDirectory( strPath.pData );
+ }
+};
+
+#ifdef _USE_NAMESPACE
+}
+#endif
+
+#endif /* __cplusplus */
+#endif /* _OSL_FILE_HXX_ */
+
diff --git a/sal/inc/osl/interlck.h b/sal/inc/osl/interlck.h
new file mode 100644
index 000000000000..ca149802b026
--- /dev/null
+++ b/sal/inc/osl/interlck.h
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * $RCSfile: interlck.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:12 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_INTERLOCK_H_
+#define _OSL_INTERLOCK_H_
+
+#ifndef _OSL_TYPES_H_
+# include <osl/types.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef sal_Int32 oslInterlockedCount;
+
+/** Increments the count variable addressed by pCount.
+ @param Address of counter variable
+ @return The result of the operation is zero, the value of the count variable.
+*/
+oslInterlockedCount SAL_CALL osl_incrementInterlockedCount(oslInterlockedCount* pCount);
+
+/** Decrement the count variable addressed by pCount.
+ @param Address of counter variable
+ @return The result of the operation is the new value is of the count variable.
+*/
+oslInterlockedCount SAL_CALL osl_decrementInterlockedCount(oslInterlockedCount* pCount);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OSL_INTERLOCK_H_ */
+
+
diff --git a/sal/inc/osl/module.h b/sal/inc/osl/module.h
new file mode 100644
index 000000000000..3d79af0d3742
--- /dev/null
+++ b/sal/inc/osl/module.h
@@ -0,0 +1,165 @@
+/*************************************************************************
+ *
+ * $RCSfile: module.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _OSL_MODULE_H_
+#define _OSL_MODULE_H_
+
+#ifndef _RTL_USTRING_H
+# include <rtl/ustring.h>
+#endif
+
+#ifndef _OSL_TYPES_H_
+# include <osl/types.h>
+#endif
+
+#ifndef _RTL_TENCINFO_H
+# include <rtl/tencinfo.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define SAL_LOADMODULE_DEFAULT 0x00000
+#define SAL_LOADMODULE_LAZY 0x00001
+#define SAL_LOADMODULE_NOW 0x00002
+#define SAL_LOADMODULE_GLOBAL 0x00100
+
+
+typedef void* oslModule;
+
+
+/** Load a module.<BR>
+ @param strModuleName denotes the name of the module to be loaded.
+ @return 0 if the module could not be loaded, otherwise a handle to the module.
+*/
+oslModule SAL_CALL osl_loadModule(rtl_uString *strModuleName, sal_Int32 nRtldMode);
+
+/** Release the Module
+*/
+void SAL_CALL osl_unloadModule(oslModule Module);
+
+/** lookup the specified symbolname.
+ @returns address of the symbol or 0 if lookup failed,
+*/
+void* SAL_CALL osl_getSymbol(oslModule Module, rtl_uString *strSymbolName);
+
+/** ascii interface for internal use.
+ @returns address of the symbol or 0 if lookup failed,
+*/
+void* SAL_CALL osl_getSymbolA(oslModule Module, const char *pszSymbolName);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OSL_MODULE_H_ */
+
+
+/*************************************************************************
+*
+* $Log: not supported by cvs2svn $
+* Revision 1.8 2000/09/18 14:28:49 willem.vandorp
+* OpenOffice header added.
+*
+* Revision 1.7 2000/05/17 14:30:14 mfe
+* comments upgraded
+*
+* Revision 1.6 2000/03/31 15:55:56 rs
+* UNICODE-Changes
+*
+* Revision 1.5 2000/03/16 16:43:52 obr
+* Unicode API changes
+*
+* Revision 1.4 2000/01/06 11:46:32 mfe
+* #71540# : for incompatible z'en
+*
+* Revision 1.3 2000/01/04 14:07:19 mfe
+* osl_loadModule takes 2nd parameter
+*
+* Revision 1.2 1999/10/27 15:02:07 mfe
+* Change of Copyright, removed compiler warnings, code clean up, ...
+*
+* Revision 1.1 1999/08/05 10:18:19 jsc
+* verschoben aus osl
+*
+* Revision 1.6 1999/08/05 11:14:35 jsc
+* verschoben in root inc-Verzeichnis
+*
+* Revision 1.5 1999/01/20 18:53:40 jsc
+* #61011# Typumstellung
+*
+* Revision 1.4 1998/02/16 19:34:51 rh
+* Cleanup of ports, integration of Size_t, features for process
+*
+* Revision 1.3 1997/07/31 15:28:38 ts
+* *** empty log message ***
+*
+* Revision 1.2 1997/07/17 11:02:27 rh
+* Header adapted and profile added
+*
+* Revision 1.1 1997/07/03 10:04:31 rh
+* Module handling added
+*
+*************************************************************************/
+
diff --git a/sal/inc/osl/mutex.h b/sal/inc/osl/mutex.h
new file mode 100644
index 000000000000..4958a2f4b033
--- /dev/null
+++ b/sal/inc/osl/mutex.h
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * $RCSfile: mutex.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_MUTEX_H_
+#define _OSL_MUTEX_H_
+
+#ifndef _OSL_TYPES_H_
+# include <osl/types.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct _oslMutexImpl;
+typedef struct _oslMutexImpl * oslMutex;
+
+/** Create a thread-local mutex.
+ @return 0 if the mutex could not be created, otherwise a handle to the mutex.
+*/
+oslMutex SAL_CALL osl_createMutex(void);
+
+/** Release the OS-structures and free mutex data-structure.
+ @param Mutex the mutex-handle
+*/
+void SAL_CALL osl_destroyMutex(oslMutex Mutex);
+
+/** Acquire the mutex, block if already acquired by another thread.
+ @param Mutex handle to a created mutex.
+ @return False if system-call fails.
+*/
+sal_Bool SAL_CALL osl_acquireMutex(oslMutex Mutex);
+
+/** Try to acquire the mutex without blocking.
+ @param Mutex handle to a created mutex.
+ @return False if it could not be acquired.
+*/
+sal_Bool SAL_CALL osl_tryToAcquireMutex(oslMutex Mutex);
+
+/** Release the mutex.
+ @param Mutex handle to a created mutex.
+ @return False if system-call fails.
+*/
+sal_Bool SAL_CALL osl_releaseMutex(oslMutex Mutex);
+
+oslMutex * SAL_CALL osl_getGlobalMutex();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OSL_MUTEX_H_ */
+
+/*************************************************************************
+*
+* $Log: not supported by cvs2svn $
+* Revision 1.6 2000/09/18 14:28:49 willem.vandorp
+* OpenOffice header added.
+*
+* Revision 1.5 2000/05/17 14:30:14 mfe
+* comments upgraded
+*
+* Revision 1.4 1999/12/08 10:40:52 jbu
+* #70413# changed oslMutex forward struct
+*
+* Revision 1.3 1999/10/27 15:02:07 mfe
+* Change of Copyright, removed compiler warnings, code clean up, ...
+*
+* Revision 1.2 1999/09/28 13:04:31 kr
+* new: getGlobalMutex
+*
+* Revision 1.1 1999/08/05 10:18:19 jsc
+* verschoben aus osl
+*
+* Revision 1.4 1999/08/05 11:14:36 jsc
+* verschoben in root inc-Verzeichnis
+*
+* Revision 1.3 1999/01/20 18:53:40 jsc
+* #61011# Typumstellung
+*
+* Revision 1.2 1998/07/04 14:56:57 rh
+* Prototype for OS/2
+*
+* Revision 1.1 1998/02/16 19:34:51 rh
+* Cleanup of ports, integration of Size_t, features for process
+*
+*************************************************************************/
diff --git a/sal/inc/osl/mutex.hxx b/sal/inc/osl/mutex.hxx
new file mode 100644
index 000000000000..e428778fd113
--- /dev/null
+++ b/sal/inc/osl/mutex.hxx
@@ -0,0 +1,232 @@
+/*************************************************************************
+ *
+ * $RCSfile: mutex.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_MUTEX_HXX_
+#define _OSL_MUTEX_HXX_
+
+#ifdef __cplusplus
+
+#include <osl/macros.hxx>
+
+#include <osl/mutex.h>
+
+
+#ifdef _USE_NAMESPACE
+namespace osl
+{
+#endif
+
+ class Mutex {
+ oslMutex mutex;
+
+ // these make no sense
+ Mutex( oslMutex ) {}
+ Mutex( const Mutex & ) {}
+
+ public:
+ /** Create a thread-local mutex.
+ @return 0 if the mutex could not be created, otherwise a handle to the mutex.
+ */
+ Mutex()
+ {
+ mutex = osl_createMutex();
+ }
+
+ /** Release the OS-structures and free mutex data-structure.
+ */
+ ~Mutex()
+ {
+ osl_destroyMutex(mutex);
+ }
+
+ /** Acquire the mutex, block if already acquired by another thread.
+ @return False if system-call fails.
+ */
+ sal_Bool acquire()
+ {
+ return osl_acquireMutex(mutex);
+ }
+
+ /** Try to acquire the mutex without blocking.
+ @return False if it could not be acquired.
+ */
+ sal_Bool tryToAcquire()
+ {
+ return osl_tryToAcquireMutex(mutex);
+ }
+
+ /** Release the mutex.
+ @return False if system-call fails.
+ */
+ sal_Bool release()
+ {
+ return osl_releaseMutex(mutex);
+ }
+
+ static Mutex * getGlobalMutex()
+ {
+ return (Mutex *)osl_getGlobalMutex();
+ }
+ };
+
+ template<class T>
+ class Guard
+ {
+ protected:
+ T * pT;
+ public:
+
+ Guard(T * pT) : pT(pT)
+ {
+ pT->acquire();
+ }
+
+ Guard(T & t) : pT(&t)
+ {
+ pT->acquire();
+ }
+
+ /** Releases mutex. */
+ ~Guard()
+ {
+ pT->release();
+ }
+ };
+
+ template<class T>
+ class ClearableGuard
+ {
+ protected:
+ T * pT;
+ public:
+
+ ClearableGuard(T * pT) : pT(pT)
+ {
+ pT->acquire();
+ }
+
+ ClearableGuard(T & t) : pT(&t)
+ {
+ pT->acquire();
+ }
+
+ /** Releases mutex. */
+ ~ClearableGuard()
+ {
+ if (pT)
+ pT->release();
+ }
+
+ /** Releases mutex. */
+ void clear()
+ {
+ if(pT)
+ {
+ pT->release();
+ pT = NULL;
+ }
+ }
+ };
+
+ typedef Guard<Mutex> MutexGuard;
+ typedef ClearableGuard<Mutex> ClearableMutexGuard;
+
+#ifdef _USE_NAMESPACE
+}
+#endif
+
+#endif /* __cplusplus */
+#endif /* _OSL_MUTEX_HXX_ */
+
+/*************************************************************************
+*
+* $Log: not supported by cvs2svn $
+* Revision 1.10 2000/09/18 14:28:49 willem.vandorp
+* OpenOffice header added.
+*
+* Revision 1.9 2000/07/04 13:38:41 dbo
+* mutex copy ctors make no sense
+*
+* Revision 1.8 2000/05/17 14:30:14 mfe
+* comments upgraded
+*
+* Revision 1.7 2000/01/04 14:48:04 dbo
+* #70396# corrected ClearableGuard
+*
+* Revision 1.6 1999/10/27 15:02:07 mfe
+* Change of Copyright, removed compiler warnings, code clean up, ...
+*
+* Revision 1.5 1999/10/18 09:08:41 rt
+* syntax change in template for gcc for windows
+*
+* Revision 1.4 1999/10/05 10:23:31 obr
+* changed OMutex to Mutex etc.
+*
+* Revision 1.3 1999/09/28 15:13:08 kr
+* Protection
+*
+* Revision 1.2 1999/09/28 13:04:07 kr
+* *** empty log message ***
+*
+* Revision 1.1 1999/09/23 12:09:22 kr
+* inline header wrapper for mutex semaphore guard
+*
+*************************************************************************/
diff --git a/sal/inc/osl/pipe.h b/sal/inc/osl/pipe.h
new file mode 100644
index 000000000000..83ffa0a3bf97
--- /dev/null
+++ b/sal/inc/osl/pipe.h
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * $RCSfile: pipe.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _OSL_PIPE_H_
+#define _OSL_PIPE_H_
+
+#ifndef _RTL_USTRING_H
+# include <rtl/ustring.h>
+#endif
+
+#ifndef _OSL_TYPES_H_
+# include <osl/types.h>
+#endif
+
+#ifndef _OSL_SECURITY_H_
+# include <osl/security.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+ osl_Pipe_E_None, /* no error */
+ osl_Pipe_E_NotFound, /* Pipe could not be found */
+ osl_Pipe_E_AlreadyExists, /* Pipe already exists */
+ osl_Pipe_E_NoProtocol, /* Protocol not available */
+ osl_Pipe_E_NetworkReset, /* Network dropped connection because of reset */
+ osl_Pipe_E_ConnectionAbort, /* Software caused connection abort */
+ osl_Pipe_E_ConnectionReset, /* Connection reset by peer */
+ osl_Pipe_E_NoBufferSpace, /* No buffer space available */
+ osl_Pipe_E_TimedOut, /* Connection timed out */
+ osl_Pipe_E_ConnectionRefused, /* Connection refused */
+ osl_Pipe_E_invalidError, /* unmapped error: always last entry in enum! */
+ osl_Pipe_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslPipeError;
+
+typedef sal_uInt32 oslPipeOptions;
+#define osl_Pipe_OPEN 0x0000 /* open existing pipe */
+#define osl_Pipe_CREATE 0x0001 /* create pipe and open it, fails if already existst */
+
+typedef void* oslPipe;
+
+oslPipe SAL_CALL osl_createPipe(rtl_uString *strPipeName, oslPipeOptions Options, oslSecurity Security);
+void SAL_CALL osl_destroyPipe(oslPipe Pipe);
+
+oslPipe SAL_CALL osl_copyPipe(oslPipe Pipe);
+
+oslPipe SAL_CALL osl_acceptPipe(oslPipe Pipe);
+
+sal_Int32 SAL_CALL osl_sendPipe(oslPipe Pipe, const void* pBuffer, sal_uInt32 BufferSize);
+sal_Int32 SAL_CALL osl_receivePipe(oslPipe Pipe, void* pBuffer, sal_uInt32 BufferSize);
+
+oslPipeError SAL_CALL osl_getLastPipeError(oslPipe Pipe);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OSL_PIPE_H_ */
+
+/*************************************************************************
+*
+* $Log: not supported by cvs2svn $
+* Revision 1.5 2000/09/18 14:28:49 willem.vandorp
+* OpenOffice header added.
+*
+* Revision 1.4 2000/05/17 14:30:14 mfe
+* comments upgraded
+*
+* Revision 1.3 2000/03/16 16:43:52 obr
+* Unicode API changes
+*
+* Revision 1.2 1999/10/27 15:02:07 mfe
+* Change of Copyright, removed compiler warnings, code clean up, ...
+*
+* Revision 1.1 1999/08/05 10:18:19 jsc
+* verschoben aus osl
+*
+* Revision 1.3 1999/08/05 11:14:37 jsc
+* verschoben in root inc-Verzeichnis
+*
+* Revision 1.2 1999/01/20 18:53:40 jsc
+* #61011# Typumstellung
+*
+* Revision 1.1 1998/03/13 15:07:31 rh
+* Cleanup of enum chaos and implemntation of pipes
+*
+*************************************************************************/
diff --git a/sal/inc/osl/process.h b/sal/inc/osl/process.h
new file mode 100644
index 000000000000..e3cf3d77b5fc
--- /dev/null
+++ b/sal/inc/osl/process.h
@@ -0,0 +1,375 @@
+/*************************************************************************
+ *
+ * $RCSfile: process.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _OSL_PROCESS_H_
+#define _OSL_PROCESS_H_
+
+#ifndef _RTL_USTRING_H
+# include <rtl/ustring.h>
+#endif
+#ifndef _RTL_TEXTENC_H
+# include <rtl/textenc.h>
+#endif
+
+#ifndef _OSL_TYPES_H_
+# include <osl/types.h>
+#endif
+
+#ifndef _OSL_FILE_H_
+# include <osl/file.h>
+#endif
+
+#ifndef _OSL_PIPE_H_
+#include <osl/pipe.h>
+#endif
+
+#ifndef _OSL_SOCKET_H_
+# include <osl/socket.h>
+#endif
+#ifndef _OSL_SECURITY_H_
+# include <osl/security.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef sal_Int32 oslProcessOption;
+#define osl_Process_WAIT 0x0001 /* wait for completion */
+#define osl_Process_SEARCHPATH 0x0002 /* search path for executable */
+#define osl_Process_DETACHED 0x0004 /* run detached */
+#define osl_Process_NORMAL 0x0000 /* run in normal window */
+#define osl_Process_HIDDEN 0x0010 /* run hidden */
+#define osl_Process_MINIMIZED 0x0020 /* run in minimized window */
+#define osl_Process_MAXIMIZED 0x0040 /* run in maximized window */
+#define osl_Process_FULLSCREEN 0x0080 /* run in fullscreen window */
+
+typedef sal_Int32 oslProcessData;
+#define osl_Process_IDENTIFIER 0x0001
+#define osl_Process_EXITCODE 0x0002
+#define osl_Process_CPUTIMES 0x0004
+#define osl_Process_HEAPUSAGE 0x0008
+
+typedef sal_uInt32 oslProcessIdentifier;
+typedef sal_uInt32 oslProcessExitCode;
+
+typedef enum {
+ osl_Process_E_None, /* no error */
+ osl_Process_E_NotFound, /* image not found */
+ osl_Process_E_TimedOut, /* timout occured */
+ osl_Process_E_NoPermission, /* permission denied */
+ osl_Process_E_Unknown, /* unknown error */
+ osl_Process_E_InvalidError, /* unmapped error */
+ osl_Process_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslProcessError;
+
+typedef enum {
+ osl_Process_TypeNone, /* no descriptor */
+ osl_Process_TypeSocket, /* socket */
+ osl_Process_TypeFile, /* file */
+ osl_Process_TypePipe, /* pipe */
+ osl_Process_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslDescriptorType;
+
+typedef sal_Int32 oslDescriptorFlag;
+#define osl_Process_DFNONE 0x0000
+#define osl_Process_DFWAIT 0x0001
+
+#ifdef SAL_W32
+# pragma pack(push, 8)
+#elif defined(SAL_OS2)
+# pragma pack(1)
+#endif
+
+typedef union {
+ oslSocket Socket;
+ oslFileHandle File;
+} oslResourceDescriptor;
+
+/** */
+typedef struct {
+ oslDescriptorType Type;
+ oslDescriptorFlag Flags;
+ oslResourceDescriptor Descriptor;
+} oslIOResource;
+
+typedef struct {
+ sal_uInt32 Size;
+ oslProcessData Fields;
+ oslProcessIdentifier Ident;
+ oslProcessExitCode Code;
+ TimeValue UserTime;
+ TimeValue SystemTime;
+ sal_uInt32 HeapUsage;
+} oslProcessInfo;
+
+#ifdef SAL_W32
+# pragma pack(pop)
+#elif defined(SAL_OS2)
+# pragma pack()
+#endif
+
+/** Process handle
+ @see osl_executeProcess
+ @see osl_freeProcessHandle
+ @see osl_joinProcess
+*/
+typedef void* oslProcess;
+
+/** Execute a process.
+ @param strImageName [in] denotes the name of the executable to be started.
+ @param strArguments [in] is an array of argument strings.
+ @param nArgument [in] the number of arguments provided.
+ @param Options [in] is a combination of int-constants to describe the mode of execution.
+ @param Security [in] describes a the user and his rights for wich the process is started.
+ @param strDirectory [in] denotes the name of the startup directory.
+ @param strEnviroments [in] is an array of strings wich describes the enviroment to set.
+ Each string has the form "variable=value".
+ @param nEnvironmentVars [in] the number of environment vars to set.
+ @param pResource [in] is a NULL terminated array of resources to transmit to the client process.
+ @param pProcess [out] points to a oslProcess variable, in wich the processhandle is returned.
+ @return osl_Process_E_None if the executable could be started, otherwise an error-code.
+ @see osl_freeProcessHandle
+ @see osl_getIOResources
+ @see osl_loginUser
+*/
+oslProcessError SAL_CALL osl_executeProcess(rtl_uString *strImageName,
+ rtl_uString *strArguments[],
+ sal_uInt32 nArguments,
+ oslProcessOption Options,
+ oslSecurity Security,
+ rtl_uString *strWorkDir,
+ rtl_uString *strEnvironment[],
+ sal_uInt32 nEnvironmentVars,
+ oslIOResource* pResources,
+ oslProcess *pProcess);
+
+oslProcessError SAL_CALL osl_terminateProcess(oslProcess Process);
+
+oslProcess SAL_CALL osl_getProcess(oslProcessIdentifier Ident);
+
+/** Free the specified proces-handle.
+ @param Process [in]
+*/
+void SAL_CALL osl_freeProcessHandle(oslProcess Process);
+
+/** Wait for completation of the specified childprocess.
+ @param Process [in]
+ @return ols_Process_E_None
+ @see osl_executeProcess
+*/
+oslProcessError SAL_CALL osl_joinProcess(oslProcess Process);
+
+oslProcessError SAL_CALL osl_getProcessInfo(oslProcess Process, oslProcessData Fields,
+ oslProcessInfo* pInfo);
+
+/** Get the filename of the executable.
+ @param strFile [out] the string that receives the executable file path.
+ @return osl_Process_E_None or does not return.
+ @see osl_executeProcess
+*/
+oslProcessError SAL_CALL osl_getExecutableFile(rtl_uString **strFile);
+
+/** @return the number of commandline arguments passed to the main-function of
+ this process
+ @see osl_getCommandArg
+*/
+sal_uInt32 SAL_CALL osl_getCommandArgCount();
+
+/** Get the nArg-th command-line argument passed to the main-function of this process.
+ @param nArg [in] The number of the argument to return.
+ @param strCommandArg [out] The string receives the nArg-th command-line argument.
+ @return osl_Process_E_None or does not return.
+ @see osl_executeProcess
+*/
+oslProcessError SAL_CALL osl_getCommandArg(sal_uInt32 nArg, rtl_uString **strCommandArg);
+
+/** Get the value of one enviroment variable.
+ @param strVar [in] denotes the name of the variable to get.
+ @param strValue [out] string that receives the value of environment variable.
+*/
+oslProcessError SAL_CALL osl_getEnvironment(rtl_uString *strVar, rtl_uString **strValue);
+
+/** Receive io-resources like file descriptors or sockets from the parent process.
+ @param Resources [out] is the buffer in wich the resources are returned.
+ @param Max [in] is the size of this buffer.
+ @return osl_Process_E_None if the variable exists, otherwise an errorcode.
+ @see osl_executeProcess (provide the ioresources)
+*/
+oslProcessError SAL_CALL osl_getIOResources(oslIOResource Resources[], sal_uInt32 Max);
+
+/** Receive a single io-resource inherited by a parent process using the Netsape
+ portable runtime.
+ NOTE: Currently only pipes are supported.
+ @param pResource [out] the buffer to be filled.
+ @param name [in] the name identifying the requested handle.
+*/
+oslProcessError SAL_CALL osl_getIOResource(oslIOResource *pResource, const char * name);
+
+sal_Bool SAL_CALL osl_sendResourcePipe(oslPipe Pipe, oslSocket Socket);
+
+oslSocket SAL_CALL osl_receiveResourcePipe(oslPipe Pipe);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OSL_PROCESS_H_ */
+
+/*************************************************************************
+*
+* $Log: not supported by cvs2svn $
+* Revision 1.13 2000/09/18 14:28:49 willem.vandorp
+* OpenOffice header added.
+*
+* Revision 1.12 2000/07/31 17:41:51 mfe
+* send and receive resource dummy implemented
+*
+* Revision 1.11 2000/07/21 16:15:41 mfe
+* IO resource funcs added
+*
+* Revision 1.10 2000/06/18 12:18:57 obr
+* enable inheritance of nspr file handles
+*
+* Revision 1.9 2000/05/17 14:30:14 mfe
+* comments upgraded
+*
+* Revision 1.8 2000/03/31 17:02:04 rs
+* UNICODE-Changes
+*
+* Revision 1.7 2000/03/27 09:17:50 hro
+* UNICODE New osl_getThreadTextEncoding
+*
+* Revision 1.6 2000/03/20 15:23:15 obr
+* Unicode API changes
+*
+* Revision 1.5 2000/03/17 13:41:25 obr
+* Fixed parameter/docu
+*
+* Revision 1.4 2000/03/17 13:05:34 obr
+* osl_getDefaulttextEncoding added.
+*
+* Revision 1.3 2000/03/17 12:03:56 obr
+* Unicode API changes
+*
+* Revision 1.2 1999/10/27 15:02:08 mfe
+* Change of Copyright, removed compiler warnings, code clean up, ...
+*
+* Revision 1.1 1999/08/05 10:18:19 jsc
+* verschoben aus osl
+*
+* Revision 1.18 1999/08/05 11:14:38 jsc
+* verschoben in root inc-Verzeichnis
+*
+* Revision 1.17 1999/01/20 18:53:41 jsc
+* #61011# Typumstellung
+*
+* Revision 1.16 1998/07/20 17:17:33 rh
+* #53072, #53073 Bugfixes for 5.0
+*
+* Revision 1.15 1998/03/13 15:07:31 rh
+* Cleanup of enum chaos and implemntation of pipes
+*
+* Revision 1.14 1998/02/16 19:34:51 rh
+* Cleanup of ports, integration of Size_t, features for process
+*
+* Revision 1.13 1997/11/28 08:55:50 fm
+* osl_PTSOCKETSEMAPHORE added
+*
+* Revision 1.12 1997/09/22 16:36:15 rh
+* terminate added
+*
+* Revision 1.11 1997/07/31 15:28:39 ts
+* *** empty log message ***
+*
+* Revision 1.10 1997/07/25 10:01:07 fm
+* *** empty log message ***
+*
+* Revision 1.9 1997/07/22 14:29:29 rh
+* process added
+*
+* Revision 1.8 1997/07/18 08:45:13 ts
+* *** empty log message ***
+*
+* Revision 1.7 1997/07/17 19:01:44 ts
+* *** empty log message ***
+*
+* Revision 1.6 1997/07/17 11:20:54 ts
+* *** empty log message ***
+*
+* Revision 1.5 1997/07/17 11:02:27 rh
+* Header adapted and profile added
+*
+* Revision 1.4 1997/07/15 19:01:58 rh
+* system.h inserted
+*
+* Revision 1.3 1997/07/14 09:09:11 rh
+* Adaptions for killable sleeps
+*
+* Revision 1.2 1997/07/11 10:14:28 ts
+* *** empty log message ***
+*
+* Revision 1.1 1997/07/11 07:33:02 rh
+* added
+*
+*************************************************************************/
diff --git a/sal/inc/osl/profile.h b/sal/inc/osl/profile.h
new file mode 100644
index 000000000000..360e36b70155
--- /dev/null
+++ b/sal/inc/osl/profile.h
@@ -0,0 +1,205 @@
+/*************************************************************************
+ *
+ * $RCSfile: profile.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_PROFILE_H_
+#define _OSL_PROFILE_H_
+
+#ifndef _RTL_USTRING_H
+# include <rtl/ustring.h>
+#endif
+
+#ifndef _OSL_TYPES_H_
+# include <osl/types.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef sal_uInt32 oslProfileOption;
+
+#define osl_Profile_DEFAULT 0x0000
+#define osl_Profile_SYSTEM 0x0001 /* use system depended functinality */
+#define osl_Profile_READLOCK 0x0002 /* lock file for reading */
+#define osl_Profile_WRITELOCK 0x0004 /* lock file for writing */
+#define osl_Profile_FLUSHWRITE 0x0010 /* writing only with flush */
+
+
+typedef void* oslProfile;
+
+/** Open or create a configuration profile.
+ @return 0 if the profile could not be created, otherwise a handle to the profile.
+*/
+oslProfile SAL_CALL osl_openProfile(rtl_uString *strProfileName, oslProfileOption Options);
+
+/** Close the opened profile an flush all data to the disk.
+ @param Profile handle to a opened profile.
+*/
+sal_Bool SAL_CALL osl_closeProfile(oslProfile Profile);
+
+
+sal_Bool SAL_CALL osl_flushProfile(oslProfile Profile);
+
+
+sal_Bool SAL_CALL osl_readProfileString(oslProfile Profile,
+ const sal_Char* pszSection, const sal_Char* pszEntry,
+ sal_Char* pszString, sal_uInt32 MaxLen,
+ const sal_Char* pszDefault);
+sal_Bool SAL_CALL osl_readProfileBool(oslProfile Profile,
+ const sal_Char* pszSection, const sal_Char* pszEntry,
+ sal_Bool Default);
+sal_uInt32 SAL_CALL osl_readProfileIdent(oslProfile Profile,
+ const sal_Char* pszSection, const sal_Char* pszEntry,
+ sal_uInt32 FirstId, const sal_Char* Strings[],
+ sal_uInt32 Default);
+
+sal_Bool SAL_CALL osl_writeProfileString(oslProfile Profile,
+ const sal_Char* pszSection, const sal_Char* pszEntry,
+ const sal_Char* pszString);
+sal_Bool SAL_CALL osl_writeProfileBool(oslProfile Profile,
+ const sal_Char* pszSection, const sal_Char* pszEntry,
+ sal_Bool Value);
+sal_Bool SAL_CALL osl_writeProfileIdent(oslProfile Profile,
+ const sal_Char* pszSection, const sal_Char* pszEntry,
+ sal_uInt32 FirstId, const sal_Char* Strings[],
+ sal_uInt32 Value);
+
+/** Acquire the mutex, block if already acquired by another thread.
+ @param Profile handle to a opened profile.
+ @return False if section or entry could not be found.
+*/
+sal_Bool SAL_CALL osl_removeProfileEntry(oslProfile Profile,
+ const sal_Char *pszSection, const sal_Char *pszEntry);
+
+/** Get all entries belonging to the specified section.
+ @param Profile handle to a opened profile.
+ @return Pointer to a array of pointers.
+*/
+sal_uInt32 SAL_CALL osl_getProfileSectionEntries(oslProfile Profile, const sal_Char *pszSection,
+ sal_Char* pszBuffer, sal_uInt32 MaxLen);
+
+/** Get all section entries
+ @param Profile handle to a opened profile.
+ @return Pointer to a array of pointers.
+*/
+sal_uInt32 SAL_CALL osl_getProfileSections(oslProfile Profile, sal_Char* pszBuffer, sal_uInt32 MaxLen);
+
+sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, rtl_uString** strProfileName);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OSL_PROFILE_H_ */
+
+/*************************************************************************
+*
+* $Log: not supported by cvs2svn $
+* Revision 1.8 2000/09/18 14:28:49 willem.vandorp
+* OpenOffice header added.
+*
+* Revision 1.7 2000/05/17 14:50:15 mfe
+* comments upgraded
+*
+* Revision 1.6 2000/03/22 17:06:42 mfe
+* #73273# #72225# : now a UniCode Version
+*
+* Revision 1.5 2000/03/22 16:58:30 mfe
+* #73273# #72225# : new Option for writing via flush without lock
+*
+* Revision 1.3 2000/03/06 14:14:46 mfe
+* #73273# : added osl_flushProfile
+*
+* Revision 1.2 1999/10/27 15:02:08 mfe
+* Change of Copyright, removed compiler warnings, code clean up, ...
+*
+* Revision 1.1 1999/08/05 10:18:19 jsc
+* verschoben aus osl
+*
+* Revision 1.8 1999/08/05 11:14:39 jsc
+* verschoben in root inc-Verzeichnis
+*
+* Revision 1.7 1999/01/20 18:53:41 jsc
+* #61011# Typumstellung
+*
+* Revision 1.6 1998/05/04 10:44:01 rh
+* Added osl_getProfileSections, minor changes on Unix signals,
+* starting every process under unix in a separate thread,
+* fix unix thread problem, when freeing a handle of a running thread
+*
+* Revision 1.5 1998/03/13 15:07:32 rh
+* Cleanup of enum chaos and implemntation of pipes
+*
+* Revision 1.4 1998/02/16 19:34:51 rh
+* Cleanup of ports, integration of Size_t, features for process
+*
+* Revision 1.3 1997/12/12 14:15:21 rh
+* Added CR/LF conversion, locking and system integration
+*
+* Revision 1.2 1997/09/18 10:57:28 rh
+* getProfileName added
+*
+* Revision 1.1 1997/07/17 11:02:27 rh
+* Header adapted and profile added
+*
+*************************************************************************/
+
diff --git a/sal/inc/osl/profile.hxx b/sal/inc/osl/profile.hxx
new file mode 100644
index 000000000000..6fd53441e269
--- /dev/null
+++ b/sal/inc/osl/profile.hxx
@@ -0,0 +1,276 @@
+/*************************************************************************
+ *
+ * $RCSfile: profile.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:12 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_PROFILE_HXX_
+#define _OSL_PROFILE_HXX_
+
+#include "profile.h"
+
+#ifndef _RTL_USTRING_
+#include <rtl/ustring>
+#endif
+
+#include <list>
+
+namespace osl {
+
+ typedef oslProfileOption ProfileOption;
+
+ const int Profile_DEFAULT = osl_Profile_DEFAULT;
+ const int Profile_SYSTEM = osl_Profile_SYSTEM; /* use system depended functinality */
+ const int Profile_READLOCK = osl_Profile_READLOCK; /* lock file for reading */
+ const int Profile_WRITELOCK = osl_Profile_WRITELOCK; /* lock file for writing */
+
+ class Profile {
+ oslProfile profile;
+
+ public:
+ /** Open or create a configuration profile.
+ @return 0 if the profile could not be created, otherwise a handle to the profile.
+ */
+ Profile(const rtl::OUString strProfileName, oslProfileOption Options = Profile_DEFAULT )
+ {
+ profile = osl_openProfile(strProfileName.pData, Options);
+ if( ! profile )
+ throw std::exception();
+ }
+
+
+ /** Close the opened profile an flush all data to the disk.
+ @param Profile handle to a opened profile.
+ */
+ ~Profile()
+ {
+ sal_Bool err = osl_closeProfile(profile);
+ }
+
+
+ sal_Bool flush()
+ {
+ return osl_flushProfile(profile);
+ }
+
+ rtl::OString readString( const rtl::OString& rSection, const rtl::OString& rEntry,
+ const rtl::OString& rDefault)
+ {
+ sal_Char aBuf[1024];
+ return osl_readProfileString( profile,
+ rSection,
+ rEntry,
+ aBuf,
+ sizeof( aBuf ),
+ rDefault ) ? rtl::OString( aBuf ) : rtl::OString();
+
+ }
+
+ sal_Bool readBool( const rtl::OString& rSection, const rtl::OString& rEntry, sal_Bool bDefault )
+ {
+ return osl_readProfileBool( profile, rSection, rEntry, bDefault );
+ }
+
+ sal_uInt32 readIdent(const rtl::OString& rSection, const rtl::OString& rEntry,
+ sal_uInt32 nFirstId, const std::list< rtl::OString >& rStrings,
+ sal_uInt32 nDefault)
+ {
+ int nItems = rStrings.size();
+ const sal_Char** pStrings = new const sal_Char*[ nItems+1 ];
+ std::list< rtl::OString >::const_iterator it = rStrings.begin();
+ nItems = 0;
+ while( it != rStrings.end() )
+ {
+ pStrings[ nItems++ ] = *it;
+ ++it;
+ }
+ pStrings[ nItems ] = NULL;
+ sal_uInt32 nRet = osl_readProfileIdent(profile, rSection, rEntry, nFirstId, pStrings, nDefault);
+ delete pStrings;
+ return nRet;
+ }
+
+ sal_Bool writeString(const rtl::OString& rSection, const rtl::OString& rEntry,
+ const rtl::OString& rString)
+ {
+ return osl_writeProfileString(profile, rSection, rEntry, rString);
+ }
+
+ sal_Bool writeBool(const rtl::OString& rSection, const rtl::OString& rEntry, sal_Bool Value)
+ {
+ return osl_writeProfileBool(profile, rSection, rEntry, Value);
+ }
+
+ sal_Bool writeIdent(const rtl::OString& rSection, const rtl::OString& rEntry,
+ sal_uInt32 nFirstId, const std::list< rtl::OString >& rStrings,
+ sal_uInt32 nValue)
+ {
+ int nItems = rStrings.size();
+ const sal_Char** pStrings = new const sal_Char*[ nItems+1 ];
+ std::list< rtl::OString >::const_iterator it = rStrings.begin();
+ nItems = 0;
+ while( it != rStrings.end() )
+ {
+ pStrings[ nItems++ ] = *it;
+ ++it;
+ }
+ pStrings[ nItems ] = NULL;
+ sal_Bool bRet =
+ osl_writeProfileIdent(profile, rSection, rEntry, nFirstId, pStrings, nValue );
+ delete pStrings;
+ return bRet;
+ }
+
+ /** Acquire the mutex, block if already acquired by another thread.
+ @param Profile handle to a opened profile.
+ @return False if section or entry could not be found.
+ */
+ sal_Bool removeEntry(const rtl::OString& rSection, const rtl::OString& rEntry)
+ {
+ return osl_removeProfileEntry(profile, rSection, rEntry);
+ }
+
+ /** Get all entries belonging to the specified section.
+ @param Profile handle to a opened profile.
+ @return Pointer to a array of pointers.
+ */
+ std::list< rtl::OString > getSectionEntries(const rtl::OString& rSection )
+ {
+ std::list< rtl::OString > aEntries;
+
+ // count buffer size necessary
+ int n = osl_getProfileSectionEntries( profile, rSection, NULL, 0 );
+ if( n > 1 )
+ {
+ sal_Char* pBuf = new sal_Char[ n+1 ];
+ osl_getProfileSectionEntries( profile, rSection, pBuf, n+1 );
+ int nLen;
+ for( n = 0; ( nLen = strlen( pBuf+n ) ); n += nLen+1 )
+ aEntries.push_back( rtl::OString( pBuf+n ) );
+ delete pBuf;
+ }
+
+ return aEntries;
+ }
+
+ /** Get all section entries
+ @param Profile handle to a opened profile.
+ @return Pointer to a array of pointers.
+ */
+ std::list< rtl::OString > getSections()
+ {
+ std::list< rtl::OString > aSections;
+
+ // count buffer size necessary
+ int n = osl_getProfileSections( profile, NULL, 0 );
+ if( n > 1 )
+ {
+ sal_Char* pBuf = new sal_Char[ n+1 ];
+ osl_getProfileSections( profile, pBuf, n+1 );
+ int nLen;
+ for( n = 0; ( nLen = strlen( pBuf+n ) ); n += nLen+1 )
+ aSections.push_back( rtl::OString( pBuf+n ) );
+ delete pBuf;
+ }
+
+ return aSections;
+ }
+
+ static rtl::OUString getName(const rtl::OUString& rPath, const rtl::OUString& rName)
+ {
+ rtl::OUString aProfileName;
+ return osl_getProfileName( rPath.pData, rName.pData, &aProfileName.pData ) ? aProfileName : rtl::OUString();
+ }
+
+ };
+}
+
+#endif /* _OSL_PROFILE_HXX_ */
+
+
+/*************************************************************************
+*
+* $Log: not supported by cvs2svn $
+* Revision 1.9 2000/09/18 14:28:49 willem.vandorp
+* OpenOffice header added.
+*
+* Revision 1.8 2000/05/31 08:52:40 obr
+* inline statement fixed
+*
+* Revision 1.7 2000/05/17 14:50:15 mfe
+* comments upgraded
+*
+* Revision 1.6 2000/03/16 16:43:53 obr
+* Unicode API changes
+*
+* Revision 1.5 2000/03/06 14:15:08 mfe
+* #73273# : added flush() method
+*
+* Revision 1.4 1999/11/09 16:15:25 pl
+* add: correct namespace
+*
+* Revision 1.3 1999/10/27 15:02:08 mfe
+* Change of Copyright, removed compiler warnings, code clean up, ...
+*
+* Revision 1.2 1999/09/30 11:45:58 pl
+* use OStrings to get rid of buffers
+*
+* Revision 1.1 1999/09/30 08:26:57 kr
+* profile header inline wrapper
+*
+*************************************************************************/
diff --git a/sal/inc/osl/security.h b/sal/inc/osl/security.h
new file mode 100644
index 000000000000..d98683f39a58
--- /dev/null
+++ b/sal/inc/osl/security.h
@@ -0,0 +1,263 @@
+/*************************************************************************
+ *
+ * $RCSfile: security.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_SECURITY_H_
+#define _OSL_SECURITY_H_
+
+#ifndef _RTL_USTRING_H_
+# include <rtl/ustring.h>
+#endif
+
+#ifndef _OSL_TYPES_H_
+# include <osl/types.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+ osl_Security_E_None,
+ osl_Security_E_UserUnknown,
+ osl_Security_E_WrongPassword,
+ osl_Security_E_Unknown,
+ osl_Security_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslSecurityError;
+
+/** Process handle
+ @see osl_loginUser
+ @see osl_freeSecurityHandle
+ @see osl_executeProcess
+*/
+typedef void* oslSecurity;
+
+/** Create a security handle for the current user.
+ @return a security handle or NULL on failure.
+ @see osl_freeSecurityHandle
+ @see osl_executeProcess
+ @see osl_executeApplication
+*/
+oslSecurity SAL_CALL osl_getCurrentSecurity(void);
+
+/** Create a security handle for the denoted user.
+ Try to log in the user on the local system.
+ @param strzUserName [in] denotes the name of the user to logg in.
+ @param strPasswd [in] the password for this user.
+ @param pSecurity [out] returns the security handle if user could be logged in.
+ @return osl_Security_E_None if user could be logged in, otherwise an error-code.
+ @see osl_freeSecurityHandle
+ @see osl_executeProcess
+ @see osl_executeApplication
+*/
+oslSecurityError SAL_CALL osl_loginUser(
+ rtl_uString *strUserName,
+ rtl_uString *strPasswd,
+ oslSecurity *pSecurity
+ );
+
+/** Create a security handle for the denoted user.
+ Try to log in the user on the denoted file server. On success the homedir will be
+ the maped drive on this server.
+ @param strUserName [in] denotes the name of the user to logg in.
+ @param strPasswd [in] the password for this user.
+ @param strFileServer [in] denotes the file server on wich the user is logged in.
+ @param pSecurity [out] returns the security handle if user could be logged in.
+ @return osl_Security_E_None if user could be logged in, otherwise an error-code.
+ @see osl_freeSecurityHandle
+ @see osl_executeProcess
+ @see osl_executeApplication
+*/
+oslSecurityError SAL_CALL osl_loginUserOnFileServer(
+ rtl_uString *strUserName,
+ rtl_uString *strPasswd,
+ rtl_uString *strFileServer,
+ oslSecurity *pSecurity
+ );
+
+/** Query if the user who is denotes by this security has administrator rigths.
+ @param Security [in] the security handle for th user.
+ @return True, if the user has adminsitrator rights, otherwise false.
+*/
+sal_Bool SAL_CALL osl_isAdministrator(oslSecurity Security);
+
+/** Free the security handle, created by osl_loginUser.
+ @param Security [in] the security handle.
+ @see osl_loginUser
+*/
+void SAL_CALL osl_freeSecurityHandle(oslSecurity Security);
+
+/** Get the login ident for the user of this security handle.
+ @param Security [in] the security handle.
+ @param strIdent [out] the string that receives the ident on success.
+ @return True, if the security handle is valid, otherwise False.
+*/
+sal_Bool SAL_CALL osl_getUserIdent(oslSecurity Security, rtl_uString **strIdent);
+
+/** Get the login name for the user of this security handle.
+ @param Security [in] the security handle.
+ @param pszName [out] the string that receives the user name on success.
+ @return True, if the security handle is valid, otherwise False.
+*/
+sal_Bool SAL_CALL osl_getUserName(oslSecurity Security, rtl_uString **strName);
+
+/** Get the home directory of the user of this security handle.
+ @param Security [in] the security handle.
+ @param strDirectory [out] the string that receives the directory path on success.
+ @return True, if the security handle is valid, otherwise False.
+*/
+sal_Bool SAL_CALL osl_getHomeDir(oslSecurity Security, rtl_uString **strDirectory);
+
+/** Get the directory for configuration data of the user of this security handle.
+ @param Security [in] the security handle.
+ @param strDirectory [out] the string that receives the directory path on success.
+ @return True, if the security handle is valid, otherwise False.
+*/
+sal_Bool SAL_CALL osl_getConfigDir(oslSecurity Security, rtl_uString **strDirectory);
+
+
+/** Load Profile of the User
+ Implemented just for Windows
+ @param oslSecurity Security [in] previously fetch Security of the User
+ @return True if the Profile could successfully loaded, False otherwise.
+*/
+
+sal_Bool SAL_CALL osl_loadUserProfile(oslSecurity Security);
+
+
+/** Unload a User Profile
+ Implemented just for Windows
+ @param oslSecurity Security [in] previously fetch Security of the User
+ @return nothing is returned!
+*/
+
+void SAL_CALL osl_unloadUserProfile(oslSecurity Security);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OSL_SECURITY_H_ */
+
+/*************************************************************************
+*
+* $Log: not supported by cvs2svn $
+* Revision 1.7 2000/09/18 14:28:49 willem.vandorp
+* OpenOffice header added.
+*
+* Revision 1.6 2000/05/17 14:50:15 mfe
+* comments upgraded
+*
+* Revision 1.5 2000/03/31 16:55:43 rs
+* UNICODE-Changes
+*
+* Revision 1.4 2000/03/16 16:43:53 obr
+* Unicode API changes
+*
+* Revision 1.3 1999/11/18 09:44:26 mfe
+* loadUserprofile moved from process.c to security.c
+*
+* Revision 1.2 1999/10/27 15:02:08 mfe
+* Change of Copyright, removed compiler warnings, code clean up, ...
+*
+* Revision 1.1 1999/08/05 10:18:20 jsc
+* verschoben aus osl
+*
+* Revision 1.13 1999/08/05 11:14:41 jsc
+* verschoben in root inc-Verzeichnis
+*
+* Revision 1.12 1999/07/09 15:35:33 br
+* BR: fuer win16
+*
+* Revision 1.11 1999/01/20 18:53:41 jsc
+* #61011# Typumstellung
+*
+* Revision 1.10 1998/09/18 15:33:41 rh
+* #56761# neue locations fr cfg/ini files
+*
+* Revision 1.9 1998/03/13 15:07:32 rh
+* Cleanup of enum chaos and implemntation of pipes
+*
+* Revision 1.8 1998/02/16 19:34:51 rh
+* Cleanup of ports, integration of Size_t, features for process
+*
+* Revision 1.7 1997/10/21 14:22:21 ts
+* Abfrage, ob ein Benutzer Adminstratorrechte hat eingebaut
+*
+* Revision 1.6 1997/10/17 16:00:44 ts
+* osl_logonUserOnFileServer hinzugefuegt
+*
+* Revision 1.5 1997/10/14 07:52:51 fm
+* *** empty log message ***
+*
+* Revision 1.4 1997/07/31 15:28:39 ts
+* *** empty log message ***
+*
+* Revision 1.3 1997/07/22 14:29:30 rh
+* process added
+*
+* Revision 1.2 1997/07/17 19:01:45 ts
+* *** empty log message ***
+*
+* Revision 1.1 1997/07/17 11:22:18 ts
+* *** empty log message ***
+*
+*************************************************************************/
+
diff --git a/sal/inc/osl/semaphor.h b/sal/inc/osl/semaphor.h
new file mode 100644
index 000000000000..911778cb0b82
--- /dev/null
+++ b/sal/inc/osl/semaphor.h
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * $RCSfile: semaphor.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_SEMAPHORE_H_
+#define _OSL_SEMAPHORE_H_
+
+#ifndef _OSL_TYPES_H_
+# include <osl/types.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void* oslSemaphore;
+
+/** Creates a semaphore.<BR>
+ @param InitialCount denotes the starting value the semaphore. If you set it to
+ zero, the first acquire() blocks. Otherwise InitialCount acquire()s are
+ immedeatly successfull.
+ @return 0 if the semaphore could not be created, otherwise a handle to the sem.
+*/
+oslSemaphore SAL_CALL osl_createSemaphore(sal_uInt32 initialCount);
+
+/** Release the OS-structures and free semaphore data-structure
+ @return fbbb
+*/
+void SAL_CALL osl_destroySemaphore(oslSemaphore Semaphore);
+
+/** acquire() decreases the count. It will block if it tries to
+ decrease below zero.
+ @return False if the system-call failed.
+*/
+sal_Bool SAL_CALL osl_acquireSemaphore(oslSemaphore Semaphore);
+
+/** tryToAcquire() tries to decreases the count. It will
+ return with False if it would decrease the count below zero.
+ (When acquire() would block.) If it could successfully
+ decrease the count, it will return True.
+*/
+sal_Bool SAL_CALL osl_tryToAcquireSemaphore(oslSemaphore Semaphore);
+
+/** release() increases the count.
+ @return False if the system-call failed.
+*/
+sal_Bool SAL_CALL osl_releaseSemaphore(oslSemaphore Semaphore);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OSL_SEMAPHORE_H_ */
+
+/*************************************************************************
+*
+* $Log: not supported by cvs2svn $
+* Revision 1.4 2000/09/18 14:28:49 willem.vandorp
+* OpenOffice header added.
+*
+* Revision 1.3 2000/05/17 14:50:15 mfe
+* comments upgraded
+*
+* Revision 1.2 1999/10/27 15:02:08 mfe
+* Change of Copyright, removed compiler warnings, code clean up, ...
+*
+* Revision 1.1 1999/08/05 10:18:20 jsc
+* verschoben aus osl
+*
+* Revision 1.6 1999/08/05 11:14:41 jsc
+* verschoben in root inc-Verzeichnis
+*
+* Revision 1.5 1999/01/20 18:53:41 jsc
+* #61011# Typumstellung
+*
+* Revision 1.4 1998/02/16 19:34:52 rh
+* Cleanup of ports, integration of Size_t, features for process
+*
+* Revision 1.3 1997/07/31 15:28:40 ts
+* *** empty log message ***
+*
+* Revision 1.2 1997/07/17 11:02:28 rh
+* Header adapted and profile added
+*
+* Revision 1.1 1997/06/19 13:10:10 bho
+* first version of OSL.
+*
+*************************************************************************/
+
diff --git a/sal/inc/osl/semaphor.hxx b/sal/inc/osl/semaphor.hxx
new file mode 100644
index 000000000000..097bc6a81dd9
--- /dev/null
+++ b/sal/inc/osl/semaphor.hxx
@@ -0,0 +1,152 @@
+/*************************************************************************
+ *
+ * $RCSfile: semaphor.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_SEMAPHORE_HXX_
+#define _OSL_SEMAPHORE_HXX_
+
+#ifdef __cplusplus
+
+#include <osl/macros.hxx>
+
+#include <osl/semaphore.h>
+
+
+#ifdef _USE_NAMESPACE
+namespace osl
+{
+#endif
+
+ class Semaphore {
+ oslSemaphore semaphore;
+
+ public:
+
+ /** Creates a semaphore.<BR>
+ @param InitialCount denotes the starting value the semaphore. If you set it to
+ zero, the first acquire() blocks. Otherwise InitialCount acquire()s are
+ immedeatly successfull.
+ @return 0 if the semaphore could not be created, otherwise a handle to the sem.
+ */
+
+ Semaphore(sal_uInt32 initialCount)
+ {
+ semaphore = osl_createSemaphore(initialCount);
+ }
+
+ /** Release the OS-structures and free semaphore data-structure
+ @return fbbb
+ */
+ ~Semaphore()
+ {
+ osl_destroySemaphore(semaphore);
+ }
+
+ /** acquire() decreases the count. It will block if it tries to
+ decrease below zero.
+ @return False if the system-call failed.
+ */
+ sal_Bool acquire()
+ {
+ return osl_acquireSemaphore(semaphore);
+ }
+
+ /** tryToAcquire() tries to decreases the count. It will
+ return with False if it would decrease the count below zero.
+ (When acquire() would block.) If it could successfully
+ decrease the count, it will return True.
+ */
+ sal_Bool tryToAcquire()
+ {
+ return osl_tryToAcquireSemaphore(semaphore);
+ }
+
+ /** release() increases the count.
+ @return False if the system-call failed.
+ */
+ sal_Bool release()
+ {
+ return osl_releaseSemaphore(semaphore);
+ }
+ };
+#ifdef _USE_NAMESPACE
+}
+#endif
+
+#endif /* __cplusplus */
+#endif /* _OSL_SEMAPHORE_HXX_ */
+
+/*************************************************************************
+*
+* $Log: not supported by cvs2svn $
+* Revision 1.4 2000/09/18 14:28:49 willem.vandorp
+* OpenOffice header added.
+*
+* Revision 1.3 2000/05/17 14:50:15 mfe
+* comments upgraded
+*
+* Revision 1.2 1999/10/27 15:02:08 mfe
+* Change of Copyright, removed compiler warnings, code clean up, ...
+*
+* Revision 1.1 1999/09/23 12:09:17 kr
+* inline header wrapper for mutex semaphore guard
+*
+*************************************************************************/
+
diff --git a/sal/inc/osl/signal.h b/sal/inc/osl/signal.h
new file mode 100644
index 000000000000..439dd2feb60a
--- /dev/null
+++ b/sal/inc/osl/signal.h
@@ -0,0 +1,182 @@
+/*************************************************************************
+ *
+ * $RCSfile: signal.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_SIGNAL_H_
+#define _OSL_SIGNAL_H_
+
+#ifndef _OSL_TYPES_H_
+# include <osl/types.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define OSL_SIGNAL_USER_RESERVED 0
+
+#define OSL_SIGNAL_USER_RESOURCEFAILURE (OSL_SIGNAL_USER_RESERVED - 1)
+#define OSL_SIGNAL_USER_X11SUBSYSTEMERROR (OSL_SIGNAL_USER_RESERVED - 2)
+#define OSL_SIGNAL_USER_RVPCONNECTIONERROR (OSL_SIGNAL_USER_RESERVED - 3)
+
+typedef void* oslSignalHandler;
+
+typedef enum
+{
+ osl_Signal_System,
+ osl_Signal_Terminate,
+ osl_Signal_AccessViolation,
+ osl_Signal_IntegerDivideByZero,
+ osl_Signal_FloatDivideByZero,
+ osl_Signal_DebugBreak,
+ osl_Signal_User,
+ osl_Signal_Alarm,
+ osl_Signal_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslSignal;
+
+typedef enum
+{
+ osl_Signal_ActCallNextHdl,
+ osl_Signal_ActIgnore,
+ osl_Signal_ActAbortApp,
+ osl_Signal_ActKillApp,
+ osl_Signal_Act_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslSignalAction;
+
+#ifdef SAL_W32
+# pragma pack(push, 8)
+#elif defined(SAL_OS2)
+# pragma pack(1)
+#endif
+
+typedef struct
+{
+ oslSignal Signal;
+ sal_Int32 UserSignal;
+ void* UserData;
+} oslSignalInfo;
+
+#ifdef SAL_W32
+# pragma pack(pop)
+#elif defined(SAL_OS2)
+# pragma pack()
+#endif
+
+/** the function-ptr. representing the signal handler-function.
+*/
+typedef oslSignalAction (SAL_CALL *oslSignalHandlerFunction)(void* pData, oslSignalInfo* pInfo);
+
+oslSignalHandler SAL_CALL osl_addSignalHandler(oslSignalHandlerFunction Handler, void* pData);
+
+sal_Bool SAL_CALL osl_removeSignalHandler(oslSignalHandler hHandler);
+
+oslSignalAction SAL_CALL osl_raiseSignal(sal_Int32 UserSignal, void* UserData);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OSL_SIGNAL_H_ */
+
+
+/*************************************************************************
+*
+* $Log: not supported by cvs2svn $
+* Revision 1.8 2000/09/18 14:28:49 willem.vandorp
+* OpenOffice header added.
+*
+* Revision 1.7 2000/08/11 16:46:28 pl
+* #77400# #76899# corrected define
+*
+* Revision 1.6 2000/08/11 16:31:40 pl
+* #77400# add OSL_SIGNAL_USER_RVPCONNECTIONERROR
+*
+* Revision 1.5 2000/05/29 16:45:16 hro
+* SRC591: Explicite SAL_CALL calling convention
+*
+* Revision 1.4 2000/05/17 14:50:15 mfe
+* comments upgraded
+*
+* Revision 1.3 1999/12/22 13:37:55 mfe
+* #71232# : added Alarm Signal Type
+*
+* Revision 1.2 1999/10/27 15:02:08 mfe
+* Change of Copyright, removed compiler warnings, code clean up, ...
+*
+* Revision 1.1 1999/08/05 10:18:20 jsc
+* verschoben aus osl
+*
+* Revision 1.5 1999/08/05 11:14:42 jsc
+* verschoben in root inc-Verzeichnis
+*
+* Revision 1.4 1999/04/22 07:54:04 rh
+* #63033# Deliver breakpoints via signal TSignal_DebugBreak
+*
+* Revision 1.3 1999/01/20 18:53:41 jsc
+* #61011# Typumstellung
+*
+* Revision 1.2 1998/03/13 15:07:32 rh
+* Cleanup of enum chaos and implemntation of pipes
+*
+* Revision 1.1 1998/03/06 15:42:09 rh
+* Added signal handling
+*
+*************************************************************************/
diff --git a/sal/inc/osl/socket.h b/sal/inc/osl/socket.h
new file mode 100644
index 000000000000..d20ebb9ad422
--- /dev/null
+++ b/sal/inc/osl/socket.h
@@ -0,0 +1,1001 @@
+/*************************************************************************
+ *
+ * $RCSfile: socket.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_SOCKET_H_
+#define _OSL_SOCKET_H_
+
+#ifndef _RTL_USTRING_H_
+# include <rtl/ustring.h>
+#endif
+
+#ifndef _OSL_TYPES_H_
+# include <osl/types.h>
+#endif
+
+#ifndef _RTL_TENCINFO_H
+# include <rtl/tencinfo.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* error returns */
+#define OSL_INADDR_NONE 0xffffffff
+#define OSL_INVALID_PORT 0xffffffff
+#define OSL_INVALID_IPX_SOCKET_NO 0xffffffff
+
+/**@{ begin section types
+*/
+
+/*
+ Opaque datatype SocketAddr.
+*/
+typedef void* oslSocketAddr;
+
+
+/*
+ Represents the address-family of a socket
+*/
+typedef enum {
+ osl_Socket_FamilyInet, /* IP */
+ osl_Socket_FamilyIpx, /* Novell IPX/SPX */
+ osl_Socket_FamilyInvalid, /* always last entry in enum! */
+ osl_Socket_Family_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslAddrFamily;
+
+/*
+ represent a specific protocol within a address-family
+*/
+typedef enum {
+ osl_Socket_ProtocolIp, /* for all af_inet */
+ osl_Socket_ProtocolIpx, /* af_ipx datagram sockets (IPX) */
+ osl_Socket_ProtocolSpx, /* af_ipx seqpacket or stream for SPX */
+ osl_Socket_ProtocolSpxII, /* af_ipx seqpacket or stream for SPX II */
+ osl_Socket_ProtocolInvalid,
+ osl_Socket_Protocol_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslProtocol;
+
+
+/*
+ Represents the type of a socket
+*/
+typedef enum {
+ osl_Socket_TypeStream,
+ osl_Socket_TypeDgram,
+ osl_Socket_TypeRaw,
+ osl_Socket_TypeRdm,
+ osl_Socket_TypeSeqPacket,
+ osl_Socket_TypeInvalid, /* always last entry in enum! */
+ osl_Socket_Type_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslSocketType;
+
+
+/*
+ Represents socket-options
+*/
+typedef enum {
+ osl_Socket_OptionDebug,
+ osl_Socket_OptionAcceptConn,
+ osl_Socket_OptionReuseAddr,
+ osl_Socket_OptionKeepAlive,
+ osl_Socket_OptionDontRoute,
+ osl_Socket_OptionBroadcast,
+ osl_Socket_OptionUseLoopback,
+ osl_Socket_OptionLinger,
+ osl_Socket_OptionOOBinLine,
+ osl_Socket_OptionSndBuf,
+ osl_Socket_OptionRcvBuf,
+ osl_Socket_OptionSndLowat,
+ osl_Socket_OptionRcvLowat,
+ osl_Socket_OptionSndTimeo,
+ osl_Socket_OptionRcvTimeo,
+ osl_Socket_OptionError,
+ osl_Socket_OptionType,
+ osl_Socket_OptionTcpNoDelay,
+ osl_Socket_OptionInvalid, /* always last entry in enum! */
+ osl_Socket_Option_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslSocketOption;
+
+/*
+ Represents the different socket-option levels
+*/
+typedef enum {
+ osl_Socket_LevelSocket,
+ osl_Socket_LevelTcp,
+ osl_Socket_LevelInvalid, /* always last entry in enum! */
+ osl_Socket_Level_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslSocketOptionLevel;
+
+
+/*
+ Represents flags to be used with send/recv-calls.
+*/
+typedef enum {
+ osl_Socket_MsgNormal,
+ osl_Socket_MsgOOB,
+ osl_Socket_MsgPeek,
+ osl_Socket_MsgDontRoute,
+ osl_Socket_MsgMaxIOVLen,
+ osl_Socket_MsgInvalid, /* always last entry in enum! */
+ osl_Socket_Msg_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslSocketMsgFlag;
+
+/*
+ Used by shutdown to denote which end of the socket to "close".
+*/
+typedef enum {
+ osl_Socket_DirRead,
+ osl_Socket_DirWrite,
+ osl_Socket_DirReadWrite,
+ osl_Socket_DirInvalid, /* always last entry in enum! */
+ osl_Socket_Dir_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslSocketDirection;
+
+
+typedef enum {
+ osl_Socket_E_None, /* no error */
+ osl_Socket_E_NotSocket, /* Socket operation on non-socket */
+ osl_Socket_E_DestAddrReq, /* Destination address required */
+ osl_Socket_E_MsgSize, /* Message too long */
+ osl_Socket_E_Prototype, /* Protocol wrong type for socket */
+ osl_Socket_E_NoProtocol, /* Protocol not available */
+ osl_Socket_E_ProtocolNoSupport, /* Protocol not supported */
+ osl_Socket_E_TypeNoSupport, /* Socket type not supported */
+ osl_Socket_E_OpNotSupport, /* Operation not supported on socket */
+ osl_Socket_E_PfNoSupport, /* Protocol family not supported */
+ osl_Socket_E_AfNoSupport, /* Address family not supported by */
+ /* protocol family */
+ osl_Socket_E_AddrInUse, /* Address already in use */
+ osl_Socket_E_AddrNotAvail, /* Can't assign requested address */
+ osl_Socket_E_NetDown, /* Network is down */
+ osl_Socket_E_NetUnreachable, /* Network is unreachable */
+ osl_Socket_E_NetReset, /* Network dropped connection because */
+ /* of reset */
+ osl_Socket_E_ConnAborted, /* Software caused connection abort */
+ osl_Socket_E_ConnReset, /* Connection reset by peer */
+ osl_Socket_E_NoBufferSpace, /* No buffer space available */
+ osl_Socket_E_IsConnected, /* Socket is already connected */
+ osl_Socket_E_NotConnected, /* Socket is not connected */
+ osl_Socket_E_Shutdown, /* Can't send after socket shutdown */
+ osl_Socket_E_TooManyRefs, /* Too many references: can't splice */
+ osl_Socket_E_TimedOut, /* Connection timed out */
+ osl_Socket_E_ConnRefused, /* Connection refused */
+ osl_Socket_E_HostDown, /* Host is down */
+ osl_Socket_E_HostUnreachable, /* No route to host */
+ osl_Socket_E_WouldBlock, /* call would block on non-blocking socket */
+ osl_Socket_E_Already, /* operation already in progress */
+ osl_Socket_E_InProgress, /* operation now in progress */
+ osl_Socket_E_InvalidError, /* unmapped error: always last entry in enum! */
+ osl_Socket_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslSocketError;
+
+
+typedef enum {
+ osl_Socket_Ok, /* successful completion */
+ osl_Socket_Error, /* error occured, check osl_getLastSocketError() for details */
+ osl_Socket_TimedOut, /* blocking operation timed out */
+ osl_Socket_Interrupted, /* blocking operation was interrupted */
+ osl_Socket_InProgress, /* nonblocking operation is in progress */
+ osl_Socket_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslSocketResult;
+
+typedef sal_uInt8 oslSocketIpxNetNumber[4];
+typedef sal_uInt8 oslSocketIpxNodeNumber[6];
+
+/**@} end section types
+*/
+
+/**@{ begin section oslSocketAddr
+*/
+
+
+/** Creates a socket-address for the given family.
+ If family == osl_af_inet the address is set to INADDR_ANY
+ port 0.
+ @return 0 if address could not be created.
+*/
+oslSocketAddr SAL_CALL osl_createEmptySocketAddr(oslAddrFamily Family);
+
+
+/** Create a new SocketAddress and fill it from Addr.
+*/
+oslSocketAddr SAL_CALL osl_copySocketAddr(oslSocketAddr Addr);
+
+/** Compare to SocketAddress.
+*/
+sal_Bool SAL_CALL osl_isEqualSocketAddr(
+ oslSocketAddr Addr1, oslSocketAddr Addr2);
+
+
+/** Uses the systems name-service interface to find an address for strHostname.
+ @param strHostname [in] The name for which you search for an address.
+ @return The desired address if one could be found, otherwise 0.
+ Don't forget to destroy the address if you don't need it any longer.
+*/
+oslSocketAddr SAL_CALL osl_resolveHostname(rtl_uString *strHostname);
+
+
+/** Create an internet address usable for sending broadcast datagrams.
+ To limit the broadcast to your subnet, pass your hosts IP address
+ in dotted decimal notation as first argument.
+ @see osl_sendToSocket(..., oslSocketAddr ReceiverAddr, ...).
+ @param strDottedAddr [in] dotted decimal internet address, may be 0.
+ @param Port [in] port number in host byte order.
+ @return 0 if address could not be created.
+*/
+oslSocketAddr SAL_CALL osl_createInetBroadcastAddr (
+ rtl_uString *strDottedAddr, sal_Int32 Port);
+
+
+/** Create an internet-address, consisting of hostaddress and port.
+ We interpret strDottedAddr as a dotted-decimal inet-addr
+ (e.g. "141.99.128.50").
+ @param strDottedAddr [in] String with dotted address.
+ @param Port [in] portnumber in host byte order.
+ @return 0 if address could not be created.
+*/
+oslSocketAddr SAL_CALL osl_createInetSocketAddr (
+ rtl_uString *strDottedAddr, sal_Int32 Port);
+
+
+/** Create an IPX address.
+*/
+oslSocketAddr SAL_CALL osl_createIpxSocketAddr(rtl_uString * strNetNumber,
+ rtl_uString * strNodeNumber,
+ sal_uInt32 SocketNumber);
+
+/** Free all memory allocated by pAddress.
+*/
+void SAL_CALL osl_destroySocketAddr(oslSocketAddr Addr);
+
+
+
+/** Looks up the port-number designated to the specified service/protocol-pair.
+ (e.g. "ftp" "tcp").
+ @return OSL_INVALID_PORT if no appropriate entry was found, otherwise the port-number.
+*/
+sal_Int32 SAL_CALL osl_getServicePort(rtl_uString *strServicename, rtl_uString *strProtocol);
+
+
+
+/** Retrieves the address-family from the Addr.
+ @return the family of the socket-address.
+ In case of an unknown family you get osl_invalid_AddrFamily.
+*/
+oslAddrFamily SAL_CALL osl_getFamilyOfSocketAddr(oslSocketAddr Addr);
+
+
+/** Retrieves the internet port-number of Addr.
+ @return the port-number of the address in host-byte order. If Addr
+ is not an address of type osl_af_inet, it returns OSL_INVALID_PORT
+*/
+sal_Int32 SAL_CALL osl_getInetPortOfSocketAddr(oslSocketAddr Addr);
+
+
+/** Sets the Port of Addr.
+ @param Port [in] is expected in host byte-order.
+ @return False if Addr is not an inet-addr.
+*/
+sal_Bool SAL_CALL osl_setInetPortOfSocketAddr(oslSocketAddr Addr, sal_Int32 Port);
+
+
+/** Gets the hostname represented by Addr.
+ @return the hostname represented by the address. If
+ there is no hostname to be found, it returns 0.
+*/
+oslSocketResult SAL_CALL osl_getHostnameOfSocketAddr(oslSocketAddr Addr, rtl_uString **strHostname);
+
+
+/** Gets the address in dotted decimal format.
+ @return the dotted decimal address (e.g. 141.99.20.34) represented
+ by the address. If the address is invalid or not of type osl_af_inet,
+ it returns 0.
+*/
+oslSocketResult SAL_CALL osl_getDottedInetAddrOfSocketAddr(oslSocketAddr Addr, rtl_uString **strDottedInetAddr);
+
+
+/** Gets the IPX Net-Number of the address.
+ @return the (4 bytes long) net-number or 0 if not an IPX address.
+*/
+oslSocketResult SAL_CALL osl_getIpxNetNumber(oslSocketAddr Addr, oslSocketIpxNetNumber NetNumber);
+
+
+/** Gets the IPX Node-Number of the address.
+ @return the (6 bytes long) net-number or 0 if not an IPX address.
+*/
+oslSocketResult SAL_CALL osl_getIpxNodeNumber(oslSocketAddr Addr, oslSocketIpxNodeNumber NodeNumber);
+
+/** Gets the IPX Socket-Number of the address.
+ @return the IPX socket number or OSL_INVALID_IPX_SOCKET_NO if not an IPX address.
+*/
+sal_Int32 SAL_CALL osl_getIpxSocketNumber(oslSocketAddr Addr);
+
+/**@} end section oslSocketAddr
+*/
+
+/**@{ begin section oslHostAddr
+*/
+
+/*
+ Opaque datatype HostAddr.
+*/
+typedef void* oslHostAddr;
+
+
+/** Create an oslHostAddr from given hostname and socket address.
+ @param strHostname [in] The hostname to be stored.
+ @param Addr [in] The socket address to be stored.
+ @return The created address or 0 upon failure.
+*/
+oslHostAddr SAL_CALL osl_createHostAddr(rtl_uString *strHostname, const oslSocketAddr Addr);
+
+
+/** Create an oslHostAddr by resolving the given strHostname.
+ Successful name resolution should result in the fully qualified
+ domain name (FQDN) and it's address as hostname and socket address
+ members of the resulting oslHostAddr.
+ @param strHostname [in] The hostname to be resolved.
+ @return The resulting address or 0 upon failure.
+*/
+oslHostAddr SAL_CALL osl_createHostAddrByName(rtl_uString *strHostname);
+
+
+/** Create an oslHostAddr by reverse resolution of the given Addr.
+ Successful name resolution should result in the fully qualified
+ domain name (FQDN) and it's address as hostname and socket address
+ members of the resulting oslHostAddr.
+ @param Addr [in] The socket address to be reverse resolved.
+ @return The resulting address or 0 upon failure.
+*/
+oslHostAddr SAL_CALL osl_createHostAddrByAddr(const oslSocketAddr Addr);
+
+
+/** Create a copy of the given Addr.
+ @return The copied address or 0 upon failure.
+*/
+oslHostAddr SAL_CALL osl_copyHostAddr(const oslHostAddr Addr);
+
+
+/** Free all memory allocated by Addr.
+*/
+void SAL_CALL osl_destroyHostAddr(oslHostAddr Addr);
+
+
+/** Get the hostname member of Addr.
+ @return The hostname or 0 upon failure.
+*/
+void SAL_CALL osl_getHostnameOfHostAddr(const oslHostAddr Addr, rtl_uString **strHostname);
+
+
+/** Get the socket address member of Addr.
+ @return The socket address or 0 upon failure.
+*/
+oslSocketAddr SAL_CALL osl_getSocketAddrOfHostAddr(const oslHostAddr Addr);
+
+/** Retrieve this machines hostname.
+ May not always be a fully qualified domain name (FQDN).
+ @param strLocalHostname [out] The string that receives the local host name.
+ @return True upon success, False otherwise.
+*/
+oslSocketResult SAL_CALL osl_getLocalHostname(rtl_uString **strLocalHostname);
+
+
+/**@} end section oslHostAddr
+*/
+
+/**@{ begin section oslSocket
+*/
+
+
+/*-***************************************************************************/
+/* oslSocket */
+/*-***************************************************************************/
+
+typedef void* oslSocket;
+
+/** Create a socket of the specified Family and Type. The semantic of
+ the Protocol parameter depends on the given family and type.
+ @return 0 if socket could not be created, otherwise you get a handle
+ to the allocated socket-datastructure.
+*/
+oslSocket SAL_CALL osl_createSocket(oslAddrFamily Family,
+ oslSocketType Type,
+ oslProtocol Protocol);
+
+/** Create a socket as a copy of another.
+ @return 0 if socket could not be created, otherwise you get a handle
+ to the allocated socket-datastructure.
+*/
+oslSocket SAL_CALL osl_copySocket(oslSocket Socket);
+
+/** Closes the socket and frees the Socket data-structure.
+ For a graceful termination of a connection, you should call
+ osl_shutdownSocket() first.
+ @param Socket [in] The Socket to be closed and destroyed.
+*/
+void SAL_CALL osl_destroySocket(oslSocket Socket);
+
+
+/** Retrieves the Address of the local end of the socket.
+ Note that a socket must be bound or connected before
+ a vaild address can be returned.
+ @return 0 if socket-address could not be created, otherwise you get
+ the created Socket-Address.
+*/
+oslSocketAddr SAL_CALL osl_getLocalAddrOfSocket(oslSocket Socket);
+
+/** Retrieves the Address of the remote end of the socket.
+ Note that a socket must be connected before
+ a vaild address can be returned.
+ @return 0 if socket-address could not be created, otherwise you get
+ the created Socket-Address.
+*/
+oslSocketAddr SAL_CALL osl_getPeerAddrOfSocket(oslSocket Socket);
+
+/** Binds the given address to the socket.
+ @param Socket [in]
+ @param Address [in]
+ @return False if the bind failed.
+*/
+sal_Bool SAL_CALL osl_bindAddrToSocket(oslSocket Socket,
+ oslSocketAddr Addr);
+
+/** Connects the socket to the given address.
+
+ @param Socket [in] a bound socket.
+ @param Addr [in] the peer address.
+ @param pTimeout Timeout value or NULL for blocking.
+
+ @return osl_sock_result_ok on successful connection,
+ osl_sock_result_timeout if operation timed out,
+ osl_sock_result_interrupted if operation was interrupted
+ osl_sock_result_error if the connection failed.
+*/
+oslSocketResult SAL_CALL osl_connectSocketTo(oslSocket Socket,
+ oslSocketAddr Addr,
+ const TimeValue* pTimeout);
+
+
+/** Prepares the socket to act as an acceptor of incoming connections.
+ You should call "listen" before you use "accept".
+ @param MaxPendingConnections [in] denotes the length of the queue of
+ pending connections for this socket. If MaxPendingConnections is
+ -1, the systems default value will be used (Usually 5).
+ @return False if the listen failed.
+*/
+sal_Bool SAL_CALL osl_listenOnSocket(oslSocket Socket,
+ sal_Int32 MaxPendingConnections);
+
+
+/** Waits for an ingoing connection on the socket.
+ This call blocks if there is no incoming connection present.
+ @param pAddr [in] if pAddr is != 0, the peers address is returned.
+ @return 0 if the accept-call failed, otherwise you get a socket
+ representing the new connection.
+*/
+oslSocket SAL_CALL osl_acceptConnectionOnSocket(oslSocket Socket,
+ oslSocketAddr* pAddr);
+
+/** Tries to receive BytesToRead data from the connected socket,
+ if no error occurs. Note that incomplete recvs due to
+ packet boundaries may occur.
+
+ @param Socket [in] A connected socket to be used to listen on.
+ @param pBuffer [out] Points to a buffer that will be filled with the received
+ data.
+ @param BytesToRead [in] The number of bytes to read. pBuffer must have at least
+ this size.
+ @param Flag [in] Modifier for the call. Valid values are:
+ <ul>
+ <li> osl_msg_normal,
+ <li> osl_msg_oob,
+ <li> osl_msg_peek,
+ <li> osl_msg_dontroute,
+ <li> osl_msg_maxiovlen,
+ </ul>
+
+ @return the number of received bytes.
+*/
+sal_Int32 SAL_CALL osl_receiveSocket(oslSocket Socket,
+ void* pBuffer,
+ sal_uInt32 BytesToRead,
+ oslSocketMsgFlag Flag);
+
+/** Tries to receives BufferSize data from the (usually unconnected)
+ (datagram-)socket, if no error occurs.
+
+ @param Socket [in] A bound socket to be used to listen for a datagram.
+ @param SenderAddr [out] An initialized oslSocketAddress. It will be
+ filled with the address of the datagrams sender. If SenderAddr is 0,
+ it is ignored.
+ @param pBuffer [out] Points to a buffer that will be filled with the received
+ datagram.
+ @param BufferSize [in] The size of pBuffer.
+ @param Flag [in] Modifier for the call. Valid values are:
+ <ul>
+ <li> osl_msg_normal,
+ <li> osl_msg_oob,
+ <li> osl_msg_peek,
+ <li> osl_msg_dontroute,
+ <li> osl_msg_maxiovlen,
+ </ul>
+
+ @return the number of received bytes.
+*/
+sal_Int32 SAL_CALL osl_receiveFromSocket(oslSocket Socket,
+ oslSocketAddr SenderAddr,
+ void* pBuffer,
+ sal_uInt32 BufferSize,
+ oslSocketMsgFlag Flag);
+
+/** Tries to send BytesToSend data from the connected socket,
+ if no error occurs.
+
+ @param Socket [in] A connected socket.
+ @param pBuffer [in] Points to a buffer that contains the send-data.
+ @param BytesToSend [in] The number of bytes to send. pBuffer must have at least
+ this size.
+ @param Flag [in] Modifier for the call. Valid values are:
+ <ul>
+ <li> osl_msg_normal,
+ <li> osl_msg_oob,
+ <li> osl_msg_peek,
+ <li> osl_msg_dontroute,
+ <li> osl_msg_maxiovlen,
+ </ul>
+
+ @return the number of transfered bytes.
+*/
+sal_Int32 SAL_CALL osl_sendSocket(oslSocket Socket,
+ const void* pBuffer,
+ sal_uInt32 BytesToSend,
+ oslSocketMsgFlag Flag);
+
+/** Tries to send one datagram with BytesToSend data to the given ReceiverAddr
+ via the (implicitly unconnected) datagram-socket.
+ Since we only send one packet, we don't need to concern ourselfes here with
+ incomplete sends due to packet boundaries.
+
+ @param Socket [in] A bound or unbound socket. Socket will be bound
+ after a successful call.
+
+ @param ReceiverAddr [in] An initialized oslSocketAddress that contains
+ the destination address for this send.
+
+ @param pBuffer [in] Points to a buffer that contains the send-data.
+ @param BytesToSend [in] The number of bytes to send. pBuffer must have at least
+ this size.
+ @param Flag [in] Modifier for the call. Valid values are:
+ <ul>
+ <li> osl_msg_normal,
+ <li> osl_msg_oob,
+ <li> osl_msg_peek,
+ <li> osl_msg_dontroute,
+ <li> osl_msg_maxiovlen,
+ </ul>
+
+ @return the number of transfered bytes.
+*/
+sal_Int32 SAL_CALL osl_sendToSocket(oslSocket Socket,
+ oslSocketAddr ReceiverAddr,
+ const void* pBuffer,
+ sal_uInt32 BytesToSend,
+ oslSocketMsgFlag Flag);
+
+/** Checks if read operations will block.
+ You can specify a timeout-value in seconds/microseconds that denotes
+ how long the operation will block if the Socket is not ready.
+ @return True if read operations (recv, recvFrom, accept) on the Socket
+ will NOT block; False if it would block or if an error occured.
+
+ @param Socket the Socket to perfom the operation on.
+ @param pTimeout if NULL, the operation will block without a timeout. Otherwise
+ the time define by timeout value.
+*/
+sal_Bool SAL_CALL osl_isReceiveReady(oslSocket Socket, const TimeValue* pTimeout);
+
+/** Checks if send operations will block.
+ You can specify a timeout-value in seconds/microseconds that denotes
+ how long the operation will block if the Socket is not ready.
+ @return True if send operations (send, sendTo) on the Socket
+ will NOT block; False if it would block or if an error occured.
+
+ @param Socket the Socket to perfom the operation on.
+ @param pTimeout if NULL, the operation will block without a timeout. Otherwise
+ the time define by timeout value.
+*/
+sal_Bool SAL_CALL osl_isSendReady(oslSocket Socket, const TimeValue* pTimeout);
+
+/** Checks if a request for out-of-band data will block.
+ You can specify a timeout-value in seconds/microseconds that denotes
+ how long the operation will block if the Socket has no pending OOB data.
+ @return True if OOB-request operations (recv with appropriate flags)
+ on the Socket will NOT block; False if it would block or if an error occured.
+
+ @param Socket the Socket to perfom the operation on.
+ @param pTimeout if NULL, the operation will block without a timeout. Otherwise
+ the time define by timeout value.
+*/
+sal_Bool SAL_CALL osl_isExceptionPending(oslSocket Socket, const TimeValue* pTimeout);
+
+/** Shuts down communication on a connected socket.
+ @param Direction denotes which end of the socket
+ should be closed:
+ <ul>
+ <li> osl_shut_read closes read operations.
+ <li> osl_shut_write closes write operations.
+ <li> osl_shut_readwrite closes read and write operations.
+ </ul>
+ @return True if the socket could be closed down.
+*/
+sal_Bool SAL_CALL osl_shutdownSocket(oslSocket Socket,
+ oslSocketDirection Direction);
+
+/** Retrieves attributes associated with the socket.
+ @param Socket is the socket to query.
+
+ @param Level selects the level for which an option should be queried.
+ Valid values are:
+ <ul>
+ <li> osl_sol_socket: Socket Level
+ <li> osl_sol_tcp: Level of Transmission Control Protocol
+ </ul>
+
+ @param Option denotes the option to query.
+ Valid values (depending on the Level) are:
+ <ul>
+ <li> osl_so_debug,
+ <li> osl_so_acceptconn,
+ <li> osl_so_reuseaddr,
+ <li> osl_so_keepalive,
+ <li> osl_so_dontroute,
+ <li> osl_so_broadcast,
+ <li> osl_so_useloopback,
+ <li> osl_so_linger,
+ <li> osl_so_oobinline,
+ <li> osl_so_sndbuf,
+ <li> osl_so_rcvbuf,
+ <li> osl_so_sndlowat,
+ <li> osl_so_rcvlowat,
+ <li> osl_so_sndtimeo,
+ <li> osl_so_rcvtimeo,
+ <li> osl_so_error,
+ <li> osl_so_type,
+ <li> osl_so_tcp_nodelay, (sol_tcp)
+ </ul>
+ If not above mentioned otherwise, the options are only valid for
+ level sol_socket.
+
+ @param pBuffer Pointer to a Buffer with enough room to take the desired
+ attribute-value.
+
+ @param BufferSize contains the length of the Buffer.
+
+ @return -1 if an error occured or else the size of the data copied into
+ pBuffer.
+*/
+sal_Int32 SAL_CALL osl_getSocketOption(oslSocket Socket,
+ oslSocketOptionLevel Level,
+ oslSocketOption Option,
+ void* pBuffer,
+ sal_uInt32 BufferLen);
+
+/** Sets the sockets attributes.
+
+ @param Socket is the socket to modify.
+
+ @param Level selects the level for which an option should be changed.
+ Valid values are:
+ <ul>
+ <li> osl_sol_socket: Socket Level
+ <li> osl_sol_tcp: Level of Transmission Control Protocol
+ </ul>
+
+ @param Option denotes the option to modify.
+ Valid values (depending on the Level) are:
+ <ul>
+ <li> osl_so_debug,
+ <li> osl_so_acceptconn,
+ <li> osl_so_reuseaddr,
+ <li> osl_so_keepalive,
+ <li> osl_so_dontroute,
+ <li> osl_so_broadcast,
+ <li> osl_so_useloopback,
+ <li> osl_so_linger,
+ <li> osl_so_oobinline,
+ <li> osl_so_sndbuf,
+ <li> osl_so_rcvbuf,
+ <li> osl_so_sndlowat,
+ <li> osl_so_rcvlowat,
+ <li> osl_so_sndtimeo,
+ <li> osl_so_rcvtimeo,
+ <li> osl_so_error,
+ <li> osl_so_type,
+ <li> osl_so_tcp_nodelay, (sol_tcp)
+ </ul>
+ If not above mentioned otherwise, the options are only valid for
+ level sol_socket.
+
+ @param pBuffer Pointer to a Buffer which contains the attribute-value.
+
+ @param BufferSize contains the length of the Buffer.
+
+ @return True if the option could be changed.
+*/
+sal_Bool SAL_CALL osl_setSocketOption(oslSocket Socket,
+ oslSocketOptionLevel Level,
+ oslSocketOption Option,
+ void* pBuffer,
+ sal_uInt32 BufferLen);
+
+/** Enables/disables non-blocking-mode of the socket.
+ @param Socket Change mode for this socket.
+ @param On True: enable non-blocking mode, False: disable non-blocking mode.
+ @return True if mode could be changed.
+*/
+sal_Bool SAL_CALL osl_enableNonBlockingMode(oslSocket Socket,
+ sal_Bool On);
+
+
+/** Query state of non-blocking-mode of the socket.
+ @param Socket Query mode for this socket.
+ @return True if non-blocking-mode is enabled.
+*/
+sal_Bool SAL_CALL osl_isNonBlockingMode(oslSocket Socket);
+
+
+/** Queries the socket for its type.
+ @return one of:
+ <ul>
+ <li> osl_sock_stream,
+ <li> osl_sock_dgram,
+ <li> osl_sock_raw,
+ <li> osl_sock_rdm,
+ <li> osl_sock_seqpacket,
+ <li> osl_invalid_SocketType, if an error occured
+ </ul>
+
+*/
+oslSocketType SAL_CALL osl_getSocketType(oslSocket Socket);
+
+/** Delivers a string which describes the last socket error.
+ @param strError The string that receives the error message.
+ than the provided buffer, it will be cut short. Buffer sizes about 128 chars
+ should be large enough.
+*/
+void SAL_CALL osl_getLastSocketErrorDescription(oslSocket Socket, rtl_uString **strError);
+
+/** Delivers a constant decribing the last error for the socket system.
+ @return osl_Socket_E_NONE if no error occured, osl_invalid_SocketError if
+ an unknown (unmapped) error occured, otherwise an enum describing the
+ error.
+*/
+oslSocketError SAL_CALL osl_getLastSocketError(oslSocket Socket);
+
+/** Type for the representation of socket sets.
+*/
+typedef void* oslSocketSet;
+
+/** Creates a set of sockets to be used with osl_demultiplexSocketEvents().
+ @return A oslSocketSet or 0 if creation failed.
+*/
+oslSocketSet SAL_CALL osl_createSocketSet();
+
+/** Destroys a oslSocketSet.
+*/
+void SAL_CALL osl_destroySocketSet(oslSocketSet Set);
+
+/** Clears the set from all previously added sockets.
+ @param Set the set to be cleared.
+*/
+void SAL_CALL osl_clearSocketSet(oslSocketSet Set);
+
+
+/** Adds a socket to the set.
+ @param Set the set were the socket is added.
+ @param Socket the socket to be added.
+*/
+void SAL_CALL osl_addToSocketSet(oslSocketSet Set, oslSocket Socket);
+
+/** Removes a socket from the set.
+ @param Set the set were the socket is removed from.
+ @param Socket the socket to be removed.
+*/
+void SAL_CALL osl_removeFromSocketSet(oslSocketSet Set, oslSocket Socket);
+
+/** Checks if socket is in the set.
+ @param Set the set to be checked.
+ @param Socket check if this socket is in the set.
+ @return True if socket is in the set.
+*/
+sal_Bool SAL_CALL osl_isInSocketSet(oslSocketSet Set, oslSocket Socket);
+
+/** Checks multiple sockets for events.
+ @param IncomingSet Checks the sockets in this set
+ for incoming events (read, accept). If the set is 0,
+ it is just skipped.
+ @param OutgoingSet Checks the sockets in this set
+ for outgoing events (write, connect). If the set is 0,
+ it is just skipped.
+ @param OutOfBandSet Checks the sockets in this set
+ for out-of-band events. If the set is 0, it is just skipped.
+ @param msTimeout Number of milliseconds to wait for events. If
+ msTimeout is -1, the call will block until an event or an error
+ occurs.
+ @return -1 on errors, otherwise the number of sockets with
+ pending events. In case of timeout, the number might be 0.
+*/
+sal_Int32 SAL_CALL osl_demultiplexSocketEvents(oslSocketSet IncomingSet,
+ oslSocketSet OutgoingSet,
+ oslSocketSet OutOfBandSet,
+ const TimeValue* pTimeout);
+
+void SAL_CALL osl_closeSocket(oslSocket Socket);
+
+
+/**@} end section oslSocket
+*/
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OSL_SOCKET_H_ */
+
+/*************************************************************************
+*
+* $Log: not supported by cvs2svn $
+* Revision 1.8 2000/09/18 14:28:49 willem.vandorp
+* OpenOffice header added.
+*
+* Revision 1.7 2000/06/27 15:45:29 mhu
+* Added function osl_createInetBroadcastAddr().
+*
+* Revision 1.6 2000/05/17 14:50:15 mfe
+* comments upgraded
+*
+* Revision 1.5 2000/03/31 15:56:19 rs
+* UNICODE-Changes
+*
+* Revision 1.4 2000/03/20 08:56:22 obr
+* Unicode API changes
+*
+* Revision 1.3 2000/03/16 16:43:53 obr
+* Unicode API changes
+*
+* Revision 1.2 1999/10/27 15:02:08 mfe
+* Change of Copyright, removed compiler warnings, code clean up, ...
+*
+* Revision 1.1 1999/08/05 10:18:20 jsc
+* verschoben aus osl
+*
+* Revision 1.22 1999/08/05 11:14:43 jsc
+* verschoben in root inc-Verzeichnis
+*
+* Revision 1.21 1999/07/21 16:13:06 ts
+* #67730# changed channel maneger api
+*
+* Revision 1.20 1999/03/04 09:58:37 rh
+* #62583 compare socketaddr
+*
+* Revision 1.19 1999/01/20 18:53:41 jsc
+* #61011# Typumstellung
+*
+* Revision 1.18 1998/03/13 15:07:32 rh
+* Cleanup of enum chaos and implemntation of pipes
+*
+* Revision 1.17 1998/02/16 19:34:52 rh
+* Cleanup of ports, integration of sal_uInt32, features for process
+*
+* Revision 1.16 1997/12/09 10:55:40 mib
+* AIX
+*
+* Revision 1.15 1997/11/25 10:14:40 fm
+* initial release for S/390
+*
+* Revision 1.14 1997/10/16 16:12:04 rh
+* *** empty log message ***
+*
+* Revision 1.13 1997/10/15 10:26:02 mhu
+* Added function: sal_Bool osl_getLocalHostname (sal_Char *pBuffer, int BufferSize)
+*
+* Revision 1.12 1997/09/15 10:53:54 mhu
+* Added function osl_copyHostAddr(const oslHostAddr Addr).
+*
+* Revision 1.11 1997/09/09 12:03:29 fm
+* *** empty log message ***
+*
+* Revision 1.10 1997/09/08 17:17:53 mhu
+* Added support for domain name resolution (oslHostAddr).
+*
+* Revision 1.9 1997/09/04 09:51:44 rh
+* Blockmode
+*
+* Revision 1.8 1997/08/23 20:36:40 rh
+* return value for name resolving
+*
+* Revision 1.7 1997/08/22 14:47:36 rh
+* TimeValue inserted
+*
+* Revision 1.6 1997/07/31 18:28:54 rh
+* Standard types adapted
+*
+* Revision 1.5 1997/07/31 15:28:40 ts
+* *** empty log message ***
+*
+* Revision 1.4 1997/07/17 11:02:28 rh
+* Header adapted and profile added
+*
+* Revision 1.3 1997/06/25 13:16:31 rh
+* Formatting
+*
+* Revision 1.2 1997/06/25 08:44:40 bho
+* !changed implementation of sems to SYS V, because POSIX Sems are not
+* supported yet by solaris.
+*
+* Revision 1.1 1997/06/19 13:10:11 bho
+* first version of OSL.
+*
+*************************************************************************/
+
diff --git a/sal/inc/osl/thread.h b/sal/inc/osl/thread.h
new file mode 100644
index 000000000000..15fc7e8f4f9b
--- /dev/null
+++ b/sal/inc/osl/thread.h
@@ -0,0 +1,329 @@
+/*************************************************************************
+ *
+ * $RCSfile: thread.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_THREAD_H_
+#define _OSL_THREAD_H_
+
+#ifndef _OSL_TYPES_H_
+# include <osl/types.h>
+#endif
+
+#ifndef _RTL_TEXTENC_H_
+# include <rtl/textenc.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ Opaque data type for threads. As with all other osl-handles
+ you can initialize and/or test it to/for 0.
+*/
+typedef void* oslThread;
+
+/** the function-ptr. representing the threads worker-function.
+*/
+typedef void (SAL_CALL *oslWorkerFunction)(void*);
+
+/** levels of thread-priority
+ Note that oslThreadPriorityUnknown might be returned
+ by getPriorityOfThread() (e.g. when it is terminated),
+ but mustn't be used with setPriority()!
+*/
+typedef enum
+{
+ osl_Thread_PriorityHighest,
+ osl_Thread_PriorityAboveNormal,
+ osl_Thread_PriorityNormal,
+ osl_Thread_PriorityBelowNormal,
+ osl_Thread_PriorityLowest,
+ osl_Thread_PriorityUnknown, /* don't use to set */
+ osl_Thread_Priority_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslThreadPriority;
+
+
+typedef enum
+{
+ osl_Thread_SleepNormal,
+ osl_Thread_SleepCancel,
+ osl_Thread_SleepPending,
+ osl_Thread_SleepActive,
+ osl_Thread_SleepError,
+ osl_Thread_SleepUnknown, /* don't use to set */
+ osl_Thread_Sleep_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} oslThreadSleep;
+
+typedef sal_uInt32 oslThreadIdentifier;
+
+typedef sal_uInt32 oslThreadKey;
+
+/** Create the thread, using the function-ptr pWorker as
+ its main (worker) function. This functions receives in
+ its void* parameter the value supplied by pThreadData.
+ Once the OS-structures are initialized,the thread starts
+ running.
+ @return 0 if creation failed, otherwise a handle to the thread
+*/
+oslThread SAL_CALL osl_createThread(oslWorkerFunction pWorker, void* pThreadData);
+
+/** Create the thread, using the function-ptr pWorker as
+ its main (worker) function. This functions receives in
+ its void* parameter the value supplied by pThreadData.
+ The thread will be created, but it won't start running.
+ To wake-up the thread, use resume().
+ @return 0 if creation failed, otherwise a handle to the thread
+*/
+oslThread SAL_CALL osl_createSuspendedThread(oslWorkerFunction pWorker, void* pThreadData);
+
+/** Get the identifier for the specified thread or if parameter
+ Thread is NULL of the current active thread.
+ @return identifier of the thread
+*/
+oslThreadIdentifier SAL_CALL osl_getThreadIdentifier(oslThread Thread);
+
+/** Forcefully abort the thread, if it is still running.
+ Then release the OS-structures and our thread data-structure.
+ If Thread is NULL, the function won't do anything.
+*/
+void SAL_CALL osl_destroyThread(oslThread Thread);
+
+/** Release our thread data-structure.
+ If Thread is NULL, the function won't do anything.
+ Note that we do not interfere with the actual running of
+ the thread, we just free up the memory needed by the handle.
+*/
+void SAL_CALL osl_freeThreadHandle(oslThread Thread);
+
+/** Wake-up a thread that was suspended with suspend() or
+ createSuspended(). The oslThread must be valid!
+*/
+void SAL_CALL osl_resumeThread(oslThread Thread);
+
+/** Suspend the execution of the thread. If you want the thread
+ to continue, call resume(). The oslThread must be valid!
+*/
+void SAL_CALL osl_suspendThread(oslThread Thread);
+
+/** Changes the threads priority.
+ The oslThread must be valid!
+*/
+void SAL_CALL osl_setThreadPriority(oslThread Thread, oslThreadPriority Priority);
+
+/** Retrieves the threads priority.
+ Returns oslThreadPriorityUnknown for invalid Thread-argument or
+ terminated thread. (I.e.: The oslThread might be invalid.)
+*/
+oslThreadPriority SAL_CALL osl_getThreadPriority(const oslThread Thread);
+
+/** Returns True if the thread was created and has not terminated yet.
+ Note that according to this definition a "running" thread might be
+ suspended! Also returns False is Thread is NULL.
+*/
+sal_Bool SAL_CALL osl_isThreadRunning(const oslThread Thread);
+
+/** Blocks the calling thread until Thread has terminated.
+ Returns immediately if Thread is NULL.
+*/
+void SAL_CALL osl_joinWithThread(oslThread Thread);
+
+/** Blocks the calling thread at least for the given number of
+ of time. Returns False if the sleep is aborted by a call
+ to awakeThread.
+*/
+oslThreadSleep SAL_CALL osl_sleepThread(oslThread Thread, const TimeValue* pDelay);
+
+/** Awake a sleeping thread. Returns False if at least one of
+ the handles is invalid or the thread is not sleeping.
+*/
+sal_Bool SAL_CALL osl_awakeThread(oslThread Thread);
+
+/** Blocks the calling thread at least for the given number
+ of time.
+*/
+void SAL_CALL osl_waitThread(const TimeValue* pDelay);
+
+/** The requested thread will get terminate the next time
+ scheduleThread() is called.
+*/
+void SAL_CALL osl_terminateThread(oslThread Thread);
+
+/** Offers the rest of the threads time-slice to the OS.
+ scheduleThread() should be called in the working loop
+ of the thread, so any other thread could also get the
+ processor. Returns False if the thread should terminate, so
+ the thread could free any allocated resources.
+*/
+sal_Bool SAL_CALL osl_scheduleThread(oslThread Thread);
+
+/** Offers the rest of the threads time-slice to the OS.
+ Under POSIX you _need_ to yield(), otherwise, since the
+ threads are not preempted during execution, NO other thread
+ (even with higher priority) gets the processor. Control is
+ only given to another thread if the current thread blocks
+ or uses yield().
+*/
+void SAL_CALL osl_yieldThread(void);
+
+/** Create a key to an associated thread local storage pointer. */
+oslThreadKey SAL_CALL osl_createThreadKey(void);
+
+/** Destroy a key to an associated thread local storage pointer. */
+void SAL_CALL osl_destroyThreadKey(oslThreadKey Key);
+
+/** Get to key associated thread specific data. */
+void* SAL_CALL osl_getThreadKeyData(oslThreadKey Key);
+
+/** Set to key associated thread specific data. */
+sal_Bool SAL_CALL osl_setThreadKeyData(oslThreadKey Key, void *pData);
+
+/** Get the current thread local text encoding. */
+rtl_TextEncoding SAL_CALL osl_getThreadTextEncoding();
+
+/** Set the thread local text encoding.
+ @return the old text encoding.
+*/
+rtl_TextEncoding SAL_CALL osl_setThreadTextEncoding(rtl_TextEncoding Encoding);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OSL_THREAD_H_ */
+
+/*************************************************************************
+*
+* $Log: not supported by cvs2svn $
+* Revision 1.9 2000/09/18 14:28:49 willem.vandorp
+* OpenOffice header added.
+*
+* Revision 1.8 2000/07/31 09:34:24 mfe
+* changed declaration of setthreadtextenconding
+*
+* Revision 1.7 2000/07/27 20:23:46 patrick.luby
+* Set osl_setThreadTextEncoding prototype to match function definition in
+* osl/unx/thread.c file.
+*
+* Revision 1.6 2000/05/29 16:45:16 hro
+* SRC591: Explicite SAL_CALL calling convention
+*
+* Revision 1.5 2000/05/17 14:50:15 mfe
+* comments upgraded
+*
+* Revision 1.4 2000/03/27 09:16:51 hro
+* UNICODE New osl_getThreadTextEncoding
+*
+* Revision 1.3 1999/12/22 13:38:17 mfe
+* some clean up
+*
+* Revision 1.2 1999/10/27 15:02:08 mfe
+* Change of Copyright, removed compiler warnings, code clean up, ...
+*
+* Revision 1.1 1999/08/05 10:18:20 jsc
+* verschoben aus osl
+*
+* Revision 1.15 1999/08/05 11:14:44 jsc
+* verschoben in root inc-Verzeichnis
+*
+* Revision 1.14 1999/03/19 09:05:58 jsc
+* #60455# osl_isCurrentThresad entfernt
+*
+* Revision 1.13 1999/01/20 18:53:41 jsc
+* #61011# Typumstellung
+*
+* Revision 1.12 1998/11/05 11:13:16 rh
+* #59037# Thread local storage implementation
+*
+* Revision 1.11 1998/03/13 15:07:33 rh
+* Cleanup of enum chaos and implemntation of pipes
+*
+* Revision 1.10 1998/02/26 18:35:27 rh
+* Avoid unix zombies and rename oslThreadHandle to oslThread
+*
+* Revision 1.9 1998/02/16 19:34:52 rh
+* Cleanup of ports, integration of Size_t, features for process
+*
+* Revision 1.8 1997/10/16 16:35:51 rh
+* *** empty log message ***
+*
+* Revision 1.7 1997/10/16 16:26:08 rh
+* *** empty log message ***
+*
+* Revision 1.6 1997/09/09 12:03:30 fm
+* *** empty log message ***
+*
+* Revision 1.5 1997/08/22 14:47:38 rh
+* TimeValue inserted
+*
+* Revision 1.4 1997/07/22 14:29:30 rh
+* process added
+*
+* Revision 1.3 1997/07/17 11:02:29 rh
+* Header adapted and profile added
+*
+* Revision 1.2 1997/07/14 09:09:12 rh
+* Adaptions for killable sleeps
+*
+* Revision 1.1 1997/06/19 13:10:13 bho
+* first version of OSL.
+*
+*************************************************************************/
+
diff --git a/sal/inc/osl/time.h b/sal/inc/osl/time.h
new file mode 100644
index 000000000000..660159935e9e
--- /dev/null
+++ b/sal/inc/osl/time.h
@@ -0,0 +1,212 @@
+/*************************************************************************
+ *
+ * $RCSfile: time.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_TIME_H_
+#define _OSL_TIME_H_
+
+#ifndef _OSL_TYPES_H_
+# include <osl/types.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/****************************************************************************/
+/* oslDateTime */
+/****************************************************************************/
+
+typedef struct _oslDateTime
+{
+ //-------------------------------------------------------------------------
+ /** contains the nanoseconds .
+ */
+ sal_uInt32 NanoSeconds;
+
+ //-------------------------------------------------------------------------
+ /** contains the seconds (0-59).
+ */
+ sal_uInt16 Seconds;
+
+ //-------------------------------------------------------------------------
+ /** contains the minutes (0-59).
+ */
+ sal_uInt16 Minutes;
+
+ //-------------------------------------------------------------------------
+ /** contains the hour (0-23).
+ */
+ sal_uInt16 Hours;
+
+ //-------------------------------------------------------------------------
+ /** is the day of month (1-31).
+ */
+ sal_uInt16 Day;
+
+ //-------------------------------------------------------------------------
+ /** is the day of week (0-6 , 0 : Sunday).
+ */
+ sal_uInt16 DayOfWeek;
+
+ //-------------------------------------------------------------------------
+ /** is the month of year (1-12).
+ */
+ sal_uInt16 Month;
+
+ //-------------------------------------------------------------------------
+ /** is the year.
+ */
+ sal_uInt16 Year;
+
+} oslDateTime;
+
+
+/** Get the current system time as TimeValue.
+ @return false if any error occurs.
+*/
+sal_Bool SAL_CALL osl_getSystemTime( TimeValue* pTimeVal );
+
+
+/** Get the GMT from a TimeValue and fill a struct oslDateTime
+ @param pTimeVal[in] TimeValue
+ @param pDateTime[out] On success it receives a struct oslDateTime
+
+ @return sal_False if any error occurs else sal_True.
+*/
+sal_Bool SAL_CALL osl_getDateTimeFromTimeValue( TimeValue* pTimeVal, oslDateTime* pDateTime );
+
+
+/** Get the GMT from a oslDateTime and fill a TimeValue
+ @param pDateTime[in] oslDateTime
+ @param pTimeVal[out] On success it receives a TimeValue
+
+ @return sal_False if any error occurs else sal_True.
+*/
+sal_Bool SAL_CALL osl_getTimeValueFromDateTime( oslDateTime* pDateTime, TimeValue* pTimeVal );
+
+
+/** Convert GMT to local time
+ @param pSystemTimeVal[in] system time to convert
+ @param pLocalTimeVal[out] On success it receives the local time
+
+ @return sal_False if any error occurs else sal_True.
+*/
+sal_Bool SAL_CALL osl_getLocalTimeFromSystemTime( TimeValue* pSystemTimeVal, TimeValue* pLocalTimeVal );
+
+
+/** Convert local time to GMT
+ @param pLocalTimeVal[in] local time to convert
+ @param pSystemTimeVal[out] On success it receives the system time
+
+ @return sal_False if any error occurs else sal_True.
+*/
+sal_Bool SAL_CALL osl_getSystemTimeFromLocalTime( TimeValue* pLocalTimeVal, TimeValue* pSystemTimeVal );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _OSL_TIME_H_ */
+
+/*************************************************************************
+*
+* $Log: not supported by cvs2svn $
+* Revision 1.6 2000/09/18 14:28:49 willem.vandorp
+* OpenOffice header added.
+*
+* Revision 1.5 2000/08/18 14:01:05 rs
+* new time functions
+*
+* Revision 1.4 2000/07/26 15:12:52 rs
+* DateTime functions
+*
+* Revision 1.3 2000/05/17 14:50:15 mfe
+* comments upgraded
+*
+* Revision 1.2 1999/10/27 15:02:09 mfe
+* Change of Copyright, removed compiler warnings, code clean up, ...
+*
+* Revision 1.1 1999/08/05 10:18:20 jsc
+* verschoben aus osl
+*
+* Revision 1.7 1999/08/05 11:14:44 jsc
+* verschoben in root inc-Verzeichnis
+*
+* Revision 1.6 1999/01/20 18:53:41 jsc
+* #61011# Typumstellung
+*
+* Revision 1.5 1998/03/13 15:07:33 rh
+* Cleanup of enum chaos and implemntation of pipes
+*
+* Revision 1.4 1998/02/16 19:34:52 rh
+* Cleanup of ports, integration of Size_t, features for process
+*
+* Revision 1.3 1997/08/22 14:47:38 rh
+* TimeValue inserted
+*
+* Revision 1.2 1997/07/23 07:07:02 rh
+* Change Micor to Nano-seconds
+*
+* Revision 1.1 1997/07/21 19:13:13 rh
+* getSystemTime added
+*
+*************************************************************************/
diff --git a/sal/inc/osl/util.h b/sal/inc/osl/util.h
new file mode 100644
index 000000000000..d0e26c3fd6dd
--- /dev/null
+++ b/sal/inc/osl/util.h
@@ -0,0 +1,130 @@
+/*************************************************************************
+ *
+ * $RCSfile: util.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _OSL_UTIL_H_
+#define _OSL_UTIL_H_
+
+#include "sal/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/***
+ *
+ * @param pEthernetAddr 6 bytes of memory
+ *
+ * @return sal_True if the ethernetaddress could be retrieved. <br>
+ * sal_False if no address could be found. This may be either because
+ * there is no ethernet card or there is no appropriate algorithm
+ * implemented on the platform. In this case, pEthernetAddr is
+ * unchanged.
+ *
+ ***/
+sal_Bool SAL_CALL osl_getEthernetAddress( sal_uInt8 *pEthernetAddr );
+
+/**
+ @deprecated
+ Set the solar build number. Affect the profile function from osl and
+ the ORealDynamicLoader class from vos.
+ Default is the SUPD from the build process if it was build with the
+ solar environment, otherwise 0.
+ */
+void SAL_CALL osl_setSUPD( sal_Int32 n );
+
+/**
+ @deprecated
+ Return the solar build number
+ */
+sal_Int32 SAL_CALL osl_getSUPD();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/*************************************************************************
+*
+* $Log: not supported by cvs2svn $
+* Revision 1.7 2000/09/18 14:28:49 willem.vandorp
+* OpenOffice header added.
+*
+* Revision 1.6 2000/05/26 10:12:13 hro
+* SAL_CALL for osl_getSUPD, osl_getSUPD
+*
+* Revision 1.5 2000/05/17 14:50:15 mfe
+* comments upgraded
+*
+* Revision 1.4 2000/03/16 16:43:53 obr
+* Unicode API changes
+*
+* Revision 1.3 2000/03/16 14:16:34 mm
+* #74230# setSUPD
+*
+* Revision 1.2 1999/12/06 14:59:18 jbu
+* osl_getEthernetAddress added
+*
+* Revision 1.1 1999/10/25 09:48:05 mfe
+* added getEtherAddr
+*
+*************************************************************************/
diff --git a/sal/inc/rtl/alloc.h b/sal/inc/rtl/alloc.h
new file mode 100644
index 000000000000..67bbaa8706cd
--- /dev/null
+++ b/sal/inc/rtl/alloc.h
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * $RCSfile: alloc.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _RTL_ALLOC_H_
+#define _RTL_ALLOC_H_
+
+#ifndef _SAL_TYPES_H_
+# include <sal/types.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** Allocate memory.
+ * @param Bytes [in] memory size.
+ * @return pointer to allocated memory.
+ */
+void * SAL_CALL rtl_allocateMemory (sal_uInt32 Bytes);
+
+
+/** Reallocate memory.
+ * @param Ptr [in] pointer to previously allocated memory.
+ * @param Bytes [in] new memory size.
+ * @return pointer to reallocated memory. May differ from Ptr.
+ */
+void * SAL_CALL rtl_reallocateMemory (void *Ptr, sal_uInt32 Bytes);
+
+
+/** Free memory.
+ * @param Ptr [in] pointer to previously allocated memory.
+ * @return none. Memory is released. Ptr is invalid.
+ */
+void SAL_CALL rtl_freeMemory (void *Ptr);
+
+
+/** Allocate and zero memory.
+ * @param Bytes [in] memory size.
+ * @return pointer to allocated and zero'ed memory.
+ */
+void * SAL_CALL rtl_allocateZeroMemory (sal_uInt32 Bytes);
+
+
+/** Zero and free memory.
+ * @param Ptr [in] pointer to previously allocated memory.
+ * @param Bytes [in] memory size.
+ * @return none. Memory is zero'ed and released. Ptr is invalid.
+ */
+void SAL_CALL rtl_freeZeroMemory (void *Ptr, sal_uInt32 Bytes);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*_RTL_ALLOC_H_ */
+
diff --git a/sal/inc/rtl/byteseq.h b/sal/inc/rtl/byteseq.h
new file mode 100644
index 000000000000..c4d5c5b1f694
--- /dev/null
+++ b/sal/inc/rtl/byteseq.h
@@ -0,0 +1,330 @@
+/*************************************************************************
+ *
+ * $RCSfile: byteseq.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _RTL_BYTESEQ_H_
+#define _RTL_BYTESEQ_H_
+
+#ifndef _SAL_TYPES_H_
+#include <sal/types.h>
+#endif
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** Assures that the reference count of the given byte sequence is one.
+ Otherwise a new copy of the sequence is created with a reference count of one.
+ <br>
+ @param ppSequence sequence
+*/
+void SAL_CALL rtl_byte_sequence_reference2One(
+ sal_Sequence ** ppSequence );
+
+/** Reallocates length of byte sequence.
+ <br>
+ @param ppSequence sequence
+ @param nSize new size of sequence
+*/
+void SAL_CALL rtl_byte_sequence_realloc(
+ sal_Sequence ** ppSequence, sal_Int32 nSize );
+
+/** Acquires the byte sequence <br>
+ @param pSequence sequence, that shall be acquired.
+ */
+void SAL_CALL rtl_byte_sequence_acquire( sal_Sequence *pSequence );
+
+/** Releases the byte sequence. If the refcount drops to zero,
+ * the sequence is freed.<br>
+
+ @param pSequence sequence, that shall be released. Invalid after call.
+ */
+void SAL_CALL rtl_byte_sequence_release( sal_Sequence *pSequence );
+
+/** Constructs a bytes sequence with length nLength. All bytes are set to zero.
+ *
+ * @param On entry *ppSequence may be null , otherwise it is released.
+ * After the call, ppSequence contains the newly constructed sequence.
+ *
+ *
+ **/
+void SAL_CALL rtl_byte_sequence_construct( sal_Sequence **ppSequence , sal_Int32 nLength );
+
+/** Constructs a bytes sequence with length nLength. The data is not initialized.
+ *
+ * @param ppSequence contains the newly constructed sequence.
+ * *ppSequence is released on entry if needed.
+ *
+ **/
+void SAL_CALL rtl_byte_sequence_constructNoDefault(
+ sal_Sequence **ppSequence , sal_Int32 nLength );
+
+/** Constructs a byte sequence with length nLength and copies nLength bytes from pData.
+ *
+ * @param ppSequence contains the newly constructed sequence.
+ * *ppSequence is released on entry if needed.
+ **/
+void SAL_CALL rtl_byte_sequence_constructFromArray(
+ sal_Sequence **ppSequence, const sal_Int8 *pData , sal_Int32 nLength );
+
+/** Assigns the byte sequence pSequence to ppSequence.
+ *
+ * @param On entry *ppSequence may be null , otherwise it is released.
+ * ppSequence contains after the call a copy of pSequence.
+ * @param pSequence the source sequence
+ **/
+void SAL_CALL rtl_byte_sequence_assign( sal_Sequence **ppSequence , sal_Sequence *pSequence );
+
+/** Compares two byte sequences.
+ *
+ * @return sal_False, if the data within the sequences are different. <br>
+ * sal_True, if the data within the sequences are identical <br>
+ **/
+sal_Bool SAL_CALL rtl_byte_sequence_equals( sal_Sequence *pSequence1 , sal_Sequence *pSequence2 );
+
+
+/** Returns the data pointer of the sequence.
+ *
+ * @return const pointer to the data of the sequence. If rtl_byte_sequence_reference2One
+ * has been called before, the pointer may be casted to a non const pointer and
+ * the sequence may be modified.
+ **/
+const sal_Int8 *SAL_CALL rtl_byte_sequence_getConstArray( sal_Sequence *pSequence );
+
+/** Returns the length of the sequence
+ *
+ *
+ **/
+sal_Int32 SAL_CALL rtl_byte_sequence_getLength( sal_Sequence *pSequence );
+
+#ifdef __cplusplus
+}
+namespace rtl
+{
+
+enum __ByteSequence_NoDefault
+{
+ /** This enum value can be used to create a bytesequence with uninitalized data.
+ <br>
+ */
+ BYTESEQ_NODEFAULT = 0xcafe
+};
+
+enum __ByteSequence_NoAcquire
+{
+ /** This enum value can be used to create a bytesequence from a C-Handle without
+ acquiring the handle.
+ <br>
+ */
+ BYTESEQ_NOACQUIRE = 0xcafebabe
+};
+/** C++ class representing a SAL byte sequence.<br>
+ C++ Sequences are reference counted and shared, so the sequence keeps a handle
+ to its data.
+ To keep value semantics, copies are only generated if the sequence is to be modified
+ (new handle).
+ <br>
+*/
+class ByteSequence
+{
+ /** sequence handle<br>
+ */
+ sal_Sequence * _pSequence;
+
+public:
+ /** Default constructor:
+ Creates an empty sequence.
+ <br>
+ */
+ inline ByteSequence();
+ /** Copy constructor:
+ Creates a copy of given sequence.
+ <br>
+ @param rSeq another byte sequence
+ */
+ inline ByteSequence( const ByteSequence & rSeq );
+ /** Copy constructor
+ Creates a copy from the C-Handle.
+ */
+ inline ByteSequence( sal_Sequence *pSequence );
+ /** Constructor:
+ Creates a copy of given bytes.
+ <br>
+ @param pElement an array of bytes
+ @param len number of bytes
+ */
+ inline ByteSequence( const sal_Int8 * pElements, sal_Int32 len );
+ /** Constructor:
+ Creates sequence of given length and initializes all bytes to 0.
+ <br>
+ @param len initial sequence length
+ */
+ inline ByteSequence( sal_Int32 len );
+ /** Constructor:
+ Creates sequence of given length and does NOT initialize data. Use
+ this ctor for performance optimization only.
+ <br>
+ @param len initial sequence length
+ @param dummy parameter
+ */
+ inline ByteSequence( sal_Int32 len , enum __ByteSequence_NoDefault nodefault );
+ /** Constructor:
+ Creates a sequence from a C-Handle without acquiring the handle. Eitherway
+ the handle is release by the destructor. This ctor is useful, when working
+ with a c-interface (it safes a pair of acquire and release call and is thus
+ a performance optimization only ).
+ <br>
+ */
+ inline ByteSequence( sal_Sequence *pSequence , enum __ByteSequence_NoAcquire noacquire );
+ /** Destructor:
+ Releases sequence handle. Last handle will free memory.
+ <br>
+ */
+ inline ~ByteSequence();
+
+ /** Assignment operator:
+ Acquires given sequence handle and releases previously set handle.
+ <br>
+ @param rSeq another byte sequence
+ @return this sequence
+ */
+ inline ByteSequence & SAL_CALL operator = ( const ByteSequence & rSeq );
+
+ /** Gets length of sequence.
+ <br>
+ @return length of sequence
+ */
+ inline sal_Int32 SAL_CALL getLength() const
+ { return _pSequence->nElements; }
+
+ /** Gets a pointer to byte array for <b>reading</b>.
+ If the sequence has a length of 0, then the returned pointer is undefined.
+ <br>
+ @return pointer to byte array
+ */
+ inline const sal_Int8 * SAL_CALL getConstArray() const
+ { return (const sal_Int8 *)_pSequence->elements; }
+ /** Gets a pointer to elements array for <b>reading and writing</b>.<br>
+ In general if the sequence has a handle acquired by other sequences
+ (reference count > 1), then a new sequence is created copying
+ all bytes to keep value semantics!<br>
+ If the sequence has a length of 0, then the returned pointer is undefined.
+ <br>
+ @return pointer to elements array
+ */
+ inline sal_Int8 * SAL_CALL getArray();
+
+ /** Non-const index operator:
+ Obtains a reference to byte indexed at given position.<br>
+ The implementation does <b>not</b> check for array bounds!<br>
+ In general if the sequence has a handle acquired by other sequences
+ (reference count > 1), then a new sequence is created copying
+ all bytes to keep value semantics!
+ <br>
+ @param nIndex index
+ @return non-const C++ reference to element
+ */
+ inline sal_Int8 & SAL_CALL operator [] ( sal_Int32 nIndex )
+ { return getArray()[ nIndex ]; }
+ /** Const index operator:
+ Obtains a reference to byte indexed at given position.<br>
+ The implementation does <b>not</b> check for array bounds!<br>
+ <br>
+ @param nIndex index
+ @return const C++ reference to byte
+ */
+ inline const sal_Int8 & SAL_CALL operator [] ( sal_Int32 nIndex ) const
+ { return getConstArray()[ nIndex ]; }
+
+ /** Equality operator:
+ Compares two sequences.
+ <br>
+ @param rSeq another byte sequence (right side)
+ @return true if both sequences are equal, false otherwise
+ */
+ inline sal_Bool SAL_CALL operator == ( const ByteSequence & rSeq ) const;
+ /** Unequality operator:
+ Compares two sequences.
+ <br>
+ @param rSeq another byte sequence (right side)
+ @return false if both sequences are equal, true otherwise
+ */
+ inline sal_Bool SAL_CALL operator != ( const ByteSequence & rSeq ) const
+ { return (! operator == ( rSeq )); }
+
+ /** Reallocates sequence to new length.
+ If the sequence has a handle acquired by other sequences
+ (reference count > 1), then the remaining elements are copied
+ to a new sequence handle to keep value semantics!
+ <br>
+ @param nSize new size of sequence
+ */
+ inline void SAL_CALL realloc( sal_Int32 nSize );
+
+ /** Returns the (unacquired) C-Handle of the sequence
+ *
+ **/
+ inline sal_Sequence * SAL_CALL getHandle()
+ { return _pSequence; }
+};
+
+}
+#endif
+#endif
diff --git a/sal/inc/rtl/byteseq.hxx b/sal/inc/rtl/byteseq.hxx
new file mode 100644
index 000000000000..5fe4c0132ddd
--- /dev/null
+++ b/sal/inc/rtl/byteseq.hxx
@@ -0,0 +1,155 @@
+/*************************************************************************
+ *
+ * $RCSfile: byteseq.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _RTL_BYTESEQ_HXX_
+#define _RTL_BYTESEQ_HXX_
+
+#ifndef _OSL_INTERLOCK_H_
+#include <osl/interlck.h>
+#endif
+#ifndef _RTL_BYTESEQ_H_
+#include <rtl/byteseq.h>
+#endif
+#ifndef _RTL_ALLOC_H_
+#include <rtl/alloc.h>
+#endif
+#ifndef _RTL_MEMORY_H_
+#include <rtl/memory.h>
+#endif
+
+
+namespace rtl
+{
+
+//__________________________________________________________________________________________________
+inline ByteSequence::ByteSequence()
+ : _pSequence( 0 )
+{
+ rtl_byte_sequence_construct( &_pSequence , 0 );
+}
+//__________________________________________________________________________________________________
+inline ByteSequence::ByteSequence( const ByteSequence & rSeq ) :
+ _pSequence( 0 )
+{
+ rtl_byte_sequence_assign( &_pSequence , rSeq._pSequence );
+}
+//__________________________________________________________________________________________________
+inline ByteSequence::ByteSequence( sal_Sequence *pSequence) :
+ _pSequence( pSequence )
+{
+ rtl_byte_sequence_acquire( pSequence );
+}
+//__________________________________________________________________________________________________
+inline ByteSequence::ByteSequence( const sal_Int8 * pElements, sal_Int32 len )
+ : _pSequence( 0 )
+{
+ rtl_byte_sequence_constructFromArray( &_pSequence, pElements , len );
+}
+//__________________________________________________________________________________________________
+inline ByteSequence::ByteSequence( sal_Int32 len, enum __ByteSequence_NoDefault value )
+ : _pSequence( 0 )
+{
+ rtl_byte_sequence_constructNoDefault( &_pSequence , len );
+}
+//__________________________________________________________________________________________________
+inline ByteSequence::ByteSequence( sal_Sequence *pSequence, enum __ByteSequence_NoAcquire value )
+ : _pSequence( pSequence )
+{
+}
+//__________________________________________________________________________________________________
+inline ByteSequence::ByteSequence( sal_Int32 len )
+ : _pSequence( 0 )
+{
+ rtl_byte_sequence_construct( &_pSequence , len );
+}
+//__________________________________________________________________________________________________
+inline ByteSequence::~ByteSequence()
+{
+ rtl_byte_sequence_release( _pSequence );
+}
+//__________________________________________________________________________________________________
+inline ByteSequence & ByteSequence::operator = ( const ByteSequence & rSeq )
+{
+ rtl_byte_sequence_assign( &_pSequence , rSeq._pSequence );
+ return *this;
+}
+//__________________________________________________________________________________________________
+inline sal_Bool ByteSequence::operator == ( const ByteSequence & rSeq ) const
+{
+ if (_pSequence == rSeq._pSequence)
+ return sal_True;
+ if (_pSequence->nElements != rSeq._pSequence->nElements)
+ return sal_False;
+ return (0 == ::rtl_compareMemory( _pSequence->elements, rSeq._pSequence->elements, _pSequence->nElements ));
+}
+//__________________________________________________________________________________________________
+inline sal_Int8 * ByteSequence::getArray()
+{
+ ::rtl_byte_sequence_reference2One( &_pSequence );
+ return (sal_Int8 *)_pSequence->elements;
+}
+//__________________________________________________________________________________________________
+inline void ByteSequence::realloc( sal_Int32 nSize )
+{
+ ::rtl_byte_sequence_realloc( &_pSequence, nSize );
+}
+
+}
+#endif
diff --git a/sal/inc/rtl/cipher.h b/sal/inc/rtl/cipher.h
new file mode 100644
index 000000000000..f64685108773
--- /dev/null
+++ b/sal/inc/rtl/cipher.h
@@ -0,0 +1,275 @@
+/*************************************************************************
+ *
+ * $RCSfile: cipher.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:14 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _RTL_CIPHER_H_
+#define _RTL_CIPHER_H_ "$Revision: 1.1.1.1 $"
+
+#ifndef _SAL_TYPES_H_
+#include <sal/types.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*========================================================================
+ *
+ * rtlCipher interface.
+ *
+ *======================================================================*/
+/** Opaque cipher handle.
+ */
+typedef void* rtlCipher;
+
+
+/** rtlCipherAlgorithm.
+ *
+ * @see rtl_cipher_create.
+ */
+typedef enum
+{
+ rtl_Cipher_AlgorithmBF,
+ rtl_Cipher_AlgorithmInvalid,
+ rtl_Cipher_Algorithm_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} rtlCipherAlgorithm;
+
+
+/** rtlCipherMode.
+ *
+ * @see rtl_cipher_create.
+ */
+typedef enum
+{
+ rtl_Cipher_ModeECB,
+ rtl_Cipher_ModeCBC,
+ rtl_Cipher_ModeStream,
+ rtl_Cipher_ModeInvalid,
+ rtl_Cipher_Mode_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} rtlCipherMode;
+
+
+/** rtlCipherDirection.
+ *
+ * @see rtl_cipher_init.
+ */
+typedef enum
+{
+ rtl_Cipher_DirectionBoth,
+ rtl_Cipher_DirectionDecode,
+ rtl_Cipher_DirectionEncode,
+ rtl_Cipher_DirectionInvalid,
+ rtl_Cipher_Direction_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} rtlCipherDirection;
+
+
+/** rtlCipherError.
+ */
+typedef enum
+{
+ rtl_Cipher_E_None,
+ rtl_Cipher_E_Argument,
+ rtl_Cipher_E_Algorithm,
+ rtl_Cipher_E_Direction,
+ rtl_Cipher_E_Mode,
+ rtl_Cipher_E_BufferSize,
+ rtl_Cipher_E_Memory,
+ rtl_Cipher_E_Unknown,
+ rtl_Cipher_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} rtlCipherError;
+
+
+/** rtl_cipher_create.
+ * Create a cipher handle for the given algorithm and mode.
+ *
+ * @param Algorithm [in]
+ * @param Mode [in]
+ * @return Cipher handle, or 0 upon failure.
+ */
+rtlCipher SAL_CALL rtl_cipher_create (
+ rtlCipherAlgorithm Algorithm,
+ rtlCipherMode Mode);
+
+
+/** rtl_cipher_init.
+ *
+ * @param Cipher [in]
+ * @param Direction [in]
+ * @param pKeyData [in]
+ * @param nKeyLen [in]
+ * @param pArgData [in]
+ * @param nArgLen [in]
+ * @return rtl_Cipher_E_None upon success.
+ */
+rtlCipherError SAL_CALL rtl_cipher_init (
+ rtlCipher Cipher,
+ rtlCipherDirection Direction,
+ const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen,
+ const sal_uInt8 *pArgData, sal_uInt32 nArgLen);
+
+
+/** rtl_cipher_encode.
+ *
+ * @param Cipher [in]
+ * @param pData [in]
+ * @param nDatLen [in]
+ * @param pBuffer [out]
+ * @param nBufLen [in]
+ * @return rtl_Cipher_E_None upon success.
+ */
+rtlCipherError SAL_CALL rtl_cipher_encode (
+ rtlCipher Cipher,
+ const void *pData, sal_uInt32 nDatLen,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen);
+
+
+/** rtl_cipher_decode.
+ *
+ * @param Cipher [in]
+ * @param pData [in]
+ * @param nDatLen [in]
+ * @param pBuffer [out]
+ * @param nBufLen [in]
+ * @return rtl_Cipher_E_None upon success.
+ */
+rtlCipherError SAL_CALL rtl_cipher_decode (
+ rtlCipher Cipher,
+ const void *pData, sal_uInt32 nDatLen,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen);
+
+
+/** rtl_cipher_destroy.
+ *
+ * @param Cipher [in] handle to be destroyed.
+ * @return None. Cipher handle destroyed and invalid.
+ */
+void SAL_CALL rtl_cipher_destroy (rtlCipher Cipher);
+
+
+/*========================================================================
+ *
+ * rtl_cipherBF (Blowfish) interface.
+ *
+ * Reference:
+ * Bruce Schneier: Applied Cryptography, 2nd edition, ch. 14.3
+ *
+ *======================================================================*/
+/** rtl_cipher_createBF.
+ *
+ * @return Cipher handle, or 0 upon failure.
+ * @see rtl_cipher_create.
+ */
+rtlCipher SAL_CALL rtl_cipher_createBF (rtlCipherMode Mode);
+
+
+/** rtl_cipher_initBF.
+ *
+ * @return rtl_Cipher_E_None upon success.
+ * @see rtl_cipher_init.
+ */
+rtlCipherError SAL_CALL rtl_cipher_initBF (
+ rtlCipher Cipher,
+ rtlCipherDirection Direction,
+ const sal_uInt8 *pKeyData, sal_uInt32 nKeyLen,
+ const sal_uInt8 *pArgData, sal_uInt32 nArgLen);
+
+
+/** rtl_cipher_encodeBF.
+ *
+ * @return rtl_Cipher_E_None upon success.
+ * @see rtl_cipher_encode.
+ */
+rtlCipherError SAL_CALL rtl_cipher_encodeBF (
+ rtlCipher Cipher,
+ const void *pData, sal_uInt32 nDatLen,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen);
+
+
+/** rtl_cipher_decodeBF.
+ *
+ * @return rtl_Cipher_E_None upon success.
+ * @see rtl_cipher_decode.
+ */
+rtlCipherError SAL_CALL rtl_cipher_decodeBF (
+ rtlCipher Cipher,
+ const void *pData, sal_uInt32 nDatLen,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen);
+
+
+/** rtl_cipher_destroyBF.
+ *
+ * @param Cipher [in] handle to be destroyed.
+ * @return None. Cipher handle destroyed and invalid.
+ * @see rtl_cipher_destroy.
+ */
+void SAL_CALL rtl_cipher_destroyBF (rtlCipher Cipher);
+
+/*========================================================================
+ *
+ * The End.
+ *
+ *======================================================================*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_RTL_CIPHER_H_ */
+
diff --git a/sal/inc/rtl/crc.h b/sal/inc/rtl/crc.h
new file mode 100644
index 000000000000..fac1552b03af
--- /dev/null
+++ b/sal/inc/rtl/crc.h
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * $RCSfile: crc.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:14 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _RTL_CRC_H_
+#define _RTL_CRC_H_ "$Revision: 1.1.1.1 $"
+
+#ifndef _SAL_TYPES_H_
+#include <sal/types.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*========================================================================
+ *
+ * rtl_crc32 interface.
+ *
+ *======================================================================*/
+/** Evaluate CRC32 over given data.
+ *
+ * @param Crc [in] CRC32 over previous data or zero.
+ * @param Data [in] data buffer.
+ * @param DatLen [in] data buffer length.
+ * @return new CRC32 value.
+ */
+sal_uInt32 SAL_CALL rtl_crc32 (
+ sal_uInt32 Crc,
+ const void *Data, sal_uInt32 DatLen);
+
+/*========================================================================
+ *
+ * The End.
+ *
+ *======================================================================*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTL_CRC_H_ */
+
diff --git a/sal/inc/rtl/digest.h b/sal/inc/rtl/digest.h
new file mode 100644
index 000000000000..a92f09ee5f68
--- /dev/null
+++ b/sal/inc/rtl/digest.h
@@ -0,0 +1,224 @@
+/*************************************************************************
+ *
+ * $RCSfile: digest.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:14 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _RTL_DIGEST_H_
+#define _RTL_DIGEST_H_ "$Revision: 1.1.1.1 $"
+
+#ifndef _SAL_TYPES_H_
+#include <sal/types.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*========================================================================
+ *
+ * rtlDigest.
+ *
+ *======================================================================*/
+typedef void* rtlDigest;
+
+typedef enum {
+ rtl_Digest_AlgorithmMD2,
+ rtl_Digest_AlgorithmMD5,
+ rtl_Digest_AlgorithmSHA,
+ rtl_Digest_AlgorithmSHA1,
+ rtl_Digest_AlgorithmInvalid,
+ rtl_Digest_Algorithm_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} rtlDigestAlgorithm;
+
+typedef enum {
+ rtl_Digest_E_None,
+ rtl_Digest_E_Argument,
+ rtl_Digest_E_Algorithm,
+ rtl_Digest_E_BufferSize,
+ rtl_Digest_E_Memory,
+ rtl_Digest_E_Unknown,
+ rtl_Digest_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+} rtlDigestError;
+
+rtlDigest SAL_CALL rtl_digest_create (rtlDigestAlgorithm Algorithm);
+void SAL_CALL rtl_digest_destroy (rtlDigest Digest);
+
+rtlDigestAlgorithm SAL_CALL rtl_digest_queryAlgorithm (rtlDigest Digest);
+sal_uInt32 SAL_CALL rtl_digest_queryLength (rtlDigest Digest);
+
+rtlDigestError SAL_CALL rtl_digest_update (
+ rtlDigest Digest,
+ const void *pData, sal_uInt32 nDatLen);
+
+rtlDigestError SAL_CALL rtl_digest_get (
+ rtlDigest Digest,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen);
+
+/*========================================================================
+ *
+ * rtl_digest_MD2 interface.
+ *
+ * Reference:
+ * RFC 1319 - The MD2 Message-Digest Algorithm (Informational)
+ *
+ *======================================================================*/
+#define RTL_DIGEST_LENGTH_MD2 16
+
+rtlDigest SAL_CALL rtl_digest_createMD2 (void);
+void SAL_CALL rtl_digest_destroyMD2 (rtlDigest Digest);
+
+rtlDigestError SAL_CALL rtl_digest_updateMD2 (
+ rtlDigest Digest,
+ const void *pData, sal_uInt32 nDatLen);
+
+rtlDigestError SAL_CALL rtl_digest_getMD2 (
+ rtlDigest Digest,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen);
+
+rtlDigestError SAL_CALL rtl_digest_MD2 (
+ const void *pData, sal_uInt32 nDatLen,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen);
+
+/*========================================================================
+ *
+ * rtl_digest_MD5 interface.
+ *
+ * Reference:
+ * RFC 1321 - The MD5 Message-Digest Algorithm (Informational)
+ *
+ *======================================================================*/
+#define RTL_DIGEST_LENGTH_MD5 16
+
+rtlDigest SAL_CALL rtl_digest_createMD5 (void);
+void SAL_CALL rtl_digest_destroyMD5 (rtlDigest Digest);
+
+rtlDigestError SAL_CALL rtl_digest_updateMD5 (
+ rtlDigest Digest,
+ const void *pData, sal_uInt32 nDatLen);
+
+rtlDigestError SAL_CALL rtl_digest_getMD5 (
+ rtlDigest Digest,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen);
+
+rtlDigestError SAL_CALL rtl_digest_MD5 (
+ const void *pData, sal_uInt32 nDatLen,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen);
+
+/*========================================================================
+ *
+ * rtl_digest_SHA interface.
+ *
+ * Reference:
+ * FIPS PUB 180 - Secure Hash Standard (Superseded by FIPS PUB 180-1)
+ *
+ *======================================================================*/
+#define RTL_DIGEST_LENGTH_SHA 20
+
+rtlDigest SAL_CALL rtl_digest_createSHA (void);
+void SAL_CALL rtl_digest_destroySHA (rtlDigest Digest);
+
+rtlDigestError SAL_CALL rtl_digest_updateSHA (
+ rtlDigest Digest,
+ const void *pData, sal_uInt32 nDatLen);
+
+rtlDigestError SAL_CALL rtl_digest_getSHA (
+ rtlDigest Digest,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen);
+
+rtlDigestError SAL_CALL rtl_digest_SHA (
+ const void *pData, sal_uInt32 nDatLen,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen);
+
+/*========================================================================
+ *
+ * rtl_digest_SHA1 interface.
+ *
+ * Reference:
+ * FIPS PUB 180-1 - Secure Hash Standard (Supersedes FIPS PUB 180)
+ *
+ *======================================================================*/
+#define RTL_DIGEST_LENGTH_SHA1 20
+
+rtlDigest SAL_CALL rtl_digest_createSHA1 (void);
+void SAL_CALL rtl_digest_destroySHA1 (rtlDigest Digest);
+
+rtlDigestError SAL_CALL rtl_digest_updateSHA1 (
+ rtlDigest Digest,
+ const void *pData, sal_uInt32 nDatLen);
+
+rtlDigestError SAL_CALL rtl_digest_getSHA1 (
+ rtlDigest Digest,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen);
+
+rtlDigestError SAL_CALL rtl_digest_SHA1 (
+ const void *pData, sal_uInt32 nDatLen,
+ sal_uInt8 *pBuffer, sal_uInt32 nBufLen);
+
+/*========================================================================
+ *
+ * The End.
+ *
+ *======================================================================*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTL_DIGEST_H_ */
+
diff --git a/sal/inc/rtl/locale.h b/sal/inc/rtl/locale.h
new file mode 100644
index 000000000000..58a9174e34e5
--- /dev/null
+++ b/sal/inc/rtl/locale.h
@@ -0,0 +1,182 @@
+/*************************************************************************
+ *
+ * $RCSfile: locale.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:14 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _RTL_LOCALE_H_
+#define _RTL_LOCALE_H_
+
+#ifndef _RTL_USTRING_
+#ifdef __BORLANDC__
+#include <rtl/wstring.>
+#else
+#include <rtl/ustring>
+#endif /*__BORLANDC__*/
+#endif /*_RTL_USTRING_*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef SAL_W32
+# pragma pack(push, 8)
+#elif defined(SAL_OS2)
+# pragma pack(1)
+#endif
+
+/**
+ * The implementation structur of a locale. Do not create this structure
+ * direct. Only use the functions rtl_locale_register and
+ * rtl_locale_setDefault. The strings Language, Country and Variant
+ * are constants, so it is not necessary to acquire and release them.
+ */
+typedef struct _rtl_Locale
+{
+ /**
+ * Lowercase two-letter ISO-639 code.
+ */
+ rtl_uString * Language;
+ /**
+ * uppercase two-letter ISO-3166 code.
+ */
+ rtl_uString * Country;
+ /**
+ * Lowercase vendor and browser specific code.
+ */
+ rtl_uString * Variant;
+ /**
+ * The merged hash value of the Language, Country and Variant strings.
+ */
+ sal_Int32 HashCode;
+} rtl_Locale;
+
+#ifdef SAL_W32
+# pragma pack(pop)
+#elif defined(SAL_OS2)
+# pragma pack()
+#endif
+
+/**
+ * Register a locale from language, country and variant.
+ * @param language lowercase two-letter ISO-639 code.
+ * @param country uppercase two-letter ISO-3166 code. May be null.
+ * @param variant vendor and browser specific code. May be null.
+ */
+rtl_Locale * SAL_CALL rtl_locale_register( const sal_Unicode * language, const sal_Unicode * country, const sal_Unicode * variant );
+
+/**
+ * Common method of getting the current default Locale.
+ * Used for the presentation: menus, dialogs, etc.
+ * Generally set once when your applet or application is initialized,
+ * then never reset. (If you do reset the default locale, you
+ * probably want to reload your GUI, so that the change is reflected
+ * in your interface.)
+ * <p>More advanced programs will allow users to use different locales
+ * for different fields, e.g. in a spreadsheet.
+ * <BR>Note that the initial setting will match the host system.
+ */
+rtl_Locale * SAL_CALL rtl_locale_getDefault();
+
+/**
+ * Sets the default.
+ * Normally set once at the beginning of applet or application,
+ * then never reset. <code>setDefault</code> does not reset the host locale.
+ * @param language lowercase two-letter ISO-639 code.
+ * @param country uppercase two-letter ISO-3166 code.
+ * @param variant vendor and browser specific code. See class description.
+ */
+void SAL_CALL rtl_locale_setDefault( const sal_Unicode * language, const sal_Unicode * country, const sal_Unicode * variant );
+
+/**
+ * Getter for programmatic name of field,
+ * an lowercased two-letter ISO-639 code.
+ * @see #getDisplayLanguage
+ */
+rtl_uString * SAL_CALL rtl_locale_getLanguage( rtl_Locale * This );
+
+/**
+ * Getter for programmatic name of field,
+ * an uppercased two-letter ISO-3166 code.
+ * @see #getDisplayCountry
+ */
+rtl_uString * SAL_CALL rtl_locale_getCountry( rtl_Locale * This );
+
+/**
+ * Getter for programmatic name of field.
+ * @see #getDisplayVariant
+ */
+rtl_uString * SAL_CALL rtl_locale_getVariant( rtl_Locale * This );
+
+/**
+ * Returns the hash code of the locale This.
+ */
+sal_Int32 SAL_CALL rtl_locale_hashCode( rtl_Locale * This );
+
+/**
+ * Returns true if the locals are equal, otherwis false.
+ */
+sal_Int32 SAL_CALL rtl_locale_equals( rtl_Locale * This, rtl_Locale * obj );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTL_LOCALE_H_ */
+
+
diff --git a/sal/inc/rtl/locale.hxx b/sal/inc/rtl/locale.hxx
new file mode 100644
index 000000000000..4ee31db7e71c
--- /dev/null
+++ b/sal/inc/rtl/locale.hxx
@@ -0,0 +1,316 @@
+/*************************************************************************
+ *
+ * $RCSfile: locale.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 15:17:14 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _RTL_LOCALE_HXX_
+#define _RTL_LOCALE_HXX_
+
+#ifndef _RTL_LOCALE_H_
+#include <rtl/locale.h>
+#endif
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+#ifdef __cplusplus
+
+#ifdef _USE_NAMESPACE
+namespace rtl
+{
+#endif
+
+/**
+ *
+ * A <code>OLocale</code> object represents a specific geographical, political,
+ * or cultural region. An operation that requires a <code>OLocale</code> to perform
+ * its task is called <em>locale-sensitive</em> and uses the <code>OLocale</code>
+ * to tailor information for the user. For example, displaying a number
+ * is a locale-sensitive operation--the number should be formatted
+ * according to the customs/conventions of the user's native country,
+ * region, or culture.
+ *
+ * <P>
+ * You create a <code>OLocale</code> object using one of the two constructors in