summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Driesner <cd@openoffice.org>2010-10-22 14:34:57 +0200
committerCarsten Driesner <cd@openoffice.org>2010-10-22 14:34:57 +0200
commit5caf677d9993d72228927c134961029e946e7524 (patch)
treeb87df3947b64b16b18cf9d319d7e5184a84343a4
parentaf494e58926d415b01b2dc2c92f8363946da0891 (diff)
parent33deb5b2f43e189cb2d98bce2331597250e6b218 (diff)
fwk149: Merge changes from DEV300_m90
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx49
-rw-r--r--bridges/source/remote/context/context.cxx45
-rw-r--r--cppu/inc/uno/lbnames.h45
-rw-r--r--cppu/source/threadpool/current.cxx4
-rw-r--r--cppu/source/threadpool/jobqueue.cxx3
-rw-r--r--cppu/source/threadpool/jobqueue.hxx6
-rw-r--r--cppu/source/threadpool/thread.cxx32
-rw-r--r--cppu/source/threadpool/thread.hxx5
-rw-r--r--cppu/source/threadpool/threadpool.cxx58
-rw-r--r--cppu/source/threadpool/threadpool.hxx15
-rw-r--r--cppu/source/typelib/static_types.cxx48
-rw-r--r--cppu/source/typelib/typelib.cxx11
-rw-r--r--cppu/source/uno/lbenv.cxx15
-rw-r--r--cppu/util/target.pmk9
-rw-r--r--cppuhelper/inc/cppuhelper/factory.hxx3
-rw-r--r--cppuhelper/inc/cppuhelper/implementationentry.hxx6
-rw-r--r--cppuhelper/inc/cppuhelper/interfacecontainer.h23
-rw-r--r--cppuhelper/inc/cppuhelper/shlib.hxx4
-rw-r--r--cppuhelper/qa/propertysetmixin/JavaSupplier.java5
-rw-r--r--cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx7
-rw-r--r--cppuhelper/qa/propertysetmixin/makefile.mk59
-rw-r--r--cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component34
-rw-r--r--cppuhelper/qa/propertysetmixin/qa_propertysetmixin.java.component34
-rw-r--r--cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx40
-rw-r--r--cppuhelper/source/bootstrap.cxx10
-rw-r--r--cppuhelper/source/interfacecontainer.cxx108
-rw-r--r--cppuhelper/source/servicefactory.cxx73
-rw-r--r--cpputools/prj/build.lst1
-rw-r--r--cpputools/prj/d.lst2
-rwxr-xr-xcpputools/source/regcomplazy/regcomplazy.cxx282
-rw-r--r--io/prj/d.lst5
-rw-r--r--io/source/TextInputStream/TextInputStream.cxx6
-rw-r--r--io/source/TextInputStream/makefile.mk8
-rw-r--r--io/source/TextInputStream/textinstream.component34
-rw-r--r--io/source/TextOutputStream/TextOutputStream.cxx6
-rw-r--r--io/source/TextOutputStream/makefile.mk8
-rw-r--r--io/source/TextOutputStream/textoutstream.component34
-rw-r--r--io/source/acceptor/acceptor.component34
-rw-r--r--io/source/acceptor/acceptor.cxx6
-rw-r--r--io/source/acceptor/makefile.mk8
-rw-r--r--io/source/connector/connector.component34
-rw-r--r--io/source/connector/connector.cxx6
-rw-r--r--io/source/connector/makefile.mk8
-rw-r--r--io/source/stm/factreg.cxx6
-rw-r--r--io/source/stm/makefile.mk7
-rw-r--r--io/source/stm/streams.component55
-rw-r--r--javaunohelper/com/sun/star/comp/JavaUNOHelperServices.java17
-rw-r--r--javaunohelper/prj/d.lst1
-rw-r--r--javaunohelper/util/juh.component34
-rw-r--r--javaunohelper/util/makefile.mk5
-rw-r--r--jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java12
-rw-r--r--jurt/com/sun/star/comp/connections/Acceptor.java15
-rw-r--r--jurt/com/sun/star/comp/connections/Connector.java15
-rw-r--r--jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java14
-rw-r--r--jurt/com/sun/star/comp/connections/PipedConnection.java13
-rw-r--r--jurt/com/sun/star/comp/urlresolver/UrlResolver.java14
-rw-r--r--jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java15
-rw-r--r--jurt/com/sun/star/lib/connections/pipe/pipeConnector.java15
-rw-r--r--jurt/com/sun/star/lib/connections/socket/socketAcceptor.java15
-rw-r--r--jurt/com/sun/star/lib/connections/socket/socketConnector.java15
-rw-r--r--offapi/com/sun/star/text/PrintPreviewSettings.idl2
-rw-r--r--pyuno/prj/d.lst3
-rw-r--r--pyuno/source/loader/makefile.mk34
-rw-r--r--pyuno/source/loader/pythonloader.component34
-rw-r--r--pyuno/source/loader/pyuno_loader.cxx6
-rw-r--r--pyuno/zipcore/python.sh2
-rw-r--r--remotebridges/prj/d.lst3
-rw-r--r--remotebridges/source/bridge/makefile.mk8
-rw-r--r--remotebridges/source/bridge/remote_bridge.cxx6
-rw-r--r--remotebridges/source/bridge/remotebridge.component36
-rw-r--r--remotebridges/source/dynamicloader/dynamicloader.cxx28
-rw-r--r--remotebridges/source/factory/bridgefac.component34
-rw-r--r--remotebridges/source/factory/bridgefactory.cxx6
-rw-r--r--remotebridges/source/factory/makefile.mk7
-rw-r--r--remotebridges/source/unourl_resolver/makefile.mk8
-rw-r--r--remotebridges/source/unourl_resolver/unourl_resolver.cxx6
-rw-r--r--remotebridges/source/unourl_resolver/uuresolver.component34
-rw-r--r--sal/inc/rtl/malformeduriexception.hxx4
-rw-r--r--sal/prj/build.lst1
-rw-r--r--sal/qa/OStringBuffer/rtl_OStringBuffer.cxx30
-rw-r--r--sal/qa/OStringBuffer/rtl_String_Const.h6
-rw-r--r--sal/qa/osl/pipe/makefile.mk2
-rw-r--r--sal/qa/osl/pipe/osl_Pipe.cxx87
-rw-r--r--stoc/prj/build.lst2
-rw-r--r--stoc/prj/d.lst10
-rw-r--r--stoc/source/bootstrap/services.cxx6
-rw-r--r--stoc/source/corereflection/base.hxx3
-rw-r--r--stoc/source/corereflection/crefl.cxx30
-rw-r--r--stoc/source/corereflection/makefile.mk7
-rw-r--r--stoc/source/corereflection/reflection.component35
-rw-r--r--stoc/source/implementationregistration/implreg.cxx25
-rw-r--r--stoc/source/inspect/introspection.component34
-rw-r--r--stoc/source/inspect/introspection.cxx27
-rw-r--r--stoc/source/inspect/makefile.mk7
-rw-r--r--stoc/source/invocation/invocation.component34
-rw-r--r--stoc/source/invocation/invocation.cxx6
-rw-r--r--stoc/source/invocation/makefile.mk6
-rw-r--r--stoc/source/invocation_adapterfactory/iafactory.cxx8
-rw-r--r--stoc/source/invocation_adapterfactory/invocadapt.component34
-rw-r--r--stoc/source/invocation_adapterfactory/makefile.mk8
-rw-r--r--stoc/source/javaloader/javaloader.component35
-rw-r--r--stoc/source/javaloader/javaloader.cxx6
-rw-r--r--stoc/source/javaloader/makefile.mk7
-rw-r--r--stoc/source/javavm/javavm.component35
-rw-r--r--stoc/source/javavm/javavm.cxx37
-rw-r--r--stoc/source/javavm/makefile.mk7
-rw-r--r--stoc/source/namingservice/makefile.mk7
-rw-r--r--stoc/source/namingservice/namingservice.component34
-rw-r--r--stoc/source/namingservice/namingservice.cxx6
-rw-r--r--stoc/source/proxy_factory/makefile.mk8
-rw-r--r--stoc/source/proxy_factory/proxyfac.component34
-rw-r--r--stoc/source/proxy_factory/proxyfac.cxx7
-rw-r--r--stoc/source/simpleregistry/makefile.mk3
-rw-r--r--stoc/source/simpleregistry/simpleregistry.cxx2380
-rw-r--r--stoc/source/simpleregistry/textualservices.cxx1216
-rw-r--r--stoc/source/simpleregistry/textualservices.hxx67
-rw-r--r--stoc/source/stocservices/stocservices.cxx6
-rw-r--r--stoc/test/uriproc/makefile.mk20
-rw-r--r--stoc/util/bootstrap.component62
-rw-r--r--stoc/util/makefile.mk16
-rw-r--r--stoc/util/stocservices.component51
-rw-r--r--ure/prj/build.lst2
-rw-r--r--ure/prj/d.lst16
-rw-r--r--ure/source/README2
-rw-r--r--ure/source/makefile.mk76
-rw-r--r--ure/source/startup.sh2
-rw-r--r--xmlreader/inc/makefile.mk40
-rw-r--r--xmlreader/inc/pch/precompiled_xmlreader.cxx28
-rw-r--r--xmlreader/inc/pch/precompiled_xmlreader.hxx32
-rw-r--r--xmlreader/inc/xmlreader/detail/xmlreaderdllapi.hxx41
-rw-r--r--xmlreader/inc/xmlreader/pad.hxx59
-rw-r--r--xmlreader/inc/xmlreader/span.hxx69
-rw-r--r--xmlreader/inc/xmlreader/xmlreader.hxx199
-rw-r--r--xmlreader/prj/build.lst3
-rw-r--r--xmlreader/prj/d.lst10
-rw-r--r--[-rwxr-xr-x]xmlreader/source/makefile.mk (renamed from cpputools/source/regcomplazy/makefile.mk)45
-rw-r--r--xmlreader/source/pad.cxx85
-rw-r--r--xmlreader/source/span.cxx66
-rw-r--r--xmlreader/source/xmlreader.cxx1054
139 files changed, 5635 insertions, 2408 deletions
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
index 37fab3d8b..d2c8f3312 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
@@ -28,10 +28,14 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_bridges.hxx"
+#include <exception>
+#include <typeinfo>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <rtl/alloc.h>
+
+#include "rtl/alloc.h"
+#include "rtl/ustrbuf.hxx"
#include <com/sun/star/uno/genfunc.hxx>
#include "com/sun/star/uno/RuntimeException.hpp"
@@ -237,6 +241,18 @@ static void callVirtualMethod(void * pThis, sal_uInt32 nVtableIndex,
//==================================================================================================
+namespace {
+
+void appendCString(OUStringBuffer & buffer, char const * text) {
+ if (text != 0) {
+ buffer.append(
+ OStringToOUString(OString(text), RTL_TEXTENCODING_ISO_8859_1));
+ // use 8859-1 to avoid conversion failure
+ }
+}
+
+}
+
static void cpp_call(
bridges::cpp_uno::shared::UnoInterfaceProxy * pThis,
bridges::cpp_uno::shared::VtableSlot aVtableSlot,
@@ -369,12 +385,31 @@ static void cpp_call(
try
{
- callVirtualMethod(
- pAdjustedThisPtr, aVtableSlot.index,
- pCppReturn, pReturnTypeRef, bSimpleReturn,
- pStackStart, ( pStack - pStackStart ),
- pGPR, nGPR,
- pFPR, nFPR );
+ try {
+ callVirtualMethod(
+ pAdjustedThisPtr, aVtableSlot.index,
+ pCppReturn, pReturnTypeRef, bSimpleReturn,
+ pStackStart, ( pStack - pStackStart ),
+ pGPR, nGPR,
+ pFPR, nFPR );
+ } catch (Exception &) {
+ throw;
+ } catch (std::exception & e) {
+ OUStringBuffer buf;
+ buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("C++ code threw "));
+ appendCString(buf, typeid(e).name());
+ buf.appendAscii(RTL_CONSTASCII_STRINGPARAM(": "));
+ appendCString(buf, e.what());
+ throw RuntimeException(
+ buf.makeStringAndClear(), Reference< XInterface >());
+ } catch (...) {
+ throw RuntimeException(
+ OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "C++ code threw unknown exception")),
+ Reference< XInterface >());
+ }
+
// NO exception occured...
*ppUnoExc = 0;
diff --git a/bridges/source/remote/context/context.cxx b/bridges/source/remote/context/context.cxx
index 4c9e1b066..58b9dc1f7 100644
--- a/bridges/source/remote/context/context.cxx
+++ b/bridges/source/remote/context/context.cxx
@@ -38,6 +38,7 @@
#include <osl/mutex.hxx>
#include "rtl/ustring.hxx"
+#include "rtl/instance.hxx"
#include <bridges/remote/context.h>
#include <bridges/remote/remote.h>
@@ -109,17 +110,9 @@ ContextMap;
static MyCounter thisCounter( "DEBUG : Context" );
#endif
-class ContextAdmin;
-
-ContextAdmin *g_pTheContext = 0;
-
-
-
class ContextAdmin
{
public:
- static ContextAdmin *getInstance();
-
// listener administration
void addContextListener( remote_contextListenerFunc listener , void *pObject );
void removeContextListener( remote_contextListenerFunc listener , void *pObject );
@@ -138,7 +131,7 @@ public:
void revokeContext( uno_Context *pRemoteContext );
- uno_Context *get( rtl_uString *pHost );
+ uno_Context *getContext( rtl_uString *pHost );
rtl_uString ** getConnectionList(
sal_Int32 *pnStringCount, MemAlloc memAlloc );
@@ -152,19 +145,6 @@ private:
List m_lstListener;
};
-ContextAdmin *ContextAdmin::getInstance()
-{
- if( ! g_pTheContext ) {
- ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() );
- if( ! g_pTheContext ) {
- //TODO This memory is leaked; see #i63473# for when this should be
- // changed again:
- g_pTheContext = new ContextAdmin;
- }
- }
- return g_pTheContext;
-}
-
void ContextAdmin::addContextListener( remote_contextListenerFunc listener , void *pObject )
{
::osl::MutexGuard guard( m_mutex );
@@ -209,7 +189,7 @@ uno_Context *ContextAdmin::createAndRegisterContext( remote_Connection *pConnect
{
::osl::MutexGuard guard( m_mutex );
- uno_Context *pContext = get( pIdStr );
+ uno_Context *pContext = getContext( pIdStr );
if( pContext )
{
pContext->release( pContext );
@@ -245,7 +225,7 @@ void ContextAdmin::revokeContext( uno_Context *pRemoteContext )
}
-uno_Context *ContextAdmin::get( rtl_uString *pHost )
+uno_Context *ContextAdmin::getContext( rtl_uString *pHost )
{
::osl::MutexGuard guard( m_mutex );
@@ -267,6 +247,10 @@ rtl_uString ** ContextAdmin::getConnectionList(
::osl::MutexGuard guard( m_mutex );
*pnStringCount = m_mapContext.size();
+
+ if (*pnStringCount == 0)
+ return NULL;
+
rtl_uString **ppReturn = ( rtl_uString ** )
memAlloc( sizeof( rtl_uString * ) * m_mapContext.size() );
memset( ppReturn , 0 , sizeof( rtl_uString * ) * m_mapContext.size() );
@@ -283,6 +267,7 @@ rtl_uString ** ContextAdmin::getConnectionList(
}
+struct theContextAdmin : public rtl::Static<ContextAdmin, theContextAdmin> {};
/*****************************
* remote_ContextImpl implementation
@@ -379,7 +364,7 @@ void remote_ContextImpl::thisDispose( remote_Context *pRemoteC )
if( ! pImpl->m_bDisposed )
{
pImpl->m_bDisposed = sal_True;
- ContextAdmin::getInstance()->revokeContext( (uno_Context * ) pRemoteC );
+ theContextAdmin::get().revokeContext( (uno_Context * ) pRemoteC );
if( pImpl->m_pInstanceProvider )
{
@@ -456,7 +441,7 @@ using namespace remote_context;
extern "C" remote_Context * SAL_CALL
remote_getContext( rtl_uString *pIdString )
{
- return (remote_Context *) ContextAdmin::getInstance()->get( pIdString );
+ return (remote_Context *) theContextAdmin::get().getContext(pIdString);
}
@@ -469,7 +454,7 @@ remote_createContext( remote_Connection *pConnection,
remote_InstanceProvider *pProvider )
{
remote_ContextImpl *p = (remote_ContextImpl * )
- ContextAdmin::getInstance()->createAndRegisterContext(
+ theContextAdmin::get().createAndRegisterContext(
pConnection ,
pIdStr ,
pDescription,
@@ -483,17 +468,17 @@ remote_createContext( remote_Connection *pConnection,
extern "C" void SAL_CALL
remote_addContextListener( remote_contextListenerFunc listener, void *pObject )
{
- ContextAdmin::getInstance()->addContextListener( listener , pObject );
+ theContextAdmin::get().addContextListener( listener , pObject );
}
extern "C" void SAL_CALL
remote_removeContextListener( remote_contextListenerFunc listener , void *pObject )
{
- ContextAdmin::getInstance()->removeContextListener( listener , pObject );
+ theContextAdmin::get().removeContextListener( listener , pObject );
}
extern "C" rtl_uString ** SAL_CALL
remote_getContextList( sal_Int32 *pnStringCount, MemAlloc memAlloc )
{
- return ContextAdmin::getInstance()->getConnectionList( pnStringCount , memAlloc );
+ return theContextAdmin::get().getConnectionList( pnStringCount , memAlloc );
}
diff --git a/cppu/inc/uno/lbnames.h b/cppu/inc/uno/lbnames.h
index 285c43b40..7da2e25ea 100644
--- a/cppu/inc/uno/lbnames.h
+++ b/cppu/inc/uno/lbnames.h
@@ -29,49 +29,6 @@
#ifdef __cplusplus
-/* environment type names for supported compilers */
-#if defined (_MSC_VER)
-#if (_MSC_VER < 1000)
-#error "ms visual c++ version must be at least 4.2"
-#elif (_MSC_VER < 1100) // MSVC 4.x
-#pragma warning( disable: 4290 )
-#define TMP_CPPU_ENV msci
-#elif (_MSC_VER < 1600) // MSVC 5-9
-#define TMP_CPPU_ENV msci
-#else
-#error "ms visual c++ version must be between 4.2 and 9.x"
-#endif /* (_MSC_VER < 1000) */
-/* sunpro cc */
-#elif defined (__SUNPRO_CC)
-#if ((__SUNPRO_CC >= 0x5000 && __SUNPRO_CC < 0x6000) || (__SUNPRO_CC >= 0x500 && __SUNPRO_CC < 0x600))
-#define TMP_CPPU_ENV sunpro5
-#elif
-#error "sunpro cc version must be 5.x"
-provoking error here, because PP ignores #error
-#endif /* defined (__SUNPRO_CC) */
-/* g++ 2.x, 3.0 */
-#elif defined (__GNUC__)
-#if (__GNUC__ == 2 && __GNUC_MINOR__ == 91)
-#define TMP_CPPU_ENV gcc2
-#elif (__GNUC__ == 2 && __GNUC_MINOR__ == 95)
-#define TMP_CPPU_ENV gcc2
-#elif (__GNUC__ == 2)
-#error "Tested gcc 2 versions are 2.91 and 2.95. Patch uno/lbnames.h to try your gcc 2 version."
-#elif (__GNUC__ == 3 && __GNUC_MINOR__ <= 4)
-#define __CPPU_ENV gcc3
-#elif (__GNUC__ == 4 && __GNUC_MINOR__ <= 4)
-#define __CPPU_ENV gcc3
-#elif (__GNUC__ == 3)
-#error "Tested gcc 3 version is <= 3.4. Patch uno/lbnames.h to try your gcc 3 version."
-#else
-#error "Supported gcc majors are 2 , 3 and 4 <= 4.4. Unsupported gcc major version."
-#endif /* defined (__GNUC__) */
-#endif /* defined (_MSC_VER) */
-
-#if (! defined (CPPU_ENV) && defined (TMP_CPPU_ENV))
-#define CPPU_ENV TMP_CPPU_ENV
-#endif
-
#ifdef CPPU_ENV
#define CPPU_STRINGIFY_EX( x ) #x
@@ -87,8 +44,6 @@ provoking error here, because PP ignores #error
#endif /* CPPU_ENV */
-#undef TMP_CPPU_ENV
-
#endif /* __cplusplus */
/** Environment type name for binary C UNO. */
diff --git a/cppu/source/threadpool/current.cxx b/cppu/source/threadpool/current.cxx
index 07323c2fd..805b5759a 100644
--- a/cppu/source/threadpool/current.cxx
+++ b/cppu/source/threadpool/current.cxx
@@ -106,11 +106,9 @@ static typelib_InterfaceTypeDescription * get_type_XCurrentContext()
1, aParameters, 1, pExceptions );
typelib_typedescription_register( (typelib_TypeDescription**)&pMethod );
typelib_typedescription_release( (typelib_TypeDescription*)pMethod );
-#if ! defined CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++reinterpret_cast< typelib_TypeDescription * >( pTD )->
nStaticRefCount;
-#endif
s_type_XCurrentContext = pTD;
}
}
diff --git a/cppu/source/threadpool/jobqueue.cxx b/cppu/source/threadpool/jobqueue.cxx
index 18693bef1..4f83261c9 100644
--- a/cppu/source/threadpool/jobqueue.cxx
+++ b/cppu/source/threadpool/jobqueue.cxx
@@ -42,6 +42,7 @@ namespace cppu_threadpool {
m_cndWait( osl_createCondition() )
{
osl_resetCondition( m_cndWait );
+ m_DisposedCallerAdmin = DisposedCallerAdmin::getInstance();
}
JobQueue::~JobQueue()
@@ -68,7 +69,7 @@ namespace cppu_threadpool {
{
// synchronize with the dispose calls
MutexGuard guard( m_mutex );
- if( DisposedCallerAdmin::getInstance()->isDisposed( nDisposeId ) )
+ if( m_DisposedCallerAdmin->isDisposed( nDisposeId ) )
{
return 0;
}
diff --git a/cppu/source/threadpool/jobqueue.hxx b/cppu/source/threadpool/jobqueue.hxx
index 7a50b8a0e..31ea0690e 100644
--- a/cppu/source/threadpool/jobqueue.hxx
+++ b/cppu/source/threadpool/jobqueue.hxx
@@ -34,6 +34,8 @@
#include <osl/conditn.h>
#include <osl/mutex.hxx>
+#include <boost/shared_ptr.hpp>
+
namespace cppu_threadpool
{
extern "C" typedef void (SAL_CALL RequestFun)(void *);
@@ -48,6 +50,9 @@ namespace cppu_threadpool
typedef ::std::list < sal_Int64 > CallStackList;
+ class DisposedCallerAdmin;
+ typedef boost::shared_ptr<DisposedCallerAdmin> DisposedCallerAdminHolder;
+
class JobQueue
{
public:
@@ -73,6 +78,7 @@ namespace cppu_threadpool
sal_Int32 m_nToDo;
sal_Bool m_bSuspended;
oslCondition m_cndWait;
+ DisposedCallerAdminHolder m_DisposedCallerAdmin;
};
}
diff --git a/cppu/source/threadpool/thread.cxx b/cppu/source/threadpool/thread.cxx
index 565020850..f8e12a0aa 100644
--- a/cppu/source/threadpool/thread.cxx
+++ b/cppu/source/threadpool/thread.cxx
@@ -31,6 +31,8 @@
#include <osl/diagnose.h>
#include <uno/threadpool.h>
+#include <rtl/instance.hxx>
+
#include "thread.hxx"
#include "jobqueue.hxx"
#include "threadpool.hxx"
@@ -98,20 +100,17 @@ namespace cppu_threadpool {
} while( pCurrent );
}
- ThreadAdmin* ThreadAdmin::getInstance()
+ struct theThreadAdmin : public rtl::StaticWithInit< ThreadAdminHolder, theThreadAdmin >
{
- static ThreadAdmin *pThreadAdmin = 0;
- if( ! pThreadAdmin )
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if( ! pThreadAdmin )
- {
- static ThreadAdmin admin;
- pThreadAdmin = &admin;
- }
+ ThreadAdminHolder operator () () {
+ ThreadAdminHolder aRet(new ThreadAdmin());
+ return aRet;
}
- return pThreadAdmin;
+ };
+ ThreadAdminHolder& ThreadAdmin::getInstance()
+ {
+ return theThreadAdmin::get();
}
// ----------------------------------------------------------------------------------
@@ -119,12 +118,13 @@ namespace cppu_threadpool {
const ByteSequence &aThreadId,
sal_Bool bAsynchron )
: m_thread( 0 )
+ , m_aThreadAdmin( ThreadAdmin::getInstance() )
, m_pQueue( pQueue )
, m_aThreadId( aThreadId )
, m_bAsynchron( bAsynchron )
, m_bDeleteSelf( sal_True )
{
- ThreadAdmin::getInstance()->add( this );
+ m_aThreadAdmin->add( this );
}
@@ -166,7 +166,7 @@ namespace cppu_threadpool {
void ORequestThread::onTerminated()
{
- ThreadAdmin::getInstance()->remove( this );
+ m_aThreadAdmin->remove( this );
if( m_bDeleteSelf )
{
delete this;
@@ -175,6 +175,8 @@ namespace cppu_threadpool {
void ORequestThread::run()
{
+ ThreadPoolHolder theThreadPool = cppu_threadpool::ThreadPool::getInstance();
+
while ( m_pQueue )
{
if( ! m_bAsynchron )
@@ -197,7 +199,7 @@ namespace cppu_threadpool {
if( m_pQueue->isEmpty() )
{
- ThreadPool::getInstance()->revokeQueue( m_aThreadId , m_bAsynchron );
+ theThreadPool->revokeQueue( m_aThreadId , m_bAsynchron );
// Note : revokeQueue might have failed because m_pQueue.isEmpty()
// may be false (race).
}
@@ -211,7 +213,7 @@ namespace cppu_threadpool {
uno_releaseIdFromCurrentThread();
}
- cppu_threadpool::ThreadPool::getInstance()->waitInPool( this );
+ theThreadPool->waitInPool( this );
}
}
}
diff --git a/cppu/source/threadpool/thread.hxx b/cppu/source/threadpool/thread.hxx
index 642820e9e..becf50286 100644
--- a/cppu/source/threadpool/thread.hxx
+++ b/cppu/source/threadpool/thread.hxx
@@ -37,6 +37,8 @@
namespace cppu_threadpool {
class JobQueue;
+ class ThreadAdmin;
+ typedef boost::shared_ptr<ThreadAdmin> ThreadAdminHolder;
//-----------------------------------------
// private thread class for the threadpool
@@ -61,6 +63,7 @@ namespace cppu_threadpool {
private:
oslThread m_thread;
+ ThreadAdminHolder m_aThreadAdmin;
JobQueue *m_pQueue;
::rtl::ByteSequence m_aThreadId;
sal_Bool m_bAsynchron;
@@ -71,7 +74,7 @@ namespace cppu_threadpool {
{
public:
~ThreadAdmin ();
- static ThreadAdmin *getInstance();
+ static ThreadAdminHolder &getInstance();
void add( ORequestThread * );
void remove( ORequestThread * );
void join();
diff --git a/cppu/source/threadpool/threadpool.cxx b/cppu/source/threadpool/threadpool.cxx
index f09c8fbd3..1d68a5482 100644
--- a/cppu/source/threadpool/threadpool.cxx
+++ b/cppu/source/threadpool/threadpool.cxx
@@ -33,6 +33,7 @@
#include <osl/diagnose.h>
#include <osl/mutex.hxx>
#include <osl/thread.h>
+#include <rtl/instance.hxx>
#include <uno/threadpool.h>
@@ -44,19 +45,17 @@ using namespace ::osl;
namespace cppu_threadpool
{
- DisposedCallerAdmin *DisposedCallerAdmin::getInstance()
+ struct theDisposedCallerAdmin :
+ public rtl::StaticWithInit< DisposedCallerAdminHolder, theDisposedCallerAdmin >
{
- static DisposedCallerAdmin *pDisposedCallerAdmin = 0;
- if( ! pDisposedCallerAdmin )
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if( ! pDisposedCallerAdmin )
- {
- static DisposedCallerAdmin admin;
- pDisposedCallerAdmin = &admin;
- }
+ DisposedCallerAdminHolder operator () () {
+ return DisposedCallerAdminHolder(new DisposedCallerAdmin());
}
- return pDisposedCallerAdmin;
+ };
+
+ DisposedCallerAdminHolder DisposedCallerAdmin::getInstance()
+ {
+ return theDisposedCallerAdmin::get();
}
DisposedCallerAdmin::~DisposedCallerAdmin()
@@ -107,6 +106,21 @@ namespace cppu_threadpool
//-------------------------------------------------------------------------------
+
+ struct theThreadPool :
+ public rtl::StaticWithInit< ThreadPoolHolder, theThreadPool >
+ {
+ ThreadPoolHolder operator () () {
+ ThreadPoolHolder aRet(new ThreadPool());
+ return aRet;
+ }
+ };
+
+ ThreadPool::ThreadPool()
+ {
+ m_DisposedCallerAdmin = DisposedCallerAdmin::getInstance();
+ }
+
ThreadPool::~ThreadPool()
{
#if OSL_DEBUG_LEVEL > 1
@@ -116,19 +130,9 @@ namespace cppu_threadpool
}
#endif
}
- ThreadPool *ThreadPool::getInstance()
+ ThreadPoolHolder ThreadPool::getInstance()
{
- static ThreadPool *pThreadPool = 0;
- if( ! pThreadPool )
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if( ! pThreadPool )
- {
- static ThreadPool pool;
- pThreadPool = &pool;
- }
- }
- return pThreadPool;
+ return theThreadPool::get();
}
@@ -136,7 +140,7 @@ namespace cppu_threadpool
{
if( nDisposeId )
{
- DisposedCallerAdmin::getInstance()->dispose( nDisposeId );
+ m_DisposedCallerAdmin->dispose( nDisposeId );
MutexGuard guard( m_mutex );
for( ThreadIdHashMap::iterator ii = m_mapQueue.begin() ;
@@ -171,7 +175,7 @@ namespace cppu_threadpool
void ThreadPool::stopDisposing( sal_Int64 nDisposeId )
{
- DisposedCallerAdmin::getInstance()->stopDisposing( nDisposeId );
+ m_DisposedCallerAdmin->stopDisposing( nDisposeId );
}
/******************
@@ -400,7 +404,7 @@ struct uno_ThreadPool_Hash
-typedef ::std::hash_set< uno_ThreadPool, uno_ThreadPool_Hash, uno_ThreadPool_Equal > ThreadpoolHashSet;
+typedef ::std::hash_map< uno_ThreadPool, ThreadPoolHolder, uno_ThreadPool_Hash, uno_ThreadPool_Equal > ThreadpoolHashSet;
static ThreadpoolHashSet *g_pThreadpoolHashSet;
@@ -420,7 +424,7 @@ uno_threadpool_create() SAL_THROW_EXTERN_C()
// Just ensure that the handle is unique in the process (via heap)
uno_ThreadPool h = new struct _uno_ThreadPool;
- g_pThreadpoolHashSet->insert( h );
+ g_pThreadpoolHashSet->insert( ThreadpoolHashSet::value_type(h, ThreadPool::getInstance()) );
return h;
}
diff --git a/cppu/source/threadpool/threadpool.hxx b/cppu/source/threadpool/threadpool.hxx
index 1ff1748fe..b9df49f43 100644
--- a/cppu/source/threadpool/threadpool.hxx
+++ b/cppu/source/threadpool/threadpool.hxx
@@ -30,6 +30,8 @@
#include <rtl/byteseq.hxx>
+#include <boost/shared_ptr.hpp>
+
#include "jobqueue.hxx"
@@ -75,13 +77,16 @@ namespace cppu_threadpool {
};
typedef ::std::list < struct ::cppu_threadpool::WaitingThread * > WaitingThreadList;
+
+ class DisposedCallerAdmin;
+ typedef boost::shared_ptr<DisposedCallerAdmin> DisposedCallerAdminHolder;
class DisposedCallerAdmin
{
public:
~DisposedCallerAdmin();
- static DisposedCallerAdmin *getInstance();
+ static DisposedCallerAdminHolder getInstance();
void dispose( sal_Int64 nDisposeId );
void stopDisposing( sal_Int64 nDisposeId );
@@ -92,11 +97,15 @@ namespace cppu_threadpool {
DisposedCallerList m_lst;
};
+ class ThreadPool;
+ typedef boost::shared_ptr<ThreadPool> ThreadPoolHolder;
+
class ThreadPool
{
public:
+ ThreadPool();
~ThreadPool();
- static ThreadPool *getInstance();
+ static ThreadPoolHolder getInstance();
void dispose( sal_Int64 nDisposeId );
void stopDisposing( sal_Int64 nDisposeId );
@@ -124,6 +133,8 @@ namespace cppu_threadpool {
::osl::Mutex m_mutexWaitingThreadList;
WaitingThreadList m_lstThreads;
+
+ DisposedCallerAdminHolder m_DisposedCallerAdmin;
};
} // end namespace cppu_threadpool
diff --git a/cppu/source/typelib/static_types.cxx b/cppu/source/typelib/static_types.cxx
index 202c55bf7..a95264379 100644
--- a/cppu/source/typelib/static_types.cxx
+++ b/cppu/source/typelib/static_types.cxx
@@ -168,10 +168,8 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass(
OUString sTypeName( RTL_CONSTASCII_USTRINGPARAM("type") );
::typelib_typedescriptionreference_new(
&s_aTypes[typelib_TypeClass_TYPE], typelib_TypeClass_TYPE, sTypeName.pData );
-#ifndef CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++s_aTypes[typelib_TypeClass_TYPE]->nStaticRefCount;
-#endif
}
// any
if (! s_aTypes[typelib_TypeClass_ANY])
@@ -179,10 +177,8 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass(
OUString sTypeName( RTL_CONSTASCII_USTRINGPARAM("any") );
::typelib_typedescriptionreference_new(
&s_aTypes[typelib_TypeClass_ANY], typelib_TypeClass_ANY, sTypeName.pData );
-#ifndef CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++s_aTypes[typelib_TypeClass_ANY]->nStaticRefCount;
-#endif
}
// string
if (! s_aTypes[typelib_TypeClass_STRING])
@@ -190,10 +186,8 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass(
OUString sTypeName( RTL_CONSTASCII_USTRINGPARAM("string") );
::typelib_typedescriptionreference_new(
&s_aTypes[typelib_TypeClass_STRING], typelib_TypeClass_STRING, sTypeName.pData );
-#ifndef CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++s_aTypes[typelib_TypeClass_STRING]->nStaticRefCount;
-#endif
}
// XInterface
if (! s_aTypes[typelib_TypeClass_INTERFACE])
@@ -220,10 +214,8 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass(
::typelib_typedescription_register( (typelib_TypeDescription **)&pTD );
::typelib_typedescriptionreference_acquire(
s_aTypes[typelib_TypeClass_INTERFACE] = ((typelib_TypeDescription *)pTD)->pWeakRef );
-#ifndef CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++s_aTypes[typelib_TypeClass_INTERFACE]->nStaticRefCount;
-#endif
::typelib_typedescription_release( (typelib_TypeDescription*)pTD );
::typelib_typedescriptionreference_release( pMembers[0] );
@@ -252,10 +244,8 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass(
typelib_typedescription_register( &pTD1 );
typelib_typedescriptionreference_acquire(
s_aTypes[typelib_TypeClass_EXCEPTION] = pTD1->pWeakRef );
-#ifndef CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++s_aTypes[typelib_TypeClass_EXCEPTION]->nStaticRefCount;
-#endif
// RuntimeException
OUString sTypeName2( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.RuntimeException") );
::typelib_typedescription_new(
@@ -302,10 +292,8 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass(
{
OUString aTypeName( OUString::createFromAscii( s_aTypeNames[eTypeClass] ) );
::typelib_typedescriptionreference_new( &s_aTypes[eTypeClass], eTypeClass, aTypeName.pData );
-#ifndef CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++s_aTypes[eTypeClass]->nStaticRefCount;
-#endif
}
}
}
@@ -327,10 +315,8 @@ void SAL_CALL typelib_static_type_init(
OUString aTypeName( OUString::createFromAscii( pTypeName ) );
::typelib_typedescriptionreference_new( ppRef, eTypeClass, aTypeName.pData );
-#ifndef CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++((*ppRef)->nStaticRefCount);
-#endif
}
}
}
@@ -364,10 +350,8 @@ void SAL_CALL typelib_static_sequence_type_init(
*ppRef = (typelib_TypeDescriptionReference *)pReg;
OSL_ASSERT( *ppRef == pReg->pWeakRef );
}
-#ifndef CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++((*ppRef)->nStaticRefCount);
-#endif
}
}
}
@@ -450,10 +434,8 @@ void init(
*ppRef = (typelib_TypeDescriptionReference *)pReg;
OSL_ASSERT( *ppRef == pReg->pWeakRef );
}
-#ifndef CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++((*ppRef)->nStaticRefCount);
-#endif
}
}
}
@@ -551,10 +533,8 @@ void SAL_CALL typelib_static_mi_interface_type_init(
*ppRef = (typelib_TypeDescriptionReference *)pReg;
OSL_ASSERT( *ppRef == pReg->pWeakRef );
}
-#ifndef CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++((*ppRef)->nStaticRefCount);
-#endif
}
}
}
@@ -593,10 +573,8 @@ void SAL_CALL typelib_static_enum_type_init(
*ppRef = (typelib_TypeDescriptionReference *)pReg;
OSL_ASSERT( *ppRef == pReg->pWeakRef );
}
-#ifndef CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++(*(sal_Int32 *)&(*ppRef)->pReserved);
-#endif
}
}
}
@@ -660,10 +638,8 @@ void SAL_CALL typelib_static_array_type_init(
OSL_ASSERT( *ppRef == pReg->pWeakRef );
} else
delete [] pDimensions;
-#ifndef CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++((*ppRef)->nStaticRefCount);
-#endif
}
}
}
diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index 01c3311ea..1745dd69b 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -264,17 +264,9 @@ inline void TypeDescriptor_Init_Impl::callChain(
}
}
-// never called
-#if defined(CPPU_LEAK_STATIC_DATA) && defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)
-static void dumb_sunpro5_must_have_dtor_stl_hashmap_code_if_compiled_with_minus_g() SAL_THROW( () )
-{
- delete (WeakMap_Impl *)0xbeef1e;
-}
-#endif
//__________________________________________________________________________________________________
TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() SAL_THROW( () )
{
-#ifndef CPPU_LEAK_STATIC_DATA
if( pCache )
{
TypeDescriptionList_Impl::const_iterator aIt = pCache->begin();
@@ -303,7 +295,6 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() SAL_THROW( () )
for( i = 0; i < nSize; i++ )
{
typelib_TypeDescriptionReference * pTDR = ppTDR[i];
- sal_Int32 nStaticCounts = pTDR->nStaticRefCount;
OSL_ASSERT( pTDR->nRefCount > pTDR->nStaticRefCount );
pTDR->nRefCount -= pTDR->nStaticRefCount;
@@ -355,9 +346,7 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() SAL_THROW( () )
#endif
delete pCallbacks;
pCallbacks = 0;
-#endif // CPPU_LEAK_STATIC_DATA
- // todo: maybe into leak block
if( pMutex )
{
delete pMutex;
diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index e3b1cdf1e..e05847191 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -139,6 +139,7 @@ struct EnvironmentsData
::osl::Mutex mutex;
OUString2EnvironmentMap aName2EnvMap;
+ EnvironmentsData() : isDisposing(false) {}
~EnvironmentsData();
inline void getEnvironment(
@@ -147,6 +148,8 @@ struct EnvironmentsData
inline void getRegisteredEnvironments(
uno_Environment *** pppEnvs, sal_Int32 * pnLen,
uno_memAlloc memAlloc, const OUString & rEnvDcp );
+
+ bool isDisposing;
};
namespace
@@ -595,9 +598,14 @@ static void SAL_CALL defenv_harden(
*ppHardEnv = 0;
}
+ EnvironmentsData & rData = theEnvironmentsData::get();
+
+ if (rData.isDisposing)
+ return;
+
uno_DefaultEnvironment * that = (uno_DefaultEnvironment *)pEnv;
{
- ::osl::MutexGuard guard( theEnvironmentsData::get().mutex );
+ ::osl::MutexGuard guard( rData.mutex );
if (1 == ::osl_incrementInterlockedCount( &that->nRef )) // is dead
{
that->nRef = 0;
@@ -914,6 +922,7 @@ static void SAL_CALL unoenv_releaseInterface(
EnvironmentsData::~EnvironmentsData()
{
::osl::MutexGuard guard( mutex );
+ isDisposing = true;
for ( OUString2EnvironmentMap::const_iterator iPos( aName2EnvMap.begin() );
iPos != aName2EnvMap.end(); ++iPos )
@@ -928,11 +937,7 @@ EnvironmentsData::~EnvironmentsData()
#if OSL_DEBUG_LEVEL > 1
::uno_dumpEnvironment( 0, pHard, 0 );
#endif
-#if defined CPPU_LEAK_STATIC_DATA
- pHard->environmentDisposing = 0; // set to null => wont be called
-#else
(*pHard->dispose)( pHard ); // send explicit dispose
-#endif
(*pHard->release)( pHard );
}
}
diff --git a/cppu/util/target.pmk b/cppu/util/target.pmk
index 4e456b206..3befcb154 100644
--- a/cppu/util/target.pmk
+++ b/cppu/util/target.pmk
@@ -51,12 +51,3 @@ CFLAGS += -Ob0
.ENDIF
.ENDIF
-
-# other stuff
-
-.IF "$(cppu_no_leak)" == ""
-.IF "$(bndchk)" == ""
-CFLAGS += -DCPPU_LEAK_STATIC_DATA
-.ENDIF
-.ENDIF
-
diff --git a/cppuhelper/inc/cppuhelper/factory.hxx b/cppuhelper/inc/cppuhelper/factory.hxx
index 4320acb98..1dd04173c 100644
--- a/cppuhelper/inc/cppuhelper/factory.hxx
+++ b/cppuhelper/inc/cppuhelper/factory.hxx
@@ -87,6 +87,9 @@ typedef void (SAL_CALL * component_getImplementationEnvironmentExtFunc)(
typedef const sal_Char * (SAL_CALL * component_getDescriptionFunc)(void);
/** Function pointer declaration.
+
+ @obsolete component_writeInfo should no longer be used in new components
+
Function writes component registry info, at least writing the supported service names.
@param pServiceManager
diff --git a/cppuhelper/inc/cppuhelper/implementationentry.hxx b/cppuhelper/inc/cppuhelper/implementationentry.hxx
index f74493210..e52e658d8 100644
--- a/cppuhelper/inc/cppuhelper/implementationentry.hxx
+++ b/cppuhelper/inc/cppuhelper/implementationentry.hxx
@@ -72,6 +72,8 @@ struct ImplementationEntry
/** Helper function for implementation of the component_writeInfo()-function.
+ @obsolete component_writeInfo should no longer be used in new components
+
@param pServiceManager The first parameter passed to component_writeInfo()-function
(This is an instance of the service manager, that creates the factory).
@param pRegistryKey The second parameter passed to the component_writeInfo()-function.
@@ -90,9 +92,9 @@ sal_Bool component_writeInfoHelper(
@param pImplName The implementation-name to be instantiated ( This is the
first parameter passed to the component_getFactory
- @param pServiceManager The first parameter passed to component_writeInfo()-function
+ @param pServiceManager The second parameter passed to component_getFactory()-function
(This is a of the service manager, that creates the factory).
- @param pRegistryKey The second parameter passed to the component_writeInfo()-function.
+ @param pRegistryKey The third parameter passed to the component_getFactory()-function.
This is a reference to the registry key, where the implementation
data has been written to.
@param entries Each element of the entries-array must contains a function pointer
diff --git a/cppuhelper/inc/cppuhelper/interfacecontainer.h b/cppuhelper/inc/cppuhelper/interfacecontainer.h
index bb8ea3d0e..5e7d1ff4a 100644
--- a/cppuhelper/inc/cppuhelper/interfacecontainer.h
+++ b/cppuhelper/inc/cppuhelper/interfacecontainer.h
@@ -44,6 +44,17 @@
namespace cppu
{
+namespace detail {
+
+ union element_alias
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > *pAsSequence;
+ ::com::sun::star::uno::XInterface * pAsInterface;
+ element_alias() : pAsInterface(0) {}
+ };
+
+}
+
//===================================================================
class OInterfaceContainerHelper;
/**
@@ -95,7 +106,9 @@ public:
private:
OInterfaceContainerHelper & rCont;
sal_Bool bIsList;
- void * pData;
+
+ detail::element_alias aData;
+
sal_Int32 nRemain;
OInterfaceIteratorHelper( const OInterfaceIteratorHelper & ) SAL_THROW( () );
@@ -222,14 +235,14 @@ public:
private:
friend class OInterfaceIteratorHelper;
/**
- bIsList == TRUE -> pData of type Sequence< XInterfaceSequence >,
- otherwise pData == of type (XEventListener *)
+ bIsList == TRUE -> aData.pAsSequence of type Sequence< XInterfaceSequence >,
+ otherwise aData.pAsInterface == of type (XEventListener *)
*/
- void * pData;
+ detail::element_alias aData;
::osl::Mutex & rMutex;
/** TRUE -> used by an iterator. */
sal_Bool bInUse;
- /** TRUE -> pData is of type Sequence< XInterfaceSequence >. */
+ /** TRUE -> aData.pAsSequence is of type Sequence< XInterfaceSequence >. */
sal_Bool bIsList;
OInterfaceContainerHelper( const OInterfaceContainerHelper & ) SAL_THROW( () );
diff --git a/cppuhelper/inc/cppuhelper/shlib.hxx b/cppuhelper/inc/cppuhelper/shlib.hxx
index 044b30758..42299fa08 100644
--- a/cppuhelper/inc/cppuhelper/shlib.hxx
+++ b/cppuhelper/inc/cppuhelper/shlib.hxx
@@ -64,7 +64,9 @@ SAL_CALL loadSharedLibComponentFactory(
(e.g. xxx.dll). You can give parameter rPath to force lookup of the library in a specific
directory. The resulting path of the library will be checked against environment variable
CPLD_ACCESSPATH if set.
-
+
+ @obsolete component_writeInfo should no longer be used in new components
+
@param rLibName name of the library
@param rPath optional path
@param xMgr service manager to be provided to the component
diff --git a/cppuhelper/qa/propertysetmixin/JavaSupplier.java b/cppuhelper/qa/propertysetmixin/JavaSupplier.java
index 513f207ab..834e448c6 100644
--- a/cppuhelper/qa/propertysetmixin/JavaSupplier.java
+++ b/cppuhelper/qa/propertysetmixin/JavaSupplier.java
@@ -75,11 +75,6 @@ public final class JavaSupplier extends WeakBase implements XSupplier {
: null;
}
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(
- implementationName, serviceName, regKey);
- }
-
private static final String implementationName
= JavaSupplier.class.getName();
private static final String serviceName
diff --git a/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx b/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx
index 67571e82c..c6eccecb4 100644
--- a/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx
+++ b/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx
@@ -427,10 +427,3 @@ extern "C" void SAL_CALL component_getImplementationEnvironment(
{
*envTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
-
-extern "C" sal_Bool SAL_CALL component_writeInfo(
- void * serviceManager, void * registryKey)
-{
- return cppu::component_writeInfoHelper(
- serviceManager, registryKey, entries);
-}
diff --git a/cppuhelper/qa/propertysetmixin/makefile.mk b/cppuhelper/qa/propertysetmixin/makefile.mk
index edd4795fc..04aa2479c 100644
--- a/cppuhelper/qa/propertysetmixin/makefile.mk
+++ b/cppuhelper/qa/propertysetmixin/makefile.mk
@@ -37,6 +37,8 @@ PACKAGE = test/cppuhelper/propertysetmixin/comp
ENABLE_EXCEPTIONS := TRUE
+my_components = $(TARGET).cpp $(TARGET).java
+
.INCLUDE: settings.mk
.IF "$(OS)" == "WNT"
@@ -75,51 +77,62 @@ JARFILES = java_uno.jar juh.jar jurt.jar ridl.jar
ALLTAR: test
$(MISC)/$(TARGET)/types.urd: types.idl
- - $(MKDIR) $(@:d)
+ $(MKDIRHIER) $(@:d)
$(IDLC) -O$(@:d) -I$(SOLARIDLDIR) -cid -we $<
$(MISC)/$(TARGET)/types.rdb: $(MISC)/$(TARGET)/types.urd
- $(RM) $@
$(REGMERGE) $@ /UCR $<
-$(MISC)/$(TARGET)/uno.rdb: $(MISC)/$(TARGET)/types.rdb $(SHL2TARGETN) \
- $(MISC)/$(TARGET)/$(TARGET).uno.jar $(MISC)/$(TARGET)/bootstrap.rdb
- - $(MKDIR) $(@:d)
- $(COPY) $(SOLARBINDIR)/types.rdb $@
- $(REGMERGE) $@ / $(MISC)/$(TARGET)/types.rdb
- $(REGCOMP) -register -r $@ -wop -c javaloader.uno -c javavm.uno \
- -c reflection.uno -c stocservices.uno -c $(SHL2TARGETN)
- $(REGCOMP) -register -br $(MISC)/$(TARGET)/bootstrap.rdb -r $@ \
- -c $(my_file)$(PWD)/$(MISC)/$(TARGET)/$(TARGET).uno.jar \
- -env:URE_INTERNAL_JAVA_DIR=$(my_file)$(SOLARBINDIR)
-
-$(MISC)/$(TARGET)/bootstrap.rdb:
- - $(MKDIR) $(@:d)
- $(COPY) $(SOLARBINDIR)/types.rdb $@
- $(REGCOMP) -register -r $@ -wop -c javaloader.uno -c javavm.uno \
- -c stocservices.uno
-
$(MISC)/$(TARGET)/cppumaker.flag: $(MISC)/$(TARGET)/types.rdb
$(CPPUMAKER) -O$(MISC)/$(TARGET)/inc -BUCR -Gc \
- -X$(SOLARBINDIR)/types.rdb $<
+ -X$(SOLARBINDIR)/udkapi.rdb $<
$(TOUCH) $@
$(SLOFILES): $(MISC)/$(TARGET)/cppumaker.flag
$(MISC)/$(TARGET)/javamaker.flag: $(MISC)/$(TARGET)/types.rdb
- $(JAVAMAKER) -O$(CLASSDIR) -BUCR -nD -Gc -X$(SOLARBINDIR)/types.rdb $<
+ $(JAVAMAKER) -O$(CLASSDIR) -BUCR -nD -Gc -X$(SOLARBINDIR)/udkapi.rdb $<
$(TOUCH) $@
$(JAVATARGET): $(MISC)/$(TARGET)/javamaker.flag
+$(MISC)/$(TARGET)/services.rdb .ERRREMOVE: $(SOLARENV)/bin/packcomponents.xslt \
+ $(MISC)/$(TARGET)/services.input \
+ $(my_components:^"$(MISC)/$(TARGET)/":+".component")
+ $(XSLTPROC) --nonet --stringparam prefix $(PWD)/$(MISC)/$(TARGET)/ -o $@ \
+ $(SOLARENV)/bin/packcomponents.xslt $(MISC)/$(TARGET)/services.input
+
+$(MISC)/$(TARGET)/services.input:
+ $(MKDIRHIER) $(@:d)
+ echo \
+ '<list>$(my_components:^"<filename>":+".component</filename>")</list>' \
+ > $@
+
+$(MISC)/$(TARGET)/$(TARGET).cpp.component .ERRREMOVE: \
+ $(SOLARENV)/bin/createcomponent.xslt $(TARGET).cpp.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_INBUILD_NATIVE)$(SHL2TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt $(TARGET).cpp.component
+
+$(MISC)/$(TARGET)/$(TARGET).java.component .ERRREMOVE: \
+ $(SOLARENV)/bin/createcomponent.xslt $(TARGET).java.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_INBUILD_JAVA)$(TARGET).uno.jar' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt $(TARGET).java.component
+
$(MISC)/$(TARGET)/$(TARGET).uno.jar: $(JAVATARGET) \
$(MISC)/$(TARGET)/javamaker.flag manifest
jar cfm $@ manifest -C $(CLASSDIR) test/cppuhelper/propertysetmixin
-test .PHONY: $(SHL1TARGETN) $(MISC)/$(TARGET)/uno.rdb
+test .PHONY: $(SHL1TARGETN) $(SHL2TARGETN) $(MISC)/$(TARGET)/$(TARGET).uno.jar \
+ $(MISC)/$(TARGET)/types.rdb $(MISC)/$(TARGET)/services.rdb
$(CPPUNITTESTER) $(SHL1TARGETN) \
- -env:URE_INTERNAL_JAVA_DIR=$(my_file)$(SOLARBINDIR) \
+ '-env:UNO_TYPES=$(my_file)$(SOLARBINDIR)/udkapi.rdb $(my_file)$(PWD)/$(MISC)/$(TARGET)/types.rdb' \
+ '-env:UNO_SERVICES=$(my_file)$(SOLARXMLDIR)/ure/services.rdb $(my_file)$(PWD)/$(MISC)/$(TARGET)/services.rdb'\
-env:URE_INTERNAL_LIB_DIR=$(my_file)$(SOLARSHAREDBIN) \
- -env:arg-reg=$(MISC)/$(TARGET)/uno.rdb -env:arg-path=$(SOLARSHAREDBIN)
+ -env:URE_INTERNAL_JAVA_DIR=$(my_file)$(SOLARBINDIR) \
+ -env:OOO_INBUILD_SHAREDLIB_DIR=$(my_file)$(PWD)/$(DLLDEST) \
+ -env:OOO_INBUILD_JAR_DIR=$(my_file)$(PWD)/$(MISC)/$(TARGET)
.END
diff --git a/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component
new file mode 100644
index 000000000..a654e0758
--- /dev/null
+++ b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="test.cppuhelper.propertysetmixin.comp.CppSupplier">
+ <service name="test.cppuhelper.propertysetmixin.CppSupplier"/>
+ </implementation>
+</component>
diff --git a/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.java.component b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.java.component
new file mode 100644
index 000000000..9711563b7
--- /dev/null
+++ b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.java.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.Java2"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="test.cppuhelper.propertysetmixin.comp.JavaSupplier">
+ <service name="test.cppuhelper.propertysetmixin.JavaSupplier"/>
+ </implementation>
+</component>
diff --git a/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx b/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx
index 82256c634..9a25e9885 100644
--- a/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx
+++ b/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx
@@ -52,21 +52,19 @@
#include "com/sun/star/beans/XPropertySetInfo.hpp"
#include "com/sun/star/beans/XVetoableChangeListener.hpp"
#include "com/sun/star/lang/XComponent.hpp"
-#include "com/sun/star/lang/XMultiComponentFactory.hpp"
#include "com/sun/star/uno/Any.hxx"
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/Sequence.hxx"
#include "com/sun/star/uno/Type.hxx"
#include "com/sun/star/uno/XComponentContext.hpp"
+#include "cppuhelper/bootstrap.hxx"
#include "cppuhelper/implbase1.hxx"
-#include "cppuhelper/servicefactory.hxx"
#include "cppunit/TestAssert.h"
#include "cppunit/TestFixture.h"
#include "cppunit/extensions/HelperMacros.h"
#include "cppunit/plugin/TestPlugIn.h"
#include "osl/mutex.hxx"
-#include "rtl/bootstrap.hxx"
#include "rtl/ref.hxx"
#include "rtl/string.h"
#include "rtl/textenc.h"
@@ -98,14 +96,6 @@ std::ostream & operator <<(std::ostream & out, css::uno::Any const & value) {
out << "com::sun::star::uno::Any[" << value.getValueType() << ", ...]";
}
-rtl::OUString getArgument(rtl::OUString const & name) {
- rtl::OUString val;
- CPPUNIT_ASSERT(
- rtl::Bootstrap::get(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("arg-")) + name, val));
- return val;
-}
-
class BoundListener:
public cppu::WeakImplHelper1< css::beans::XPropertyChangeListener >
{
@@ -178,7 +168,7 @@ class Test: public CppUnit::TestFixture {
public:
virtual void setUp();
- void finish();
+ virtual void tearDown();
void testCppEmpty1() { testEmpty1(getCppSupplier()); }
@@ -199,7 +189,6 @@ public:
CPPUNIT_TEST(testJavaEmpty1);
CPPUNIT_TEST(testJavaEmpty2);
CPPUNIT_TEST(testJavaFull);
- CPPUNIT_TEST(finish);
CPPUNIT_TEST_SUITE_END();
private:
@@ -221,30 +210,15 @@ private:
css::uno::Reference< test::cppuhelper::propertysetmixin::XSupplier >
const & supplier) const;
- static css::uno::Reference< css::uno::XComponentContext > m_context;
+ css::uno::Reference< css::uno::XComponentContext > m_context;
};
void Test::setUp() {
- // For whatever reason, on W32 it does not work to create/destroy a fresh
- // component context for each test in Test::setUp/tearDown; therefore, a
- // single component context is used for all tests and destroyed in the last
- // pseudo-test "finish":
- if (!m_context.is()) {
- css::uno::Reference< css::lang::XMultiComponentFactory > factory(
- cppu::createRegistryServiceFactory(
- getArgument(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("reg"))),
- sal_False,
- getArgument(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("path")))),
- css::uno::UNO_QUERY_THROW);
- css::uno::Reference< css::beans::XPropertySet >(
- factory, css::uno::UNO_QUERY_THROW)->getPropertyValue(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")))
- >>= m_context;
- }
+ m_context = cppu::defaultBootstrap_InitialComponentContext();
+ CPPUNIT_ASSERT(m_context.is());
}
-void Test::finish() {
+void Test::tearDown() {
css::uno::Reference< css::lang::XComponent >(
m_context, css::uno::UNO_QUERY_THROW)->dispose();
}
@@ -671,8 +645,6 @@ void Test::testFull(
} catch (css::beans::UnknownPropertyException &) {}
}
-css::uno::Reference< css::uno::XComponentContext > Test::m_context;
-
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
}
diff --git a/cppuhelper/source/bootstrap.cxx b/cppuhelper/source/bootstrap.cxx
index 0dcb24b5a..b8af92fed 100644
--- a/cppuhelper/source/bootstrap.cxx
+++ b/cppuhelper/source/bootstrap.cxx
@@ -380,9 +380,15 @@ SAL_CALL defaultBootstrap_InitialComponentContext(
Bootstrap const & bootstrap )
SAL_THROW( (Exception) )
{
- OUString bootstrapPath( get_this_libpath() );
- OUString iniDir;
+ OUString bootstrapPath;
+ if (!bootstrap.getFrom(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URE_INTERNAL_LIB_DIR")),
+ bootstrapPath))
+ {
+ bootstrapPath = get_this_libpath();
+ }
+ OUString iniDir;
osl_getProcessWorkingDir(&iniDir.pData);
Reference<lang::XMultiComponentFactory> smgr_XMultiComponentFactory(
diff --git a/cppuhelper/source/interfacecontainer.cxx b/cppuhelper/source/interfacecontainer.cxx
index b1f45c687..b04b34b45 100644
--- a/cppuhelper/source/interfacecontainer.cxx
+++ b/cppuhelper/source/interfacecontainer.cxx
@@ -99,15 +99,15 @@ OInterfaceIteratorHelper::OInterfaceIteratorHelper( OInterfaceContainerHelper &
// worst case, two iterators at the same time
rCont.copyAndResetInUse();
bIsList = rCont_.bIsList;
- pData = rCont_.pData;
+ aData = rCont_.aData;
if( bIsList )
{
rCont.bInUse = sal_True;
- nRemain = ((Sequence< Reference< XInterface > >*)pData)->getLength();
+ nRemain = aData.pAsSequence->getLength();
}
- else if( pData )
+ else if( aData.pAsInterface )
{
- ((XInterface *)pData)->acquire();
+ aData.pAsInterface->acquire();
nRemain = 1;
}
else
@@ -120,7 +120,7 @@ OInterfaceIteratorHelper::~OInterfaceIteratorHelper() SAL_THROW( () )
{
MutexGuard aGuard( rCont.rMutex );
// bResetInUse protect the iterator against recursion
- bShared = pData == rCont.pData && rCont.bIsList;
+ bShared = aData.pAsSequence == rCont.aData.pAsSequence && rCont.bIsList;
if( bShared )
{
OSL_ENSURE( rCont.bInUse, "OInterfaceContainerHelper must be in use" );
@@ -132,10 +132,10 @@ OInterfaceIteratorHelper::~OInterfaceIteratorHelper() SAL_THROW( () )
{
if( bIsList )
// Sequence owned by the iterator
- delete (Sequence< Reference< XInterface > >*)pData;
- else if( pData )
+ delete aData.pAsSequence;
+ else if( aData.pAsInterface )
// Interface is acquired by the iterator
- ((XInterface*)pData)->release();
+ aData.pAsInterface->release();
}
}
@@ -146,9 +146,9 @@ XInterface * OInterfaceIteratorHelper::next() SAL_THROW( () )
nRemain--;
if( bIsList )
// typecase to const,so the getArray method is faster
- return ((const Sequence< Reference< XInterface > >*)pData)->getConstArray()[nRemain].get();
- else if( pData )
- return (XInterface*)pData;
+ return aData.pAsSequence->getConstArray()[nRemain].get();
+ else if( aData.pAsInterface )
+ return aData.pAsInterface;
}
// exception
return 0;
@@ -159,15 +159,14 @@ void OInterfaceIteratorHelper::remove() SAL_THROW( () )
if( bIsList )
{
OSL_ASSERT( nRemain >= 0 &&
- nRemain < ((const Sequence< Reference< XInterface > >*)pData)->getLength() );
- XInterface * p =
- ((const Sequence< Reference< XInterface > >*)pData)->getConstArray()[nRemain].get();
+ nRemain < aData.pAsSequence->getLength() );
+ XInterface * p = aData.pAsSequence->getConstArray()[nRemain].get();
rCont.removeInterface( * reinterpret_cast< const Reference< XInterface > * >( &p ) );
}
else
{
OSL_ASSERT( 0 == nRemain );
- rCont.removeInterface( * reinterpret_cast< const Reference< XInterface > * >(&pData));
+ rCont.removeInterface( * reinterpret_cast< const Reference< XInterface > * >(&aData.pAsInterface));
}
}
@@ -177,8 +176,7 @@ void OInterfaceIteratorHelper::remove() SAL_THROW( () )
OInterfaceContainerHelper::OInterfaceContainerHelper( Mutex & rMutex_ ) SAL_THROW( () )
- : pData( 0 )
- , rMutex( rMutex_ )
+ : rMutex( rMutex_ )
, bInUse( sal_False )
, bIsList( sal_False )
{
@@ -188,17 +186,17 @@ OInterfaceContainerHelper::~OInterfaceContainerHelper() SAL_THROW( () )
{
OSL_ENSURE( !bInUse, "~OInterfaceContainerHelper but is in use" );
if( bIsList )
- delete (Sequence< Reference< XInterface > >*)pData;
- else if( pData )
- ((XInterface*)pData)->release();
+ delete aData.pAsSequence;
+ else if( aData.pAsInterface )
+ aData.pAsInterface->release();
}
sal_Int32 OInterfaceContainerHelper::getLength() const SAL_THROW( () )
{
MutexGuard aGuard( rMutex );
if( bIsList )
- return ((Sequence< Reference< XInterface > >*)pData)->getLength();
- else if( pData )
+ return aData.pAsSequence->getLength();
+ else if( aData.pAsInterface )
return 1;
return 0;
}
@@ -207,10 +205,10 @@ Sequence< Reference<XInterface> > OInterfaceContainerHelper::getElements() const
{
MutexGuard aGuard( rMutex );
if( bIsList )
- return *(Sequence< Reference< XInterface > >*)pData;
- else if( pData )
+ return *aData.pAsSequence;
+ else if( aData.pAsInterface )
{
- Reference<XInterface> x( (XInterface *)pData );
+ Reference<XInterface> x( aData.pAsInterface );
return Sequence< Reference< XInterface > >( &x, 1 );
}
return Sequence< Reference< XInterface > >();
@@ -224,9 +222,9 @@ void OInterfaceContainerHelper::copyAndResetInUse() SAL_THROW( () )
// this should be the worst case. If a iterator is active
// and a new Listener is added.
if( bIsList )
- pData = new Sequence< Reference< XInterface > >( *(Sequence< Reference< XInterface > >*)pData );
- else if( pData )
- ((XInterface*)pData)->acquire();
+ aData.pAsSequence = new Sequence< Reference< XInterface > >( *aData.pAsSequence );
+ else if( aData.pAsInterface )
+ aData.pAsInterface->acquire();
bInUse = sal_False;
}
@@ -241,25 +239,25 @@ sal_Int32 OInterfaceContainerHelper::addInterface( const Reference<XInterface> &
if( bIsList )
{
- sal_Int32 nLen = ((Sequence< Reference< XInterface > >*)pData)->getLength();
- realloc( *(Sequence< Reference< XInterface > >*)pData, nLen +1 );
- ((Sequence< Reference< XInterface > >*)pData)->getArray()[ nLen ] = rListener;
+ sal_Int32 nLen = aData.pAsSequence->getLength();
+ realloc( *aData.pAsSequence, nLen +1 );
+ aData.pAsSequence->getArray()[ nLen ] = rListener;
return nLen +1;
}
- else if( pData )
+ else if( aData.pAsInterface )
{
Sequence< Reference< XInterface > > * pSeq = new Sequence< Reference< XInterface > >( 2 );
Reference<XInterface> * pArray = pSeq->getArray();
- pArray[0] = (XInterface *)pData;
+ pArray[0] = aData.pAsInterface;
pArray[1] = rListener;
- ((XInterface *)pData)->release();
- pData = pSeq;
+ aData.pAsInterface->release();
+ aData.pAsSequence = pSeq;
bIsList = sal_True;
return 2;
}
else
{
- pData = rListener.get();
+ aData.pAsInterface = rListener.get();
if( rListener.is() )
rListener->acquire();
return 1;
@@ -275,8 +273,8 @@ sal_Int32 OInterfaceContainerHelper::removeInterface( const Reference<XInterface
if( bIsList )
{
- const Reference<XInterface> * pL = ((const Sequence< Reference< XInterface > >*)pData)->getConstArray();
- sal_Int32 nLen = ((Sequence< Reference< XInterface > >*)pData)->getLength();
+ const Reference<XInterface> * pL = aData.pAsSequence->getConstArray();
+ sal_Int32 nLen = aData.pAsSequence->getLength();
sal_Int32 i;
for( i = 0; i < nLen; i++ )
{
@@ -284,7 +282,7 @@ sal_Int32 OInterfaceContainerHelper::removeInterface( const Reference<XInterface
// more faster.
if( pL[i].get() == rListener.get() )
{
- sequenceRemoveElementAt( *(Sequence< Reference< XInterface > >*)pData, i );
+ sequenceRemoveElementAt( *aData.pAsSequence, i );
break;
}
}
@@ -296,30 +294,30 @@ sal_Int32 OInterfaceContainerHelper::removeInterface( const Reference<XInterface
{
if( pL[i] == rListener )
{
- sequenceRemoveElementAt(*(Sequence< Reference< XInterface > >*)pData, i );
+ sequenceRemoveElementAt(*aData.pAsSequence, i );
break;
}
}
}
- if( ((Sequence< Reference< XInterface > >*)pData)->getLength() == 1 )
+ if( aData.pAsSequence->getLength() == 1 )
{
- XInterface * p = ((const Sequence< Reference< XInterface > >*)pData)->getConstArray()[0].get();
+ XInterface * p = aData.pAsSequence->getConstArray()[0].get();
p->acquire();
- delete (Sequence< Reference< XInterface > >*)pData;
- pData = p;
+ delete aData.pAsSequence;
+ aData.pAsInterface = p;
bIsList = sal_False;
return 1;
}
else
- return ((Sequence< Reference< XInterface > >*)pData)->getLength();
+ return aData.pAsSequence->getLength();
}
- else if( pData && Reference<XInterface>( (XInterface*)pData ) == rListener )
+ else if( aData.pAsInterface && Reference<XInterface>( aData.pAsInterface ) == rListener )
{
- ((XInterface *)pData)->release();
- pData = 0;
+ aData.pAsInterface->release();
+ aData.pAsInterface = 0;
}
- return pData ? 1 : 0;
+ return aData.pAsInterface ? 1 : 0;
}
void OInterfaceContainerHelper::disposeAndClear( const EventObject & rEvt ) SAL_THROW( () )
@@ -328,10 +326,10 @@ void OInterfaceContainerHelper::disposeAndClear( const EventObject & rEvt ) SAL_
OInterfaceIteratorHelper aIt( *this );
// Container freigeben, falls im disposing neue Einträge kommen
OSL_ENSURE( !bIsList || bInUse, "OInterfaceContainerHelper not in use" );
- if( !bIsList && pData )
- ((XInterface *)pData)->release();
+ if( !bIsList && aData.pAsInterface )
+ aData.pAsInterface->release();
// set the member to null, the iterator delete the values
- pData = NULL;
+ aData.pAsInterface = NULL;
bIsList = sal_False;
bInUse = sal_False;
aGuard.clear();
@@ -358,10 +356,10 @@ void OInterfaceContainerHelper::clear() SAL_THROW( () )
OInterfaceIteratorHelper aIt( *this );
// Container freigeben, falls im disposing neue Einträge kommen
OSL_ENSURE( !bIsList || bInUse, "OInterfaceContainerHelper not in use" );
- if( !bIsList && pData )
- ((XInterface *)pData)->release();
+ if( !bIsList && aData.pAsInterface )
+ aData.pAsInterface->release();
// set the member to null, the iterator delete the values
- pData = 0;
+ aData.pAsInterface = 0;
bIsList = sal_False;
bInUse = sal_False;
// release mutex before aIt destructor call
diff --git a/cppuhelper/source/servicefactory.cxx b/cppuhelper/source/servicefactory.cxx
index d1ae7f1a9..3dcea15c7 100644
--- a/cppuhelper/source/servicefactory.cxx
+++ b/cppuhelper/source/servicefactory.cxx
@@ -28,13 +28,9 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_cppuhelper.hxx"
-#if OSL_DEBUG_LEVEL > 0
-#include <stdio.h>
-#endif
#include <vector>
#include "rtl/string.hxx"
-#include "rtl/ustrbuf.hxx"
#include "rtl/bootstrap.hxx"
#include "osl/diagnose.h"
#include "osl/file.h"
@@ -46,6 +42,7 @@
#include "cppuhelper/servicefactory.hxx"
#include "cppuhelper/bootstrap.hxx"
+#include "com/sun/star/uno/DeploymentException.hpp"
#include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/lang/XInitialization.hpp"
#include "com/sun/star/lang/XSingleServiceFactory.hpp"
@@ -64,6 +61,7 @@ using namespace ::rtl;
using namespace ::osl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
+namespace css = com::sun::star;
namespace cppu
{
@@ -417,39 +415,42 @@ Reference< XComponentContext > bootstrapInitialContext(
keys.getConstArray();
for ( sal_Int32 nPos = keys.getLength(); nPos--; )
{
- Reference< registry::XRegistryKey > const & xKey2 =
- pKeys[ nPos ];
- try
- {
- OUStringBuffer buf( 32 );
- buf.appendAscii(
- RTL_CONSTASCII_STRINGPARAM("/singletons/") );
- buf.append(
- xKey2->getKeyName().copy(
- sizeof("/SINGLETONS") /* -\0 +'/' */ ) );
- entry.name = buf.makeStringAndClear();
- entry.value <<= xKey2->getStringValue();
- context_values.push_back( entry );
- }
- catch (Exception & rExc)
- {
-#if OSL_DEBUG_LEVEL > 0
- OString aStr(
- OUStringToOString(
- xKey2->getKeyName().copy( 11 ),
- RTL_TEXTENCODING_ASCII_US ) );
- OString aStr2(
- OUStringToOString(
- rExc.Message, RTL_TEXTENCODING_ASCII_US ) );
- fprintf(
- stderr,
- "### failed reading singleton [%s]"
- " service name from registry: %s\n",
- aStr.getStr(), aStr2.getStr() );
-#else
- (void) rExc; // avoid warning about unused variable
-#endif
+ css::uno::Sequence< rtl::OUString > impls(
+ css::uno::Reference< css::registry::XRegistryKey >(
+ pKeys[nPos]->openKey(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "REGISTERED_BY"))),
+ css::uno::UNO_SET_THROW)->getAsciiListValue());
+ switch (impls.getLength()) {
+ case 0:
+ throw css::uno::DeploymentException(
+ (pKeys[nPos]->getKeyName() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "/REGISTERED_BY is empty"))),
+ css::uno::Reference< css::uno::XInterface >());
+ case 1:
+ break;
+ default:
+ OSL_TRACE(
+ ("arbitrarily chosing \"%s\" among multiple"
+ " implementations for \"%s\""),
+ rtl::OUStringToOString(
+ impls[0], RTL_TEXTENCODING_UTF8).getStr(),
+ rtl::OUStringToOString(
+ pKeys[nPos]->getKeyName(),
+ RTL_TEXTENCODING_UTF8).getStr());
+ break;
}
+ context_values.push_back(
+ ContextEntry_Init(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("/singletons/")) +
+ pKeys[nPos]->getKeyName().copy(
+ RTL_CONSTASCII_LENGTH("/SINGLETONS/"))),
+ css::uno::makeAny(impls[0]),
+ true));
}
}
}
diff --git a/cpputools/prj/build.lst b/cpputools/prj/build.lst
index 7cd9053c5..ca820871b 100644
--- a/cpputools/prj/build.lst
+++ b/cpputools/prj/build.lst
@@ -2,7 +2,6 @@ pt cpputools : cppuhelper offuh LIBXML2:libxml2 NULL
pt cpputools usr1 - all pt_mkout NULL
pt cpputools\prj get - all pt_prj NULL
pt cpputools\source\registercomponent nmake - all pt_regcomp NULL
-pt cpputools\source\regcomplazy nmake - all pt_regcomplazy NULL
pt cpputools\source\regsingleton nmake - all pt_regsingleton NULL
pt cpputools\source\unoexe nmake - all pt_unoexe NULL
pt cpputools\source\sp2bv nmake - all pt_sp2bv NULL
diff --git a/cpputools/prj/d.lst b/cpputools/prj/d.lst
index fa029cc4d..14de5e78a 100644
--- a/cpputools/prj/d.lst
+++ b/cpputools/prj/d.lst
@@ -1,8 +1,6 @@
..\%__SRC%\bin\regcomp.exe %_DEST%\bin%_EXT%\regcomp.exe
..\%__SRC%\bin\regcomp %_DEST%\bin%_EXT%\regcomp
..\%__SRC%\bin\regcomp %_DEST%\bin%_EXT%\regcomp.bin
-..\%__SRC%\bin\regcomplazy.exe %_DEST%\bin%_EXT%\regcomplazy.exe
-..\%__SRC%\bin\regcomplazy %_DEST%\bin%_EXT%\regcomplazy
..\%__SRC%\bin\uno.exe %_DEST%\bin%_EXT%\uno.exe
..\%__SRC%\bin\uno %_DEST%\bin%_EXT%\uno
..\%__SRC%\bin\uno %_DEST%\bin%_EXT%\uno.bin
diff --git a/cpputools/source/regcomplazy/regcomplazy.cxx b/cpputools/source/regcomplazy/regcomplazy.cxx
deleted file mode 100755
index 00907602f..000000000
--- a/cpputools/source/regcomplazy/regcomplazy.cxx
+++ /dev/null
@@ -1,282 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include <stdio.h>
-
-#include "sal/main.h"
-#include <osl/diagnose.h>
-#include <osl/thread.h>
-#include <osl/file.hxx>
-#include <rtl/strbuf.hxx>
-#include <rtl/ustrbuf.hxx>
-
-#include <vector>
-
-#include <registry/registry.hxx>
-
-
-#define OUSTR(x) ::rtl::OUString::createFromAscii( x )
-#define OSToOUS(x) ::rtl::OStringToOUString(x, osl_getThreadTextEncoding())
-#define OUSToOS(x) ::rtl::OUStringToOString(x, osl_getThreadTextEncoding())
-using namespace ::rtl;
-
-typedef ::std::vector< ::rtl::OString > OSVector;
-
-struct CompDescriptor {
- OString sImplementationName;
- OString sComponentName;
- OString sLoaderName;
- OSVector vSupportedServices;
-};
-
-typedef ::std::vector< CompDescriptor > CDescrVector;
-
-static void print_options() SAL_THROW( () )
-{
- printf(
- "\nusage: regcomplazy [-v]registry_file cmp_descr_file ...\n\n"
- "Register a cmponent using a comp description file.\n"
- "Option -v prints verbose output on stdout.\n" );
-}
-
-static bool checkImplValue(RegistryValueList<sal_Char*>* pValueList, OString sImplName) {
- for (sal_uInt32 i=0; i < pValueList->getLength(); i++) {
- if (sImplName.equals(pValueList->getElement(i)))
- return true;
- }
-
- return false;
-}
-
-//==================================================================================================
-SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
-{
- if (argc < 3)
- {
- print_options();
- return 1;
- }
-
- bool bVerbose = false;
- int nPos = 1;
- if ('-' == argv[ nPos ][ 0 ] && 'v' == argv[ nPos ][ 1 ])
- {
- if ('\0' != argv[ nPos ][ 2 ])
- {
- print_options();
- return 1;
- }
- bVerbose = true;
- ++nPos;
- }
-
- OUString sys_path( OUSTR( argv[ nPos ] ) );
- OUString reg_url;
- oslFileError rc = osl_getFileURLFromSystemPath( sys_path.pData, &reg_url.pData );
- if (osl_File_E_None != rc)
- {
- if (bVerbose)
- fprintf( stderr, "\nERROR: cannot make file url out of %s\n", argv[nPos]);
- return 1;
- }
-
- FILE* fDescr = fopen(argv[ ++nPos ], "r");
- OStringBuffer sBuffer(512);
-
- if ( fDescr) {
- size_t totalSize = 0;
- size_t readSize = 0;
- char pBuffer[513];
-
- while ( !feof(fDescr) )
- {
- if ( (readSize = fread(pBuffer, 1, 512, fDescr)) > 0
- && !ferror(fDescr) ) {
- totalSize += readSize;
- if (totalSize >= 512)
- sBuffer.ensureCapacity(totalSize * 2);
-
- sBuffer.append(pBuffer, readSize);
- }
- }
- fclose(fDescr);
- fDescr = 0; // just to be sure noone tries to use the file ever after
- }
-
- OString sDescr = sBuffer.makeStringAndClear();
- sal_Int32 nTokenIndex = 0;
-
- CDescrVector vDescr;
- CompDescriptor descr;
- bool bFirst = true;
-
- do {
- OString sTmp = sDescr.getToken(0, '\x0A', nTokenIndex);
- OString sToken(sTmp);
- if (sTmp.pData->buffer[sTmp.getLength()-1] == '\x0D')
- sToken = sTmp.copy(0, sTmp.getLength()-1);
- if ( sToken.indexOf("[ComponentDescriptor]") >= 0) {
- if (bFirst)
- bFirst = false;
- else
- vDescr.push_back(descr);
-
- descr = CompDescriptor();
- }
- else if ( sToken.indexOf("ImplementationName=") >= 0) {
- descr.sImplementationName = sToken.copy(19);
- }
- else if ( sToken.indexOf("ComponentName=") >= 0) {
- descr.sComponentName = sToken.copy(14);
- }
- else if ( sToken.indexOf("LoaderName=") >= 0) {
- descr.sLoaderName = sToken.copy(11);
- }
- else if ( (sToken.indexOf("[SupportedServices]") < 0) &&
- (sToken.getLength() > 0) &&
- (sToken.pData->buffer[0] != '[') ) {
- descr.vSupportedServices.push_back(sToken);
- }
- } while (nTokenIndex >= 0 );
- // insert the last descriptor
- vDescr.push_back(descr);
-
- Registry *pReg = new Registry;
-
- RegistryKey rootKey, key, subKey, serviceKey;
-
- if (pReg->open(reg_url, REG_READWRITE))
- {
- if (pReg->create(reg_url))
- {
- if (bVerbose)
- fprintf(stderr, "ERROR: open registry \"%s\" failed\n", argv[1]);
- return 1;
- }
- }
- if (pReg->openRootKey(rootKey)) {
- if (bVerbose)
- fprintf(stderr, "ERROR: open root key failed\n");
- return 1;
- }
-
- CDescrVector::const_iterator comp_iter = vDescr.begin();
- do {
- OString sImplName = (*comp_iter).sImplementationName;
- OUStringBuffer sbImpl;
- sbImpl.appendAscii("/IMPLEMENTATIONS/");
- sbImpl.append(OSToOUS(sImplName));
- OUString sImplKeyName = sbImpl.makeStringAndClear();
-
- if (rootKey.openKey(sImplKeyName, key) == REG_NO_ERROR) {
- if (bVerbose) {
- fprintf(stderr, "WARNING: implementation entry for \"%s\" already exists, existing entries are overwritten\n", sImplName.getStr());
- }
- } else {
- if (rootKey.createKey(sImplKeyName, key)) {
- if (bVerbose) {
- fprintf(stderr, "ERROR: can't create new implementation entry \"%s\".\n", sImplName.getStr());
- }
- return 1;
- }
- }
-
- OString sLoaderName = (*comp_iter).sLoaderName;
- OUString usKeyName(OUSTR("UNO/ACTIVATOR"));
- key.createKey(usKeyName, subKey);
- subKey.setValue(OUString(), RG_VALUETYPE_STRING,
- (sal_Char*)sLoaderName.getStr(), sLoaderName.getLength()+1);
-
- OString sCompName = (*comp_iter).sComponentName;
- usKeyName = OUSTR("UNO/LOCATION");
- key.createKey(usKeyName, subKey);
- subKey.setValue(OUString(), RG_VALUETYPE_STRING,
- (sal_Char*)sCompName.getStr(), sCompName.getLength()+1);
-
- usKeyName = OUSTR("UNO/SERVICES");
- key.createKey(usKeyName, subKey);
-
- rootKey.createKey(OUSTR("/SERVICES"), serviceKey);
-
- OSVector::const_iterator serv_iter = ((*comp_iter).vSupportedServices).begin();
- OUString usServiceKeyName;
- do {
- usServiceKeyName = OSToOUS(*serv_iter);
- // write service key in impl section
- subKey.createKey(usServiceKeyName, key);
-
- if (serviceKey.openKey(usServiceKeyName, key) == REG_NO_ERROR) {
- RegistryValueList<sal_Char*> valueList;
- serviceKey.getStringListValue(usServiceKeyName, valueList);
- if ( checkImplValue(&valueList, sImplName) ) {
- serv_iter++;
- continue;
- }
-
- sal_uInt32 nServices = valueList.getLength()+1;
- sal_Char** pImplList = (sal_Char**)rtl_allocateZeroMemory(
- nServices * sizeof(sal_Char*));
- pImplList[0] = (sal_Char*)rtl_allocateZeroMemory(
- sImplName.getLength()+1 * sizeof(sal_Char));
- rtl_copyMemory(pImplList[0], (sal_Char*)sImplName.getStr(),
- sImplName.getLength()+1);
- for (sal_uInt32 i=0; i < valueList.getLength(); i++) {
- pImplList[i+1]=valueList.getElement(i);
- }
- key.setStringListValue(OUString(), pImplList, nServices);
-
- // free memory
- rtl_freeMemory(pImplList[0]);
- rtl_freeMemory(pImplList);
-
- } else {
- serviceKey.createKey(usServiceKeyName, key);
-
- sal_Char* pImplList[1];
- pImplList[0] = (sal_Char*)rtl_allocateZeroMemory(
- sImplName.getLength()+1 * sizeof(sal_Char));
- rtl_copyMemory(pImplList[0], (sal_Char*)sImplName.getStr(),
- sImplName.getLength()+1);
- key.setStringListValue(OUString(), pImplList, 1);
-
- // free memory
- rtl_freeMemory(pImplList[0]);
- }
- serv_iter++;
- } while (serv_iter != (*comp_iter).vSupportedServices.end());
-
- comp_iter++;
- } while (comp_iter != vDescr.end());
-
- key.closeKey();
- subKey.closeKey();
- serviceKey.closeKey();
- rootKey.closeKey();
- pReg->close();
-
- return 0;
-}
diff --git a/io/prj/d.lst b/io/prj/d.lst
index 9d19e5f8e..eaadf64db 100644
--- a/io/prj/d.lst
+++ b/io/prj/d.lst
@@ -5,3 +5,8 @@
..\source\stm\stm.xml %_DEST%\xml%_EXT%\streams.uno.xml
..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\*
..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*
+..\%__SRC%\misc\acceptor.component %_DEST%\xml%_EXT%\acceptor.component
+..\%__SRC%\misc\connector.component %_DEST%\xml%_EXT%\connector.component
+..\%__SRC%\misc\streams.component %_DEST%\xml%_EXT%\streams.component
+..\%__SRC%\misc\textinstream.component %_DEST%\xml%_EXT%\textinstream.component
+..\%__SRC%\misc\textoutstream.component %_DEST%\xml%_EXT%\textoutstream.component
diff --git a/io/source/TextInputStream/TextInputStream.cxx b/io/source/TextInputStream/TextInputStream.cxx
index 3fa833139..c7ea60d7d 100644
--- a/io/source/TextInputStream/TextInputStream.cxx
+++ b/io/source/TextInputStream/TextInputStream.cxx
@@ -521,12 +521,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//==================================================================================================
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries );
-}
-//==================================================================================================
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
diff --git a/io/source/TextInputStream/makefile.mk b/io/source/TextInputStream/makefile.mk
index 3c0cd5c57..ea476c57c 100644
--- a/io/source/TextInputStream/makefile.mk
+++ b/io/source/TextInputStream/makefile.mk
@@ -59,3 +59,11 @@ DEF1NAME= $(SHL1TARGET)
.ENDIF # L10N_framework
.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/textinstream.component
+
+$(MISC)/textinstream.component .ERRREMOVE : \
+ $(SOLARENV)/bin/createcomponent.xslt textinstream.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt textinstream.component
diff --git a/io/source/TextInputStream/textinstream.component b/io/source/TextInputStream/textinstream.component
new file mode 100644
index 000000000..6ac7d2a98
--- /dev/null
+++ b/io/source/TextInputStream/textinstream.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.io.TextInputStream">
+ <service name="com.sun.star.io.TextInputStream"/>
+ </implementation>
+</component>
diff --git a/io/source/TextOutputStream/TextOutputStream.cxx b/io/source/TextOutputStream/TextOutputStream.cxx
index b0a70f55c..3232d43cc 100644
--- a/io/source/TextOutputStream/TextOutputStream.cxx
+++ b/io/source/TextOutputStream/TextOutputStream.cxx
@@ -319,12 +319,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//==================================================================================================
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries );
-}
-//==================================================================================================
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
diff --git a/io/source/TextOutputStream/makefile.mk b/io/source/TextOutputStream/makefile.mk
index ad78178f8..2c9d4eb2e 100644
--- a/io/source/TextOutputStream/makefile.mk
+++ b/io/source/TextOutputStream/makefile.mk
@@ -60,3 +60,11 @@ DEF1NAME= $(SHL1TARGET)
.ENDIF # L10N_framework
.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/textoutstream.component
+
+$(MISC)/textoutstream.component .ERRREMOVE : \
+ $(SOLARENV)/bin/createcomponent.xslt textoutstream.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt textoutstream.component
diff --git a/io/source/TextOutputStream/textoutstream.component b/io/source/TextOutputStream/textoutstream.component
new file mode 100644
index 000000000..afbc50ab8
--- /dev/null
+++ b/io/source/TextOutputStream/textoutstream.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.io.TextOutputStream">
+ <service name="com.sun.star.io.TextOutputStream"/>
+ </implementation>
+</component>
diff --git a/io/source/acceptor/acceptor.component b/io/source/acceptor/acceptor.component
new file mode 100644
index 000000000..81e0399b2
--- /dev/null
+++ b/io/source/acceptor/acceptor.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.io.Acceptor">
+ <service name="com.sun.star.connection.Acceptor"/>
+ </implementation>
+</component>
diff --git a/io/source/acceptor/acceptor.cxx b/io/source/acceptor/acceptor.cxx
index 9cc2d0ebd..a21b05ddb 100644
--- a/io/source/acceptor/acceptor.cxx
+++ b/io/source/acceptor/acceptor.cxx
@@ -366,12 +366,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//==================================================================================================
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries );
-}
-//==================================================================================================
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
diff --git a/io/source/acceptor/makefile.mk b/io/source/acceptor/makefile.mk
index 3da3fbe18..bbc7ac6d3 100644
--- a/io/source/acceptor/makefile.mk
+++ b/io/source/acceptor/makefile.mk
@@ -71,3 +71,11 @@ DEF1NAME= $(SHL1TARGET)
.ENDIF # L10N_framework
.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/acceptor.component
+
+$(MISC)/acceptor.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ acceptor.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt acceptor.component
diff --git a/io/source/connector/connector.component b/io/source/connector/connector.component
new file mode 100644
index 000000000..95fa72aa5
--- /dev/null
+++ b/io/source/connector/connector.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.io.Connector">
+ <service name="com.sun.star.connection.Connector"/>
+ </implementation>
+</component>
diff --git a/io/source/connector/connector.cxx b/io/source/connector/connector.cxx
index a9a69a351..49b6c860b 100644
--- a/io/source/connector/connector.cxx
+++ b/io/source/connector/connector.cxx
@@ -278,12 +278,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//==================================================================================================
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries );
-}
-//==================================================================================================
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
diff --git a/io/source/connector/makefile.mk b/io/source/connector/makefile.mk
index 7f12b850f..e3a67abe6 100644
--- a/io/source/connector/makefile.mk
+++ b/io/source/connector/makefile.mk
@@ -71,3 +71,11 @@ DEF1NAME= $(SHL1TARGET)
.ENDIF # L10N_framework
.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/connector.component
+
+$(MISC)/connector.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ connector.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt connector.component
diff --git a/io/source/stm/factreg.cxx b/io/source/stm/factreg.cxx
index 50a2f673b..24c858efa 100644
--- a/io/source/stm/factreg.cxx
+++ b/io/source/stm/factreg.cxx
@@ -110,12 +110,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//==================================================================================================
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries );
-}
-//==================================================================================================
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
diff --git a/io/source/stm/makefile.mk b/io/source/stm/makefile.mk
index a6a163eca..52dd0c492 100644
--- a/io/source/stm/makefile.mk
+++ b/io/source/stm/makefile.mk
@@ -75,3 +75,10 @@ DEF1NAME= $(SHL1TARGET)
.INCLUDE : target.mk
+ALLTAR : $(MISC)/streams.component
+
+$(MISC)/streams.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ streams.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt streams.component
diff --git a/io/source/stm/streams.component b/io/source/stm/streams.component
new file mode 100644
index 000000000..76890d360
--- /dev/null
+++ b/io/source/stm/streams.component
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.io.Pump">
+ <service name="com.sun.star.io.Pump"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.io.stm.DataInputStream">
+ <service name="com.sun.star.io.DataInputStream"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.io.stm.DataOutputStream">
+ <service name="com.sun.star.io.DataOutputStream"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.io.stm.MarkableInputStream">
+ <service name="com.sun.star.io.MarkableInputStream"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.io.stm.MarkableOutputStream">
+ <service name="com.sun.star.io.MarkableOutputStream"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.io.stm.ObjectInputStream">
+ <service name="com.sun.star.io.ObjectInputStream"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.io.stm.ObjectOutputStream">
+ <service name="com.sun.star.io.ObjectOutputStream"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.io.stm.Pipe">
+ <service name="com.sun.star.io.Pipe"/>
+ </implementation>
+</component>
diff --git a/javaunohelper/com/sun/star/comp/JavaUNOHelperServices.java b/javaunohelper/com/sun/star/comp/JavaUNOHelperServices.java
index 411779faf..7df6497a1 100644
--- a/javaunohelper/com/sun/star/comp/JavaUNOHelperServices.java
+++ b/javaunohelper/com/sun/star/comp/JavaUNOHelperServices.java
@@ -28,7 +28,6 @@ package com.sun.star.comp;
import com.sun.star.lib.uno.helper.Factory;
import com.sun.star.lang.XSingleComponentFactory;
-import com.sun.star.registry.XRegistryKey;
import com.sun.star.comp.juhtest.SmoketestCommandEnvironment;
@@ -62,20 +61,4 @@ public class JavaUNOHelperServices {
return xFactory;
}
-
- /**
- * Writes the service information into the given registry key.
- * This method is called by the <code>JavaLoader</code>
- * <p>
- * @return returns true if the operation succeeded
- * @param regKey the registryKey
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return Factory.writeRegistryServiceInfo(SmoketestCommandEnvironment.class.getName(),
- SmoketestCommandEnvironment.getServiceNames(),
- regKey);
- }
}
-
-
diff --git a/javaunohelper/prj/d.lst b/javaunohelper/prj/d.lst
index 1fbd9c223..d58290843 100644
--- a/javaunohelper/prj/d.lst
+++ b/javaunohelper/prj/d.lst
@@ -2,5 +2,6 @@
..\%__SRC%\bin\juh*.dll %_DEST%\bin%_EXT%\juh*.dll
..\%__SRC%\lib\libjuh*.so %_DEST%\lib%_EXT%\libjuh*.so
..\%__SRC%\lib\libjuh*.dylib %_DEST%\lib%_EXT%\libjuh*.dylib
+..\%__SRC%\misc\juh.component %_DEST%\xml%_EXT%\juh.component
..\%__SRC%\bin\juh_src.zip %COMMON_DEST%\bin%_EXT%\juh_src.zip
diff --git a/javaunohelper/util/juh.component b/javaunohelper/util/juh.component
new file mode 100644
index 000000000..790a2a2b1
--- /dev/null
+++ b/javaunohelper/util/juh.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.Java2"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.juhtest.SmoketestCommandEnvironment">
+ <service name="com.sun.star.deployment.test.SmoketestCommandEnvironment"/>
+ </implementation>
+</component>
diff --git a/javaunohelper/util/makefile.mk b/javaunohelper/util/makefile.mk
index 22b3a72be..796280eb3 100644
--- a/javaunohelper/util/makefile.mk
+++ b/javaunohelper/util/makefile.mk
@@ -50,4 +50,9 @@ ZIP1LIST=com -x "*makefile.mk"
.INCLUDE : target.mk
+ALLTAR : $(MISC)/juh.component
+$(MISC)/juh.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ juh.component
+ $(XSLTPROC) --nonet --stringparam uri '$(COMPONENTPREFIX_URE_JAVA)juh.jar' \
+ -o $@ $(SOLARENV)/bin/createcomponent.xslt juh.component
diff --git a/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java b/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java
index 89174467a..23516fef0 100644
--- a/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java
+++ b/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java
@@ -92,18 +92,6 @@ public class BridgeFactory implements XBridgeFactory/*, XEventListener*/ {
return xSingleServiceFactory;
}
-
- /**
- * Writes the service information into the given registry key.
- * This method is called by the <code>JavaLoader</code>
- * <p>
- * @return returns true if the operation succeeded
- * @param regKey the registryKey
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(BridgeFactory.class.getName(), __serviceName, regKey);
- }
/**
* Creates a remote bridge and memorizes it under <code>sName</code>.
diff --git a/jurt/com/sun/star/comp/connections/Acceptor.java b/jurt/com/sun/star/comp/connections/Acceptor.java
index 2539bb528..1b0cf9c6e 100644
--- a/jurt/com/sun/star/comp/connections/Acceptor.java
+++ b/jurt/com/sun/star/comp/connections/Acceptor.java
@@ -84,21 +84,6 @@ public final class Acceptor implements XAcceptor {
}
/**
- * Writes the service information into the given registry key.
- *
- * <p>This method is called by the <code>JavaLoader</code>.</p>
- *
- * @param regKey the registry key.
- * @return <code>true</code> if the operation succeeded.
- *
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(Acceptor.class.getName(),
- __serviceName, regKey);
- }
-
- /**
* Constructs a new <code>Acceptor</code> that uses the given service
* factory to create a specific <code>XAcceptor</code>.
*
diff --git a/jurt/com/sun/star/comp/connections/Connector.java b/jurt/com/sun/star/comp/connections/Connector.java
index 6f0f351e2..3e0c38aed 100644
--- a/jurt/com/sun/star/comp/connections/Connector.java
+++ b/jurt/com/sun/star/comp/connections/Connector.java
@@ -84,21 +84,6 @@ public class Connector implements XConnector {
}
/**
- * Writes the service information into the given registry key.
- *
- * <p>This method is called by the <code>JavaLoader</code>.</p>
- *
- * @param regKey the registry key.
- * @return <code>true</code> if the operation succeeded.
- *
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(Connector.class.getName(),
- __serviceName, regKey);
- }
-
- /**
* Constructs a new <code>Connector</code> that uses the given service
* factory to create a specific <code>XConnector</code>.
*
diff --git a/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java b/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java
index d3e188f3f..ce64cb95d 100644
--- a/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java
+++ b/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java
@@ -84,20 +84,6 @@ public class ConstantInstanceProvider implements XInstanceProvider {
return xSingleServiceFactory;
}
-
- /**
- * Writes the service information into the given registry key.
- * This method is called by the <code>JavaLoader</code>
- * <p>
- * @return returns true if the operation succeeded
- * @param regKey the registryKey
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(ConstantInstanceProvider.class.getName(), __serviceName, regKey);
- }
-
-
protected XMultiServiceFactory _serviceManager;
protected String _serviceName;
diff --git a/jurt/com/sun/star/comp/connections/PipedConnection.java b/jurt/com/sun/star/comp/connections/PipedConnection.java
index ee772124e..719e24b15 100644
--- a/jurt/com/sun/star/comp/connections/PipedConnection.java
+++ b/jurt/com/sun/star/comp/connections/PipedConnection.java
@@ -84,19 +84,6 @@ public class PipedConnection implements XConnection {
return xSingleServiceFactory;
}
-
- /**
- * Writes the service information into the given registry key.
- * This method is called by the <code>JavaLoader</code>
- * <p>
- * @return returns true if the operation succeeded
- * @param regKey the registryKey
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(PipedConnection.class.getName(), __serviceName, regKey);
- }
-
/**
* The amount of time in milliseconds, to wait to
diff --git a/jurt/com/sun/star/comp/urlresolver/UrlResolver.java b/jurt/com/sun/star/comp/urlresolver/UrlResolver.java
index a73b24098..7b8dce558 100644
--- a/jurt/com/sun/star/comp/urlresolver/UrlResolver.java
+++ b/jurt/com/sun/star/comp/urlresolver/UrlResolver.java
@@ -154,18 +154,4 @@ public class UrlResolver {
return xSingleServiceFactory;
}
-
- /**
- * Writes the service information into the given registry key.
- * This method is called by the <code>JavaLoader</code>
- * <p>
- * @return returns true if the operation succeeded
- * @param regKey the registryKey
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(_UrlResolver.class.getName(), _UrlResolver.__serviceName, regKey);
- }
-
}
-
diff --git a/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java b/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java
index f9e2a43bc..63a3fb3a6 100644
--- a/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java
+++ b/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java
@@ -84,21 +84,6 @@ public final class pipeAcceptor implements XAcceptor {
}
/**
- * Writes the service information into the given registry key.
- *
- * <p>This method is called by the <code>JavaLoader</code>.</p>
- *
- * @param regKey the registry key.
- * @return <code>true</code> if the operation succeeded.
- *
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(
- pipeAcceptor.class.getName(), __serviceName, regKey);
- }
-
- /**
* Accepts a connection request via the described pipe.
*
* <p>This call blocks until a connection has been established.</p>
diff --git a/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java b/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java
index 7128a5b3f..2f631a788 100644
--- a/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java
+++ b/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java
@@ -84,21 +84,6 @@ public final class pipeConnector implements XConnector {
}
/**
- * Writes the service information into the given registry key.
- *
- * <p>This method is called by the <code>JavaLoader</code>.</p>
- *
- * @param regKey the registry key.
- * @return <code>true</code> if the operation succeeded.
- *
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(
- pipeConnector.class.getName(), __serviceName, regKey);
- }
-
- /**
* Connects via the described pipe to a waiting server.
*
* <p>The connection description has the following format:
diff --git a/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java b/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java
index 930eeecf4..1f64d16c8 100644
--- a/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java
+++ b/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java
@@ -89,21 +89,6 @@ public final class socketAcceptor implements XAcceptor {
}
/**
- * Writes the service information into the given registry key.
- *
- * <p>This method is called by the <code>JavaLoader</code>.</p>
- *
- * @param regKey the registry key.
- * @return <code>true</code> if the operation succeeded.
- *
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(
- socketAcceptor.class.getName(), __serviceName, regKey);
- }
-
- /**
* Accepts a connection request via the described socket.
*
* <p>This call blocks until a connection has been established.</p>
diff --git a/jurt/com/sun/star/lib/connections/socket/socketConnector.java b/jurt/com/sun/star/lib/connections/socket/socketConnector.java
index 287274356..11ffcb174 100644
--- a/jurt/com/sun/star/lib/connections/socket/socketConnector.java
+++ b/jurt/com/sun/star/lib/connections/socket/socketConnector.java
@@ -89,21 +89,6 @@ public final class socketConnector implements XConnector {
}
/**
- * Writes the service information into the given registry key.
- *
- * <p>This method is called by the <code>JavaLoader</code>.</p>
- *
- * @param regKey the registry key.
- * @return <code>true</code> if the operation succeeded.
- *
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(
- socketConnector.class.getName(), __serviceName, regKey);
- }
-
- /**
* Connects via the described socket to a waiting server.
*
* <p>The connection description has the following format:
diff --git a/offapi/com/sun/star/text/PrintPreviewSettings.idl b/offapi/com/sun/star/text/PrintPreviewSettings.idl
index bec086e30..bd6c61d2f 100644
--- a/offapi/com/sun/star/text/PrintPreviewSettings.idl
+++ b/offapi/com/sun/star/text/PrintPreviewSettings.idl
@@ -39,6 +39,8 @@
//=============================================================================
/** These properties describe the printing of the content of a text document.
+ *
+ * @deprecated since OOo 3.3
*/
published service PrintPreviewSettings
{
diff --git a/pyuno/prj/d.lst b/pyuno/prj/d.lst
index 5fe7400a8..1dd212ea9 100644
--- a/pyuno/prj/d.lst
+++ b/pyuno/prj/d.lst
@@ -9,12 +9,11 @@ mkdir: %_DEST%\lib%_EXT%\pyuno
..\%__SRC%\lib\unohelper.py %_DEST%\lib%_EXT%\pyuno\unohelper.py
..\%__SRC%\lib\pythonloader.py %_DEST%\lib%_EXT%\pyuno\pythonloader.py
..\%__SRC%\lib\uno.py %_DEST%\lib%_EXT%\pyuno\uno.py
-..\%__SRC%\lib\pyuno_services.rdb %_DEST%\bin%_EXT%\pyuno_services.rdb
+..\%__SRC%\misc\pythonloader.component %_DEST%\xml\pythonloader.component
..\%__SRC%\bin\unohelper.py %_DEST%\bin%_EXT%\pyuno\unohelper.py
..\%__SRC%\bin\pythonloader.py %_DEST%\bin%_EXT%\pyuno\pythonloader.py
..\%__SRC%\bin\uno.py %_DEST%\bin%_EXT%\pyuno\uno.py
-..\%__SRC%\bin\pyuno_services.rdb %_DEST%\bin%_EXT%\pyuno_services.rdb
..\%__SRC%\bin\pyuno.pyd %_DEST%\bin%_EXT%\pyuno.pyd
..\%__SRC%\bin\pyuno.dll %_DEST%\bin%_EXT%\pyuno.dll
..\%__SRC%\bin\pythonl*.dll %_DEST%\bin%_EXT%\pythonl*.dll
diff --git a/pyuno/source/loader/makefile.mk b/pyuno/source/loader/makefile.mk
index 6f8648ce5..65ec8116f 100644
--- a/pyuno/source/loader/makefile.mk
+++ b/pyuno/source/loader/makefile.mk
@@ -73,40 +73,22 @@ SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
SLOFILES= $(SLO)$/pyuno_loader.obj
-#COMPONENTS= \
-# tcv \
-# inv \
-# corefl \
-# insp \
-# invadp \
-# proxyfac \
-# pythonloader.uno \
-
-
-COMPONENTS= \
- stocservices.uno \
- invocation.uno \
- introspection.uno \
- invocadapt.uno \
- proxyfac.uno \
- reflection.uno \
- .$/pythonloader.uno
-
# --- Targets ------------------------------------------------------
ALL : ALLTAR \
- $(DLLDEST)$/pythonloader.py \
- $(DLLDEST)$/pyuno_services.rdb
+ $(DLLDEST)$/pythonloader.py
.ENDIF # L10N_framework
.INCLUDE : target.mk
.IF "$(L10N_framework)"==""
$(DLLDEST)$/%.py: %.py
cp $? $@
-
-$(DLLDEST)$/pyuno_services.rdb : makefile.mk $(DLLDEST)$/$(DLLPRE)$(TARGET)$(DLLPOST)
- -rm -f $@ $(DLLDEST)$/pyuno_services.tmp $(DLLDEST)$/pyuno_services.rdb
- cd $(DLLDEST) && $(REGCOMP) -register -r pyuno_services.tmp -wop $(foreach,i,$(COMPONENTS) -c $(i))
- cd $(DLLDEST) && mv pyuno_services.tmp pyuno_services.rdb
.ENDIF # L10N_framework
+ALLTAR : $(MISC)/pythonloader.component
+
+$(MISC)/pythonloader.component .ERRREMOVE : \
+ $(SOLARENV)/bin/createcomponent.xslt pythonloader.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ 'vnd.sun.star.expand:$$OOO_BASE_DIR/program/$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt pythonloader.component
diff --git a/pyuno/source/loader/pythonloader.component b/pyuno/source/loader/pythonloader.component
new file mode 100644
index 000000000..583b6ed38
--- /dev/null
+++ b/pyuno/source/loader/pythonloader.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="org.openoffice.comp.pyuno.Loader">
+ <service name="com.sun.star.loader.Python"/>
+ </implementation>
+</component>
diff --git a/pyuno/source/loader/pyuno_loader.cxx b/pyuno/source/loader/pyuno_loader.cxx
index cddb42f63..f94b4ea51 100644
--- a/pyuno/source/loader/pyuno_loader.cxx
+++ b/pyuno/source/loader/pyuno_loader.cxx
@@ -229,12 +229,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//==================================================================================================
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- return cppu::component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries );
-}
-//==================================================================================================
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
diff --git a/pyuno/zipcore/python.sh b/pyuno/zipcore/python.sh
index f471b1dfd..b53e369fe 100644
--- a/pyuno/zipcore/python.sh
+++ b/pyuno/zipcore/python.sh
@@ -44,7 +44,7 @@ PATH=$sd_prog${PATH+:$PATH}
export PATH
# Set LD_LIBRARY_PATH so that "import pyuno" finds libpyuno.so:
-LD_LIBRARY_PATH=$sd_prog/../basis-link/program:$sd_prog/../basis-link/ure-link/lib${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}
+LD_LIBRARY_PATH=$sd_prog/../basis-link/program:$sd_prog/../basis-link/ure-link/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
# Set UNO_PATH so that "officehelper.bootstrap()" can find soffice executable:
diff --git a/remotebridges/prj/d.lst b/remotebridges/prj/d.lst
index 04b8bf4f7..b304680e2 100644
--- a/remotebridges/prj/d.lst
+++ b/remotebridges/prj/d.lst
@@ -15,3 +15,6 @@
..\%__SRC%\lib\dynamicloader.uno.so %_DEST%\lib%_EXT%\dynamicloader.uno.so
..\%__SRC%\lib\uuresolver.uno.so %_DEST%\lib%_EXT%\uuresolver.uno.so
..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*
+..\%__SRC%\misc\bridgefac.component %_DEST%\xml%_EXT%\bridgefac.component
+..\%__SRC%\misc\remotebridge.component %_DEST%\xml%_EXT%\remotebridge.component
+..\%__SRC%\misc\uuresolver.component %_DEST%\xml%_EXT%\uuresolver.component
diff --git a/remotebridges/source/bridge/makefile.mk b/remotebridges/source/bridge/makefile.mk
index 1b712bef1..2a5ea130d 100644
--- a/remotebridges/source/bridge/makefile.mk
+++ b/remotebridges/source/bridge/makefile.mk
@@ -62,3 +62,11 @@ DEF1NAME= $(SHL1TARGET)
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/remotebridge.component
+
+$(MISC)/remotebridge.component .ERRREMOVE : \
+ $(SOLARENV)/bin/createcomponent.xslt remotebridge.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt remotebridge.component
diff --git a/remotebridges/source/bridge/remote_bridge.cxx b/remotebridges/source/bridge/remote_bridge.cxx
index 40f233625..67272df80 100644
--- a/remotebridges/source/bridge/remote_bridge.cxx
+++ b/remotebridges/source/bridge/remote_bridge.cxx
@@ -457,12 +457,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//==================================================================================================
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries );
-}
-//==================================================================================================
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
diff --git a/remotebridges/source/bridge/remotebridge.component b/remotebridges/source/bridge/remotebridge.component
new file mode 100644
index 000000000..bbc6bede1
--- /dev/null
+++ b/remotebridges/source/bridge/remotebridge.component
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.remotebridges.Bridge.various">
+ <service name="com.sun.star.bridge.Bridge"/>
+ <service name="com.sun.star.bridge.IiopBridge"/>
+ <service name="com.sun.star.bridge.UrpBridge"/>
+ </implementation>
+</component>
diff --git a/remotebridges/source/dynamicloader/dynamicloader.cxx b/remotebridges/source/dynamicloader/dynamicloader.cxx
index ec87b5212..08001cb0b 100644
--- a/remotebridges/source/dynamicloader/dynamicloader.cxx
+++ b/remotebridges/source/dynamicloader/dynamicloader.cxx
@@ -381,34 +381,6 @@ extern "C" {
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
- sal_Bool SAL_CALL component_writeInfo(XMultiServiceFactory *, XRegistryKey * pRegistryKey) {
- sal_Bool bRes = sal_False;
-
- if (pRegistryKey) {
- try {
- OUString x = OUString::createFromAscii("/");
- x += ::dynamic_loader::DynamicLoader::implname;
- x += OUString::createFromAscii("/UNO/SERVICES");
-
-
- Reference<XRegistryKey> xNewKey(pRegistryKey->createKey(x));
-
- const Sequence<OUString> rSNL = ::dynamic_loader::DynamicLoader::getSupportedServiceNames_Static();
- const OUString * pArray = rSNL.getConstArray();
- for (sal_Int32 nPos = rSNL.getLength(); nPos--;)
- xNewKey->createKey(pArray[nPos]);
-
-
- bRes = sal_True;
- }
- catch (InvalidRegistryException &) {
- OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
- }
- }
-
- return bRes;
- }
-
void * SAL_CALL component_getFactory(const sal_Char * pImplName, XMultiServiceFactory * pServiceManager, XRegistryKey *) {
void * pRet = 0;
diff --git a/remotebridges/source/factory/bridgefac.component b/remotebridges/source/factory/bridgefac.component
new file mode 100644
index 000000000..e20bc3425
--- /dev/null
+++ b/remotebridges/source/factory/bridgefac.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.remotebridges.BridgeFactory">
+ <service name="com.sun.star.bridge.BridgeFactory"/>
+ </implementation>
+</component>
diff --git a/remotebridges/source/factory/bridgefactory.cxx b/remotebridges/source/factory/bridgefactory.cxx
index e9e183525..fbe39339c 100644
--- a/remotebridges/source/factory/bridgefactory.cxx
+++ b/remotebridges/source/factory/bridgefactory.cxx
@@ -481,12 +481,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//==================================================================================================
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries );
-}
-//==================================================================================================
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
diff --git a/remotebridges/source/factory/makefile.mk b/remotebridges/source/factory/makefile.mk
index 7cd3875bc..b47207077 100644
--- a/remotebridges/source/factory/makefile.mk
+++ b/remotebridges/source/factory/makefile.mk
@@ -64,3 +64,10 @@ DEF1NAME= $(SHL1TARGET)
.INCLUDE : target.mk
+ALLTAR : $(MISC)/bridgefac.component
+
+$(MISC)/bridgefac.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ bridgefac.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt bridgefac.component
diff --git a/remotebridges/source/unourl_resolver/makefile.mk b/remotebridges/source/unourl_resolver/makefile.mk
index a3e4af7f0..edf5aa72c 100644
--- a/remotebridges/source/unourl_resolver/makefile.mk
+++ b/remotebridges/source/unourl_resolver/makefile.mk
@@ -62,3 +62,11 @@ DEF1NAME= $(SHL1TARGET)
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/uuresolver.component
+
+$(MISC)/uuresolver.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ uuresolver.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt uuresolver.component
diff --git a/remotebridges/source/unourl_resolver/unourl_resolver.cxx b/remotebridges/source/unourl_resolver/unourl_resolver.cxx
index f7d8b92ec..bdddf783d 100644
--- a/remotebridges/source/unourl_resolver/unourl_resolver.cxx
+++ b/remotebridges/source/unourl_resolver/unourl_resolver.cxx
@@ -239,12 +239,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//==================================================================================================
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries );
-}
-//==================================================================================================
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
diff --git a/remotebridges/source/unourl_resolver/uuresolver.component b/remotebridges/source/unourl_resolver/uuresolver.component
new file mode 100644
index 000000000..f9dcd71d8
--- /dev/null
+++ b/remotebridges/source/unourl_resolver/uuresolver.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.bridge.UnoUrlResolver">
+ <service name="com.sun.star.bridge.UnoUrlResolver"/>
+ </implementation>
+</component>
diff --git a/sal/inc/rtl/malformeduriexception.hxx b/sal/inc/rtl/malformeduriexception.hxx
index 4a5bfbe85..5d824c3bf 100644
--- a/sal/inc/rtl/malformeduriexception.hxx
+++ b/sal/inc/rtl/malformeduriexception.hxx
@@ -53,8 +53,8 @@ public:
inline SAL_EXCEPTION_DLLPRIVATE ~MalformedUriException() {}
inline SAL_EXCEPTION_DLLPRIVATE MalformedUriException operator =(
- MalformedUriException const & other)
- { m_aMessage = other.m_aMessage; return *this; }
+ MalformedUriException const & rOther)
+ { m_aMessage = rOther.m_aMessage; return *this; }
/** Get the message.
diff --git a/sal/prj/build.lst b/sal/prj/build.lst
index 638252ad4..c96c3977f 100644
--- a/sal/prj/build.lst
+++ b/sal/prj/build.lst
@@ -18,4 +18,5 @@ sa sal\cppunittester nmake - all sa_cppunittester sa_cpprt.u sa_util NULL
sa sal\qa\ByteSequence nmake - all sa_qa_ByteSequence sa_cppunittester sa_util NULL
sa sal\qa\OStringBuffer nmake - all sa_qa_OStringBuffer sa_cppunittester sa_util NULL
sa sal\qa\osl\mutex nmake - all sa_qa_osl_mutex sa_cppunittester sa_util NULL
+sa sal\qa\osl\pipe nmake - all sa_qa_osl_pipe sa_cppunittester sa_util NULL
sa sal\qa\osl\profile nmake - all sa_qa_osl_profile sa_cppunittester sa_util NULL
diff --git a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx
index 2b091f440..bdbd41bc2 100644
--- a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx
+++ b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx
@@ -14789,11 +14789,7 @@ sal_Bool test_append( const char** resArray, int n, sal_Int16 radix,
{
::rtl::OStringBuffer aStrBuf( *arrOUS[0] );
OString expVal( kTestStr116 );
-#if defined(UNX) || defined(OS2)
- sal_Int64 input = 9223372036854775807LL;
-#else
- sal_Int64 input = 9223372036854775807;
-#endif
+ sal_Int64 input = SAL_CONST_INT64(9223372036854775807);
aStrBuf.append( input );
CPPUNIT_ASSERT_MESSAGE
@@ -14873,11 +14869,7 @@ sal_Bool test_append( const char** resArray, int n, sal_Int16 radix,
{
::rtl::OStringBuffer aStrBuf( *arrOUS[1] );
OString expVal( kTestStr118 );
-#if defined(UNX) || defined(OS2)
- sal_Int64 input = 9223372036854775807LL;
-#else
- sal_Int64 input = 9223372036854775807;
-#endif
+ sal_Int64 input = SAL_CONST_INT64(9223372036854775807);
aStrBuf.append( input );
CPPUNIT_ASSERT_MESSAGE
@@ -14956,11 +14948,7 @@ sal_Bool test_append( const char** resArray, int n, sal_Int16 radix,
{
::rtl::OStringBuffer aStrBuf( *arrOUS[2] );
OString expVal( kTestStr118 );
-#if defined(UNX) || defined(OS2)
- sal_Int64 input = 9223372036854775807LL;
-#else
- sal_Int64 input = 9223372036854775807;
-#endif
+ sal_Int64 input = SAL_CONST_INT64(9223372036854775807);
aStrBuf.append( input );
CPPUNIT_ASSERT_MESSAGE
@@ -15039,11 +15027,7 @@ sal_Bool test_append( const char** resArray, int n, sal_Int16 radix,
{
::rtl::OStringBuffer aStrBuf( *arrOUS[3] );
OString expVal( kTestStr118 );
-#if defined(UNX) || defined(OS2)
- sal_Int64 input = 9223372036854775807LL;
-#else
- sal_Int64 input = 9223372036854775807;
-#endif
+ sal_Int64 input = SAL_CONST_INT64(9223372036854775807);
aStrBuf.append( input );
CPPUNIT_ASSERT_MESSAGE
@@ -15122,11 +15106,7 @@ sal_Bool test_append( const char** resArray, int n, sal_Int16 radix,
{
::rtl::OStringBuffer aStrBuf( *arrOUS[4] );
OString expVal( kTestStr120 );
-#if defined(UNX) || defined(OS2)
- sal_Int64 input = 9223372036854775807LL;
-#else
- sal_Int64 input = 9223372036854775807;
-#endif
+ sal_Int64 input = SAL_CONST_INT64(9223372036854775807);
aStrBuf.append( input );
CPPUNIT_ASSERT_MESSAGE
diff --git a/sal/qa/OStringBuffer/rtl_String_Const.h b/sal/qa/OStringBuffer/rtl_String_Const.h
index dc905ac60..0c058273c 100644
--- a/sal/qa/OStringBuffer/rtl_String_Const.h
+++ b/sal/qa/OStringBuffer/rtl_String_Const.h
@@ -357,11 +357,7 @@ static const sal_Int16 kSInt16Max = SHRT_MAX;
static const sal_Int32 kUInt16Max = USHRT_MAX;
static const sal_Int32 kSInt32Max = INT_MAX;
static const sal_Int64 kUInt32Max = UINT_MAX;
-#if defined(UNX) || defined(OS2)
-static const sal_Int64 kSInt64Max = 9223372036854775807LL;
-#else
-static const sal_Int64 kSInt64Max = 9223372036854775807;
-#endif
+static const sal_Int64 kSInt64Max = SAL_CONST_INT64(9223372036854775807);
//------------------------------------------------------------------------
diff --git a/sal/qa/osl/pipe/makefile.mk b/sal/qa/osl/pipe/makefile.mk
index 6350cdba0..85452eac8 100644
--- a/sal/qa/osl/pipe/makefile.mk
+++ b/sal/qa/osl/pipe/makefile.mk
@@ -51,7 +51,7 @@ SHL1OBJS= \
$(SLO)$/osl_Pipe.obj
SHL1TARGET= osl_Pipe
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB)
+SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTLIB)
SHL1IMPLIB= i$(SHL1TARGET)
# SHL1DEF= $(MISC)$/$(SHL1TARGET).def
diff --git a/sal/qa/osl/pipe/osl_Pipe.cxx b/sal/qa/osl/pipe/osl_Pipe.cxx
index 5a6e9afc5..8dfe261d9 100644
--- a/sal/qa/osl/pipe/osl_Pipe.cxx
+++ b/sal/qa/osl/pipe/osl_Pipe.cxx
@@ -36,6 +36,7 @@
#include "cppunit/TestFixture.h"
#include "cppunit/extensions/HelperMacros.h"
#include "cppunit/plugin/TestPlugIn.h"
+#include "test/uniquepipename.hxx"
#include <sal/types.h>
#include <rtl/ustring.hxx>
@@ -186,8 +187,8 @@ namespace osl_Pipe
void ctors_name_option( )
{
/// create a named pipe.
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE );
- ::osl::Pipe aAssignPipe( aTestPipeName, osl_Pipe_OPEN );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
+ ::osl::Pipe aAssignPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN );
bRes = aPipe.is( ) && aAssignPipe.is( );
@@ -199,7 +200,7 @@ namespace osl_Pipe
{
/// create a security pipe.
const ::osl::Security rSecurity;
- ::osl::Pipe aSecurityPipe( aTestPipeName, osl_Pipe_CREATE, rSecurity );
+ ::osl::Pipe aSecurityPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE, rSecurity );
bRes = aSecurityPipe.is( );
@@ -210,7 +211,7 @@ namespace osl_Pipe
void ctors_copy( )
{
/// create a pipe.
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
/// create a pipe using copy constructor.
::osl::Pipe aCopyPipe( aPipe );
@@ -233,7 +234,7 @@ namespace osl_Pipe
void ctors_no_acquire( )
{
/// create a pipe.
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
/// constructs a pipe reference without acquiring the handle.
::osl::Pipe aNoAcquirePipe( aPipe.getHandle( ), SAL_NO_ACQUIRE );
@@ -249,7 +250,7 @@ namespace osl_Pipe
void ctors_acquire( )
{
/// create a base pipe.
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
/// constructs two pipes without acquiring the handle on the base pipe.
::osl::Pipe aAcquirePipe( aPipe.getHandle( ) );
::osl::Pipe aAcquirePipe1( NULL );
@@ -287,14 +288,14 @@ namespace osl_Pipe
void is_002( )
{
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
CPPUNIT_ASSERT_MESSAGE( "#test comment#: test is(), a normal pipe creation.", sal_True == aPipe.is( ) );
}
void is_003( )
{
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
aPipe.clear( );
CPPUNIT_ASSERT_MESSAGE( "#test comment#: test is(), an invalid case.", sal_False == aPipe.is( ) );
@@ -337,8 +338,8 @@ namespace osl_Pipe
{
const Security rSec;
::osl::Pipe aPipe;
- bRes = aPipe.create( aTestPipeName, osl_Pipe_CREATE, rSec );
- bRes1 = aPipe.create( aTestPipeName, osl_Pipe_CREATE, rSec );
+ bRes = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE, rSec );
+ bRes1 = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE, rSec );
aPipe.clear( );
CPPUNIT_ASSERT_MESSAGE( "#test comment#: test creation.",
@@ -349,8 +350,8 @@ namespace osl_Pipe
{
const Security rSec;
::osl::Pipe aPipe, aPipe1;
- bRes = aPipe.create( aTestPipeName, osl_Pipe_CREATE, rSec );
- bRes1 = aPipe1.create( aTestPipeName, osl_Pipe_OPEN, rSec );
+ bRes = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE, rSec );
+ bRes1 = aPipe1.create( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN, rSec );
aPipe.clear( );
CPPUNIT_ASSERT_MESSAGE( "#test comment#: test creation and open.",
@@ -360,8 +361,8 @@ namespace osl_Pipe
void create_named_001( )
{
::osl::Pipe aPipe;
- bRes = aPipe.create( aTestPipeName, osl_Pipe_CREATE );
- bRes1 = aPipe.create( aTestPipeName, osl_Pipe_CREATE );
+ bRes = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
+ bRes1 = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
aPipe.clear( );
CPPUNIT_ASSERT_MESSAGE( "#test comment#: test creation.",
@@ -371,8 +372,8 @@ namespace osl_Pipe
void create_named_002( )
{
::osl::Pipe aPipe, aPipe1;
- bRes = aPipe.create( aTestPipeName, osl_Pipe_CREATE );
- bRes1 = aPipe1.create( aTestPipeName, osl_Pipe_OPEN );
+ bRes = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
+ bRes1 = aPipe1.create( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN );
aPipe.clear( );
CPPUNIT_ASSERT_MESSAGE( "#test comment#: test creation and open.",
@@ -382,7 +383,7 @@ namespace osl_Pipe
void create_named_003( )
{
::osl::Pipe aPipe;
- bRes = aPipe.create( aTestPipeName );
+ bRes = aPipe.create( test::uniquePipeName(aTestPipeName) );
aPipe.clear( );
CPPUNIT_ASSERT_MESSAGE( "#test comment#: test default option is open.",
@@ -410,7 +411,7 @@ namespace osl_Pipe
void clear_001( )
{
::osl::Pipe aPipe;
- aPipe.create( aTestPipeName, osl_Pipe_CREATE );
+ aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
aPipe.clear( );
bRes = aPipe.is( );
@@ -436,7 +437,7 @@ namespace osl_Pipe
void assign_ref( )
{
::osl::Pipe aPipe, aPipe1;
- aPipe.create( aTestPipeName, osl_Pipe_CREATE );
+ aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
aPipe1 = aPipe;
bRes = aPipe1.is( );
bRes1 = aPipe == aPipe1;
@@ -450,7 +451,7 @@ namespace osl_Pipe
void assign_handle( )
{
::osl::Pipe aPipe, aPipe1;
- aPipe.create( aTestPipeName, osl_Pipe_CREATE );
+ aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
aPipe1 = aPipe.getHandle( );
bRes = aPipe1.is( );
bRes1 = aPipe == aPipe1;
@@ -500,7 +501,7 @@ namespace osl_Pipe
void isEqual_001( )
{
::osl::Pipe aPipe;
- aPipe.create( aTestPipeName, osl_Pipe_CREATE );
+ aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
bRes = aPipe == aPipe;
aPipe.close( );
@@ -511,10 +512,10 @@ namespace osl_Pipe
void isEqual_002( )
{
::osl::Pipe aPipe, aPipe1, aPipe2;
- aPipe.create( aTestPipeName, osl_Pipe_CREATE );
+ aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
aPipe1 = aPipe;
- aPipe2.create( aTestPipeName, osl_Pipe_CREATE );
+ aPipe2.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
bRes = aPipe == aPipe1;
bRes1 = aPipe == aPipe2;
@@ -543,7 +544,7 @@ namespace osl_Pipe
void close_001( )
{
- ::osl::Pipe aPipe( aTestPipe1, osl_Pipe_CREATE );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipe1), osl_Pipe_CREATE );
aPipe.close( );
bRes = aPipe.is( );
@@ -556,7 +557,7 @@ namespace osl_Pipe
void close_002( )
{
- ::osl::StreamPipe aPipe( aTestPipe1, osl_Pipe_CREATE );
+ ::osl::StreamPipe aPipe( test::uniquePipeName(aTestPipe1), osl_Pipe_CREATE );
aPipe.close( );
int nRet = aPipe.send( m_pTestString1.getStr(), 3 );
@@ -624,7 +625,7 @@ namespace osl_Pipe
void getError_001( )
{
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_OPEN );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN );
oslPipeError nError = aPipe.getError( );
printPipeError( aPipe );
aPipe.clear( );
@@ -635,8 +636,8 @@ namespace osl_Pipe
void getError_002( )
{
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE );
- ::osl::Pipe aPipe1( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
+ ::osl::Pipe aPipe1( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
oslPipeError nError = aPipe.getError( );
printPipeError( aPipe );
aPipe.clear( );
@@ -663,7 +664,7 @@ namespace osl_Pipe
void getHandle_001( )
{
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_OPEN );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN );
bRes = aPipe == aPipe.getHandle( );
aPipe.clear( );
@@ -673,7 +674,7 @@ namespace osl_Pipe
void getHandle_002( )
{
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
::osl::Pipe aPipe1( aPipe.getHandle( ) );
bRes = aPipe == aPipe1;
aPipe.clear( );
@@ -726,7 +727,7 @@ namespace osl_StreamPipe
void ctors_none( )
{
// create a pipe.
- ::osl::StreamPipe aStreamPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::StreamPipe aStreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
// create an unattached pipe.
::osl::StreamPipe aStreamPipe1;
bRes = aStreamPipe1.is( );
@@ -744,7 +745,7 @@ namespace osl_StreamPipe
void ctors_handle( )
{
// create a pipe.
- ::osl::StreamPipe aStreamPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::StreamPipe aStreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
// create a pipe with last handle.
::osl::StreamPipe aStreamPipe1( aStreamPipe.getHandle( ) );
bRes = aStreamPipe1.is( ) && aStreamPipe == aStreamPipe1;
@@ -758,7 +759,7 @@ namespace osl_StreamPipe
void ctors_copy( )
{
// create a pipe.
- ::osl::StreamPipe aStreamPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::StreamPipe aStreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
// create an unattached pipe.
::osl::StreamPipe aStreamPipe1( aStreamPipe );
bRes = aStreamPipe1.is( ) && aStreamPipe == aStreamPipe1;
@@ -772,9 +773,9 @@ namespace osl_StreamPipe
void ctors_name_option( )
{
// create a pipe.
- ::osl::StreamPipe aStreamPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::StreamPipe aStreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
// create an unattached pipe.
- ::osl::StreamPipe aStreamPipe1( aTestPipeName, osl_Pipe_OPEN );
+ ::osl::StreamPipe aStreamPipe1( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN );
bRes = aStreamPipe1.is( ) && aStreamPipe.is( );
aStreamPipe.clear( );
aStreamPipe1.clear( );
@@ -787,7 +788,7 @@ namespace osl_StreamPipe
{
/// create a security pipe.
const ::osl::Security rSecurity;
- ::osl::StreamPipe aSecurityPipe( aTestPipeName, osl_Pipe_CREATE, rSecurity );
+ ::osl::StreamPipe aSecurityPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE, rSecurity );
bRes = aSecurityPipe.is( );
aSecurityPipe.clear( );
@@ -809,7 +810,7 @@ namespace osl_StreamPipe
void ctors_no_acquire( )
{
// create a pipe.
- ::osl::StreamPipe aPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::StreamPipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
// constructs a pipe reference without acquiring the handle.
::osl::StreamPipe aNoAcquirePipe( aPipe.getHandle( ), SAL_NO_ACQUIRE );
@@ -846,7 +847,7 @@ namespace osl_StreamPipe
void assign_ref( )
{
::osl::StreamPipe aPipe, aPipe1;
- aPipe.create( aTestPipeName, osl_Pipe_CREATE );
+ aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
aPipe1 = aPipe;
bRes = aPipe1.is( );
bRes1 = aPipe == aPipe1;
@@ -859,7 +860,7 @@ namespace osl_StreamPipe
void assign_handle( )
{
- ::osl::StreamPipe * pPipe = new ::osl::StreamPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::StreamPipe * pPipe = new ::osl::StreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
::osl::StreamPipe * pAssignPipe = new ::osl::StreamPipe;
*pAssignPipe = pPipe->getHandle( );
@@ -914,7 +915,7 @@ namespace osl_StreamPipe
sal_Int32 nChars = 0;
printf("open pipe\n");
- ::osl::StreamPipe aSenderPipe( aTestPipeName, osl_Pipe_OPEN ); // aTestPipeName is a string = "TestPipe"
+ ::osl::StreamPipe aSenderPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN ); // test::uniquePipeName(aTestPipeName) is a string = "TestPipe"
if ( aSenderPipe.is() == sal_False )
{
printf("pipe open failed! \n");
@@ -947,13 +948,13 @@ namespace osl_StreamPipe
{
public:
sal_Char buf[256];
- //::osl::StreamPipe aListenPipe; //( aTestPipeName, osl_Pipe_CREATE );
+ //::osl::StreamPipe aListenPipe; //( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
::osl::Pipe aListenPipe;
::osl::StreamPipe aConnectionPipe;
Pipe_DataSource_Thread( )
{
printf("create pipe\n");
- aListenPipe.create( aTestPipeName, osl_Pipe_CREATE );
+ aListenPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
}
~Pipe_DataSource_Thread( )
{
@@ -964,7 +965,7 @@ namespace osl_StreamPipe
{
//create pipe.
sal_Int32 nChars;
- //::osl::StreamPipe aListenPipe( aTestPipeName, osl_Pipe_CREATE );
+ //::osl::StreamPipe aListenPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
printf("listen\n");
if ( aListenPipe.is() == sal_False )
{
diff --git a/stoc/prj/build.lst b/stoc/prj/build.lst
index 1fb7d34ee..256f09474 100644
--- a/stoc/prj/build.lst
+++ b/stoc/prj/build.lst
@@ -1,4 +1,4 @@
-tc stoc : rdbmaker cppuhelper cppu jvmaccess sal salhelper jvmfwk NULL
+tc stoc : rdbmaker cppuhelper cppu jvmaccess sal salhelper jvmfwk xmlreader LIBXSTL:libxslt NULL
tc stoc usr1 - all tc_mkout NULL
tc stoc\inc nmake - all tc_inc NULL
tc stoc\source\defaultregistry nmake - all tc_defr tc_boot tc_inc NULL
diff --git a/stoc/prj/d.lst b/stoc/prj/d.lst
index 1f01434bf..79b2d7734 100644
--- a/stoc/prj/d.lst
+++ b/stoc/prj/d.lst
@@ -4,6 +4,16 @@ mkdir: %_DEST%\inc%_EXT%\stoc
..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\*
..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
..\%__SRC%\bin\*.rdb %_DEST%\rdb%_EXT%\*
+..\%__SRC%\misc\bootstrap.component %_DEST%\xml%_EXT%\bootstrap.component
+..\%__SRC%\misc\introspection.component %_DEST%\xml%_EXT%\introspection.component
+..\%__SRC%\misc\invocadapt.component %_DEST%\xml%_EXT%\invocadapt.component
+..\%__SRC%\misc\invocation.component %_DEST%\xml%_EXT%\invocation.component
+..\%__SRC%\misc\javaloader.component %_DEST%\xml%_EXT%\javaloader.component
+..\%__SRC%\misc\javavm.component %_DEST%\xml%_EXT%\javavm.component
+..\%__SRC%\misc\namingservice.component %_DEST%\xml%_EXT%\namingservice.component
+..\%__SRC%\misc\proxyfac.component %_DEST%\xml%_EXT%\proxyfac.component
+..\%__SRC%\misc\reflection.component %_DEST%\xml%_EXT%\reflection.component
+..\%__SRC%\misc\stocservices.component %_DEST%\xml%_EXT%\stocservices.component
..\source\module-description.dtd %_DEST%\xml%_EXT%\module-description.dtd
..\source\corereflection\corefl.xml %_DEST%\xml%_EXT%\reflection.uno.xml
diff --git a/stoc/source/bootstrap/services.cxx b/stoc/source/bootstrap/services.cxx
index 2fb68a0cc..d5ce619c6 100644
--- a/stoc/source/bootstrap/services.cxx
+++ b/stoc/source/bootstrap/services.cxx
@@ -132,12 +132,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//==================================================================================================
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries );
-}
-//==================================================================================================
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
diff --git a/stoc/source/corereflection/base.hxx b/stoc/source/corereflection/base.hxx
index ba35d4f80..faf3e56bc 100644
--- a/stoc/source/corereflection/base.hxx
+++ b/stoc/source/corereflection/base.hxx
@@ -55,9 +55,6 @@
#include <com/sun/star/reflection/XIdlField2.hpp>
#include <com/sun/star/reflection/XIdlMethod.hpp>
-#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
-
-
using namespace std;
using namespace osl;
using namespace rtl;
diff --git a/stoc/source/corereflection/crefl.cxx b/stoc/source/corereflection/crefl.cxx
index c706e233a..dac197e6f 100644
--- a/stoc/source/corereflection/crefl.cxx
+++ b/stoc/source/corereflection/crefl.cxx
@@ -32,7 +32,6 @@
#include <cppuhelper/implementationentry.hxx>
#endif
-#include <com/sun/star/registry/XRegistryKey.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/reflection/XTypeDescription.hpp>
#include "com/sun/star/uno/RuntimeException.hpp"
@@ -509,35 +508,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//==================================================================================================
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- if (component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ))
- {
- try
- {
- // register singleton
- registry::XRegistryKey * pKey =
- reinterpret_cast< registry::XRegistryKey * >( pRegistryKey );
- Reference< registry::XRegistryKey > xKey(
- pKey->createKey(
- OUSTR(IMPLNAME "/UNO/SINGLETONS/com.sun.star.reflection.theCoreReflection") ) );
- xKey->setStringValue( OUSTR("com.sun.star.reflection.CoreReflection") );
- return sal_True;
- }
- catch (Exception & exc)
- {
-#if OSL_DEBUG_LEVEL > 0
- OString cstr( OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) );
- OSL_ENSURE( 0, cstr.getStr() );
-#else
- (void) exc; // unused
-#endif
- }
- }
- return sal_False;
-}
-//==================================================================================================
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
diff --git a/stoc/source/corereflection/makefile.mk b/stoc/source/corereflection/makefile.mk
index b61eb13aa..7156f6d63 100644
--- a/stoc/source/corereflection/makefile.mk
+++ b/stoc/source/corereflection/makefile.mk
@@ -73,3 +73,10 @@ DEF1NAME= $(SHL1TARGET)
.INCLUDE : target.mk
+ALLTAR : $(MISC)/reflection.component
+
+$(MISC)/reflection.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ reflection.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt reflection.component
diff --git a/stoc/source/corereflection/reflection.component b/stoc/source/corereflection/reflection.component
new file mode 100644
index 000000000..00772a448
--- /dev/null
+++ b/stoc/source/corereflection/reflection.component
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.stoc.CoreReflection">
+ <service name="com.sun.star.reflection.CoreReflection"/>
+ <singleton name="com.sun.star.reflection.theCoreReflection"/>
+ </implementation>
+</component>
diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx
index d803bd44c..eb3e6dc34 100644
--- a/stoc/source/implementationregistration/implreg.cxx
+++ b/stoc/source/implementationregistration/implreg.cxx
@@ -628,9 +628,9 @@ static void deleteUserLink(const Reference < XRegistryKey >& xRootKey,
} else
{
oldImpl = implEntries.getConstArray()[0];
-
+ rtl::OUString path(xOldKey->getKeyName());
xOldKey->closeKey();
- xRootKey->deleteKey(xOldKey->getKeyName());
+ xRootKey->deleteKey(path);
}
OUString oldTarget = searchLinkTargetForImpl(xRootKey, linkName, oldImpl);
@@ -644,8 +644,9 @@ static void deleteUserLink(const Reference < XRegistryKey >& xRootKey,
{
bClean = sal_True;
hasNoImplementations = sal_False;
+ rtl::OUString path(xOldKey->getKeyName());
xOldKey->closeKey();
- xRootKey->deleteKey(xOldKey->getKeyName());
+ xRootKey->deleteKey(path);
}
}
} else
@@ -808,21 +809,24 @@ static void deleteAllImplementations( const Reference < XSimpleRegistry >& xReg,
if (hasLocationUrl)
{
hasLocationUrl = sal_False;
+ rtl::OUString path(xImplKey->getKeyName());
xImplKey->closeKey();
- xReg->getRootKey()->deleteKey(xImplKey->getKeyName());
+ xReg->getRootKey()->deleteKey(path);
}
}
subKeys = xSource->openKeys();
if (subKeys.getLength() == 0)
{
+ rtl::OUString path(xSource->getKeyName());
xSource->closeKey();
- xReg->getRootKey()->deleteKey(xSource->getKeyName());
+ xReg->getRootKey()->deleteKey(path);
}
} else
{
+ rtl::OUString path(xSource->getKeyName());
xSource->closeKey();
- xReg->getRootKey()->deleteKey(xSource->getKeyName());
+ xReg->getRootKey()->deleteKey(path);
}
}
@@ -947,21 +951,24 @@ static void deleteAllServiceEntries( const Reference < XSimpleRegistry >& xReg,
if (hasNoImplementations)
{
hasNoImplementations = sal_False;
+ rtl::OUString path(xServiceKey->getKeyName());
xServiceKey->closeKey();
- xReg->getRootKey()->deleteKey(xServiceKey->getKeyName());
+ xReg->getRootKey()->deleteKey(path);
}
}
subKeys = xSource->openKeys();
if (subKeys.getLength() == 0)
{
+ rtl::OUString path(xSource->getKeyName());
xSource->closeKey();
- xReg->getRootKey()->deleteKey(xSource->getKeyName());
+ xReg->getRootKey()->deleteKey(path);
}
} else
{
+ rtl::OUString path(xSource->getKeyName());
xSource->closeKey();
- xReg->getRootKey()->deleteKey(xSource->getKeyName());
+ xReg->getRootKey()->deleteKey(path);
}
}
diff --git a/stoc/source/inspect/introspection.component b/stoc/source/inspect/introspection.component
new file mode 100644
index 000000000..349fb0c9d
--- /dev/null
+++ b/stoc/source/inspect/introspection.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.stoc.Introspection">
+ <service name="com.sun.star.beans.Introspection"/>
+ </implementation>
+</component>
diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx
index b8ae012d2..0b9857abe 100644
--- a/stoc/source/inspect/introspection.cxx
+++ b/stoc/source/inspect/introspection.cxx
@@ -71,7 +71,6 @@
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
-#include <com/sun/star/registry/XRegistryKey.hpp>
#include <rtl/ustrbuf.hxx>
#include <rtl/strbuf.hxx>
@@ -3065,32 +3064,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//==================================================================================================
-sal_Bool SAL_CALL component_writeInfo( void *, void * pRegistryKey )
-{
- if (pRegistryKey)
- {
- try
- {
- Reference< XRegistryKey > xNewKey(
- reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey(
- OUString::createFromAscii( "/" IMPLEMENTATION_NAME "/UNO/SERVICES" ) ) );
-
- const Sequence< OUString > & rSNL =
- stoc_inspect::ImplIntrospection::getSupportedServiceNames_Static();
- const OUString * pArray = rSNL.getConstArray();
- for ( sal_Int32 nPos = rSNL.getLength(); nPos--; )
- xNewKey->createKey( pArray[nPos] );
-
- return sal_True;
- }
- catch (InvalidRegistryException &)
- {
- OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
- }
- }
- return sal_False;
-}
-//==================================================================================================
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * )
{
diff --git a/stoc/source/inspect/makefile.mk b/stoc/source/inspect/makefile.mk
index 80e87dbf7..60864eea2 100644
--- a/stoc/source/inspect/makefile.mk
+++ b/stoc/source/inspect/makefile.mk
@@ -64,3 +64,10 @@ DEF1NAME= $(SHL1TARGET)
.INCLUDE : target.mk
+ALLTAR : $(MISC)/introspection.component
+
+$(MISC)/introspection.component .ERRREMOVE : \
+ $(SOLARENV)/bin/createcomponent.xslt introspection.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt introspection.component
diff --git a/stoc/source/invocation/invocation.component b/stoc/source/invocation/invocation.component
new file mode 100644
index 000000000..67178ef2e
--- /dev/null
+++ b/stoc/source/invocation/invocation.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.stoc.Invocation">
+ <service name="com.sun.star.script.Invocation"/>
+ </implementation>
+</component>
diff --git a/stoc/source/invocation/invocation.cxx b/stoc/source/invocation/invocation.cxx
index b321d97cd..c5813efac 100644
--- a/stoc/source/invocation/invocation.cxx
+++ b/stoc/source/invocation/invocation.cxx
@@ -1251,12 +1251,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//==================================================================================================
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries );
-}
-//==================================================================================================
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
diff --git a/stoc/source/invocation/makefile.mk b/stoc/source/invocation/makefile.mk
index c170bf6b6..72eeea37c 100644
--- a/stoc/source/invocation/makefile.mk
+++ b/stoc/source/invocation/makefile.mk
@@ -62,4 +62,10 @@ DEF1NAME= $(SHL1TARGET)
.INCLUDE : target.mk
+ALLTAR : $(MISC)/invocation.component
+$(MISC)/invocation.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ invocation.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt invocation.component
diff --git a/stoc/source/invocation_adapterfactory/iafactory.cxx b/stoc/source/invocation_adapterfactory/iafactory.cxx
index e42aae68d..4c2bc37b5 100644
--- a/stoc/source/invocation_adapterfactory/iafactory.cxx
+++ b/stoc/source/invocation_adapterfactory/iafactory.cxx
@@ -1016,14 +1016,6 @@ void SAL_CALL component_getImplementationEnvironment(
}
//==============================================================================
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- return ::cppu::component_writeInfoHelper(
- pServiceManager, pRegistryKey, g_entries );
-}
-
-//==============================================================================
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
diff --git a/stoc/source/invocation_adapterfactory/invocadapt.component b/stoc/source/invocation_adapterfactory/invocadapt.component
new file mode 100644
index 000000000..64f7b2b36
--- /dev/null
+++ b/stoc/source/invocation_adapterfactory/invocadapt.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.stoc.InvocationAdapterFactory">
+ <service name="com.sun.star.script.InvocationAdapterFactory"/>
+ </implementation>
+</component>
diff --git a/stoc/source/invocation_adapterfactory/makefile.mk b/stoc/source/invocation_adapterfactory/makefile.mk
index 66568af03..4c3450ac8 100644
--- a/stoc/source/invocation_adapterfactory/makefile.mk
+++ b/stoc/source/invocation_adapterfactory/makefile.mk
@@ -63,3 +63,11 @@ DEF1NAME= $(SHL1TARGET)
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/invocadapt.component
+
+$(MISC)/invocadapt.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ invocadapt.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt invocadapt.component
diff --git a/stoc/source/javaloader/javaloader.component b/stoc/source/javaloader/javaloader.component
new file mode 100644
index 000000000..bdd3b82d5
--- /dev/null
+++ b/stoc/source/javaloader/javaloader.component
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.stoc.JavaComponentLoader">
+ <service name="com.sun.star.loader.Java"/>
+ <service name="com.sun.star.loader.Java2"/>
+ </implementation>
+</component>
diff --git a/stoc/source/javaloader/javaloader.cxx b/stoc/source/javaloader/javaloader.cxx
index 069c9b1ea..ee4f5c8b4 100644
--- a/stoc/source/javaloader/javaloader.cxx
+++ b/stoc/source/javaloader/javaloader.cxx
@@ -472,12 +472,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//==================================================================================================
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries );
-}
-//==================================================================================================
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
diff --git a/stoc/source/javaloader/makefile.mk b/stoc/source/javaloader/makefile.mk
index 60eea6a23..e53b90d5e 100644
--- a/stoc/source/javaloader/makefile.mk
+++ b/stoc/source/javaloader/makefile.mk
@@ -70,3 +70,10 @@ all:
.INCLUDE : target.mk
+ALLTAR : $(MISC)/javaloader.component
+
+$(MISC)/javaloader.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ javaloader.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt javaloader.component
diff --git a/stoc/source/javavm/javavm.component b/stoc/source/javavm/javavm.component
new file mode 100644
index 000000000..f78d8af3a
--- /dev/null
+++ b/stoc/source/javavm/javavm.component
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.stoc.JavaVirtualMachine">
+ <service name="com.sun.star.java.JavaVirtualMachine"/>
+ <singleton name="com.sun.star.java.theJavaVirtualMachine"/>
+ </implementation>
+</component>
diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx
index f2c018418..ba1c3cf17 100644
--- a/stoc/source/javavm/javavm.cxx
+++ b/stoc/source/javavm/javavm.cxx
@@ -226,15 +226,10 @@ rtl::OUString serviceGetImplementationName()
"com.sun.star.comp.stoc.JavaVirtualMachine"));
}
-rtl::OUString serviceGetServiceName()
-{
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.java.JavaVirtualMachine"));
-}
-
css::uno::Sequence< rtl::OUString > serviceGetSupportedServiceNames()
{
- rtl::OUString aServiceName = serviceGetServiceName();
+ rtl::OUString aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.java.JavaVirtualMachine"));
return css::uno::Sequence< rtl::OUString >(&aServiceName, 1);
}
@@ -619,34 +614,6 @@ component_getImplementationEnvironment(sal_Char const ** pEnvTypeName,
*pEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
-extern "C" sal_Bool SAL_CALL component_writeInfo(void * pServiceManager,
- void * pRegistryKey)
-{
- if (cppu::component_writeInfoHelper(pServiceManager, pRegistryKey,
- aServiceImplementation))
- {
- try
- {
- css::uno::Reference< css::registry::XRegistryKey >(
- reinterpret_cast< css::registry::XRegistryKey * >(
- pRegistryKey)->
- createKey(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.comp.stoc.JavaVirtualMachine"
- "/UNO/SINGLETONS/"
- "com.sun.star.java.theJavaVirtualMachine"))))->
- setStringValue(serviceGetServiceName());
- return true;
- }
- catch (css::uno::Exception &)
- {
- OSL_ENSURE(false, "com.sun.star.uno.Exception caught");
- }
- }
- return false;
-}
-
extern "C" void * SAL_CALL component_getFactory(sal_Char const * pImplName,
void * pServiceManager,
void * pRegistryKey)
diff --git a/stoc/source/javavm/makefile.mk b/stoc/source/javavm/makefile.mk
index 96908d10d..bcd36e696 100644
--- a/stoc/source/javavm/makefile.mk
+++ b/stoc/source/javavm/makefile.mk
@@ -85,3 +85,10 @@ all:
.INCLUDE : target.mk
+ALLTAR : $(MISC)/javavm.component
+
+$(MISC)/javavm.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ javavm.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt javavm.component
diff --git a/stoc/source/namingservice/makefile.mk b/stoc/source/namingservice/makefile.mk
index 424180e11..cc98cdfc3 100644
--- a/stoc/source/namingservice/makefile.mk
+++ b/stoc/source/namingservice/makefile.mk
@@ -64,3 +64,10 @@ DEF1NAME= $(SHL1TARGET)
.INCLUDE : target.mk
+ALLTAR : $(MISC)/namingservice.component
+
+$(MISC)/namingservice.component .ERRREMOVE : \
+ $(SOLARENV)/bin/createcomponent.xslt namingservice.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt namingservice.component
diff --git a/stoc/source/namingservice/namingservice.component b/stoc/source/namingservice/namingservice.component
new file mode 100644
index 000000000..8450cdee6
--- /dev/null
+++ b/stoc/source/namingservice/namingservice.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.stoc.NamingService">
+ <service name="com.sun.star.uno.NamingService"/>
+ </implementation>
+</component>
diff --git a/stoc/source/namingservice/namingservice.cxx b/stoc/source/namingservice/namingservice.cxx
index 761fccf64..e5aae9a74 100644
--- a/stoc/source/namingservice/namingservice.cxx
+++ b/stoc/source/namingservice/namingservice.cxx
@@ -238,12 +238,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//==================================================================================================
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries );
-}
-//==================================================================================================
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
diff --git a/stoc/source/proxy_factory/makefile.mk b/stoc/source/proxy_factory/makefile.mk
index b38dac146..23146e678 100644
--- a/stoc/source/proxy_factory/makefile.mk
+++ b/stoc/source/proxy_factory/makefile.mk
@@ -63,3 +63,11 @@ DEF1NAME=$(SHL1TARGET)
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/proxyfac.component
+
+$(MISC)/proxyfac.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ proxyfac.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt proxyfac.component
diff --git a/stoc/source/proxy_factory/proxyfac.component b/stoc/source/proxy_factory/proxyfac.component
new file mode 100644
index 000000000..bfe2c9c42
--- /dev/null
+++ b/stoc/source/proxy_factory/proxyfac.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.reflection.ProxyFactory">
+ <service name="com.sun.star.reflection.ProxyFactory"/>
+ </implementation>
+</component>
diff --git a/stoc/source/proxy_factory/proxyfac.cxx b/stoc/source/proxy_factory/proxyfac.cxx
index 4b69487f3..8547900b1 100644
--- a/stoc/source/proxy_factory/proxyfac.cxx
+++ b/stoc/source/proxy_factory/proxyfac.cxx
@@ -526,13 +526,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- return ::cppu::component_writeInfoHelper(
- pServiceManager, pRegistryKey, g_entries );
-}
-
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
diff --git a/stoc/source/simpleregistry/makefile.mk b/stoc/source/simpleregistry/makefile.mk
index 510e7b466..bc0ddf7cc 100644
--- a/stoc/source/simpleregistry/makefile.mk
+++ b/stoc/source/simpleregistry/makefile.mk
@@ -39,7 +39,8 @@ UNOUCROUT=$(OUT)$/inc$/bootstrap
# ------------------------------------------------------------------
SLOFILES= \
- $(SLO)$/simpleregistry.obj
+ $(SLO)/simpleregistry.obj \
+ $(SLO)/textualservices.obj
# --- Targets ------------------------------------------------------
diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx
index 03faa9a2c..9c6b71bc6 100644
--- a/stoc/source/simpleregistry/simpleregistry.cxx
+++ b/stoc/source/simpleregistry/simpleregistry.cxx
@@ -1,1306 +1,1320 @@
/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
#include "precompiled_stoc.hxx"
-#include <osl/diagnose.h>
-#include <osl/mutex.hxx>
-#include <rtl/alloc.h>
-#ifndef _RTL_USTRBUF_H_
-#include <rtl/ustrbuf.hxx>
-#endif
-#include <cppuhelper/queryinterface.hxx>
-#include <cppuhelper/weak.hxx>
-#include <cppuhelper/factory.hxx>
-#include <cppuhelper/implbase1.hxx>
-#include <cppuhelper/implbase2.hxx>
-#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_
-#include <cppuhelper/implementationentry.hxx>
-#endif
-#include <registry/registry.hxx>
-
-#include <com/sun/star/registry/XSimpleRegistry.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-
-using namespace com::sun::star::uno;
-using namespace com::sun::star::registry;
-using namespace com::sun::star::lang;
-using namespace cppu;
-using namespace osl;
-using namespace rtl;
-
-#define SERVICENAME "com.sun.star.registry.SimpleRegistry"
-#define IMPLNAME "com.sun.star.comp.stoc.SimpleRegistry"
+#include "sal/config.h"
+
+#include <cstdlib>
+#include <memory>
+#include <vector>
+
+#include "com/sun/star/lang/XServiceInfo.hpp"
+#include "com/sun/star/registry/InvalidRegistryException.hpp"
+#include "com/sun/star/registry/InvalidValueException.hpp"
+#include "com/sun/star/registry/MergeConflictException.hpp"
+#include "com/sun/star/registry/RegistryKeyType.hpp"
+#include "com/sun/star/registry/XRegistryKey.hpp"
+#include "com/sun/star/registry/XSimpleRegistry.hpp"
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "cppuhelper/implbase1.hxx"
+#include "cppuhelper/implbase2.hxx"
+#include "cppuhelper/weak.hxx"
+#include "osl/mutex.hxx"
+#include "registry/registry.hxx"
+#include "registry/regtype.h"
+#include "rtl/ref.hxx"
+#include "rtl/string.h"
+#include "rtl/string.hxx"
+#include "rtl/textcvt.h"
+#include "rtl/textenc.h"
+#include "rtl/unload.h"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+
+#include "bootstrapservices.hxx"
+
+#include "textualservices.hxx"
extern rtl_StandardModuleCount g_moduleCount;
-namespace stoc_bootstrap
-{
-Sequence< OUString > simreg_getSupportedServiceNames()
-{
- static Sequence < OUString > *pNames = 0;
- if( ! pNames )
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if( !pNames )
- {
- static Sequence< OUString > seqNames(1);
- seqNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM(SERVICENAME));
- pNames = &seqNames;
- }
- }
- return *pNames;
-}
+namespace {
-OUString simreg_getImplementationName()
-{
- static OUString *pImplName = 0;
- if( ! pImplName )
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if( ! pImplName )
- {
- static OUString implName( RTL_CONSTASCII_USTRINGPARAM( IMPLNAME ) );
- pImplName = &implName;
- }
- }
- return *pImplName;
-}
-}
-
-namespace stoc_simreg {
-
-//*************************************************************************
-// class RegistryKeyImpl the implenetation of interface XRegistryKey
-//*************************************************************************
-class RegistryKeyImpl;
-
-//*************************************************************************
-// SimpleRegistryImpl
-//*************************************************************************
-class SimpleRegistryImpl : public WeakImplHelper2< XSimpleRegistry, XServiceInfo >
+namespace css = com::sun::star;
+
+class SimpleRegistry:
+ public cppu::WeakImplHelper2<
+ css::registry::XSimpleRegistry, css::lang::XServiceInfo >
{
public:
- SimpleRegistryImpl( const Registry& rRegistry );
-
- ~SimpleRegistryImpl();
-
- // XServiceInfo
- virtual OUString SAL_CALL getImplementationName( ) throw(RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException);
- virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(RuntimeException);
-
- // XSimpleRegistry
- virtual OUString SAL_CALL getURL() throw(RuntimeException);
- virtual void SAL_CALL open( const OUString& rURL, sal_Bool bReadOnly, sal_Bool bCreate ) throw(InvalidRegistryException, RuntimeException);
- virtual sal_Bool SAL_CALL isValid( ) throw(RuntimeException);
- virtual void SAL_CALL close( ) throw(InvalidRegistryException, RuntimeException);
- virtual void SAL_CALL destroy( ) throw(InvalidRegistryException, RuntimeException);
- virtual Reference< XRegistryKey > SAL_CALL getRootKey( ) throw(InvalidRegistryException, RuntimeException);
- virtual sal_Bool SAL_CALL isReadOnly( ) throw(InvalidRegistryException, RuntimeException);
- virtual void SAL_CALL mergeKey( const OUString& aKeyName, const OUString& aUrl ) throw(InvalidRegistryException, MergeConflictException, RuntimeException);
-
- friend class RegistryKeyImpl;
-protected:
- Mutex m_mutex;
- OUString m_url;
- Registry m_registry;
-};
+ SimpleRegistry() { g_moduleCount.modCnt.acquire(&g_moduleCount.modCnt); }
+ ~SimpleRegistry() { g_moduleCount.modCnt.release(&g_moduleCount.modCnt); }
-class RegistryKeyImpl : public WeakImplHelper1< XRegistryKey >
-{
+ osl::Mutex mutex_;
+
+private:
+ virtual rtl::OUString SAL_CALL getURL() throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL open(
+ rtl::OUString const & rURL, sal_Bool bReadOnly, sal_Bool bCreate)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL isValid() throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL close() throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL destroy() throw(
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL
+ getRootKey() throw(
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL isReadOnly() throw(
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL mergeKey(
+ rtl::OUString const & aKeyName, rtl::OUString const & aUrl)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::registry::MergeConflictException, css::uno::RuntimeException);
+
+ virtual rtl::OUString SAL_CALL getImplementationName()
+ throw (css::uno::RuntimeException)
+ { return stoc_bootstrap::simreg_getImplementationName(); }
+
+ virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName)
+ throw (css::uno::RuntimeException)
+ { return ServiceName == getSupportedServiceNames()[0]; }
+
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL
+ getSupportedServiceNames() throw (css::uno::RuntimeException)
+ { return stoc_bootstrap::simreg_getSupportedServiceNames(); }
+
+ Registry registry_;
+ std::auto_ptr< stoc::simpleregistry::TextualServices > textual_;
+};
+
+class Key: public cppu::WeakImplHelper1< css::registry::XRegistryKey > {
public:
- RegistryKeyImpl( const RegistryKey& rKey, SimpleRegistryImpl* pRegistry );
-
- RegistryKeyImpl( const OUString& rKeyName, SimpleRegistryImpl* pRegistry );
-
- ~RegistryKeyImpl();
-
- // XRegistryKey
- virtual OUString SAL_CALL getKeyName() throw(RuntimeException);
- virtual sal_Bool SAL_CALL isReadOnly( ) throw(InvalidRegistryException, RuntimeException);
- virtual sal_Bool SAL_CALL isValid( ) throw(RuntimeException);
- virtual RegistryKeyType SAL_CALL getKeyType( const OUString& rKeyName ) throw(InvalidRegistryException, RuntimeException);
- virtual RegistryValueType SAL_CALL getValueType( ) throw(InvalidRegistryException, RuntimeException);
- virtual sal_Int32 SAL_CALL getLongValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
- virtual void SAL_CALL setLongValue( sal_Int32 value ) throw(InvalidRegistryException, RuntimeException);
- virtual Sequence< sal_Int32 > SAL_CALL getLongListValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
- virtual void SAL_CALL setLongListValue( const ::com::sun::star::uno::Sequence< sal_Int32 >& seqValue ) throw(InvalidRegistryException, RuntimeException);
- virtual OUString SAL_CALL getAsciiValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
- virtual void SAL_CALL setAsciiValue( const OUString& value ) throw(InvalidRegistryException, RuntimeException);
- virtual Sequence< OUString > SAL_CALL getAsciiListValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
- virtual void SAL_CALL setAsciiListValue( const ::com::sun::star::uno::Sequence< OUString >& seqValue ) throw(InvalidRegistryException, RuntimeException);
- virtual OUString SAL_CALL getStringValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
- virtual void SAL_CALL setStringValue( const OUString& value ) throw(InvalidRegistryException, RuntimeException);
- virtual Sequence< OUString > SAL_CALL getStringListValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
- virtual void SAL_CALL setStringListValue( const ::com::sun::star::uno::Sequence< OUString >& seqValue ) throw(InvalidRegistryException, RuntimeException);
- virtual Sequence< sal_Int8 > SAL_CALL getBinaryValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
- virtual void SAL_CALL setBinaryValue( const ::com::sun::star::uno::Sequence< sal_Int8 >& value ) throw(InvalidRegistryException, RuntimeException);
- virtual Reference< XRegistryKey > SAL_CALL openKey( const OUString& aKeyName ) throw(InvalidRegistryException, RuntimeException);
- virtual Reference< XRegistryKey > SAL_CALL createKey( const OUString& aKeyName ) throw(InvalidRegistryException, RuntimeException);
- virtual void SAL_CALL closeKey( ) throw(InvalidRegistryException, RuntimeException);
- virtual void SAL_CALL deleteKey( const OUString& rKeyName ) throw(InvalidRegistryException, RuntimeException);
- virtual Sequence< Reference< XRegistryKey > > SAL_CALL openKeys( ) throw(InvalidRegistryException, RuntimeException);
- virtual Sequence< OUString > SAL_CALL getKeyNames( ) throw(InvalidRegistryException, RuntimeException);
- virtual sal_Bool SAL_CALL createLink( const OUString& aLinkName, const OUString& aLinkTarget ) throw(InvalidRegistryException, RuntimeException);
- virtual void SAL_CALL deleteLink( const OUString& rLinkName ) throw(InvalidRegistryException, RuntimeException);
- virtual OUString SAL_CALL getLinkTarget( const OUString& rLinkName ) throw(InvalidRegistryException, RuntimeException);
- virtual OUString SAL_CALL getResolvedName( const OUString& aKeyName ) throw(InvalidRegistryException, RuntimeException);
-
-protected:
- OUString m_name;
- RegistryKey m_key;
- SimpleRegistryImpl* m_pRegistry;
-};
-
-//*************************************************************************
-RegistryKeyImpl::RegistryKeyImpl( const RegistryKey& key, SimpleRegistryImpl* pRegistry )
- : m_key(key)
- , m_pRegistry(pRegistry)
-{
- m_pRegistry->acquire();
- m_name = m_key.getName();
+ Key(
+ rtl::Reference< SimpleRegistry > const & registry,
+ RegistryKey const & key):
+ registry_(registry), key_(key) {}
+
+private:
+ virtual rtl::OUString SAL_CALL getKeyName()
+ throw (css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL isReadOnly() throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL isValid() throw(css::uno::RuntimeException);
+
+ virtual css::registry::RegistryKeyType SAL_CALL getKeyType(
+ rtl::OUString const & rKeyName)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual css::registry::RegistryValueType SAL_CALL getValueType() throw(
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL getLongValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setLongValue(sal_Int32 value) throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< sal_Int32 > SAL_CALL getLongListValue() throw(
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setLongListValue(
+ com::sun::star::uno::Sequence< sal_Int32 > const & seqValue)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual rtl::OUString SAL_CALL getAsciiValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setAsciiValue(rtl::OUString const & value) throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL getAsciiListValue()
+ throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setAsciiListValue(
+ css::uno::Sequence< rtl::OUString > const & seqValue)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual rtl::OUString SAL_CALL getStringValue() throw(
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setStringValue(rtl::OUString const & value) throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL getStringListValue()
+ throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setStringListValue(
+ css::uno::Sequence< rtl::OUString > const & seqValue)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBinaryValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setBinaryValue(
+ css::uno::Sequence< sal_Int8 > const & value)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL openKey(
+ rtl::OUString const & aKeyName)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL
+ createKey(rtl::OUString const & aKeyName) throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL closeKey() throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL deleteKey(rtl::OUString const & rKeyName) throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual
+ css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
+ SAL_CALL openKeys() throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL getKeyNames() throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL createLink(
+ rtl::OUString const & aLinkName, rtl::OUString const & aLinkTarget)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual void SAL_CALL deleteLink(rtl::OUString const & rLinkName) throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual rtl::OUString SAL_CALL getLinkTarget(
+ rtl::OUString const & rLinkName)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual rtl::OUString SAL_CALL getResolvedName(
+ rtl::OUString const & aKeyName)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ rtl::Reference< SimpleRegistry > registry_;
+ RegistryKey key_;
+};
+
+rtl::OUString Key::getKeyName() throw (css::uno::RuntimeException) {
+ osl::MutexGuard guard(registry_->mutex_);
+ return key_.getName();
}
-//*************************************************************************
-RegistryKeyImpl::RegistryKeyImpl( const OUString& rKeyName,
- SimpleRegistryImpl* pRegistry )
- : m_pRegistry(pRegistry)
+sal_Bool Key::isReadOnly()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- m_pRegistry->acquire();
-
- RegistryKey rootKey;
- if (!pRegistry->m_registry.isValid() ||
- pRegistry->m_registry.openRootKey(rootKey))
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- if ( rootKey.openKey(rKeyName, m_key) )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- m_name = rKeyName;
- }
- }
+ osl::MutexGuard guard(registry_->mutex_);
+ return key_.isReadOnly();
}
-//*************************************************************************
-RegistryKeyImpl::~RegistryKeyImpl()
-{
- m_pRegistry->release();
+sal_Bool Key::isValid() throw (css::uno::RuntimeException) {
+ osl::MutexGuard guard(registry_->mutex_);
+ return key_.isValid();
}
-//*************************************************************************
-OUString SAL_CALL RegistryKeyImpl::getKeyName() throw(RuntimeException)
+css::registry::RegistryKeyType Key::getKeyType(rtl::OUString const & rKeyName)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- return m_name;
-}
+ osl::MutexGuard guard(registry_->mutex_);
+ RegKeyType type;
+ RegError err = key_.getKeyType(rKeyName, &type);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getKeyType:"
+ " underlying RegistryKey::getKeyType() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ switch (type) {
+ default:
+ std::abort(); // this cannot happen
+ // pseudo-fall-through to avoid warnings on MSC
+ case RG_KEYTYPE:
+ return css::registry::RegistryKeyType_KEY;
+ case RG_LINKTYPE:
+ return css::registry::RegistryKeyType_LINK;
+ }
+}
-//*************************************************************************
-sal_Bool SAL_CALL RegistryKeyImpl::isReadOnly( )
- throw(InvalidRegistryException, RuntimeException)
+css::registry::RegistryValueType Key::getValueType()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if (m_key.isValid())
- {
- return(m_key.isReadOnly());
- } else
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
+ osl::MutexGuard guard(registry_->mutex_);
+ RegValueType type;
+ sal_uInt32 size;
+ RegError err = key_.getValueInfo(rtl::OUString(), &type, &size);
+ switch (err) {
+ case REG_NO_ERROR:
+ break;
+ case REG_INVALID_VALUE:
+ type = RG_VALUETYPE_NOT_DEFINED;
+ break;
+ default:
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getValueType:"
+ " underlying RegistryKey::getValueInfo() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ switch (type) {
+ default:
+ std::abort(); // this cannot happen
+ // pseudo-fall-through to avoid warnings on MSC
+ case RG_VALUETYPE_NOT_DEFINED:
+ return css::registry::RegistryValueType_NOT_DEFINED;
+ case RG_VALUETYPE_LONG:
+ return css::registry::RegistryValueType_LONG;
+ case RG_VALUETYPE_STRING:
+ return css::registry::RegistryValueType_ASCII;
+ case RG_VALUETYPE_UNICODE:
+ return css::registry::RegistryValueType_STRING;
+ case RG_VALUETYPE_BINARY:
+ return css::registry::RegistryValueType_BINARY;
+ case RG_VALUETYPE_LONGLIST:
+ return css::registry::RegistryValueType_LONGLIST;
+ case RG_VALUETYPE_STRINGLIST:
+ return css::registry::RegistryValueType_ASCIILIST;
+ case RG_VALUETYPE_UNICODELIST:
+ return css::registry::RegistryValueType_STRINGLIST;
}
-}
+}
-//*************************************************************************
-sal_Bool SAL_CALL RegistryKeyImpl::isValid( ) throw(RuntimeException)
+sal_Int32 Key::getLongValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- return m_key.isValid();
-}
+ osl::MutexGuard guard(registry_->mutex_);
+ sal_Int32 value;
+ RegError err = key_.getValue(rtl::OUString(), &value);
+ switch (err) {
+ case REG_NO_ERROR:
+ break;
+ case REG_INVALID_VALUE:
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getLongValue:"
+ " underlying RegistryKey::getValue() = REG_INVALID_VALUE")),
+ static_cast< OWeakObject * >(this));
+ default:
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getLongValue:"
+ " underlying RegistryKey::getValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ return value;
+}
-//*************************************************************************
-RegistryKeyType SAL_CALL RegistryKeyImpl::getKeyType( const OUString& rKeyName )
- throw(InvalidRegistryException, RuntimeException)
+void Key::setLongValue(sal_Int32 value)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( m_key.isValid() )
- {
- RegKeyType keyType;
- if ( !m_key.getKeyType(rKeyName, &keyType) )
- {
- switch (keyType)
- {
- case RG_KEYTYPE:
- return RegistryKeyType_KEY;
- case RG_LINKTYPE:
- return RegistryKeyType_LINK;
- }
- } else
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- }
- } else
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
+ osl::MutexGuard guard(registry_->mutex_);
+ RegError err = key_.setValue(
+ rtl::OUString(), RG_VALUETYPE_LONG, &value, sizeof (sal_Int32));
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key setLongValue:"
+ " underlying RegistryKey::setValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
-
- return RegistryKeyType_KEY;
-}
+}
-//*************************************************************************
-RegistryValueType SAL_CALL RegistryKeyImpl::getValueType( )
- throw(InvalidRegistryException, RuntimeException)
+css::uno::Sequence< sal_Int32 > Key::getLongListValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if (!m_key.isValid())
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegValueType type;
- sal_uInt32 size;
-
- if (m_key.getValueInfo(OUString(), &type, &size))
- {
- return RegistryValueType_NOT_DEFINED;
- } else
- {
- switch (type)
- {
- case RG_VALUETYPE_LONG: return RegistryValueType_LONG;
- case RG_VALUETYPE_STRING: return RegistryValueType_ASCII;
- case RG_VALUETYPE_UNICODE: return RegistryValueType_STRING;
- case RG_VALUETYPE_BINARY: return RegistryValueType_BINARY;
- case RG_VALUETYPE_LONGLIST: return RegistryValueType_LONGLIST;
- case RG_VALUETYPE_STRINGLIST: return RegistryValueType_ASCIILIST;
- case RG_VALUETYPE_UNICODELIST: return RegistryValueType_STRINGLIST;
- default: return RegistryValueType_NOT_DEFINED;
- }
- }
+ osl::MutexGuard guard(registry_->mutex_);
+ RegistryValueList< sal_Int32 > list;
+ RegError err = key_.getLongListValue(rtl::OUString(), list);
+ switch (err) {
+ case REG_NO_ERROR:
+ break;
+ case REG_VALUE_NOT_EXISTS:
+ return css::uno::Sequence< sal_Int32 >();
+ case REG_INVALID_VALUE:
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getLongListValue:"
+ " underlying RegistryKey::getLongListValue() ="
+ " REG_INVALID_VALUE")),
+ static_cast< OWeakObject * >(this));
+ default:
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getLongListValue:"
+ " underlying RegistryKey::getLongListValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ sal_uInt32 n = list.getLength();
+ if (n > SAL_MAX_INT32) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getLongListValue:"
+ " underlying RegistryKey::getLongListValue() too large")),
+ static_cast< OWeakObject * >(this));
}
-
- return RegistryValueType_NOT_DEFINED;
-}
+ css::uno::Sequence< sal_Int32 > value(static_cast< sal_Int32 >(n));
+ for (sal_uInt32 i = 0; i < n; ++i) {
+ value[static_cast< sal_Int32 >(i)] = list.getElement(i);
+ }
+ return value;
+}
-//*************************************************************************
-sal_Int32 SAL_CALL RegistryKeyImpl::getLongValue( )
- throw(InvalidRegistryException, InvalidValueException, RuntimeException)
+void Key::setLongListValue(css::uno::Sequence< sal_Int32 > const & seqValue)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if (!m_key.isValid())
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegValueType type;
- sal_uInt32 size;
-
- if ( !m_key.getValueInfo(OUString(), &type, &size) )
- {
- if (type == RG_VALUETYPE_LONG)
- {
- sal_Int32 value;
- if ( !m_key.getValue(OUString(), (RegValue)&value) )
- {
- return value;
- }
- }
- }
-
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
+ osl::MutexGuard guard(registry_->mutex_);
+ std::vector< sal_Int32 > list;
+ for (sal_Int32 i = 0; i < seqValue.getLength(); ++i) {
+ list.push_back(seqValue[i]);
}
-}
+ RegError err = key_.setLongListValue(
+ rtl::OUString(), list.empty() ? 0 : &list[0],
+ static_cast< sal_uInt32 >(list.size()));
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key setLongListValue:"
+ " underlying RegistryKey::setLongListValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+}
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::setLongValue( sal_Int32 value )
- throw(InvalidRegistryException, RuntimeException)
+rtl::OUString Key::getAsciiValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- if (m_key.setValue(OUString(), RG_VALUETYPE_LONG, &value, sizeof(sal_Int32)))
- {
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
- }
+ osl::MutexGuard guard(registry_->mutex_);
+ RegValueType type;
+ sal_uInt32 size;
+ RegError err = key_.getValueInfo(rtl::OUString(), &type, &size);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getAsciiValue:"
+ " underlying RegistryKey::getValueInfo() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ if (type != RG_VALUETYPE_STRING) {
+ throw css::registry::InvalidValueException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getAsciiValue:"
+ " underlying RegistryKey type = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(type))),
+ static_cast< OWeakObject * >(this));
+ }
+ // size contains terminating null (error in underlying registry.cxx):
+ if (size == 0) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getAsciiValue:"
+ " underlying RegistryKey size 0 cannot happen due to"
+ " design error")),
+ static_cast< OWeakObject * >(this));
+ }
+ if (size > SAL_MAX_INT32) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getAsciiValue:"
+ " underlying RegistryKey size too large")),
+ static_cast< OWeakObject * >(this));
+ }
+ std::vector< char > list(size);
+ err = key_.getValue(rtl::OUString(), &list[0]);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getAsciiValue:"
+ " underlying RegistryKey::getValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ if (list[size - 1] != '\0') {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getAsciiValue:"
+ " underlying RegistryKey value must be null-terminated due"
+ " to design error")),
+ static_cast< OWeakObject * >(this));
}
-}
+ rtl::OUString value;
+ if (!rtl_convertStringToUString(
+ &value.pData, &list[0],
+ static_cast< sal_Int32 >(size - 1), RTL_TEXTENCODING_UTF8,
+ (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)))
+ {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getAsciiValue:"
+ " underlying RegistryKey not UTF-8")),
+ static_cast< OWeakObject * >(this));
+ }
+ return value;
+}
-//*************************************************************************
-Sequence< sal_Int32 > SAL_CALL RegistryKeyImpl::getLongListValue( )
- throw(InvalidRegistryException, InvalidValueException, RuntimeException)
+void Key::setAsciiValue(rtl::OUString const & value)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegValueType type;
- sal_uInt32 size;
-
- if ( !m_key.getValueInfo(OUString(), &type, &size) )
- {
- if (type == RG_VALUETYPE_LONGLIST)
- {
- RegistryValueList<sal_Int32> tmpValue;
- if ( !m_key.getLongListValue(OUString(), tmpValue) )
- {
- Sequence<sal_Int32> seqValue(size);
-
- for (sal_uInt32 i=0; i < size; i++)
- {
- seqValue.getArray()[i] = tmpValue.getElement(i);
- }
-
- return seqValue;
- }
- }
- }
-
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
+ osl::MutexGuard guard(registry_->mutex_);
+ rtl::OString utf8;
+ if (!value.convertToString(
+ &utf8, RTL_TEXTENCODING_UTF8,
+ (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)))
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key setAsciiValue:"
+ " value not UTF-16")),
+ static_cast< OWeakObject * >(this));
+ }
+ RegError err = key_.setValue(
+ rtl::OUString(), RG_VALUETYPE_STRING,
+ const_cast< char * >(utf8.getStr()), utf8.getLength() + 1);
+ // +1 for terminating null (error in underlying registry.cxx)
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key setAsciiValue:"
+ " underlying RegistryKey::setValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
}
-
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::setLongListValue( const Sequence< sal_Int32 >& seqValue )
- throw(InvalidRegistryException, RuntimeException)
-{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- sal_uInt32 length = seqValue.getLength();
- sal_Int32* tmpValue = new sal_Int32[length];
-
- for (sal_uInt32 i=0; i < length; i++)
- {
- tmpValue[i] = seqValue.getConstArray()[i];
- }
-
- if ( m_key.setLongListValue(OUString(), tmpValue, length) )
- {
- delete[] tmpValue;
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
- }
-
- delete[] tmpValue;
- }
-}
-//*************************************************************************
-OUString SAL_CALL RegistryKeyImpl::getAsciiValue( )
- throw(InvalidRegistryException, InvalidValueException, RuntimeException)
+css::uno::Sequence< rtl::OUString > Key::getAsciiListValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if (!m_key.isValid())
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegValueType type;
- sal_uInt32 size;
-
- if ( !m_key.getValueInfo(OUString(), &type, &size) )
+ osl::MutexGuard guard(registry_->mutex_);
+ RegistryValueList< char * > list;
+ RegError err = key_.getStringListValue(rtl::OUString(), list);
+ switch (err) {
+ case REG_NO_ERROR:
+ break;
+ case REG_VALUE_NOT_EXISTS:
+ return css::uno::Sequence< rtl::OUString >();
+ case REG_INVALID_VALUE:
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key"
+ " getAsciiListValue: underlying"
+ " RegistryKey::getStringListValue() = REG_INVALID_VALUE")),
+ static_cast< OWeakObject * >(this));
+ default:
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key"
+ " getAsciiListValue: underlying"
+ " RegistryKey::getStringListValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ sal_uInt32 n = list.getLength();
+ if (n > SAL_MAX_INT32) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key"
+ " getAsciiListValue: underlying"
+ " RegistryKey::getStringListValue() too large")),
+ static_cast< OWeakObject * >(this));
+ }
+ css::uno::Sequence< rtl::OUString > value(static_cast< sal_Int32 >(n));
+ for (sal_uInt32 i = 0; i < n; ++i) {
+ char * el = list.getElement(i);
+ sal_Int32 size = rtl_str_getLength(el);
+ if (!rtl_convertStringToUString(
+ &value[static_cast< sal_Int32 >(i)].pData, el, size,
+ RTL_TEXTENCODING_UTF8,
+ (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)))
{
- if ( type == RG_VALUETYPE_STRING )
- {
- char* value = new char[size];
- if ( m_key.getValue(OUString(), (RegValue)value) )
- {
- delete [] value;
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
- } else
- {
- OUString ret(OStringToOUString(value, RTL_TEXTENCODING_UTF8));
- delete [] value;
- return ret;
- }
- }
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key"
+ " getAsciiListValue: underlying RegistryKey not"
+ " UTF-8")),
+ static_cast< OWeakObject * >(this));
}
-
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
}
-}
+ return value;
+}
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::setAsciiValue( const OUString& value )
- throw(InvalidRegistryException, RuntimeException)
+void Key::setAsciiListValue(
+ css::uno::Sequence< rtl::OUString > const & seqValue)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- OString sValue = OUStringToOString(value, RTL_TEXTENCODING_UTF8);
- sal_uInt32 size = sValue.getLength()+1;
- if ( m_key.setValue(OUString(), RG_VALUETYPE_STRING,
- (RegValue)(sValue.getStr()), size) )
+ osl::MutexGuard guard(registry_->mutex_);
+ std::vector< rtl::OString > list;
+ for (sal_Int32 i = 0; i < seqValue.getLength(); ++i) {
+ rtl::OString utf8;
+ if (!seqValue[i].convertToString(
+ &utf8, RTL_TEXTENCODING_UTF8,
+ (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)))
{
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key"
+ " setAsciiListValue: value not UTF-16")),
+ static_cast< OWeakObject * >(this));
}
+ list.push_back(utf8);
}
-}
-
-//*************************************************************************
-Sequence< OUString > SAL_CALL RegistryKeyImpl::getAsciiListValue( )
- throw(InvalidRegistryException, InvalidValueException, RuntimeException)
-{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
+ std::vector< char * > list2;
+ for (std::vector< rtl::OString >::iterator i(list.begin()); i != list.end();
+ ++i)
{
- RegValueType type;
- sal_uInt32 size;
-
- if ( !m_key.getValueInfo(OUString(), &type, &size) )
- {
- if (type == RG_VALUETYPE_STRINGLIST)
- {
- RegistryValueList<char*> tmpValue;
- if ( !m_key.getStringListValue(OUString(), tmpValue) )
- {
- Sequence<OUString> seqValue(size);
-
- for (sal_uInt32 i=0; i < size; i++)
- {
- seqValue.getArray()[i] =
- OStringToOUString(tmpValue.getElement(i), RTL_TEXTENCODING_UTF8);
- }
-
- return seqValue;
- }
- }
- }
-
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
+ list2.push_back(const_cast< char * >(i->getStr()));
+ }
+ RegError err = key_.setStringListValue(
+ rtl::OUString(), list2.empty() ? 0 : &list2[0],
+ static_cast< sal_uInt32 >(list2.size()));
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key"
+ " setAsciiListValue: underlying"
+ " RegistryKey::setStringListValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
}
-
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::setAsciiListValue( const Sequence< OUString >& seqValue )
- throw(InvalidRegistryException, RuntimeException)
-{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- sal_uInt32 length = seqValue.getLength();
- OString* pSValue = new OString[length];
- char** tmpValue = new char*[length];
-
- for (sal_uInt32 i=0; i < length; i++)
- {
- pSValue[i] = OUStringToOString(seqValue.getConstArray()[i], RTL_TEXTENCODING_UTF8);
- tmpValue[i] = (char*)pSValue[i].getStr();
- }
-
- if ( m_key.setStringListValue(OUString(), tmpValue, length) )
- {
- delete[] pSValue;
- delete[] tmpValue;
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
- }
- delete[] pSValue;
- delete[] tmpValue;
+rtl::OUString Key::getStringValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
+{
+ osl::MutexGuard guard(registry_->mutex_);
+ RegValueType type;
+ sal_uInt32 size;
+ RegError err = key_.getValueInfo(rtl::OUString(), &type, &size);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getStringValue:"
+ " underlying RegistryKey::getValueInfo() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ if (type != RG_VALUETYPE_UNICODE) {
+ throw css::registry::InvalidValueException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getStringValue:"
+ " underlying RegistryKey type = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(type))),
+ static_cast< OWeakObject * >(this));
+ }
+ // size contains terminating null and is *2 (error in underlying
+ // registry.cxx):
+ if (size == 0 || (size & 1) == 1) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getStringValue:"
+ " underlying RegistryKey size 0 or odd cannot happen due to"
+ " design error")),
+ static_cast< OWeakObject * >(this));
+ }
+ if (size > SAL_MAX_INT32) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getStringValue:"
+ " underlying RegistryKey size too large")),
+ static_cast< OWeakObject * >(this));
}
-}
+ std::vector< sal_Unicode > list(size);
+ err = key_.getValue(rtl::OUString(), &list[0]);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getStringValue:"
+ " underlying RegistryKey::getValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ if (list[size/2 - 1] != 0) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getStringValue:"
+ " underlying RegistryKey value must be null-terminated due"
+ " to design error")),
+ static_cast< OWeakObject * >(this));
+ }
+ return rtl::OUString(&list[0], static_cast< sal_Int32 >(size/2 - 1));
+}
-//*************************************************************************
-OUString SAL_CALL RegistryKeyImpl::getStringValue( )
- throw(InvalidRegistryException, InvalidValueException, RuntimeException)
+void Key::setStringValue(rtl::OUString const & value)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegValueType type;
- sal_uInt32 size;
-
- if ( !m_key.getValueInfo(OUString(), &type, &size) )
- {
- if (type == RG_VALUETYPE_UNICODE)
- {
- sal_Unicode* value = new sal_Unicode[size];
- if ( m_key.getValue(OUString(), (RegValue)value) )
- {
- delete [] value;
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
- } else
- {
- OUString ret(value);
- delete [] value;
- return ret;
- }
- }
- }
-
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
+ osl::MutexGuard guard(registry_->mutex_);
+ RegError err = key_.setValue(
+ rtl::OUString(), RG_VALUETYPE_UNICODE,
+ const_cast< sal_Unicode * >(value.getStr()),
+ (value.getLength() + 1) * sizeof (sal_Unicode));
+ // +1 for terminating null (error in underlying registry.cxx)
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key setStringValue:"
+ " underlying RegistryKey::setValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
-}
+}
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::setStringValue( const OUString& value )
- throw(InvalidRegistryException, RuntimeException)
+css::uno::Sequence< rtl::OUString > Key::getStringListValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- sal_uInt32 size = (value.getLength() + 1) * sizeof(sal_Unicode);
- if ( m_key.setValue(OUString(), RG_VALUETYPE_UNICODE,
- (RegValue)(value.getStr()), size) )
- {
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
- }
- }
-}
+ osl::MutexGuard guard(registry_->mutex_);
+ RegistryValueList< sal_Unicode * > list;
+ RegError err = key_.getUnicodeListValue(rtl::OUString(), list);
+ switch (err) {
+ case REG_NO_ERROR:
+ break;
+ case REG_VALUE_NOT_EXISTS:
+ return css::uno::Sequence< rtl::OUString >();
+ case REG_INVALID_VALUE:
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key"
+ " getStringListValue: underlying"
+ " RegistryKey::getUnicodeListValue() = REG_INVALID_VALUE")),
+ static_cast< OWeakObject * >(this));
+ default:
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key"
+ " getStringListValue: underlying"
+ " RegistryKey::getUnicodeListValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ sal_uInt32 n = list.getLength();
+ if (n > SAL_MAX_INT32) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key"
+ " getStringListValue: underlying"
+ " RegistryKey::getUnicodeListValue() too large")),
+ static_cast< OWeakObject * >(this));
+ }
+ css::uno::Sequence< rtl::OUString > value(static_cast< sal_Int32 >(n));
+ for (sal_uInt32 i = 0; i < n; ++i) {
+ value[static_cast< sal_Int32 >(i)] = list.getElement(i);
+ }
+ return value;
+}
-//*************************************************************************
-Sequence< OUString > SAL_CALL RegistryKeyImpl::getStringListValue( )
- throw(InvalidRegistryException, InvalidValueException, RuntimeException)
+void Key::setStringListValue(
+ css::uno::Sequence< rtl::OUString > const & seqValue)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegValueType type;
- sal_uInt32 size;
-
- if ( !m_key.getValueInfo(OUString(), &type, &size) )
- {
- if (type == RG_VALUETYPE_UNICODELIST)
- {
- RegistryValueList<sal_Unicode*> tmpValue;
- if ( !m_key.getUnicodeListValue(OUString(), tmpValue) )
- {
- Sequence<OUString> seqValue(size);
-
- for (sal_uInt32 i=0; i < size; i++)
- {
- seqValue.getArray()[i] = OUString(tmpValue.getElement(i));
- }
-
- return seqValue;
- }
- }
- }
-
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
+ osl::MutexGuard guard(registry_->mutex_);
+ std::vector< sal_Unicode * > list;
+ for (sal_Int32 i = 0; i < seqValue.getLength(); ++i) {
+ list.push_back(const_cast< sal_Unicode * >(seqValue[i].getStr()));
+ }
+ RegError err = key_.setUnicodeListValue(
+ rtl::OUString(), list.empty() ? 0 : &list[0],
+ static_cast< sal_uInt32 >(list.size()));
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key"
+ " setStringListValue: underlying"
+ " RegistryKey::setUnicodeListValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
}
-
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::setStringListValue( const Sequence< OUString >& seqValue )
- throw(InvalidRegistryException, RuntimeException)
-{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- sal_uInt32 length = seqValue.getLength();
- sal_Unicode** tmpValue = new sal_Unicode*[length];
-
- for (sal_uInt32 i=0; i < length; i++)
- {
- tmpValue[i] = (sal_Unicode*)seqValue.getConstArray()[i].getStr();
- }
-
- if (m_key.setUnicodeListValue(OUString(), tmpValue, length))
- {
- delete[] tmpValue;
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
- }
-
- delete[] tmpValue;
- }
-}
-//*************************************************************************
-Sequence< sal_Int8 > SAL_CALL RegistryKeyImpl::getBinaryValue( )
- throw(InvalidRegistryException, InvalidValueException, RuntimeException)
+css::uno::Sequence< sal_Int8 > Key::getBinaryValue()
+ throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegValueType type;
- sal_uInt32 size;
-
- if ( !m_key.getValueInfo(OUString(), &type, &size) )
- {
- if (type == RG_VALUETYPE_BINARY)
- {
- sal_Int8* value = new sal_Int8[size];
- if (m_key.getValue(OUString(), (RegValue)value))
- {
- delete [] value;
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
- } else
- {
- Sequence<sal_Int8> seqBytes(value, size);
- delete [] value;
- return seqBytes;
- }
- }
- }
-
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
+ osl::MutexGuard guard(registry_->mutex_);
+ RegValueType type;
+ sal_uInt32 size;
+ RegError err = key_.getValueInfo(rtl::OUString(), &type, &size);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getBinaryValue:"
+ " underlying RegistryKey::getValueInfo() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ if (type != RG_VALUETYPE_BINARY) {
+ throw css::registry::InvalidValueException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getBinaryValue:"
+ " underlying RegistryKey type = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(type))),
+ static_cast< OWeakObject * >(this));
+ }
+ if (size > SAL_MAX_INT32) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getBinaryValue:"
+ " underlying RegistryKey size too large")),
+ static_cast< OWeakObject * >(this));
}
-}
+ css::uno::Sequence< sal_Int8 > value(static_cast< sal_Int32 >(size));
+ err = key_.getValue(rtl::OUString(), value.getArray());
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getBinaryValue:"
+ " underlying RegistryKey::getValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ return value;
+}
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::setBinaryValue( const Sequence< sal_Int8 >& value )
- throw(InvalidRegistryException, RuntimeException)
+void Key::setBinaryValue(css::uno::Sequence< sal_Int8 > const & value)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- sal_uInt32 size = value.getLength();
- if ( m_key.setValue(OUString(), RG_VALUETYPE_BINARY,
- (RegValue)(value.getConstArray()), size) )
- {
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
- }
- }
-}
+ osl::MutexGuard guard(registry_->mutex_);
+ RegError err = key_.setValue(
+ rtl::OUString(), RG_VALUETYPE_BINARY,
+ const_cast< sal_Int8 * >(value.getConstArray()),
+ static_cast< sal_uInt32 >(value.getLength()));
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key setBinaryValue:"
+ " underlying RegistryKey::setValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+}
-//*************************************************************************
-Reference< XRegistryKey > SAL_CALL RegistryKeyImpl::openKey( const OUString& aKeyName )
- throw(InvalidRegistryException, RuntimeException)
+css::uno::Reference< css::registry::XRegistryKey > Key::openKey(
+ rtl::OUString const & aKeyName)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- RegistryKey newKey;
-
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegError _ret = m_key.openKey(aKeyName, newKey);
- if ( _ret )
- {
- if ( _ret == REG_INVALID_KEY )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- }
-
- return Reference<XRegistryKey>();
- } else
- {
- return ((XRegistryKey*)new RegistryKeyImpl(newKey, m_pRegistry));
- }
- }
-}
+ osl::MutexGuard guard(registry_->mutex_);
+ RegistryKey key;
+ RegError err = key_.openKey(aKeyName, key);
+ switch (err) {
+ case REG_NO_ERROR:
+ return new Key(registry_, key);
+ case REG_KEY_NOT_EXISTS:
+ return css::uno::Reference< css::registry::XRegistryKey >();
+ default:
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key openKey:"
+ " underlying RegistryKey::openKey() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+}
-//*************************************************************************
-Reference< XRegistryKey > SAL_CALL RegistryKeyImpl::createKey( const OUString& aKeyName )
- throw(InvalidRegistryException, RuntimeException)
+css::uno::Reference< css::registry::XRegistryKey > Key::createKey(
+ rtl::OUString const & aKeyName)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- RegistryKey newKey;
-
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegError _ret = m_key.createKey(aKeyName, newKey);
- if ( _ret )
- {
- if (_ret == REG_INVALID_KEY)
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- }
-
- return Reference<XRegistryKey>();
- } else
- {
- return ((XRegistryKey*)new RegistryKeyImpl(newKey, m_pRegistry));
- }
- }
-}
+ osl::MutexGuard guard(registry_->mutex_);
+ RegistryKey key;
+ RegError err = key_.createKey(aKeyName, key);
+ switch (err) {
+ case REG_NO_ERROR:
+ return new Key(registry_, key);
+ case REG_INVALID_KEYNAME:
+ return css::uno::Reference< css::registry::XRegistryKey >();
+ default:
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key createKey:"
+ " underlying RegistryKey::createKey() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+}
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::closeKey( )
- throw(InvalidRegistryException, RuntimeException)
-{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( m_key.isValid() )
- {
- if ( !m_key.closeKey() )
- return;
- }
-
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
-}
-
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::deleteKey( const OUString& rKeyName )
- throw(InvalidRegistryException, RuntimeException)
+void Key::closeKey()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( m_key.isValid() )
- {
- if ( !m_key.deleteKey(rKeyName) )
- return;
- }
-
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
-}
-
-//*************************************************************************
-Sequence< Reference< XRegistryKey > > SAL_CALL RegistryKeyImpl::openKeys( )
- throw(InvalidRegistryException, RuntimeException)
-{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegistryKeyArray subKeys;
- RegError _ret = REG_NO_ERROR;
- if ( (_ret = m_key.openSubKeys(OUString(), subKeys)) )
- {
- if ( _ret == REG_INVALID_KEY )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- }
-
- return Sequence< Reference<XRegistryKey> >();
- } else
- {
- sal_uInt32 length = subKeys.getLength();
- Sequence< Reference<XRegistryKey> > seqKeys(length);
-
- for (sal_uInt32 i=0; i < length; i++)
- {
- seqKeys.getArray()[i] =
- (XRegistryKey*) new RegistryKeyImpl(subKeys.getElement(i), m_pRegistry);
- }
- return seqKeys;
- }
- }
-}
+ osl::MutexGuard guard(registry_->mutex_);
+ RegError err = key_.closeKey();
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key closeKey:"
+ " underlying RegistryKey::closeKey() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+}
-//*************************************************************************
-Sequence< OUString > SAL_CALL RegistryKeyImpl::getKeyNames( )
- throw(InvalidRegistryException, RuntimeException)
+void Key::deleteKey(rtl::OUString const & rKeyName)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegistryKeyNames subKeys;
- RegError _ret = REG_NO_ERROR;
- if ( (_ret = m_key.getKeyNames(OUString(), subKeys)) )
- {
- if ( _ret == REG_INVALID_KEY )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- }
-
- return Sequence<OUString>();
- } else
- {
- sal_uInt32 length = subKeys.getLength();
- Sequence<OUString> seqKeys(length);
-
- for (sal_uInt32 i=0; i < length; i++)
- {
- seqKeys.getArray()[i] = subKeys.getElement(i);
- }
- return seqKeys;
- }
- }
-}
+ osl::MutexGuard guard(registry_->mutex_);
+ RegError err = key_.deleteKey(rKeyName);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key deleteKey:"
+ " underlying RegistryKey::deleteKey() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+}
-//*************************************************************************
-sal_Bool SAL_CALL RegistryKeyImpl::createLink( const OUString& aLinkName, const OUString& aLinkTarget )
- throw(InvalidRegistryException, RuntimeException)
+css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
+Key::openKeys()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegError ret = m_key.createLink(aLinkName, aLinkTarget);
- if ( ret )
- {
- if ( ret == REG_DETECT_RECURSION ||
- ret == REG_INVALID_KEY )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- return sal_False;
- }
- }
+ osl::MutexGuard guard(registry_->mutex_);
+ RegistryKeyArray list;
+ RegError err = key_.openSubKeys(rtl::OUString(), list);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key openKeys:"
+ " underlying RegistryKey::openSubKeys() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ sal_uInt32 n = list.getLength();
+ if (n > SAL_MAX_INT32) {
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getKeyNames:"
+ " underlying RegistryKey::getKeyNames() too large")),
+ static_cast< OWeakObject * >(this));
}
- return sal_True;
+ css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
+ keys(static_cast< sal_Int32 >(n));
+ for (sal_uInt32 i = 0; i < n; ++i) {
+ keys[static_cast< sal_Int32 >(i)] = new Key(
+ registry_, list.getElement(i));
+ }
+ return keys;
}
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::deleteLink( const OUString& rLinkName )
- throw(InvalidRegistryException, RuntimeException)
+css::uno::Sequence< rtl::OUString > Key::getKeyNames()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- if ( m_key.deleteLink(rLinkName) )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- }
- }
+ osl::MutexGuard guard(registry_->mutex_);
+ RegistryKeyNames list;
+ RegError err = key_.getKeyNames(rtl::OUString(), list);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getKeyNames:"
+ " underlying RegistryKey::getKeyNames() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ sal_uInt32 n = list.getLength();
+ if (n > SAL_MAX_INT32) {
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getKeyNames:"
+ " underlying RegistryKey::getKeyNames() too large")),
+ static_cast< OWeakObject * >(this));
+ }
+ css::uno::Sequence< rtl::OUString > names(static_cast< sal_Int32 >(n));
+ for (sal_uInt32 i = 0; i < n; ++i) {
+ names[static_cast< sal_Int32 >(i)] = list.getElement(i);
+ }
+ return names;
}
-
-//*************************************************************************
-OUString SAL_CALL RegistryKeyImpl::getLinkTarget( const OUString& rLinkName )
- throw(InvalidRegistryException, RuntimeException)
-{
- OUString linkTarget;
-
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegError ret = m_key.getLinkTarget(rLinkName, linkTarget);
- if ( ret )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- }
- }
- return linkTarget;
-}
-
-//*************************************************************************
-OUString SAL_CALL RegistryKeyImpl::getResolvedName( const OUString& aKeyName )
- throw(InvalidRegistryException, RuntimeException)
-{
- OUString resolvedName;
-
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegError ret = m_key.getResolvedKeyName(
- aKeyName, sal_True, resolvedName);
- if ( ret )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- }
- }
-
- return resolvedName;
-}
-
-//*************************************************************************
-SimpleRegistryImpl::SimpleRegistryImpl( const Registry& rRegistry )
- : m_registry(rRegistry)
+sal_Bool Key::createLink(
+ rtl::OUString const & aLinkName, rtl::OUString const & aLinkTarget)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
-}
+ osl::MutexGuard guard(registry_->mutex_);
+ RegError err = key_.createLink(aLinkName, aLinkTarget);
+ switch (err) {
+ case REG_NO_ERROR:
+ return true;
+ case REG_INVALID_KEY:
+ case REG_DETECT_RECURSION:
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key createLink:"
+ " underlying RegistryKey::createLink() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ default:
+ return false;
+ }
+}
-//*************************************************************************
-SimpleRegistryImpl::~SimpleRegistryImpl()
+void Key::deleteLink(rtl::OUString const & rLinkName)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
+ osl::MutexGuard guard(registry_->mutex_);
+ RegError err = key_.deleteLink(rLinkName);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key deleteLink:"
+ " underlying RegistryKey::deleteLink() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
}
-//*************************************************************************
-OUString SAL_CALL SimpleRegistryImpl::getImplementationName( )
- throw(RuntimeException)
+rtl::OUString Key::getLinkTarget(rtl::OUString const & rLinkName)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- return stoc_bootstrap::simreg_getImplementationName();
-}
+ osl::MutexGuard guard(registry_->mutex_);
+ rtl::OUString target;
+ RegError err = key_.getLinkTarget(rLinkName, target);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getLinkTarget:"
+ " underlying RegistryKey::getLinkTarget() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ return target;
+}
-//*************************************************************************
-sal_Bool SAL_CALL SimpleRegistryImpl::supportsService( const OUString& ServiceName )
- throw(RuntimeException)
-{
- Guard< Mutex > aGuard( m_mutex );
- Sequence< OUString > aSNL = getSupportedServiceNames();
- const OUString * pArray = aSNL.getArray();
- for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
- if( pArray[i] == ServiceName )
- return sal_True;
- return sal_False;
-}
-
-//*************************************************************************
-Sequence<OUString> SAL_CALL SimpleRegistryImpl::getSupportedServiceNames( )
- throw(RuntimeException)
+rtl::OUString Key::getResolvedName(rtl::OUString const & aKeyName)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- return stoc_bootstrap::simreg_getSupportedServiceNames();
-}
+ osl::MutexGuard guard(registry_->mutex_);
+ rtl::OUString resolved;
+ RegError err = key_.getResolvedKeyName(aKeyName, true, resolved);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getResolvedName:"
+ " underlying RegistryKey::getResolvedName() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ return resolved;
+}
-//*************************************************************************
-OUString SAL_CALL SimpleRegistryImpl::getURL() throw(RuntimeException)
-{
- Guard< Mutex > aGuard( m_mutex );
- return m_url;
-}
+rtl::OUString SimpleRegistry::getURL() throw (css::uno::RuntimeException) {
+ osl::MutexGuard guard(mutex_);
+ return textual_.get() == 0 ? registry_.getName() : textual_->getUri();
+}
-//*************************************************************************
-void SAL_CALL SimpleRegistryImpl::open( const OUString& rURL, sal_Bool bReadOnly, sal_Bool bCreate )
- throw(InvalidRegistryException, RuntimeException)
+void SimpleRegistry::open(
+ rtl::OUString const & rURL, sal_Bool bReadOnly, sal_Bool bCreate)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_mutex );
- if ( m_registry.isValid() )
- {
- m_registry.close();
+ osl::MutexGuard guard(mutex_);
+ if (textual_.get() != 0) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry.open(")) +
+ rURL +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "): instance already open"))),
+ static_cast< OWeakObject * >(this));
}
-
- RegAccessMode accessMode = REG_READWRITE;
-
- if ( bReadOnly )
- accessMode = REG_READONLY;
-
- if ( !m_registry.open(rURL, accessMode) )
- {
- m_url = rURL;
- return;
+ RegError err = (rURL.getLength() == 0 && bCreate)
+ ? REG_REGISTRY_NOT_EXISTS
+ : registry_.open(rURL, bReadOnly ? REG_READONLY : REG_READWRITE);
+ if (err == REG_REGISTRY_NOT_EXISTS && bCreate) {
+ err = registry_.create(rURL);
}
-
- if ( bCreate )
- {
- if ( !m_registry.create(rURL) )
- {
- m_url = rURL;
- return;
+ switch (err) {
+ case REG_NO_ERROR:
+ break;
+ case REG_INVALID_REGISTRY:
+ if (bReadOnly && !bCreate) {
+ textual_.reset(new stoc::simpleregistry::TextualServices(rURL));
+ break;
}
+ // fall through
+ default:
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry.open(")) +
+ rURL +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "): underlying Registry::open/create() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
-
- m_url = OUString();
-
- OUStringBuffer reason( 128 );
- reason.appendAscii( RTL_CONSTASCII_STRINGPARAM("Couldn't ") );
- if( bCreate )
- {
- reason.appendAscii( RTL_CONSTASCII_STRINGPARAM("create") );
- }
- else
- {
- reason.appendAscii( RTL_CONSTASCII_STRINGPARAM("open") );
- }
- reason.appendAscii( RTL_CONSTASCII_STRINGPARAM(" registry ") );
- reason.append( rURL );
- if( bReadOnly )
- {
- reason.appendAscii( RTL_CONSTASCII_STRINGPARAM(" for reading") );
- }
- else
- {
- reason.appendAscii( RTL_CONSTASCII_STRINGPARAM(" for writing" ) );
- }
- throw InvalidRegistryException( reason.makeStringAndClear() , Reference< XInterface >() );
-}
+}
-//*************************************************************************
-sal_Bool SAL_CALL SimpleRegistryImpl::isValid( ) throw(RuntimeException)
-{
- Guard< Mutex > aGuard( m_mutex );
- return m_registry.isValid();
-}
+sal_Bool SimpleRegistry::isValid() throw (css::uno::RuntimeException) {
+ osl::MutexGuard guard(mutex_);
+ return textual_.get() != 0 || registry_.isValid();
+}
-//*************************************************************************
-void SAL_CALL SimpleRegistryImpl::close( )
- throw(InvalidRegistryException, RuntimeException)
+void SimpleRegistry::close()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_mutex );
- if ( m_registry.isValid() )
- {
- if ( !m_registry.close() )
- {
- m_url = OUString();
- return;
- }
+ osl::MutexGuard guard(mutex_);
+ if (textual_.get() != 0) {
+ textual_.reset();
+ return;
+ }
+ RegError err = registry_.close();
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry.close:"
+ " underlying Registry::close() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
-
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
-}
+}
-//*************************************************************************
-void SAL_CALL SimpleRegistryImpl::destroy( )
- throw(InvalidRegistryException, RuntimeException)
+void SimpleRegistry::destroy()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_mutex );
- if ( m_registry.isValid() )
- {
- if ( !m_registry.destroy(OUString()) )
- {
- m_url = OUString();
- return;
- }
+ osl::MutexGuard guard(mutex_);
+ if (textual_.get() != 0) {
+ textual_.reset();
+ return;
}
+ RegError err = registry_.destroy(rtl::OUString());
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry.destroy:"
+ " underlying Registry::destroy() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+}
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
-}
-
-//*************************************************************************
-Reference< XRegistryKey > SAL_CALL SimpleRegistryImpl::getRootKey( )
- throw(InvalidRegistryException, RuntimeException)
+css::uno::Reference< css::registry::XRegistryKey > SimpleRegistry::getRootKey()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_mutex );
- if ( m_registry.isValid() )
- return ((XRegistryKey*)new RegistryKeyImpl(OUString( RTL_CONSTASCII_USTRINGPARAM("/") ), this));
- else
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
+ osl::MutexGuard guard(mutex_);
+ if (textual_.get() != 0) {
+ return textual_->getRootKey();
}
-}
+ RegistryKey root;
+ RegError err = registry_.openRootKey(root);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry.getRootKey:"
+ " underlying Registry::getRootKey() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ return new Key(this, root);
+}
-//*************************************************************************
-sal_Bool SAL_CALL SimpleRegistryImpl::isReadOnly( )
- throw(InvalidRegistryException, RuntimeException)
+sal_Bool SimpleRegistry::isReadOnly()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_mutex );
- if ( m_registry.isValid() )
- return m_registry.isReadOnly();
- else
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- }
-}
+ osl::MutexGuard guard(mutex_);
+ return textual_.get() != 0 || registry_.isReadOnly();
+}
-//*************************************************************************
-void SAL_CALL SimpleRegistryImpl::mergeKey( const OUString& aKeyName, const OUString& aUrl )
- throw(InvalidRegistryException, MergeConflictException, RuntimeException)
+void SimpleRegistry::mergeKey(
+ rtl::OUString const & aKeyName, rtl::OUString const & aUrl)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::registry::MergeConflictException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_mutex );
- if ( m_registry.isValid() )
- {
- RegistryKey rootKey;
- if ( !m_registry.openRootKey(rootKey) )
- {
- RegError ret = m_registry.mergeKey(rootKey, aKeyName, aUrl, sal_False, sal_False);
- if (ret)
- {
- if ( ret == REG_MERGE_CONFLICT )
- return;
- if ( ret == REG_MERGE_ERROR )
- {
- throw MergeConflictException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("MergeConflictException") ),
- (OWeakObject *)this );
- }
- else
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- }
- }
-
- return;
- }
+ osl::MutexGuard guard(mutex_);
+ if (textual_.get() != 0) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry.mergeKey: not"
+ " supported for textual representation")),
+ static_cast< cppu::OWeakObject * >(this));
+ }
+ RegistryKey root;
+ RegError err = registry_.openRootKey(root);
+ if (err == REG_NO_ERROR) {
+ err = registry_.mergeKey(root, aKeyName, aUrl, false, false);
}
+ switch (err) {
+ case REG_NO_ERROR:
+ case REG_MERGE_CONFLICT:
+ break;
+ case REG_MERGE_ERROR:
+ throw css::registry::MergeConflictException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry.mergeKey:"
+ " underlying Registry::mergeKey() = REG_MERGE_ERROR")),
+ static_cast< cppu::OWeakObject * >(this));
+ default:
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry.mergeKey:"
+ " underlying Registry::getRootKey/mergeKey() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+}
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
-}
}
-namespace stoc_bootstrap
-{
-//*************************************************************************
-Reference<XInterface> SAL_CALL SimpleRegistry_CreateInstance( const Reference<XComponentContext>& )
-{
- Reference<XInterface> xRet;
+namespace stoc_bootstrap {
- Registry reg;
-
- XSimpleRegistry *pRegistry = (XSimpleRegistry*) new stoc_simreg::SimpleRegistryImpl(reg);
+css::uno::Reference< css::uno::XInterface > SimpleRegistry_CreateInstance(
+ css::uno::Reference< css::uno::XComponentContext > const &)
+{
+ return static_cast< cppu::OWeakObject * >(new SimpleRegistry);
+}
- if (pRegistry)
- {
- xRet = Reference<XInterface>::query(pRegistry);
- }
-
- return xRet;
+css::uno::Sequence< rtl::OUString > simreg_getSupportedServiceNames() {
+ css::uno::Sequence< rtl::OUString > names(1);
+ names[0] = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.SimpleRegistry"));
+ return names;
}
+
+rtl::OUString simreg_getImplementationName() {
+ return rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.stoc.SimpleRegistry"));
}
+}
diff --git a/stoc/source/simpleregistry/textualservices.cxx b/stoc/source/simpleregistry/textualservices.cxx
new file mode 100644
index 000000000..932c63912
--- /dev/null
+++ b/stoc/source/simpleregistry/textualservices.cxx
@@ -0,0 +1,1216 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#include "precompiled_stoc.hxx"
+#include "sal/config.h"
+
+#include <cstddef>
+#include <cstdlib>
+#include <map>
+#include <vector>
+
+#include "boost/noncopyable.hpp"
+#include "com/sun/star/container/NoSuchElementException.hpp"
+#include "com/sun/star/registry/InvalidRegistryException.hpp"
+#include "com/sun/star/registry/XRegistryKey.hpp"
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "cppuhelper/implbase1.hxx"
+#include "osl/diagnose.h"
+#include "rtl/ref.hxx"
+#include "rtl/string.h"
+#include "rtl/ustrbuf.hxx"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "salhelper/simplereferenceobject.hxx"
+#include "xmlreader/span.hxx"
+#include "xmlreader/xmlreader.hxx"
+
+#include "textualservices.hxx"
+
+namespace stoc { namespace simpleregistry {
+
+namespace {
+
+namespace css = com::sun::star;
+
+struct Implementation {
+ rtl::OUString uri;
+ rtl::OUString loader;
+ std::vector< rtl::OUString > services;
+ std::vector< rtl::OUString > singletons;
+};
+
+typedef std::map< rtl::OUString, Implementation > Implementations;
+
+typedef std::map< rtl::OUString, std::vector< rtl::OUString > >
+ ImplementationMap;
+
+}
+
+class Data: public salhelper::SimpleReferenceObject, private boost::noncopyable
+{
+public:
+ Implementations implementations;
+ ImplementationMap services;
+ ImplementationMap singletons;
+};
+
+namespace {
+
+class Parser: private boost::noncopyable {
+public:
+ Parser(rtl::OUString const & uri, rtl::Reference< Data > const & data);
+
+private:
+ void handleComponent();
+
+ void handleImplementation();
+
+ void handleService();
+
+ void handleSingleton();
+
+ rtl::OUString getNameAttribute();
+
+ xmlreader::XmlReader reader_;
+ rtl::Reference< Data > data_;
+ rtl::OUString attrUri_;
+ rtl::OUString attrLoader_;
+ rtl::OUString attrImplementation_;
+};
+
+Parser::Parser(rtl::OUString const & uri, rtl::Reference< Data > const & data):
+ reader_(uri), data_(data)
+{
+ OSL_ASSERT(data.is());
+ int ucNsId = reader_.registerNamespaceIri(
+ xmlreader::Span(
+ RTL_CONSTASCII_STRINGPARAM(
+ "http://openoffice.org/2010/uno-components")));
+ enum State {
+ STATE_BEGIN, STATE_END, STATE_COMPONENTS, STATE_COMPONENT_INITIAL,
+ STATE_COMPONENT, STATE_IMPLEMENTATION, STATE_SERVICE, STATE_SINGLETON };
+ for (State state = STATE_BEGIN;;) {
+ xmlreader::Span name;
+ int nsId;
+ xmlreader::XmlReader::Result res = reader_.nextItem(
+ xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
+ switch (state) {
+ case STATE_BEGIN:
+ if (res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId &&
+ name.equals(RTL_CONSTASCII_STRINGPARAM("components")))
+ {
+ state = STATE_COMPONENTS;
+ break;
+ }
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": unexpected item in outer level"))),
+ css::uno::Reference< css::uno::XInterface >());
+ case STATE_END:
+ if (res == xmlreader::XmlReader::RESULT_DONE) {
+ return;
+ }
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": unexpected item in outer level"))),
+ css::uno::Reference< css::uno::XInterface >());
+ case STATE_COMPONENTS:
+ if (res == xmlreader::XmlReader::RESULT_END) {
+ state = STATE_END;
+ break;
+ }
+ if (res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId &&
+ name.equals(RTL_CONSTASCII_STRINGPARAM("component")))
+ {
+ handleComponent();
+ state = STATE_COMPONENT_INITIAL;
+ break;
+ }
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": unexpected item in <components>"))),
+ css::uno::Reference< css::uno::XInterface >());
+ case STATE_COMPONENT:
+ if (res == xmlreader::XmlReader::RESULT_END) {
+ state = STATE_COMPONENTS;
+ break;
+ }
+ // fall through
+ case STATE_COMPONENT_INITIAL:
+ if (res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId &&
+ name.equals(RTL_CONSTASCII_STRINGPARAM("implementation")))
+ {
+ handleImplementation();
+ state = STATE_IMPLEMENTATION;
+ break;
+ }
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": unexpected item in <component>"))),
+ css::uno::Reference< css::uno::XInterface >());
+ case STATE_IMPLEMENTATION:
+ if (res == xmlreader::XmlReader::RESULT_END) {
+ state = STATE_COMPONENT;
+ break;
+ }
+ if (res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId &&
+ name.equals(RTL_CONSTASCII_STRINGPARAM("service")))
+ {
+ handleService();
+ state = STATE_SERVICE;
+ break;
+ }
+ if (res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId &&
+ name.equals(RTL_CONSTASCII_STRINGPARAM("singleton")))
+ {
+ handleSingleton();
+ state = STATE_SINGLETON;
+ break;
+ }
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": unexpected item in <implementation>"))),
+ css::uno::Reference< css::uno::XInterface >());
+ case STATE_SERVICE:
+ if (res == xmlreader::XmlReader::RESULT_END) {
+ state = STATE_IMPLEMENTATION;
+ break;
+ }
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": unexpected item in <service>"))),
+ css::uno::Reference< css::uno::XInterface >());
+ case STATE_SINGLETON:
+ if (res == xmlreader::XmlReader::RESULT_END) {
+ state = STATE_IMPLEMENTATION;
+ break;
+ }
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": unexpected item in <service>"))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ }
+}
+
+void Parser::handleComponent() {
+ attrUri_ = rtl::OUString();
+ attrLoader_ = rtl::OUString();
+ xmlreader::Span name;
+ int nsId;
+ while (reader_.nextAttribute(&nsId, &name)) {
+ if (nsId == xmlreader::XmlReader::NAMESPACE_NONE &&
+ name.equals(RTL_CONSTASCII_STRINGPARAM("uri")))
+ {
+ if (attrUri_.getLength() != 0) {
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": <component> has multiple \"uri\" attributes"))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ attrUri_ = reader_.getAttributeValue(false).convertFromUtf8();
+ if (attrUri_.getLength() == 0) {
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": <component> has empty \"uri\" attribute"))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ } else if (nsId == xmlreader::XmlReader::NAMESPACE_NONE &&
+ name.equals(RTL_CONSTASCII_STRINGPARAM("loader")))
+ {
+ if (attrLoader_.getLength() != 0) {
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": <component> has multiple \"loader\""
+ " attributes"))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ attrLoader_ = reader_.getAttributeValue(false).convertFromUtf8();
+ if (attrLoader_.getLength() == 0) {
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": <component> has empty \"loader\" attribute"))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ } else {
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": expected <component> attribute \"uri\" or"
+ " \"loader\""))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ }
+ if (attrUri_.getLength() == 0) {
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": <component> is missing \"uri\" attribute"))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ if (attrLoader_.getLength() == 0) {
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": <component> is missing \"loader\" attribute"))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+}
+
+void Parser::handleImplementation() {
+ attrImplementation_ = getNameAttribute();
+ if (data_->implementations.find(attrImplementation_) !=
+ data_->implementations.end())
+ {
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": duplicate <implementation name=\"")) +
+ attrImplementation_ +
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\">"))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ data_->implementations[attrImplementation_].uri = attrUri_;
+ data_->implementations[attrImplementation_].loader = attrLoader_;
+}
+
+void Parser::handleService() {
+ rtl::OUString name = getNameAttribute();
+ data_->implementations[attrImplementation_].services.push_back(name);
+ data_->services[name].push_back(attrImplementation_);
+}
+
+void Parser::handleSingleton() {
+ rtl::OUString name = getNameAttribute();
+ data_->implementations[attrImplementation_].singletons.push_back(name);
+ data_->singletons[name].push_back(attrImplementation_);
+}
+
+rtl::OUString Parser::getNameAttribute() {
+ rtl::OUString attrName;
+ xmlreader::Span name;
+ int nsId;
+ while (reader_.nextAttribute(&nsId, &name)) {
+ if (nsId == xmlreader::XmlReader::NAMESPACE_NONE &&
+ name.equals(RTL_CONSTASCII_STRINGPARAM("name")))
+ {
+ if (attrName.getLength() != 0) {
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": element has multiple \"name\" attributes"))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ attrName = reader_.getAttributeValue(false).convertFromUtf8();
+ if (attrName.getLength() == 0) {
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": element has empty \"name\" attribute"))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ } else {
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": expected element attribute \"name\""))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ }
+ if (attrName.getLength() == 0) {
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": element is missing \"name\" attribute"))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ return attrName;
+}
+
+rtl::OUString pathToString(std::vector< rtl::OUString > const & path) {
+ rtl::OUStringBuffer buf;
+ for (std::vector< rtl::OUString >::const_iterator i(path.begin());
+ i != path.end(); ++i)
+ {
+ buf.append(sal_Unicode('/'));
+ buf.append(*i);
+ }
+ if (buf.getLength() == 0) {
+ buf.append(sal_Unicode('/'));
+ }
+ return buf.makeStringAndClear();
+}
+
+class Key: public cppu::WeakImplHelper1< css::registry::XRegistryKey > {
+public:
+ Key(
+ rtl::Reference< Data > const & data,
+ std::vector< rtl::OUString > const & path):
+ data_(data), path_(path) { OSL_ASSERT(data.is());
+ }
+
+private:
+ /*
+ /
+ IMPLEMENTATIONS
+ <implementation>
+ UNO
+ LOCATION utf-8
+ ACTIVATOR utf-8
+ SERVICES
+ <service>
+ ...
+ SINGLETONS
+ <singleton> utf-16
+ ...
+ ...
+ SERVICES
+ <service> utf-8-list
+ ...
+ SINGLETONS
+ <singleton> utf-16
+ REGISTERED_BY utf-8-list
+ ...
+ */
+ enum State {
+ STATE_ROOT, STATE_IMPLEMENTATIONS, STATE_IMPLEMENTATION, STATE_UNO,
+ STATE_LOCATION, STATE_ACTIVATOR, STATE_IMPLEMENTATION_SERVICES,
+ STATE_IMPLEMENTATION_SERVICE, STATE_IMPLEMENTATION_SINGLETONS,
+ STATE_IMPLEMENTATION_SINGLETON, STATE_SERVICES, STATE_SERVICE,
+ STATE_SINGLETONS, STATE_SINGLETON, STATE_REGISTEREDBY };
+
+ virtual rtl::OUString SAL_CALL getKeyName()
+ throw (css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL isReadOnly() throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL isValid() throw(css::uno::RuntimeException);
+
+ virtual css::registry::RegistryKeyType SAL_CALL getKeyType(
+ rtl::OUString const & rKeyName)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual css::registry::RegistryValueType SAL_CALL getValueType() throw(
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL getLongValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setLongValue(sal_Int32 value) throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< sal_Int32 > SAL_CALL getLongListValue() throw(
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setLongListValue(
+ com::sun::star::uno::Sequence< sal_Int32 > const & seqValue)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual rtl::OUString SAL_CALL getAsciiValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setAsciiValue(rtl::OUString const & value) throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL getAsciiListValue()
+ throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setAsciiListValue(
+ css::uno::Sequence< rtl::OUString > const & seqValue)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual rtl::OUString SAL_CALL getStringValue() throw(
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setStringValue(rtl::OUString const & value) throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL getStringListValue()
+ throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setStringListValue(
+ css::uno::Sequence< rtl::OUString > const & seqValue)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBinaryValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setBinaryValue(
+ css::uno::Sequence< sal_Int8 > const & value)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL openKey(
+ rtl::OUString const & aKeyName)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL
+ createKey(rtl::OUString const & aKeyName) throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL closeKey() throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL deleteKey(rtl::OUString const & rKeyName) throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual
+ css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
+ SAL_CALL openKeys() throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL getKeyNames() throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL createLink(
+ rtl::OUString const & aLinkName, rtl::OUString const & aLinkTarget)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual void SAL_CALL deleteLink(rtl::OUString const & rLinkName) throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual rtl::OUString SAL_CALL getLinkTarget(
+ rtl::OUString const & rLinkName)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual rtl::OUString SAL_CALL getResolvedName(
+ rtl::OUString const & aKeyName)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ bool find(
+ rtl::OUString const & relative, std::vector< rtl::OUString > * path,
+ State * state, css::registry::RegistryValueType * type) const;
+
+ css::uno::Sequence< rtl::OUString > getChildren();
+
+ rtl::Reference< Data > data_;
+ std::vector< rtl::OUString > path_;
+};
+
+rtl::OUString Key::getKeyName() throw (css::uno::RuntimeException) {
+ return pathToString(path_);
+}
+
+sal_Bool Key::isReadOnly()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ return true;
+}
+
+sal_Bool Key::isValid() throw(css::uno::RuntimeException) {
+ return true;
+}
+
+css::registry::RegistryKeyType Key::getKeyType(rtl::OUString const & rKeyName)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ if (!find(rtl::OUString(), 0, 0, 0)) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("unknown key ")) +
+ rKeyName),
+ static_cast< cppu::OWeakObject * >(this));
+ }
+ return css::registry::RegistryKeyType_KEY;
+}
+
+css::registry::RegistryValueType Key::getValueType()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ css::registry::RegistryValueType type =
+ css::registry::RegistryValueType_NOT_DEFINED;
+ OSL_VERIFY(find(rtl::OUString(), 0, 0, &type));
+ return type;
+}
+
+sal_Int32 Key::getLongValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " getLongValue not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+void Key::setLongValue(sal_Int32)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " setLongValue not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+css::uno::Sequence< sal_Int32 > Key::getLongListValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " getLongListValue not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+void Key::setLongListValue(css::uno::Sequence< sal_Int32 > const &)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " setLongListValue not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+rtl::OUString Key::getAsciiValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
+{
+ State state = STATE_ROOT;
+ OSL_VERIFY(find(rtl::OUString(), 0, &state, 0));
+ switch (state) {
+ case STATE_LOCATION:
+ return data_->implementations[path_[1]].uri;
+ case STATE_ACTIVATOR:
+ return data_->implementations[path_[1]].loader;
+ default:
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " getAsciiValue: wrong type")),
+ static_cast< OWeakObject * >(this));
+ }
+}
+
+void Key::setAsciiValue(rtl::OUString const &)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " setAsciiValue not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+css::uno::Sequence< rtl::OUString > Key::getAsciiListValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
+{
+ State state = STATE_ROOT;
+ OSL_VERIFY(find(rtl::OUString(), 0, &state, 0));
+ std::vector< rtl::OUString > const * list;
+ switch (state) {
+ case STATE_SERVICE:
+ list = &data_->services[path_[1]];
+ break;
+ case STATE_REGISTEREDBY:
+ list = &data_->singletons[path_[1]];
+ break;
+ default:
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " getAsciiListValue: wrong type")),
+ static_cast< OWeakObject * >(this));
+ }
+ if (list->size() > SAL_MAX_INT32) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " getAsciiListValue: too large")),
+ static_cast< OWeakObject * >(this));
+ }
+ css::uno::Sequence< rtl::OUString > seq(
+ static_cast< sal_Int32 >(list->size()));
+ sal_Int32 i = 0;
+ for (std::vector< rtl::OUString >::const_iterator j(list->begin());
+ j != list->end(); ++j)
+ {
+ seq[i++] = *j;
+ }
+ return seq;
+}
+
+void Key::setAsciiListValue(css::uno::Sequence< rtl::OUString > const &)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " setAsciiListValue not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+rtl::OUString Key::getStringValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
+{
+ State state = STATE_ROOT;
+ OSL_VERIFY(find(rtl::OUString(), 0, &state, 0));
+ switch (state) {
+ case STATE_IMPLEMENTATION_SINGLETON:
+ case STATE_SINGLETON:
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " getStringValue: does not associate singletons with"
+ " services")),
+ static_cast< OWeakObject * >(this));
+ default:
+ break;
+ }
+ // default case extracted from switch to avoid erroneous compiler warnings
+ // on Solaris:
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " getStringValue: wrong type")),
+ static_cast< OWeakObject * >(this));
+}
+
+void Key::setStringValue(rtl::OUString const &)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " setStringValue not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+css::uno::Sequence< rtl::OUString > Key::getStringListValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " getStringListValue not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+void Key::setStringListValue(css::uno::Sequence< rtl::OUString > const &)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " setStringListValue not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+css::uno::Sequence< sal_Int8 > Key::getBinaryValue()
+ throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " getBinarValue not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+void Key::setBinaryValue(css::uno::Sequence< sal_Int8 > const &)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " setBinaryValue not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+css::uno::Reference< css::registry::XRegistryKey > Key::openKey(
+ rtl::OUString const & aKeyName)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ std::vector< rtl::OUString > path;
+ if (!find(aKeyName, &path, 0, 0)) {
+ return css::uno::Reference< css::registry::XRegistryKey >();
+ }
+ return new Key(data_, path);
+}
+
+css::uno::Reference< css::registry::XRegistryKey > Key::createKey(
+ rtl::OUString const &)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " createKey not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+void Key::closeKey()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{}
+
+void Key::deleteKey(rtl::OUString const &)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " deleteKey not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
+Key::openKeys()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ css::uno::Sequence< rtl::OUString > names(getChildren());
+ css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
+ keys(names.getLength());
+ for (sal_Int32 i = 0; i < keys.getLength(); ++i) {
+ keys[i] = openKey(names[i]);
+ OSL_ASSERT(keys[i].is());
+ }
+ return keys;
+}
+
+css::uno::Sequence< rtl::OUString > Key::getKeyNames()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ css::uno::Sequence< rtl::OUString > names(getChildren());
+ rtl::OUString prefix(pathToString(path_));
+ prefix += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
+ for (sal_Int32 i = 0; i < names.getLength(); ++i) {
+ names[i] = prefix + names[i];
+ }
+ return names;
+}
+
+sal_Bool Key::createLink(rtl::OUString const &, rtl::OUString const &)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " createLink not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+void Key::deleteLink(rtl::OUString const &)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " deleteLink not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+rtl::OUString Key::getLinkTarget(rtl::OUString const &)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " getLinkTarget not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+rtl::OUString Key::getResolvedName(rtl::OUString const & aKeyName)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ std::vector< rtl::OUString > path;
+ find(aKeyName, &path, 0, 0);
+ return pathToString(path);
+}
+
+bool Key::find(
+ rtl::OUString const & relative, std::vector< rtl::OUString > * path,
+ State * state, css::registry::RegistryValueType * type) const
+{
+ std::vector< rtl::OUString > p(path_);
+ sal_Int32 i = 0;
+ do {
+ rtl::OUString seg(relative.getToken(0, '/', i));
+ if (seg.getLength() != 0) {
+ p.push_back(seg);
+ }
+ } while (i >= 0);
+ if (path != 0) {
+ *path = p;
+ }
+ std::size_t const MAX_TRANSITIONS = 4;
+ struct StateInfo {
+ css::registry::RegistryValueType type;
+ std::size_t count;
+ struct { char const * segment; State state; }
+ transitions[MAX_TRANSITIONS];
+ };
+ static StateInfo const info[] = {
+ // STATE_ROOT:
+ { css::registry::RegistryValueType_NOT_DEFINED, 3,
+ { { "IMPLEMENTATIONS", STATE_IMPLEMENTATIONS },
+ { "SERVICES", STATE_SERVICES },
+ { "SINGLETONS", STATE_SINGLETONS } } },
+ // STATE_IMPLEMENTATIONS:
+ { css::registry::RegistryValueType_NOT_DEFINED, 1,
+ { { 0, STATE_IMPLEMENTATION } } },
+ // STATE_IMPLEMENTATION:
+ { css::registry::RegistryValueType_NOT_DEFINED, 1,
+ { { "UNO", STATE_UNO } } },
+ // STATE_UNO:
+ { css::registry::RegistryValueType_NOT_DEFINED, 4,
+ { { "LOCATION", STATE_LOCATION },
+ { "ACTIVATOR", STATE_ACTIVATOR },
+ { "SERVICES", STATE_IMPLEMENTATION_SERVICES },
+ { "SINGLETONS", STATE_IMPLEMENTATION_SINGLETONS } } },
+ // STATE_LOCATION:
+ { css::registry::RegistryValueType_ASCII, 0, {} },
+ // STATE_ACTIVATOR:
+ { css::registry::RegistryValueType_ASCII, 0, {} },
+ // STATE_IMPLEMENTATION_SERVICES:
+ { css::registry::RegistryValueType_NOT_DEFINED, 1,
+ { { 0, STATE_IMPLEMENTATION_SERVICE } } },
+ // STATE_IMPLEMENTATION_SERVICE:
+ { css::registry::RegistryValueType_NOT_DEFINED, 0, {} },
+ // STATE_IMPLEMENTATION_SINGLETONS:
+ { css::registry::RegistryValueType_NOT_DEFINED, 1,
+ { { 0, STATE_IMPLEMENTATION_SINGLETON } } },
+ // STATE_IMPLEMENTATION_SINGLETON:
+ { css::registry::RegistryValueType_STRING, 0, {} },
+ // STATE_SERVICES:
+ { css::registry::RegistryValueType_NOT_DEFINED, 1,
+ { { 0, STATE_SERVICE } } },
+ // STATE_SERVICE:
+ { css::registry::RegistryValueType_ASCIILIST, 0, {} },
+ // STATE_SINGLETONS:
+ { css::registry::RegistryValueType_NOT_DEFINED, 1,
+ { { 0, STATE_SINGLETON } } },
+ // STATE_SINGLETON:
+ { css::registry::RegistryValueType_STRING, 1,
+ { { "REGISTERED_BY", STATE_REGISTEREDBY } } },
+ // STATE_REGISTEREDBY:
+ { css::registry::RegistryValueType_ASCIILIST, 0, {} } };
+ State s = STATE_ROOT;
+ for (std::vector< rtl::OUString >::iterator j(p.begin()); j != p.end(); ++j)
+ {
+ bool found = false;
+ for (std::size_t k = 0; k < info[s].count; ++k) {
+ if (info[s].transitions[k].segment == 0) {
+ switch (info[s].transitions[k].state) {
+ case STATE_IMPLEMENTATION:
+ found = data_->implementations.find(*j) !=
+ data_->implementations.end();
+ break;
+ case STATE_IMPLEMENTATION_SERVICE:
+ case STATE_IMPLEMENTATION_SINGLETON:
+ found = true; //TODO
+ break;
+ case STATE_SERVICE:
+ found = data_->services.find(*j) != data_->services.end();
+ break;
+ case STATE_SINGLETON:
+ found = data_->singletons.find(*j) !=
+ data_->singletons.end();
+ break;
+ default:
+ std::abort(); // this cannot happen
+ }
+ } else {
+ found = j->equalsAscii(info[s].transitions[k].segment);
+ }
+ if (found) {
+ s = info[s].transitions[k].state;
+ break;
+ }
+ }
+ if (!found) {
+ return false;
+ }
+ }
+ if (state != 0) {
+ *state = s;
+ }
+ if (type != 0) {
+ *type = info[s].type;
+ }
+ return true;
+}
+
+css::uno::Sequence< rtl::OUString > Key::getChildren() {
+ State state = STATE_ROOT;
+ OSL_VERIFY(find(rtl::OUString(), 0, &state, 0));
+ switch (state) {
+ default:
+ std::abort(); // this cannot happen
+ // pseudo-fall-through to avoid warnings on MSC
+ case STATE_ROOT:
+ {
+ css::uno::Sequence< rtl::OUString > seq(3);
+ seq[0] = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("IMPLEMENTATIONS"));
+ seq[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SERVICES"));
+ seq[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SINGLETONS"));
+ return seq;
+ }
+ case STATE_IMPLEMENTATIONS:
+ {
+ if (data_->implementations.size() > SAL_MAX_INT32) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual"
+ " services key openKeys: too large")),
+ static_cast< OWeakObject * >(this));
+ }
+ css::uno::Sequence< rtl::OUString > seq(
+ static_cast< sal_Int32 >(data_->implementations.size()));
+ sal_Int32 i = 0;
+ for (Implementations::iterator j(data_->implementations.begin());
+ j != data_->implementations.end(); ++j)
+ {
+ seq[i++] = j->first;
+ }
+ return seq;
+ }
+ case STATE_UNO:
+ {
+ css::uno::Sequence< rtl::OUString > seq(4);
+ seq[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LOCATION"));
+ seq[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ACTIVATOR"));
+ seq[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SERVICES"));
+ seq[3] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SINGLETONS"));
+ return seq;
+ }
+ case STATE_LOCATION:
+ case STATE_ACTIVATOR:
+ case STATE_IMPLEMENTATION_SERVICE:
+ case STATE_IMPLEMENTATION_SINGLETON:
+ case STATE_SERVICE:
+ case STATE_REGISTEREDBY:
+ return css::uno::Sequence< rtl::OUString >();
+ case STATE_IMPLEMENTATION_SERVICES:
+ {
+ if (data_->implementations[path_[1]].services.size() >
+ SAL_MAX_INT32)
+ {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual"
+ " services key openKeys: too large")),
+ static_cast< OWeakObject * >(this));
+ }
+ css::uno::Sequence< rtl::OUString > seq(
+ static_cast< sal_Int32 >(
+ data_->implementations[path_[1]].services.size()));
+ sal_Int32 i = 0;
+ for (std::vector< rtl::OUString >::iterator j(
+ data_->implementations[path_[1]].services.begin());
+ j != data_->implementations[path_[1]].services.end(); ++j)
+ {
+ seq[i++] = *j;
+ }
+ return seq;
+ }
+ case STATE_IMPLEMENTATION_SINGLETONS:
+ {
+ if (data_->implementations[path_[1]].singletons.size() >
+ SAL_MAX_INT32)
+ {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual"
+ " services key openKeys: too large")),
+ static_cast< OWeakObject * >(this));
+ }
+ css::uno::Sequence< rtl::OUString > seq(
+ static_cast< sal_Int32 >(
+ data_->implementations[path_[1]].singletons.size()));
+ sal_Int32 i = 0;
+ for (std::vector< rtl::OUString >::iterator j(
+ data_->implementations[path_[1]].singletons.begin());
+ j != data_->implementations[path_[1]].singletons.end(); ++j)
+ {
+ seq[i++] = *j;
+ }
+ return seq;
+ }
+ case STATE_SERVICES:
+ {
+ if (data_->services.size() > SAL_MAX_INT32) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual"
+ " services key openKeys: too large")),
+ static_cast< OWeakObject * >(this));
+ }
+ css::uno::Sequence< rtl::OUString > seq(
+ static_cast< sal_Int32 >(data_->services.size()));
+ sal_Int32 i = 0;
+ for (ImplementationMap::iterator j(data_->services.begin());
+ j != data_->services.end(); ++j)
+ {
+ seq[i++] = j->first;
+ }
+ return seq;
+ }
+ case STATE_SINGLETONS:
+ {
+ if (data_->singletons.size() > SAL_MAX_INT32) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual"
+ " services key openKeys: too large")),
+ static_cast< OWeakObject * >(this));
+ }
+ css::uno::Sequence< rtl::OUString > seq(
+ static_cast< sal_Int32 >(data_->singletons.size()));
+ sal_Int32 i = 0;
+ for (ImplementationMap::iterator j(data_->singletons.begin());
+ j != data_->singletons.end(); ++j)
+ {
+ seq[i++] = j->first;
+ }
+ return seq;
+ }
+ case STATE_SINGLETON:
+ {
+ css::uno::Sequence< rtl::OUString > seq(1);
+ seq[0] = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("REGISTERED_BY"));
+ return seq;
+ }
+ }
+}
+
+}
+
+TextualServices::TextualServices(rtl::OUString const & uri):
+ uri_(uri), data_(new Data)
+{
+ try {
+ Parser(uri, data_);
+ } catch (css::container::NoSuchElementException &) {
+ throw css::registry::InvalidRegistryException(
+ (uri +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(": no such file"))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+}
+
+TextualServices::~TextualServices() {}
+
+css::uno::Reference< css::registry::XRegistryKey > TextualServices::getRootKey()
+{
+ return new Key(data_, std::vector< rtl::OUString >());
+}
+
+} }
diff --git a/stoc/source/simpleregistry/textualservices.hxx b/stoc/source/simpleregistry/textualservices.hxx
new file mode 100644
index 000000000..0261e2604
--- /dev/null
+++ b/stoc/source/simpleregistry/textualservices.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef INCLUDED_STOC_SOURCE_SIMPLEREGISTRY_TEXTUALSERVICES_HXX
+#define INCLUDED_STOC_SOURCE_SIMPLEREGISTRY_TEXTUALSERVICES_HXX
+
+#include "sal/config.h"
+
+#include <memory>
+
+#include "boost/noncopyable.hpp"
+#include "com/sun/star/uno/Reference.hxx"
+#include "rtl/ref.hxx"
+#include "rtl/ustring.hxx"
+
+namespace com { namespace sun { namespace star { namespace registry {
+ class XRegistryKey;
+} } } }
+
+namespace stoc { namespace simpleregistry {
+
+class Data;
+
+class TextualServices: private boost::noncopyable {
+public:
+ explicit TextualServices(rtl::OUString const & uri);
+ // throws com::sun::star::registry::InvalidRegistryException
+
+ virtual ~TextualServices();
+
+ inline rtl::OUString getUri() { return uri_; }
+
+ com::sun::star::uno::Reference< com::sun::star::registry::XRegistryKey >
+ getRootKey();
+
+private:
+ rtl::OUString uri_;
+ rtl::Reference< Data > data_;
+};
+
+} }
+
+#endif
diff --git a/stoc/source/stocservices/stocservices.cxx b/stoc/source/stocservices/stocservices.cxx
index 7b8cfdb90..73787a5f3 100644
--- a/stoc/source/stocservices/stocservices.cxx
+++ b/stoc/source/stocservices/stocservices.cxx
@@ -102,12 +102,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//==================================================================================================
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries );
-}
-//==================================================================================================
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
diff --git a/stoc/test/uriproc/makefile.mk b/stoc/test/uriproc/makefile.mk
index cfdc33e75..05ffd5fdd 100644
--- a/stoc/test/uriproc/makefile.mk
+++ b/stoc/test/uriproc/makefile.mk
@@ -35,6 +35,8 @@ TARGET := test_uriproc
ENABLE_EXCEPTIONS := TRUE
+my_components = stocservices
+
.INCLUDE: settings.mk
CFLAGSCXX += $(CPPUNIT_CFLAGS)
@@ -62,14 +64,20 @@ ALLTAR: test
test .PHONY: $(SHL1TARGETN) $(MISC)/$(TARGET)/services.rdb
$(CPPUNITTESTER) $(SHL1TARGETN) \
- -env:UNO_SERVICES=$(my_file)$(PWD)/$(MISC)/$(TARGET)/services.rdb \
-env:UNO_TYPES=$(my_file)$(SOLARBINDIR)/udkapi.rdb \
- -env:OOO_TEST_PREFIX=$(my_file)$(PWD)/$(DLLDEST)/
+ -env:UNO_SERVICES=$(my_file)$(PWD)/$(MISC)/$(TARGET)/services.rdb \
+ -env:URE_INTERNAL_LIB_DIR=$(my_file)$(PWD)/$(DLLDEST)
+
+$(MISC)/$(TARGET)/services.rdb .ERRREMOVE: $(SOLARENV)/bin/packcomponents.xslt \
+ $(MISC)/$(TARGET)/services.input \
+ $(my_components:^"$(MISC)/":+".component")
+ $(XSLTPROC) --nonet --stringparam prefix $(PWD)/$(MISC)/ -o $@ \
+ $(SOLARENV)/bin/packcomponents.xslt $(MISC)/$(TARGET)/services.input
-$(MISC)/$(TARGET)/services.rdb:
+$(MISC)/$(TARGET)/services.input:
$(MKDIRHIER) $(@:d)
- $(RM) $@
- $(REGCOMP) -register -r $@ -wop=vnd.sun.star.expand:\$${{OOO_TEST_PREFIX}} \
- -c $(DLLDEST)/stocservices.uno$(DLLPOST)
+ echo \
+ '<list>$(my_components:^"<filename>":+".component</filename>")</list>' \
+ > $@
.END
diff --git a/stoc/util/bootstrap.component b/stoc/util/bootstrap.component
new file mode 100644
index 000000000..ccc131b4a
--- /dev/null
+++ b/stoc/util/bootstrap.component
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.stoc.DLLComponentLoader">
+ <service name="com.sun.star.loader.SharedLibrary"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.stoc.ImplementationRegistration">
+ <service name="com.sun.star.registry.ImplementationRegistration"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.stoc.NestedRegistry">
+ <service name="com.sun.star.registry.NestedRegistry"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.stoc.ORegistryServiceManager">
+ <service name="com.sun.star.lang.RegistryServiceManager"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.stoc.OServiceManager">
+ <service name="com.sun.star.lang.ServiceManager"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.stoc.OServiceManagerWrapper"/>
+ <implementation name="com.sun.star.comp.stoc.RegistryTypeDescriptionProvider">
+ <service name="com.sun.star.reflection.TypeDescriptionProvider"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.stoc.SimpleRegistry">
+ <service name="com.sun.star.registry.SimpleRegistry"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.stoc.TypeDescriptionManager">
+ <service name="com.sun.star.reflection.TypeDescriptionManager"/>
+ </implementation>
+ <implementation name="com.sun.star.security.comp.stoc.AccessController">
+ <service name="com.sun.star.security.AccessController"/>
+ </implementation>
+ <implementation name="com.sun.star.security.comp.stoc.FilePolicy">
+ <service name="com.sun.star.security.Policy"/>
+ </implementation>
+</component>
diff --git a/stoc/util/makefile.mk b/stoc/util/makefile.mk
index 4243d4551..32f229cc3 100644
--- a/stoc/util/makefile.mk
+++ b/stoc/util/makefile.mk
@@ -57,7 +57,8 @@ SHL1STDLIBS= \
$(SALHELPERLIB) \
$(CPPUHELPERLIB) \
$(SALLIB) \
- $(REGLIB)
+ $(REGLIB) \
+ $(XMLREADERLIB)
SHL1DEPN=
SHL1IMPLIB= i$(TARGET)
@@ -94,3 +95,16 @@ DEF2NAME= $(SHL2TARGET)
.INCLUDE : target.mk
+ALLTAR : $(MISC)/bootstrap.component $(MISC)/stocservices.component
+
+$(MISC)/bootstrap.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ bootstrap.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt bootstrap.component
+
+$(MISC)/stocservices.component .ERRREMOVE : \
+ $(SOLARENV)/bin/createcomponent.xslt stocservices.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL2TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt stocservices.component
diff --git a/stoc/util/stocservices.component b/stoc/util/stocservices.component
new file mode 100644
index 000000000..fb3528728
--- /dev/null
+++ b/stoc/util/stocservices.component
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.stoc.TypeConverter">
+ <service name="com.sun.star.script.Converter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.uri.ExternalUriReferenceTranslator">
+ <service name="com.sun.star.uri.ExternalUriReferenceTranslator"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.uri.UriReferenceFactory">
+ <service name="com.sun.star.uri.UriReferenceFactory"/>
+ </implementation>
+ <implementation
+ name="com.sun.star.comp.uri.UriSchemeParser_vndDOTsunDOTstarDOTexpand">
+ <service name="com.sun.star.uri.UriSchemeParser_vndDOTsunDOTstarDOTexpand"/>
+ </implementation>
+ <implementation
+ name="com.sun.star.comp.uri.UriSchemeParser_vndDOTsunDOTstarDOTscript">
+ <service name="com.sun.star.uri.UriSchemeParser_vndDOTsunDOTstarDOTscript"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.uri.VndSunStarPkgUrlReferenceFactory">
+ <service name="com.sun.star.uri.VndSunStarPkgUrlReferenceFactory"/>
+ </implementation>
+</component>
diff --git a/ure/prj/build.lst b/ure/prj/build.lst
index 07fbfc484..7d3e23edc 100644
--- a/ure/prj/build.lst
+++ b/ure/prj/build.lst
@@ -1,2 +1,2 @@
-ur ure : cli_ure solenv NULL
+ur ure : cli_ure io javaunohelper remotebridges solenv stoc NULL
ur ure\source nmake - all ur_source NULL
diff --git a/ure/prj/d.lst b/ure/prj/d.lst
index 23524c981..22cfb161c 100644
--- a/ure/prj/d.lst
+++ b/ure/prj/d.lst
@@ -1,9 +1,11 @@
mkdir: %_DEST%\bin%_EXT%\ure
-..\%__SRC%\bin\ure\README %_DEST%\bin%_EXT%\ure\README
-..\%__SRC%\bin\ure\THIRDPARTYLICENSEREADME.html %_DEST%\bin%_EXT%\ure\THIRDPARTYLICENSEREADME.html
-..\%__SRC%\bin\ure\jvmfwk3.ini %_DEST%\bin%_EXT%\ure\jvmfwk3.ini
-..\%__SRC%\bin\ure\jvmfwk3rc %_DEST%\bin%_EXT%\ure\jvmfwk3rc
-..\%__SRC%\bin\ure\startup.sh %_DEST%\bin%_EXT%\ure\startup.sh
-..\%__SRC%\bin\ure\uno.ini %_DEST%\bin%_EXT%\ure\uno.ini
-..\%__SRC%\bin\ure\unorc %_DEST%\bin%_EXT%\ure\unorc
+mkdir: %_DEST%\xml%_EXT%\ure
..\%__SRC%\bin\uretest.zip %COMMON_DEST%\bin%_EXT%\uretest.zip
+..\%__SRC%\misc\services.rdb %_DEST%\xml%_EXT%\ure\services.rdb
+..\source\README %_DEST%\bin%_EXT%\ure\README
+..\source\THIRDPARTYLICENSEREADME.html %_DEST%\bin%_EXT%\ure\THIRDPARTYLICENSEREADME.html
+..\source\jvmfwk3.ini %_DEST%\bin%_EXT%\ure\jvmfwk3.ini
+..\source\jvmfwk3rc %_DEST%\bin%_EXT%\ure\jvmfwk3rc
+..\source\startup.sh %_DEST%\bin%_EXT%\ure\startup.sh
+..\source\uno.ini %_DEST%\bin%_EXT%\ure\uno.ini
+..\source\unorc %_DEST%\bin%_EXT%\ure\unorc
diff --git a/ure/source/README b/ure/source/README
index 6e5162d8f..3bbdaa43d 100644
--- a/ure/source/README
+++ b/ure/source/README
@@ -65,6 +65,7 @@ Linux x86, Solaris x86, and Solaris SPARC:
/opt/openoffice.org/ure/lib/libreg.so.3 [private]
/opt/openoffice.org/ure/lib/librmcxt.so.3 [private]
/opt/openoffice.org/ure/lib/libstore.so.3 [private]
+/opt/openoffice.org/ure/lib/libxmlreader.so [private]
/opt/openoffice.org/ure/lib/libjvmaccessgcc3.so.3 [private; Linux x86 only]
/opt/openoffice.org/ure/lib/libjvmaccessC52.so.3 [private; Solaris only]
/opt/openoffice.org/ure/lib/libjvmfwk.so.3 [private]
@@ -128,6 +129,7 @@ Program Files\URE\bin\uno.ini [private]
Program Files\URE\bin\reg3.dll [private]
Program Files\URE\bin\rmcxt3.dll [private]
Program Files\URE\bin\store3.dll [private]
+Program Files\URE\bin\xmlreader.dll [private]
Program Files\URE\bin\jvmaccess3MSC.dll [private]
Program Files\URE\bin\jvmfwk3.dll [private]
Program Files\URE\bin\sunjavaplugin.dll [private]
diff --git a/ure/source/makefile.mk b/ure/source/makefile.mk
index a1728b277..cd6fab210 100644
--- a/ure/source/makefile.mk
+++ b/ure/source/makefile.mk
@@ -1,7 +1,7 @@
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
+#
# Copyright 2000, 2010 Oracle and/or its affiliates.
#
# OpenOffice.org - a multi-platform office productivity suite
@@ -25,52 +25,46 @@
#
#*************************************************************************
-PRJ := ..
-PRJNAME := ure
-TARGET := $(PRJNAME)
-
-.INCLUDE: settings.mk
-
-.IF "$(OS)" == "WNT" || "$(OS)" == "OS2"
-MY_RC = .ini
-.ELSE
-MY_RC = rc
-.ENDIF
+PRJ = ..
+PRJNAME = ure
+TARGET = source
ZIP1TARGET = uretest
ZIP1FLAGS = -r
ZIP1LIST = uretest
-.INCLUDE: target.mk
-
-ALLTAR: \
- $(BIN)$/ure$/README \
- $(BIN)$/ure$/THIRDPARTYLICENSEREADME.html \
- $(BIN)$/ure$/jvmfwk3$(MY_RC) \
- $(BIN)$/ure$/uno$(MY_RC)
+my_components = \
+ acceptor \
+ bootstrap \
+ bridgefac \
+ connector \
+ introspection \
+ invocadapt \
+ invocation \
+ javaloader \
+ javavm \
+ juh \
+ namingservice \
+ proxyfac \
+ reflection \
+ remotebridge \
+ stocservices \
+ streams \
+ textinstream \
+ textoutstream \
+ uuresolver
-$(BIN)$/ure$/README: README
- -$(MKDIR) $(@:d)
- $(COPY) $< $@
-
-$(BIN)$/ure$/THIRDPARTYLICENSEREADME.html: THIRDPARTYLICENSEREADME.html
- - $(MKDIR) $(@:d)
- $(COPY) $< $@
-
-$(BIN)$/ure$/jvmfwk3$(MY_RC): jvmfwk3$(MY_RC)
- -$(MKDIR) $(@:d)
- $(COPY) $< $@
-
-$(BIN)$/ure$/uno$(MY_RC): uno$(MY_RC)
- -$(MKDIR) $(@:d)
- $(COPY) $< $@
-
-.IF "$(OS)" != "WNT"
+.INCLUDE: settings.mk
+.INCLUDE: target.mk
-ALLTAR: $(BIN)$/ure$/startup.sh
+ALLTAR : $(MISC)/services.rdb
-$(BIN)$/ure$/startup.sh: startup.sh
- -$(MKDIR) $(@:d)
- $(COPY) $< $@
+$(MISC)/services.rdb .ERRREMOVE : $(SOLARENV)/bin/packcomponents.xslt \
+ $(MISC)/services.input $(my_components:^"$(SOLARXMLDIR)/":+".component")
+ $(XSLTPROC) --nonet --stringparam prefix $(SOLARXMLDIR)/ -o $@ \
+ $(SOLARENV)/bin/packcomponents.xslt $(MISC)/services.input
-.ENDIF
+$(MISC)/services.input :
+ echo \
+ '<list>$(my_components:^"<filename>":+".component</filename>")</list>' \
+ > $@
diff --git a/ure/source/startup.sh b/ure/source/startup.sh
index 70748f262..7f973c5bf 100644
--- a/ure/source/startup.sh
+++ b/ure/source/startup.sh
@@ -39,7 +39,7 @@ epath=`dirname "$0"`
if [ -x "${epath}/javaldx" ] ; then
jpath=`"${epath}/javaldx" $my_envargs`
if [ -n "${jpath}" ]; then
- LD_LIBRARY_PATH=${jpath}${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}
+ LD_LIBRARY_PATH=${jpath}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export LD_LIBRARY_PATH
fi
fi
diff --git a/xmlreader/inc/makefile.mk b/xmlreader/inc/makefile.mk
new file mode 100644
index 000000000..9f8443470
--- /dev/null
+++ b/xmlreader/inc/makefile.mk
@@ -0,0 +1,40 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#***********************************************************************/
+
+PRJ = ..
+PRJNAME = xmlreader
+TARGET = inc
+
+ENABLE_EXCEPTIONS = TRUE
+VISIBILITY_HIDDEN = TRUE
+
+.INCLUDE: settings.mk
+.INCLUDE: target.mk
+
+.IF "$(ENABLE_PCH)" != ""
+ALLTAR: $(SLO)/precompiled.pch $(SLO)/precompiled_ex.pch
+.ENDIF
diff --git a/xmlreader/inc/pch/precompiled_xmlreader.cxx b/xmlreader/inc/pch/precompiled_xmlreader.cxx
new file mode 100644
index 000000000..e5d584855
--- /dev/null
+++ b/xmlreader/inc/pch/precompiled_xmlreader.cxx
@@ -0,0 +1,28 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#include "precompiled_xmlreader.hxx"
diff --git a/xmlreader/inc/pch/precompiled_xmlreader.hxx b/xmlreader/inc/pch/precompiled_xmlreader.hxx
new file mode 100644
index 000000000..7561fe89f
--- /dev/null
+++ b/xmlreader/inc/pch/precompiled_xmlreader.hxx
@@ -0,0 +1,32 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#if defined PRECOMPILED_HEADERS
+
+#include "sal/config.h"
+
+#endif
diff --git a/xmlreader/inc/xmlreader/detail/xmlreaderdllapi.hxx b/xmlreader/inc/xmlreader/detail/xmlreaderdllapi.hxx
new file mode 100644
index 000000000..238661a24
--- /dev/null
+++ b/xmlreader/inc/xmlreader/detail/xmlreaderdllapi.hxx
@@ -0,0 +1,41 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef INCLUDED_XMLREADER_DETAIL_XMLREADERDLLAPI_HXX
+#define INCLUDED_XMLREADER_DETAIL_XMLREADERDLLAPI_HXX
+
+#include "sal/config.h"
+
+#include "sal/types.h"
+
+#if defined OOO_DLLIMPLEMENTATION_XMLREADER
+#define OOO_DLLPUBLIC_XMLREADER SAL_DLLPUBLIC_EXPORT
+#else
+#define OOO_DLLPUBLIC_XMLREADER SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
diff --git a/xmlreader/inc/xmlreader/pad.hxx b/xmlreader/inc/xmlreader/pad.hxx
new file mode 100644
index 000000000..d01574147
--- /dev/null
+++ b/xmlreader/inc/xmlreader/pad.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef INCLUDED_XMLREADER_PAD_HXX
+#define INCLUDED_XMLREADER_PAD_HXX
+
+#include "sal/config.h"
+
+#include "rtl/strbuf.hxx"
+#include "sal/types.h"
+#include "xmlreader/detail/xmlreaderdllapi.hxx"
+#include "xmlreader/span.hxx"
+
+namespace xmlreader {
+
+class OOO_DLLPUBLIC_XMLREADER Pad {
+public:
+ void add(char const * begin, sal_Int32 length);
+
+ void addEphemeral(char const * begin, sal_Int32 length);
+
+ void clear();
+
+ Span get() const;
+
+private:
+ SAL_DLLPRIVATE void flushSpan();
+
+ Span span_;
+ rtl::OStringBuffer buffer_;
+};
+
+}
+
+#endif
diff --git a/xmlreader/inc/xmlreader/span.hxx b/xmlreader/inc/xmlreader/span.hxx
new file mode 100644
index 000000000..4ec8b574f
--- /dev/null
+++ b/xmlreader/inc/xmlreader/span.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef INCLUDED_XMLREADER_SPAN_HXX
+#define INCLUDED_XMLREADER_SPAN_HXX
+
+#include "sal/config.h"
+
+#include "rtl/string.h"
+#include "sal/types.h"
+#include "xmlreader/detail/xmlreaderdllapi.hxx"
+
+namespace rtl { class OUString; }
+
+namespace xmlreader {
+
+struct OOO_DLLPUBLIC_XMLREADER Span {
+ char const * begin;
+ sal_Int32 length;
+
+ inline Span(): begin(0), length(0) {}
+ // init length to avoid compiler warnings
+
+ inline Span(char const * theBegin, sal_Int32 theLength):
+ begin(theBegin), length(theLength) {}
+
+ inline void clear() throw() { begin = 0; }
+
+ inline bool is() const { return begin != 0; }
+
+ inline bool equals(Span const & text) const {
+ return rtl_str_compare_WithLength(
+ begin, length, text.begin, text.length) == 0;
+ }
+
+ inline bool equals(char const * textBegin, sal_Int32 textLength) const {
+ return equals(Span(textBegin, textLength));
+ }
+
+ rtl::OUString convertFromUtf8() const;
+};
+
+}
+
+#endif
diff --git a/xmlreader/inc/xmlreader/xmlreader.hxx b/xmlreader/inc/xmlreader/xmlreader.hxx
new file mode 100644
index 000000000..242af58c7
--- /dev/null
+++ b/xmlreader/inc/xmlreader/xmlreader.hxx
@@ -0,0 +1,199 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef INCLUDED_XMLREADER_XMLREADER_HXX
+#define INCLUDED_XMLREADER_XMLREADER_HXX
+
+#include "sal/config.h"
+
+#include <stack>
+#include <vector>
+
+#include "boost/noncopyable.hpp"
+#include "com/sun/star/container/NoSuchElementException.hpp"
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "osl/file.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "xmlreader/detail/xmlreaderdllapi.hxx"
+#include "xmlreader/pad.hxx"
+#include "xmlreader/span.hxx"
+
+namespace xmlreader {
+
+class OOO_DLLPUBLIC_XMLREADER XmlReader: private boost::noncopyable {
+public:
+ explicit XmlReader(rtl::OUString const & fileUrl)
+ SAL_THROW((
+ com::sun::star::container::NoSuchElementException,
+ com::sun::star::uno::RuntimeException));
+
+ ~XmlReader();
+
+ enum { NAMESPACE_NONE = -2, NAMESPACE_UNKNOWN = -1, NAMESPACE_XML = 0 };
+
+ enum Text { TEXT_NONE, TEXT_RAW, TEXT_NORMALIZED };
+
+ enum Result { RESULT_BEGIN, RESULT_END, RESULT_TEXT, RESULT_DONE };
+
+ int registerNamespaceIri(Span const & iri);
+
+ // RESULT_BEGIN: data = localName, ns = ns
+ // RESULT_END: data, ns unused
+ // RESULT_TEXT: data = text, ns unused
+ Result nextItem(Text reportText, Span * data, int * nsId);
+
+ bool nextAttribute(int * nsId, Span * localName);
+
+ // the span returned by getAttributeValue is only valid until the next call
+ // to nextItem or getAttributeValue
+ Span getAttributeValue(bool fullyNormalize);
+
+ int getNamespaceId(Span const & prefix) const;
+
+ rtl::OUString getUrl() const;
+
+private:
+ typedef std::vector< Span > NamespaceIris;
+
+ // If NamespaceData (and similarly ElementData and AttributeData) is made
+ // SAL_DLLPRIVATE, at least gcc 4.2.3 erroneously warns about
+ // "'xmlreader::XmlReader' declared with greater visibility than the type of
+ // its field 'xmlreader::XmlReader::namespaces_'" (and similarly for
+ // elements_ and attributes_):
+
+ struct NamespaceData {
+ Span prefix;
+ int nsId;
+
+ NamespaceData() {}
+
+ NamespaceData(Span const & thePrefix, int theNsId):
+ prefix(thePrefix), nsId(theNsId) {}
+ };
+
+ typedef std::vector< NamespaceData > NamespaceList;
+
+ struct ElementData {
+ Span name;
+ NamespaceList::size_type inheritedNamespaces;
+ int defaultNamespaceId;
+
+ ElementData(
+ Span const & theName,
+ NamespaceList::size_type theInheritedNamespaces,
+ int theDefaultNamespaceId):
+ name(theName), inheritedNamespaces(theInheritedNamespaces),
+ defaultNamespaceId(theDefaultNamespaceId)
+ {}
+ };
+
+ typedef std::stack< ElementData > ElementStack;
+
+ struct AttributeData {
+ char const * nameBegin;
+ char const * nameEnd;
+ char const * nameColon;
+ char const * valueBegin;
+ char const * valueEnd;
+
+ AttributeData(
+ char const * theNameBegin, char const * theNameEnd,
+ char const * theNameColon, char const * theValueBegin,
+ char const * theValueEnd):
+ nameBegin(theNameBegin), nameEnd(theNameEnd),
+ nameColon(theNameColon), valueBegin(theValueBegin),
+ valueEnd(theValueEnd)
+ {}
+ };
+
+ typedef std::vector< AttributeData > Attributes;
+
+ enum State {
+ STATE_CONTENT, STATE_START_TAG, STATE_END_TAG, STATE_EMPTY_ELEMENT_TAG,
+ STATE_DONE };
+
+ SAL_DLLPRIVATE inline char read() { return pos_ == end_ ? '\0' : *pos_++; }
+
+ SAL_DLLPRIVATE inline char peek() { return pos_ == end_ ? '\0' : *pos_; }
+
+ SAL_DLLPRIVATE void normalizeLineEnds(Span const & text);
+
+ SAL_DLLPRIVATE void skipSpace();
+
+ SAL_DLLPRIVATE bool skipComment();
+
+ SAL_DLLPRIVATE void skipProcessingInstruction();
+
+ SAL_DLLPRIVATE void skipDocumentTypeDeclaration();
+
+ SAL_DLLPRIVATE Span scanCdataSection();
+
+ SAL_DLLPRIVATE bool scanName(char const ** nameColon);
+
+ SAL_DLLPRIVATE int scanNamespaceIri(
+ char const * begin, char const * end);
+
+ SAL_DLLPRIVATE char const * handleReference(
+ char const * position, char const * end);
+
+ SAL_DLLPRIVATE Span handleAttributeValue(
+ char const * begin, char const * end, bool fullyNormalize);
+
+ SAL_DLLPRIVATE Result handleStartTag(int * nsId, Span * localName);
+
+ SAL_DLLPRIVATE Result handleEndTag();
+
+ SAL_DLLPRIVATE void handleElementEnd();
+
+ SAL_DLLPRIVATE Result handleSkippedText(Span * data, int * nsId);
+
+ SAL_DLLPRIVATE Result handleRawText(Span * text);
+
+ SAL_DLLPRIVATE Result handleNormalizedText(Span * text);
+
+ SAL_DLLPRIVATE int toNamespaceId(NamespaceIris::size_type pos);
+
+ rtl::OUString fileUrl_;
+ oslFileHandle fileHandle_;
+ sal_uInt64 fileSize_;
+ void * fileAddress_;
+ NamespaceIris namespaceIris_;
+ NamespaceList namespaces_;
+ ElementStack elements_;
+ char const * pos_;
+ char const * end_;
+ State state_;
+ Attributes attributes_;
+ Attributes::iterator currentAttribute_;
+ bool firstAttribute_;
+ Pad pad_;
+};
+
+}
+
+#endif
diff --git a/xmlreader/prj/build.lst b/xmlreader/prj/build.lst
new file mode 100644
index 000000000..5408a5255
--- /dev/null
+++ b/xmlreader/prj/build.lst
@@ -0,0 +1,3 @@
+xr xmlreader : BOOST:boost cppu offuh sal stlport NULL
+xr xmlreader\inc nmake - all xr_inc NULL
+xr xmlreader\source nmake - all xr_source xr_inc NULL
diff --git a/xmlreader/prj/d.lst b/xmlreader/prj/d.lst
new file mode 100644
index 000000000..fcb99bd30
--- /dev/null
+++ b/xmlreader/prj/d.lst
@@ -0,0 +1,10 @@
+mkdir: %_DEST%\inc%_EXT%\xmlreader
+mkdir: %_DEST%\inc%_EXT%\xmlreader\detail
+..\%__SRC%\bin\xmlreader.dll %_DEST%\bin%_EXT%\xmlreader.dll
+..\%__SRC%\lib\ixmlreader.lib %_DEST%\lib%_EXT%\ixmlreader.lib
+..\%__SRC%\lib\libxmlreader.dylib %_DEST%\lib%_EXT%\libxmlreader.dylib
+..\%__SRC%\lib\libxmlreader.so %_DEST%\lib%_EXT%\libxmlreader.so
+..\inc\xmlreader\detail\xmlreaderdllapi.hxx %_DEST%\inc%_EXT%\xmlreader\detail\xmlreaderdllapi.hxx
+..\inc\xmlreader\pad.hxx %_DEST%\inc%_EXT%\xmlreader\pad.hxx
+..\inc\xmlreader\span.hxx %_DEST%\inc%_EXT%\xmlreader\span.hxx
+..\inc\xmlreader\xmlreader.hxx %_DEST%\inc%_EXT%\xmlreader\xmlreader.hxx
diff --git a/cpputools/source/regcomplazy/makefile.mk b/xmlreader/source/makefile.mk
index 0a4fe8477..cb71e21a1 100755..100644
--- a/cpputools/source/regcomplazy/makefile.mk
+++ b/xmlreader/source/makefile.mk
@@ -1,7 +1,7 @@
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
+#
# Copyright 2000, 2010 Oracle and/or its affiliates.
#
# OpenOffice.org - a multi-platform office productivity suite
@@ -23,32 +23,31 @@
# <http://www.openoffice.org/license.html>
# for a copy of the LGPLv3 License.
#
-#*************************************************************************
-PRJ=..$/..
-
-PRJNAME=cpputools
-TARGET=regcomplazy
-TARGETTYPE=CUI
-LIBTARGET=NO
-
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
+#***********************************************************************/
-.INCLUDE : settings.mk
+PRJ = ..
+PRJNAME = xmlreader
+TARGET = xmlreader
-# --- Files --------------------------------------------------------
+ENABLE_EXCEPTIONS = TRUE
+VISIBILITY_HIDDEN = TRUE
-DEPOBJFILES= \
- $(OBJ)$/regcomplazy.obj
+.INCLUDE: settings.mk
-APP1TARGET=$(TARGET)
-APP1OBJS=$(DEPOBJFILES)
+CDEFS += -DOOO_DLLIMPLEMENTATION_XMLREADER
-APP1STDLIBS= \
- $(SALLIB) \
- $(SALHELPERLIB) \
- $(REGLIB)
+SLOFILES = \
+ $(SLO)/pad.obj \
+ $(SLO)/span.obj \
+ $(SLO)/xmlreader.obj
-.INCLUDE : target.mk
+SHL1IMPLIB = i$(SHL1TARGET)
+SHL1OBJS = $(SLOFILES)
+SHL1RPATH = URELIB
+SHL1STDLIBS = \
+ $(SALLIB)
+SHL1TARGET = xmlreader
+SHL1USE_EXPORTS = name
+DEF1NAME = $(SHL1TARGET)
+.INCLUDE: target.mk
diff --git a/xmlreader/source/pad.cxx b/xmlreader/source/pad.cxx
new file mode 100644
index 000000000..b1673c4a4
--- /dev/null
+++ b/xmlreader/source/pad.cxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#include "precompiled_xmlreader.hxx"
+#include "sal/config.h"
+
+#include "osl/diagnose.h"
+#include "rtl/string.h"
+#include "sal/types.h"
+#include "xmlreader/pad.hxx"
+#include "xmlreader/span.hxx"
+
+namespace xmlreader {
+
+void Pad::add(char const * begin, sal_Int32 length) {
+ OSL_ASSERT(
+ begin != 0 && length >= 0 && !(span_.is() && buffer_.getLength() != 0));
+ if (length != 0) {
+ flushSpan();
+ if (buffer_.getLength() == 0) {
+ span_ = Span(begin, length);
+ } else {
+ buffer_.append(begin, length);
+ }
+ }
+}
+
+void Pad::addEphemeral(char const * begin, sal_Int32 length) {
+ OSL_ASSERT(
+ begin != 0 && length >= 0 && !(span_.is() && buffer_.getLength() != 0));
+ if (length != 0) {
+ flushSpan();
+ buffer_.append(begin, length);
+ }
+}
+
+void Pad::clear() {
+ OSL_ASSERT(!(span_.is() && buffer_.getLength() != 0));
+ span_.clear();
+ buffer_.setLength(0);
+}
+
+Span Pad::get() const {
+ OSL_ASSERT(!(span_.is() && buffer_.getLength() != 0));
+ if (span_.is()) {
+ return span_;
+ } else if (buffer_.getLength() == 0) {
+ return Span(RTL_CONSTASCII_STRINGPARAM(""));
+ } else {
+ return Span(buffer_.getStr(), buffer_.getLength());
+ }
+}
+
+void Pad::flushSpan() {
+ if (span_.is()) {
+ buffer_.append(span_.begin, span_.length);
+ span_.clear();
+ }
+}
+
+}
diff --git a/xmlreader/source/span.cxx b/xmlreader/source/span.cxx
new file mode 100644
index 000000000..3b936553b
--- /dev/null
+++ b/xmlreader/source/span.cxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#include "precompiled_xmlreader.hxx"
+#include "sal/config.h"
+
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "osl/diagnose.h"
+#include "rtl/textcvt.h"
+#include "rtl/textenc.h"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "xmlreader/span.hxx"
+
+namespace xmlreader {
+
+namespace {
+
+namespace css = com::sun::star;
+
+}
+
+rtl::OUString Span::convertFromUtf8() const {
+ OSL_ASSERT(is());
+ rtl_uString * s = 0;
+ if (!rtl_convertStringToUString(
+ &s, begin, length, RTL_TEXTENCODING_UTF8,
+ (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)))
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("cannot convert from UTF-8")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ return rtl::OUString(s, SAL_NO_ACQUIRE);
+}
+
+}
diff --git a/xmlreader/source/xmlreader.cxx b/xmlreader/source/xmlreader.cxx
new file mode 100644
index 000000000..27350a8f0
--- /dev/null
+++ b/xmlreader/source/xmlreader.cxx
@@ -0,0 +1,1054 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#include "precompiled_xmlreader.hxx"
+#include "sal/config.h"
+
+#include <climits>
+#include <cstddef>
+
+#include "com/sun/star/container/NoSuchElementException.hpp"
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "osl/diagnose.h"
+#include "osl/file.h"
+#include "rtl/string.h"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "xmlreader/pad.hxx"
+#include "xmlreader/span.hxx"
+#include "xmlreader/xmlreader.hxx"
+
+namespace xmlreader {
+
+namespace {
+
+namespace css = com::sun::star;
+
+bool isSpace(char c) {
+ switch (c) {
+ case '\x09':
+ case '\x0A':
+ case '\x0D':
+ case ' ':
+ return true;
+ default:
+ return false;
+ }
+}
+
+}
+
+XmlReader::XmlReader(rtl::OUString const & fileUrl)
+ SAL_THROW((
+ css::container::NoSuchElementException, css::uno::RuntimeException)):
+ fileUrl_(fileUrl)
+{
+ switch (osl_openFile(fileUrl_.pData, &fileHandle_, osl_File_OpenFlag_Read))
+ {
+ case osl_File_E_None:
+ break;
+ case osl_File_E_NOENT:
+ throw css::container::NoSuchElementException(
+ fileUrl_, css::uno::Reference< css::uno::XInterface >());
+ default:
+ throw css::uno::RuntimeException(
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("cannot open ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ oslFileError e = osl_getFileSize(fileHandle_, &fileSize_);
+ if (e == osl_File_E_None) {
+ e = osl_mapFile(
+ fileHandle_, &fileAddress_, fileSize_, 0,
+ osl_File_MapFlag_WillNeed);
+ }
+ if (e != osl_File_E_None) {
+ e = osl_closeFile(fileHandle_);
+ if (e != osl_File_E_None) {
+ OSL_TRACE("osl_closeFile failed with %ld", static_cast< long >(e));
+ }
+ throw css::uno::RuntimeException(
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("cannot mmap ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ namespaceIris_.push_back(
+ Span(
+ RTL_CONSTASCII_STRINGPARAM(
+ "http://www.w3.org/XML/1998/namespace")));
+ namespaces_.push_back(
+ NamespaceData(Span(RTL_CONSTASCII_STRINGPARAM("xml")), NAMESPACE_XML));
+ pos_ = static_cast< char * >(fileAddress_);
+ end_ = pos_ + fileSize_;
+ state_ = STATE_CONTENT;
+}
+
+XmlReader::~XmlReader() {
+ oslFileError e = osl_unmapFile(fileAddress_, fileSize_);
+ if (e != osl_File_E_None) {
+ OSL_TRACE("osl_unmapFile failed with %ld", static_cast< long >(e));
+ }
+ e = osl_closeFile(fileHandle_);
+ if (e != osl_File_E_None) {
+ OSL_TRACE("osl_closeFile failed with %ld", static_cast< long >(e));
+ }
+}
+
+int XmlReader::registerNamespaceIri(Span const & iri) {
+ int id = toNamespaceId(namespaceIris_.size());
+ namespaceIris_.push_back(iri);
+ if (iri.equals(
+ Span(
+ RTL_CONSTASCII_STRINGPARAM(
+ "http://www.w3.org/2001/XMLSchema-instance"))))
+ {
+ // Old user layer .xcu files used the xsi namespace prefix without
+ // declaring a corresponding namespace binding, see issue 77174; reading
+ // those files during migration would fail without this hack that can be
+ // removed once migration is no longer relevant (see
+ // configmgr::Components::parseModificationLayer):
+ namespaces_.push_back(
+ NamespaceData(Span(RTL_CONSTASCII_STRINGPARAM("xsi")), id));
+ }
+ return id;
+}
+
+XmlReader::Result XmlReader::nextItem(Text reportText, Span * data, int * nsId)
+{
+ switch (state_) {
+ case STATE_CONTENT:
+ switch (reportText) {
+ case TEXT_NONE:
+ return handleSkippedText(data, nsId);
+ case TEXT_RAW:
+ return handleRawText(data);
+ case TEXT_NORMALIZED:
+ return handleNormalizedText(data);
+ }
+ case STATE_START_TAG:
+ return handleStartTag(nsId, data);
+ case STATE_END_TAG:
+ return handleEndTag();
+ case STATE_EMPTY_ELEMENT_TAG:
+ handleElementEnd();
+ return RESULT_END;
+ default: // STATE_DONE
+ return RESULT_DONE;
+ }
+}
+
+bool XmlReader::nextAttribute(int * nsId, Span * localName) {
+ OSL_ASSERT(nsId != 0 && localName != 0);
+ if (firstAttribute_) {
+ currentAttribute_ = attributes_.begin();
+ firstAttribute_ = false;
+ } else {
+ ++currentAttribute_;
+ }
+ if (currentAttribute_ == attributes_.end()) {
+ return false;
+ }
+ if (currentAttribute_->nameColon == 0) {
+ *nsId = NAMESPACE_NONE;
+ *localName = Span(
+ currentAttribute_->nameBegin,
+ currentAttribute_->nameEnd - currentAttribute_->nameBegin);
+ } else {
+ *nsId = getNamespaceId(
+ Span(
+ currentAttribute_->nameBegin,
+ currentAttribute_->nameColon - currentAttribute_->nameBegin));
+ *localName = Span(
+ currentAttribute_->nameColon + 1,
+ currentAttribute_->nameEnd - (currentAttribute_->nameColon + 1));
+ }
+ return true;
+}
+
+Span XmlReader::getAttributeValue(bool fullyNormalize) {
+ return handleAttributeValue(
+ currentAttribute_->valueBegin, currentAttribute_->valueEnd,
+ fullyNormalize);
+}
+
+int XmlReader::getNamespaceId(Span const & prefix) const {
+ for (NamespaceList::const_reverse_iterator i(namespaces_.rbegin());
+ i != namespaces_.rend(); ++i)
+ {
+ if (prefix.equals(i->prefix)) {
+ return i->nsId;
+ }
+ }
+ return NAMESPACE_UNKNOWN;
+}
+
+rtl::OUString XmlReader::getUrl() const {
+ return fileUrl_;
+}
+
+void XmlReader::normalizeLineEnds(Span const & text) {
+ char const * p = text.begin;
+ sal_Int32 n = text.length;
+ for (;;) {
+ sal_Int32 i = rtl_str_indexOfChar_WithLength(p, n, '\x0D');
+ if (i < 0) {
+ break;
+ }
+ pad_.add(p, i);
+ p += i + 1;
+ n -= i + 1;
+ if (n == 0 || *p != '\x0A') {
+ pad_.add(RTL_CONSTASCII_STRINGPARAM("\x0A"));
+ }
+ }
+ pad_.add(p, n);
+}
+
+void XmlReader::skipSpace() {
+ while (isSpace(peek())) {
+ ++pos_;
+ }
+}
+
+bool XmlReader::skipComment() {
+ if (rtl_str_shortenedCompare_WithLength(
+ pos_, end_ - pos_, RTL_CONSTASCII_STRINGPARAM("--"),
+ RTL_CONSTASCII_LENGTH("--")) !=
+ 0)
+ {
+ return false;
+ }
+ pos_ += RTL_CONSTASCII_LENGTH("--");
+ sal_Int32 i = rtl_str_indexOfStr_WithLength(
+ pos_, end_ - pos_, RTL_CONSTASCII_STRINGPARAM("--"));
+ if (i < 0) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "premature end (within comment) of ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ pos_ += i + RTL_CONSTASCII_LENGTH("--");
+ if (read() != '>') {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "illegal \"--\" within comment in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ return true;
+}
+
+void XmlReader::skipProcessingInstruction() {
+ sal_Int32 i = rtl_str_indexOfStr_WithLength(
+ pos_, end_ - pos_, RTL_CONSTASCII_STRINGPARAM("?>"));
+ if (i < 0) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bad '<?' in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ pos_ += i + RTL_CONSTASCII_LENGTH("?>");
+}
+
+void XmlReader::skipDocumentTypeDeclaration() {
+ // Neither is it checked that the doctypedecl is at the correct position in
+ // the document, nor that it is well-formed:
+ for (;;) {
+ char c = read();
+ switch (c) {
+ case '\0': // i.e., EOF
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "premature end (within DTD) of ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ case '"':
+ case '\'':
+ {
+ sal_Int32 i = rtl_str_indexOfChar_WithLength(
+ pos_, end_ - pos_, c);
+ if (i < 0) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "premature end (within DTD) of ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ pos_ += i + 1;
+ }
+ break;
+ case '>':
+ return;
+ case '[':
+ for (;;) {
+ c = read();
+ switch (c) {
+ case '\0': // i.e., EOF
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "premature end (within DTD) of ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ case '"':
+ case '\'':
+ {
+ sal_Int32 i = rtl_str_indexOfChar_WithLength(
+ pos_, end_ - pos_, c);
+ if (i < 0) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "premature end (within DTD) of ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ pos_ += i + 1;
+ }
+ break;
+ case '<':
+ switch (read()) {
+ case '\0': // i.e., EOF
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "premature end (within DTD) of ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ case '!':
+ skipComment();
+ break;
+ case '?':
+ skipProcessingInstruction();
+ break;
+ default:
+ break;
+ }
+ break;
+ case ']':
+ skipSpace();
+ if (read() != '>') {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "missing \">\" of DTD in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ return;
+ default:
+ break;
+ }
+ }
+ default:
+ break;
+ }
+ }
+}
+
+Span XmlReader::scanCdataSection() {
+ if (rtl_str_shortenedCompare_WithLength(
+ pos_, end_ - pos_, RTL_CONSTASCII_STRINGPARAM("[CDATA["),
+ RTL_CONSTASCII_LENGTH("[CDATA[")) !=
+ 0)
+ {
+ return Span();
+ }
+ pos_ += RTL_CONSTASCII_LENGTH("[CDATA[");
+ char const * begin = pos_;
+ sal_Int32 i = rtl_str_indexOfStr_WithLength(
+ pos_, end_ - pos_, RTL_CONSTASCII_STRINGPARAM("]]>"));
+ if (i < 0) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "premature end (within CDATA section) of ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ pos_ += i + RTL_CONSTASCII_LENGTH("]]>");
+ return Span(begin, i);
+}
+
+bool XmlReader::scanName(char const ** nameColon) {
+ OSL_ASSERT(nameColon != 0 && *nameColon == 0);
+ for (char const * begin = pos_;; ++pos_) {
+ switch (peek()) {
+ case '\0': // i.e., EOF
+ case '\x09':
+ case '\x0A':
+ case '\x0D':
+ case ' ':
+ case '/':
+ case '=':
+ case '>':
+ return pos_ != begin;
+ case ':':
+ *nameColon = pos_;
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+int XmlReader::scanNamespaceIri(char const * begin, char const * end) {
+ OSL_ASSERT(begin != 0 && begin <= end);
+ Span iri(handleAttributeValue(begin, end, false));
+ for (NamespaceIris::size_type i = 0; i < namespaceIris_.size(); ++i) {
+ if (namespaceIris_[i].equals(iri)) {
+ return toNamespaceId(i);
+ }
+ }
+ return XmlReader::NAMESPACE_UNKNOWN;
+}
+
+char const * XmlReader::handleReference(char const * position, char const * end)
+{
+ OSL_ASSERT(position != 0 && *position == '&' && position < end);
+ ++position;
+ if (*position == '#') {
+ ++position;
+ sal_Int32 val = 0;
+ char const * p;
+ if (*position == 'x') {
+ ++position;
+ p = position;
+ for (;; ++position) {
+ char c = *position;
+ if (c >= '0' && c <= '9') {
+ val = 16 * val + (c - '0');
+ } else if (c >= 'A' && c <= 'F') {
+ val = 16 * val + (c - 'A') + 10;
+ } else if (c >= 'a' && c <= 'f') {
+ val = 16 * val + (c - 'a') + 10;
+ } else {
+ break;
+ }
+ if (val > 0x10FFFF) { // avoid overflow
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "'&#x...' too large in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ }
+ } else {
+ p = position;
+ for (;; ++position) {
+ char c = *position;
+ if (c >= '0' && c <= '9') {
+ val = 10 * val + (c - '0');
+ } else {
+ break;
+ }
+ if (val > 0x10FFFF) { // avoid overflow
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "'&#...' too large in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ }
+ }
+ if (position == p || *position++ != ';') {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("'&#...' missing ';' in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ OSL_ASSERT(val >= 0 && val <= 0x10FFFF);
+ if ((val < 0x20 && val != 0x9 && val != 0xA && val != 0xD) ||
+ (val >= 0xD800 && val <= 0xDFFF) || val == 0xFFFE || val == 0xFFFF)
+ {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "character reference denoting invalid character in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ char buf[4];
+ sal_Int32 len;
+ if (val < 0x80) {
+ buf[0] = static_cast< char >(val);
+ len = 1;
+ } else if (val < 0x800) {
+ buf[0] = static_cast< char >((val >> 6) | 0xC0);
+ buf[1] = static_cast< char >((val & 0x3F) | 0x80);
+ len = 2;
+ } else if (val < 0x10000) {
+ buf[0] = static_cast< char >((val >> 12) | 0xE0);
+ buf[1] = static_cast< char >(((val >> 6) & 0x3F) | 0x80);
+ buf[2] = static_cast< char >((val & 0x3F) | 0x80);
+ len = 3;
+ } else {
+ buf[0] = static_cast< char >((val >> 18) | 0xF0);
+ buf[1] = static_cast< char >(((val >> 12) & 0x3F) | 0x80);
+ buf[2] = static_cast< char >(((val >> 6) & 0x3F) | 0x80);
+ buf[3] = static_cast< char >((val & 0x3F) | 0x80);
+ len = 4;
+ }
+ pad_.addEphemeral(buf, len);
+ return position;
+ } else {
+ struct EntityRef {
+ char const * inBegin;
+ sal_Int32 inLength;
+ char const * outBegin;
+ sal_Int32 outLength;
+ };
+ static EntityRef const refs[] = {
+ { RTL_CONSTASCII_STRINGPARAM("amp;"),
+ RTL_CONSTASCII_STRINGPARAM("&") },
+ { RTL_CONSTASCII_STRINGPARAM("lt;"),
+ RTL_CONSTASCII_STRINGPARAM("<") },
+ { RTL_CONSTASCII_STRINGPARAM("gt;"),
+ RTL_CONSTASCII_STRINGPARAM(">") },
+ { RTL_CONSTASCII_STRINGPARAM("apos;"),
+ RTL_CONSTASCII_STRINGPARAM("'") },
+ { RTL_CONSTASCII_STRINGPARAM("quot;"),
+ RTL_CONSTASCII_STRINGPARAM("\"") } };
+ for (std::size_t i = 0; i < sizeof refs / sizeof refs[0]; ++i) {
+ if (rtl_str_shortenedCompare_WithLength(
+ position, end - position, refs[i].inBegin, refs[i].inLength,
+ refs[i].inLength) ==
+ 0)
+ {
+ position += refs[i].inLength;
+ pad_.add(refs[i].outBegin, refs[i].outLength);
+ return position;
+ }
+ }
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("unknown entity reference in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+}
+
+Span XmlReader::handleAttributeValue(
+ char const * begin, char const * end, bool fullyNormalize)
+{
+ pad_.clear();
+ if (fullyNormalize) {
+ while (begin != end && isSpace(*begin)) {
+ ++begin;
+ }
+ while (end != begin && isSpace(end[-1])) {
+ --end;
+ }
+ char const * p = begin;
+ enum Space { SPACE_NONE, SPACE_SPAN, SPACE_BREAK };
+ // a single true space character can go into the current span,
+ // everything else breaks the span
+ Space space = SPACE_NONE;
+ while (p != end) {
+ switch (*p) {
+ case '\x09':
+ case '\x0A':
+ case '\x0D':
+ switch (space) {
+ case SPACE_NONE:
+ pad_.add(begin, p - begin);
+ pad_.add(RTL_CONSTASCII_STRINGPARAM(" "));
+ space = SPACE_BREAK;
+ break;
+ case SPACE_SPAN:
+ pad_.add(begin, p - begin);
+ space = SPACE_BREAK;
+ break;
+ case SPACE_BREAK:
+ break;
+ }
+ begin = ++p;
+ break;
+ case ' ':
+ switch (space) {
+ case SPACE_NONE:
+ ++p;
+ space = SPACE_SPAN;
+ break;
+ case SPACE_SPAN:
+ pad_.add(begin, p - begin);
+ begin = ++p;
+ space = SPACE_BREAK;
+ break;
+ case SPACE_BREAK:
+ begin = ++p;
+ break;
+ }
+ break;
+ case '&':
+ pad_.add(begin, p - begin);
+ p = handleReference(p, end);
+ begin = p;
+ space = SPACE_NONE;
+ break;
+ default:
+ ++p;
+ space = SPACE_NONE;
+ break;
+ }
+ }
+ pad_.add(begin, p - begin);
+ } else {
+ char const * p = begin;
+ while (p != end) {
+ switch (*p) {
+ case '\x09':
+ case '\x0A':
+ pad_.add(begin, p - begin);
+ begin = ++p;
+ pad_.add(RTL_CONSTASCII_STRINGPARAM(" "));
+ break;
+ case '\x0D':
+ pad_.add(begin, p - begin);
+ ++p;
+ if (peek() == '\x0A') {
+ ++p;
+ }
+ begin = p;
+ pad_.add(RTL_CONSTASCII_STRINGPARAM(" "));
+ break;
+ case '&':
+ pad_.add(begin, p - begin);
+ p = handleReference(p, end);
+ begin = p;
+ break;
+ default:
+ ++p;
+ break;
+ }
+ }
+ pad_.add(begin, p - begin);
+ }
+ return pad_.get();
+}
+
+XmlReader::Result XmlReader::handleStartTag(int * nsId, Span * localName) {
+ OSL_ASSERT(nsId != 0 && localName);
+ char const * nameBegin = pos_;
+ char const * nameColon = 0;
+ if (!scanName(&nameColon)) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bad tag name in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ char const * nameEnd = pos_;
+ NamespaceList::size_type inheritedNamespaces = namespaces_.size();
+ bool hasDefaultNs = false;
+ int defaultNsId = NAMESPACE_NONE;
+ attributes_.clear();
+ for (;;) {
+ char const * p = pos_;
+ skipSpace();
+ if (peek() == '/' || peek() == '>') {
+ break;
+ }
+ if (pos_ == p) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "missing whitespace before attribute in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ char const * attrNameBegin = pos_;
+ char const * attrNameColon = 0;
+ if (!scanName(&attrNameColon)) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("bad attribute name in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ char const * attrNameEnd = pos_;
+ skipSpace();
+ if (read() != '=') {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("missing '=' in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ skipSpace();
+ char del = read();
+ if (del != '\'' && del != '"') {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("bad attribute value in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ char const * valueBegin = pos_;
+ sal_Int32 i = rtl_str_indexOfChar_WithLength(pos_, end_ - pos_, del);
+ if (i < 0) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "unterminated attribute value in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ char const * valueEnd = pos_ + i;
+ pos_ += i + 1;
+ if (attrNameColon == 0 &&
+ Span(attrNameBegin, attrNameEnd - attrNameBegin).equals(
+ RTL_CONSTASCII_STRINGPARAM("xmlns")))
+ {
+ hasDefaultNs = true;
+ defaultNsId = scanNamespaceIri(valueBegin, valueEnd);
+ } else if (attrNameColon != 0 &&
+ Span(attrNameBegin, attrNameColon - attrNameBegin).equals(
+ RTL_CONSTASCII_STRINGPARAM("xmlns")))
+ {
+ namespaces_.push_back(
+ NamespaceData(
+ Span(attrNameColon + 1, attrNameEnd - (attrNameColon + 1)),
+ scanNamespaceIri(valueBegin, valueEnd)));
+ } else {
+ attributes_.push_back(
+ AttributeData(
+ attrNameBegin, attrNameEnd, attrNameColon, valueBegin,
+ valueEnd));
+ }
+ }
+ if (!hasDefaultNs && !elements_.empty()) {
+ defaultNsId = elements_.top().defaultNamespaceId;
+ }
+ firstAttribute_ = true;
+ if (peek() == '/') {
+ state_ = STATE_EMPTY_ELEMENT_TAG;
+ ++pos_;
+ } else {
+ state_ = STATE_CONTENT;
+ }
+ if (peek() != '>') {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("missing '>' in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ ++pos_;
+ elements_.push(
+ ElementData(
+ Span(nameBegin, nameEnd - nameBegin), inheritedNamespaces,
+ defaultNsId));
+ if (nameColon == 0) {
+ *nsId = defaultNsId;
+ *localName = Span(nameBegin, nameEnd - nameBegin);
+ } else {
+ *nsId = getNamespaceId(Span(nameBegin, nameColon - nameBegin));
+ *localName = Span(nameColon + 1, nameEnd - (nameColon + 1));
+ }
+ return RESULT_BEGIN;
+}
+
+XmlReader::Result XmlReader::handleEndTag() {
+ if (elements_.empty()) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("spurious end tag in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ char const * nameBegin = pos_;
+ char const * nameColon = 0;
+ if (!scanName(&nameColon) ||
+ !elements_.top().name.equals(nameBegin, pos_ - nameBegin))
+ {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("tag mismatch in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ handleElementEnd();
+ skipSpace();
+ if (peek() != '>') {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("missing '>' in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ ++pos_;
+ return RESULT_END;
+}
+
+void XmlReader::handleElementEnd() {
+ OSL_ASSERT(!elements_.empty());
+ namespaces_.resize(elements_.top().inheritedNamespaces);
+ elements_.pop();
+ state_ = elements_.empty() ? STATE_DONE : STATE_CONTENT;
+}
+
+XmlReader::Result XmlReader::handleSkippedText(Span * data, int * nsId) {
+ for (;;) {
+ sal_Int32 i = rtl_str_indexOfChar_WithLength(pos_, end_ - pos_, '<');
+ if (i < 0) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("premature end of ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ pos_ += i + 1;
+ switch (peek()) {
+ case '!':
+ ++pos_;
+ if (!skipComment() && !scanCdataSection().is()) {
+ skipDocumentTypeDeclaration();
+ }
+ break;
+ case '/':
+ ++pos_;
+ return handleEndTag();
+ case '?':
+ ++pos_;
+ skipProcessingInstruction();
+ break;
+ default:
+ return handleStartTag(nsId, data);
+ }
+ }
+}
+
+XmlReader::Result XmlReader::handleRawText(Span * text) {
+ pad_.clear();
+ for (char const * begin = pos_;;) {
+ switch (peek()) {
+ case '\0': // i.e., EOF
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("premature end of ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ case '\x0D':
+ pad_.add(begin, pos_ - begin);
+ ++pos_;
+ if (peek() != '\x0A') {
+ pad_.add(RTL_CONSTASCII_STRINGPARAM("\x0A"));
+ }
+ begin = pos_;
+ break;
+ case '&':
+ pad_.add(begin, pos_ - begin);
+ pos_ = handleReference(pos_, end_);
+ begin = pos_;
+ break;
+ case '<':
+ pad_.add(begin, pos_ - begin);
+ ++pos_;
+ switch (peek()) {
+ case '!':
+ ++pos_;
+ if (!skipComment()) {
+ Span cdata(scanCdataSection());
+ if (cdata.is()) {
+ normalizeLineEnds(cdata);
+ } else {
+ skipDocumentTypeDeclaration();
+ }
+ }
+ begin = pos_;
+ break;
+ case '/':
+ *text = pad_.get();
+ ++pos_;
+ state_ = STATE_END_TAG;
+ return RESULT_TEXT;
+ case '?':
+ ++pos_;
+ skipProcessingInstruction();
+ begin = pos_;
+ break;
+ default:
+ *text = pad_.get();
+ state_ = STATE_START_TAG;
+ return RESULT_TEXT;
+ }
+ break;
+ default:
+ ++pos_;
+ break;
+ }
+ }
+}
+
+XmlReader::Result XmlReader::handleNormalizedText(Span * text) {
+ pad_.clear();
+ char const * flowBegin = pos_;
+ char const * flowEnd = pos_;
+ enum Space { SPACE_START, SPACE_NONE, SPACE_SPAN, SPACE_BREAK };
+ // a single true space character can go into the current flow,
+ // everything else breaks the flow
+ Space space = SPACE_START;
+ for (;;) {
+ switch (peek()) {
+ case '\0': // i.e., EOF
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("premature end of ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ case '\x09':
+ case '\x0A':
+ case '\x0D':
+ switch (space) {
+ case SPACE_START:
+ case SPACE_BREAK:
+ break;
+ case SPACE_NONE:
+ case SPACE_SPAN:
+ space = SPACE_BREAK;
+ break;
+ }
+ ++pos_;
+ break;
+ case ' ':
+ switch (space) {
+ case SPACE_START:
+ case SPACE_BREAK:
+ break;
+ case SPACE_NONE:
+ space = SPACE_SPAN;
+ break;
+ case SPACE_SPAN:
+ space = SPACE_BREAK;
+ break;
+ }
+ ++pos_;
+ break;
+ case '&':
+ switch (space) {
+ case SPACE_START:
+ break;
+ case SPACE_NONE:
+ case SPACE_SPAN:
+ pad_.add(flowBegin, pos_ - flowBegin);
+ break;
+ case SPACE_BREAK:
+ pad_.add(flowBegin, flowEnd - flowBegin);
+ pad_.add(RTL_CONSTASCII_STRINGPARAM(" "));
+ break;
+ }
+ pos_ = handleReference(pos_, end_);
+ flowBegin = pos_;
+ flowEnd = pos_;
+ space = SPACE_NONE;
+ break;
+ case '<':
+ ++pos_;
+ switch (peek()) {
+ case '!':
+ ++pos_;
+ if (skipComment()) {
+ space = SPACE_BREAK;
+ } else {
+ Span cdata(scanCdataSection());
+ if (cdata.is()) {
+ // CDATA is not normalized (similar to character
+ // references; it keeps the code simple), but it might
+ // arguably be better to normalize it:
+ switch (space) {
+ case SPACE_START:
+ break;
+ case SPACE_NONE:
+ case SPACE_SPAN:
+ pad_.add(flowBegin, pos_ - flowBegin);
+ break;
+ case SPACE_BREAK:
+ pad_.add(flowBegin, flowEnd - flowBegin);
+ pad_.add(RTL_CONSTASCII_STRINGPARAM(" "));
+ break;
+ }
+ normalizeLineEnds(cdata);
+ flowBegin = pos_;
+ flowEnd = pos_;
+ space = SPACE_NONE;
+ } else {
+ skipDocumentTypeDeclaration();
+ }
+ }
+ break;
+ case '/':
+ ++pos_;
+ pad_.add(flowBegin, flowEnd - flowBegin);
+ *text = pad_.get();
+ state_ = STATE_END_TAG;
+ return RESULT_TEXT;
+ case '?':
+ ++pos_;
+ skipProcessingInstruction();
+ space = SPACE_BREAK;
+ break;
+ default:
+ pad_.add(flowBegin, flowEnd - flowBegin);
+ *text = pad_.get();
+ state_ = STATE_START_TAG;
+ return RESULT_TEXT;
+ }
+ break;
+ default:
+ switch (space) {
+ case SPACE_START:
+ flowBegin = pos_;
+ break;
+ case SPACE_NONE:
+ case SPACE_SPAN:
+ break;
+ case SPACE_BREAK:
+ pad_.add(flowBegin, flowEnd - flowBegin);
+ pad_.add(RTL_CONSTASCII_STRINGPARAM(" "));
+ flowBegin = pos_;
+ break;
+ }
+ flowEnd = ++pos_;
+ space = SPACE_NONE;
+ break;
+ }
+ }
+}
+
+int XmlReader::toNamespaceId(NamespaceIris::size_type pos) {
+ OSL_ASSERT(pos <= INT_MAX);
+ return static_cast< int >(pos);
+}
+
+}