LCOV - code coverage report
Current view: top level - libreoffice/configmgr/source - configurationregistry.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 218 0.9 %
Date: 2012-12-27 Functions: 1 55 1.8 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "sal/config.h"
      21             : 
      22             : #include <cassert>
      23             : 
      24             : #include "boost/noncopyable.hpp"
      25             : #include "com/sun/star/beans/NamedValue.hpp"
      26             : #include "com/sun/star/beans/Property.hpp"
      27             : #include "com/sun/star/beans/XProperty.hpp"
      28             : #include "com/sun/star/container/NoSuchElementException.hpp"
      29             : #include "com/sun/star/container/XHierarchicalNameAccess.hpp"
      30             : #include "com/sun/star/container/XNamed.hpp"
      31             : #include "com/sun/star/lang/XMultiServiceFactory.hpp"
      32             : #include "com/sun/star/lang/XServiceInfo.hpp"
      33             : #include "com/sun/star/registry/InvalidRegistryException.hpp"
      34             : #include "com/sun/star/registry/InvalidValueException.hpp"
      35             : #include "com/sun/star/registry/MergeConflictException.hpp"
      36             : #include "com/sun/star/registry/RegistryKeyType.hpp"
      37             : #include "com/sun/star/registry/RegistryValueType.hpp"
      38             : #include "com/sun/star/registry/XRegistryKey.hpp"
      39             : #include "com/sun/star/registry/XSimpleRegistry.hpp"
      40             : #include "com/sun/star/uno/Any.hxx"
      41             : #include "com/sun/star/uno/DeploymentException.hpp"
      42             : #include "com/sun/star/uno/Exception.hpp"
      43             : #include "com/sun/star/uno/Reference.hxx"
      44             : #include "com/sun/star/uno/RuntimeException.hpp"
      45             : #include "com/sun/star/uno/Sequence.hxx"
      46             : #include "com/sun/star/uno/Type.hxx"
      47             : #include "com/sun/star/uno/TypeClass.hpp"
      48             : #include "com/sun/star/uno/XComponentContext.hpp"
      49             : #include "com/sun/star/uno/XInterface.hpp"
      50             : #include "com/sun/star/util/XFlushable.hpp"
      51             : #include "cppu/unotype.hxx"
      52             : #include "cppuhelper/implbase1.hxx"
      53             : #include "cppuhelper/implbase3.hxx"
      54             : #include "cppuhelper/weak.hxx"
      55             : #include "osl/mutex.hxx"
      56             : #include "rtl/ustring.h"
      57             : #include "rtl/ustring.hxx"
      58             : #include "sal/types.h"
      59             : 
      60             : #include "configurationregistry.hxx"
      61             : 
      62             : namespace com { namespace sun { namespace star { namespace util {
      63             :     class XFlushListener;
      64             : } } } }
      65             : 
      66             : namespace configmgr { namespace configuration_registry {
      67             : 
      68             : namespace {
      69             : 
      70             : class Service:
      71             :     public cppu::WeakImplHelper3<
      72             :         css::lang::XServiceInfo, css::registry::XSimpleRegistry,
      73             :         css::util::XFlushable >,
      74             :     private boost::noncopyable
      75             : {
      76             : public:
      77             :     Service(css::uno::Reference< css::uno::XComponentContext > const & context);
      78             : 
      79             : private:
      80           0 :     virtual ~Service() {}
      81             : 
      82           0 :     virtual OUString SAL_CALL getImplementationName()
      83             :         throw (css::uno::RuntimeException)
      84           0 :     { return configuration_registry::getImplementationName(); }
      85             : 
      86           0 :     virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
      87             :         throw (css::uno::RuntimeException)
      88           0 :     { return ServiceName == getSupportedServiceNames()[0]; } //TODO
      89             : 
      90             :     virtual css::uno::Sequence< OUString > SAL_CALL
      91           0 :     getSupportedServiceNames() throw (css::uno::RuntimeException)
      92           0 :     { return configuration_registry::getSupportedServiceNames(); }
      93             : 
      94             :     virtual OUString SAL_CALL getURL() throw (css::uno::RuntimeException);
      95             : 
      96             :     virtual void SAL_CALL open(
      97             :         OUString const & rURL, sal_Bool bReadOnly, sal_Bool)
      98             :         throw (
      99             :             css::registry::InvalidRegistryException,
     100             :             css::uno::RuntimeException);
     101             : 
     102             :     virtual sal_Bool SAL_CALL isValid() throw (css::uno::RuntimeException);
     103             : 
     104             :     virtual void SAL_CALL close()
     105             :         throw (
     106             :             css::registry::InvalidRegistryException,
     107             :             css::uno::RuntimeException);
     108             : 
     109             :     virtual void SAL_CALL destroy()
     110             :         throw (
     111             :             css::registry::InvalidRegistryException,
     112             :             css::uno::RuntimeException);
     113             : 
     114             :     virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL
     115             :     getRootKey()
     116             :         throw (
     117             :             css::registry::InvalidRegistryException,
     118             :             css::uno::RuntimeException);
     119             : 
     120             :     virtual sal_Bool SAL_CALL isReadOnly() throw (css::uno::RuntimeException);
     121             : 
     122             :     virtual void SAL_CALL mergeKey(OUString const &, OUString const &)
     123             :         throw (
     124             :             css::registry::InvalidRegistryException,
     125             :             css::registry::MergeConflictException, css::uno::RuntimeException);
     126             : 
     127             :     virtual void SAL_CALL flush() throw (css::uno::RuntimeException);
     128             : 
     129             :     virtual void SAL_CALL addFlushListener(
     130             :         css::uno::Reference< css::util::XFlushListener > const &)
     131             :         throw (css::uno::RuntimeException);
     132             : 
     133             :     virtual void SAL_CALL removeFlushListener(
     134             :         css::uno::Reference< css::util::XFlushListener > const &)
     135             :         throw (css::uno::RuntimeException);
     136             : 
     137             :     void checkValid();
     138             : 
     139             :     void checkValid_RuntimeException();
     140             : 
     141             :     void doClose();
     142             : 
     143             :     css::uno::Reference< css::lang::XMultiServiceFactory > provider_;
     144             :     osl::Mutex mutex_;
     145             :     css::uno::Reference< css::uno::XInterface > access_;
     146             :     OUString url_;
     147             :     bool readOnly_;
     148             : 
     149             :     friend class RegistryKey;
     150             : };
     151             : 
     152             : class RegistryKey:
     153             :     public cppu::WeakImplHelper1< css::registry::XRegistryKey >,
     154             :     private boost::noncopyable
     155             : {
     156             : public:
     157           0 :     RegistryKey(Service & service, css::uno::Any const & value):
     158           0 :         service_(service), value_(value) {}
     159             : 
     160             : private:
     161           0 :     virtual ~RegistryKey() {}
     162             : 
     163             :     virtual OUString SAL_CALL getKeyName()
     164             :         throw (css::uno::RuntimeException);
     165             : 
     166             :     virtual sal_Bool SAL_CALL isReadOnly()
     167             :         throw (
     168             :             css::registry::InvalidRegistryException,
     169             :             css::uno::RuntimeException);
     170             : 
     171             :     virtual sal_Bool SAL_CALL isValid() throw (css::uno::RuntimeException);
     172             : 
     173             :     virtual css::registry::RegistryKeyType SAL_CALL getKeyType(
     174             :         OUString const &)
     175             :         throw (
     176             :             css::registry::InvalidRegistryException,
     177             :             css::uno::RuntimeException);
     178             : 
     179             :     virtual css::registry::RegistryValueType SAL_CALL getValueType()
     180             :         throw (
     181             :             css::registry::InvalidRegistryException,
     182             :             css::uno::RuntimeException);
     183             : 
     184             :     virtual sal_Int32 SAL_CALL getLongValue()
     185             :         throw (
     186             :             css::registry::InvalidRegistryException,
     187             :             css::registry::InvalidValueException, css::uno::RuntimeException);
     188             : 
     189             :     virtual void SAL_CALL setLongValue(sal_Int32)
     190             :         throw (
     191             :             css::registry::InvalidRegistryException,
     192             :             css::uno::RuntimeException);
     193             : 
     194             :     virtual css::uno::Sequence< sal_Int32 > SAL_CALL getLongListValue()
     195             :         throw (
     196             :             css::registry::InvalidRegistryException,
     197             :             css::registry::InvalidValueException, css::uno::RuntimeException);
     198             : 
     199             :     virtual void SAL_CALL setLongListValue(
     200             :         css::uno::Sequence< sal_Int32 > const &)
     201             :         throw (
     202             :             css::registry::InvalidRegistryException,
     203             :             css::uno::RuntimeException);
     204             : 
     205             :     virtual OUString SAL_CALL getAsciiValue()
     206             :         throw (
     207             :             css::registry::InvalidRegistryException,
     208             :             css::registry::InvalidValueException, css::uno::RuntimeException);
     209             : 
     210             :     virtual void SAL_CALL setAsciiValue(OUString const &)
     211             :         throw (
     212             :             css::registry::InvalidRegistryException,
     213             :             css::uno::RuntimeException);
     214             : 
     215             :     virtual css::uno::Sequence< OUString > SAL_CALL getAsciiListValue()
     216             :         throw (
     217             :             css::registry::InvalidRegistryException,
     218             :             css::registry::InvalidValueException, css::uno::RuntimeException);
     219             : 
     220             :     virtual void SAL_CALL setAsciiListValue(
     221             :         css::uno::Sequence< OUString > const &)
     222             :         throw (
     223             :             css::registry::InvalidRegistryException,
     224             :             css::uno::RuntimeException);
     225             : 
     226             :     virtual OUString SAL_CALL getStringValue()
     227             :         throw (
     228             :             css::registry::InvalidRegistryException,
     229             :             css::registry::InvalidValueException, css::uno::RuntimeException);
     230             : 
     231             :     virtual void SAL_CALL setStringValue(OUString const &)
     232             :         throw (
     233             :             css::registry::InvalidRegistryException,
     234             :             css::uno::RuntimeException);
     235             : 
     236             :     virtual css::uno::Sequence< OUString > SAL_CALL getStringListValue()
     237             :         throw (
     238             :             css::registry::InvalidRegistryException,
     239             :             css::registry::InvalidValueException, css::uno::RuntimeException);
     240             : 
     241             :     virtual void SAL_CALL setStringListValue(
     242             :         css::uno::Sequence< OUString > const &)
     243             :         throw (
     244             :             css::registry::InvalidRegistryException,
     245             :             css::uno::RuntimeException);
     246             : 
     247             :     virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBinaryValue()
     248             :         throw (
     249             :             css::registry::InvalidRegistryException,
     250             :             css::registry::InvalidValueException, css::uno::RuntimeException);
     251             : 
     252             :     virtual void SAL_CALL setBinaryValue(css::uno::Sequence< sal_Int8 > const &)
     253             :         throw (
     254             :             css::registry::InvalidRegistryException,
     255             :             css::uno::RuntimeException);
     256             : 
     257             :     virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL openKey(
     258             :         OUString const & aKeyName)
     259             :         throw (
     260             :             css::registry::InvalidRegistryException,
     261             :             css::uno::RuntimeException);
     262             : 
     263             :     virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL
     264             :     createKey(OUString const &)
     265             :         throw (
     266             :             css::registry::InvalidRegistryException,
     267             :             css::uno::RuntimeException);
     268             : 
     269             :     virtual void SAL_CALL closeKey()
     270             :         throw (
     271             :             css::registry::InvalidRegistryException,
     272             :             css::uno::RuntimeException);
     273             : 
     274             :     virtual void SAL_CALL deleteKey(OUString const &)
     275             :         throw (
     276             :             css::registry::InvalidRegistryException,
     277             :             css::uno::RuntimeException);
     278             : 
     279             :     virtual
     280             :     css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
     281             :     SAL_CALL openKeys()
     282             :         throw (
     283             :             css::registry::InvalidRegistryException,
     284             :             css::uno::RuntimeException);
     285             : 
     286             :     virtual css::uno::Sequence< OUString > SAL_CALL getKeyNames()
     287             :         throw (
     288             :             css::registry::InvalidRegistryException,
     289             :             css::uno::RuntimeException);
     290             : 
     291             :     virtual sal_Bool SAL_CALL createLink(
     292             :         OUString const &, OUString const &)
     293             :         throw (
     294             :             css::registry::InvalidRegistryException,
     295             :             css::uno::RuntimeException);
     296             : 
     297             :     virtual void SAL_CALL deleteLink(OUString const &)
     298             :         throw (
     299             :             css::registry::InvalidRegistryException,
     300             :             css::uno::RuntimeException);
     301             : 
     302             :     virtual OUString SAL_CALL getLinkTarget(OUString const &)
     303             :         throw (
     304             :             css::registry::InvalidRegistryException,
     305             :             css::uno::RuntimeException);
     306             : 
     307             :     virtual OUString SAL_CALL getResolvedName(
     308             :         OUString const & aKeyName)
     309             :         throw (
     310             :             css::registry::InvalidRegistryException,
     311             :             css::uno::RuntimeException);
     312             : 
     313             :     Service & service_;
     314             :     css::uno::Any value_;
     315             : };
     316             : 
     317           0 : Service::Service(
     318           0 :     css::uno::Reference< css::uno::XComponentContext > const & context)
     319             : {
     320             :     assert(context.is());
     321             :     try {
     322             :         provider_ = css::uno::Reference< css::lang::XMultiServiceFactory >(
     323           0 :             context->getServiceManager()->createInstanceWithContext(
     324             :                 OUString("com.sun.star.configuration.DefaultProvider"),
     325           0 :                 context),
     326           0 :             css::uno::UNO_QUERY_THROW);
     327           0 :     } catch (css::uno::RuntimeException &) {
     328           0 :         throw;
     329           0 :     } catch (css::uno::Exception & e) {
     330             :         throw css::uno::DeploymentException(
     331             :             (OUString("component context fails to supply service"
     332             :                     " com.sun.star.configuration.DefaultProvider of type"
     333             :                     " com.sun.star.lang.XMultiServiceFactory: ") +
     334           0 :              e.Message),
     335           0 :             context);
     336             :     }
     337           0 : }
     338             : 
     339           0 : OUString Service::getURL() throw (css::uno::RuntimeException) {
     340           0 :     osl::MutexGuard g(mutex_);
     341           0 :     checkValid_RuntimeException();
     342           0 :     return url_;
     343             : }
     344             : 
     345           0 : void Service::open(OUString const & rURL, sal_Bool bReadOnly, sal_Bool)
     346             :     throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
     347             : {
     348             :     //TODO: bCreate
     349           0 :     osl::MutexGuard g(mutex_);
     350           0 :     if (access_.is()) {
     351           0 :         doClose();
     352             :     }
     353           0 :     css::uno::Sequence< css::uno::Any > args(1);
     354           0 :     args[0] <<= css::beans::NamedValue(
     355             :         OUString("nodepath"),
     356           0 :         css::uno::makeAny(rURL));
     357             :     try {
     358           0 :         access_ = provider_->createInstanceWithArguments(
     359             :             (bReadOnly
     360             :              ? OUString("com.sun.star.configuration.ConfigurationAccess")
     361             :              : OUString("com.sun.star.configuration.ConfigurationUpdateAccess")),
     362           0 :             args);
     363           0 :     } catch (css::uno::RuntimeException &) {
     364           0 :         throw;
     365           0 :     } catch (css::uno::Exception & e) {
     366             :         throw css::uno::RuntimeException(
     367             :             (OUString("com.sun.star.configuration.ConfigurationRegistry: open"
     368             :                     " failed: ") +
     369           0 :              e.Message),
     370           0 :             static_cast< cppu::OWeakObject * >(this));
     371             :     }
     372           0 :     url_ = rURL;
     373           0 :     readOnly_ = bReadOnly;
     374           0 : }
     375             : 
     376           0 : sal_Bool Service::isValid() throw (css::uno::RuntimeException) {
     377           0 :     osl::MutexGuard g(mutex_);
     378           0 :     return access_.is();
     379             : }
     380             : 
     381           0 : void Service::close()
     382             :     throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
     383             : {
     384           0 :     osl::MutexGuard g(mutex_);
     385           0 :     checkValid();
     386           0 :     doClose();
     387           0 : }
     388             : 
     389           0 : void Service::destroy()
     390             :     throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
     391             : {
     392             :     throw css::uno::RuntimeException(
     393             :         OUString("com.sun.star.configuration.ConfigurationRegistry: not"
     394             :                 " implemented"),
     395           0 :         static_cast< cppu::OWeakObject * >(this));
     396             : }
     397             : 
     398           0 : css::uno::Reference< css::registry::XRegistryKey > Service::getRootKey()
     399             :     throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
     400             : {
     401           0 :     osl::MutexGuard g(mutex_);
     402           0 :     checkValid();
     403           0 :     return new RegistryKey(*this, css::uno::makeAny(access_));
     404             : }
     405             : 
     406           0 : sal_Bool Service::isReadOnly() throw (css::uno::RuntimeException) {
     407           0 :     osl::MutexGuard g(mutex_);
     408           0 :     checkValid_RuntimeException();
     409           0 :     return readOnly_;
     410             : }
     411             : 
     412           0 : void Service::mergeKey(OUString const &, OUString const &)
     413             :     throw (
     414             :         css::registry::InvalidRegistryException,
     415             :         css::registry::MergeConflictException, css::uno::RuntimeException)
     416             : {
     417             :     throw css::uno::RuntimeException(
     418             :         OUString("com.sun.star.configuration.ConfigurationRegistry: not"
     419             :                 " implemented"),
     420           0 :         static_cast< cppu::OWeakObject * >(this));
     421             : }
     422             : 
     423           0 : void Service::flush() throw (css::uno::RuntimeException)
     424             : {
     425             :     throw css::uno::RuntimeException(
     426             :         OUString("com.sun.star.configuration.ConfigurationRegistry: not"
     427             :                 " implemented"),
     428           0 :         static_cast< cppu::OWeakObject * >(this));
     429             : }
     430             : 
     431           0 : void Service::addFlushListener(
     432             :     css::uno::Reference< css::util::XFlushListener > const &)
     433             :     throw (css::uno::RuntimeException)
     434             : {
     435             :     throw css::uno::RuntimeException(
     436             :         OUString("com.sun.star.configuration.ConfigurationRegistry: not"
     437             :                 " implemented"),
     438           0 :         static_cast< cppu::OWeakObject * >(this));
     439             : }
     440             : 
     441           0 : void Service::removeFlushListener(
     442             :     css::uno::Reference< css::util::XFlushListener > const &)
     443             :     throw (css::uno::RuntimeException)
     444             : {
     445             :     throw css::uno::RuntimeException(
     446             :         OUString("com.sun.star.configuration.ConfigurationRegistry: not"
     447             :                 " implemented"),
     448           0 :         static_cast< cppu::OWeakObject * >(this));
     449             : }
     450             : 
     451           0 : void Service::checkValid() {
     452           0 :     if (!access_.is()) {
     453             :         throw css::registry::InvalidRegistryException(
     454             :             OUString("com.sun.star.configuration.ConfigurationRegistry: not"
     455             :                     " valid"),
     456           0 :             static_cast< cppu::OWeakObject * >(this));
     457             :     }
     458           0 : }
     459             : 
     460           0 : void Service::checkValid_RuntimeException() {
     461           0 :     if (!access_.is()) {
     462             :         throw css::uno::RuntimeException(
     463             :             OUString("com.sun.star.configuration.ConfigurationRegistry: not"
     464             :                     " valid"),
     465           0 :             static_cast< cppu::OWeakObject * >(this));
     466             :     }
     467           0 : }
     468             : 
     469           0 : void Service::doClose() {
     470           0 :     access_.clear();
     471           0 : }
     472             : 
     473           0 : OUString RegistryKey::getKeyName() throw (css::uno::RuntimeException) {
     474           0 :     osl::MutexGuard g(service_.mutex_);
     475           0 :     service_.checkValid_RuntimeException();
     476           0 :     css::uno::Reference< css::container::XNamed > named;
     477           0 :     if (value_ >>= named) {
     478           0 :         return named->getName();
     479             :     }
     480             :     throw css::uno::RuntimeException(
     481             :         OUString("com.sun.star.configuration.ConfigurationRegistry: not"
     482             :                 " implemented"),
     483           0 :         static_cast< cppu::OWeakObject * >(this));
     484             : }
     485             : 
     486           0 : sal_Bool RegistryKey::isReadOnly()
     487             :     throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
     488             : {
     489           0 :     osl::MutexGuard g(service_.mutex_);
     490           0 :     service_.checkValid_RuntimeException();
     491           0 :     return service_.readOnly_; //TODO: read-only sub-nodes in update access?
     492             : }
     493             : 
     494           0 : sal_Bool RegistryKey::isValid() throw (css::uno::RuntimeException) {
     495           0 :     return service_.isValid();
     496             : }
     497             : 
     498           0 : css::registry::RegistryKeyType RegistryKey::getKeyType(OUString const &)
     499             :     throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
     500             : {
     501           0 :     osl::MutexGuard g(service_.mutex_);
     502           0 :     service_.checkValid();
     503           0 :     return css::registry::RegistryKeyType_KEY;
     504             : }
     505             : 
     506           0 : css::registry::RegistryValueType RegistryKey::getValueType()
     507             :     throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
     508             : {
     509           0 :     osl::MutexGuard g(service_.mutex_);
     510           0 :     service_.checkValid();
     511           0 :     css::uno::Type t(value_.getValueType());
     512           0 :     switch (t.getTypeClass()) {
     513             :     case css::uno::TypeClass_LONG:
     514           0 :         return css::registry::RegistryValueType_LONG;
     515             :     case css::uno::TypeClass_STRING:
     516           0 :         return css::registry::RegistryValueType_STRING;
     517             :     case css::uno::TypeClass_SEQUENCE:
     518           0 :         if (t == cppu::UnoType< css::uno::Sequence< sal_Int8 > >::get()) {
     519           0 :             return css::registry::RegistryValueType_BINARY;
     520           0 :         } else if (t == cppu::UnoType< css::uno::Sequence< sal_Int32 > >::get())
     521             :         {
     522           0 :             return css::registry::RegistryValueType_LONGLIST;
     523           0 :         } else if (t ==
     524           0 :                    cppu::UnoType< css::uno::Sequence< OUString > >::get())
     525             :         {
     526           0 :             return css::registry::RegistryValueType_STRINGLIST;
     527             :         }
     528             :         // fall through
     529             :     default:
     530           0 :         return css::registry::RegistryValueType_NOT_DEFINED;
     531           0 :     }
     532             : }
     533             : 
     534           0 : sal_Int32 RegistryKey::getLongValue()
     535             :     throw (
     536             :         css::registry::InvalidRegistryException,
     537             :         css::registry::InvalidValueException, css::uno::RuntimeException)
     538             : {
     539           0 :     osl::MutexGuard g(service_.mutex_);
     540           0 :     service_.checkValid();
     541           0 :     sal_Int32 v = 0;
     542           0 :     if (value_ >>= v) {
     543           0 :         return v;
     544             :     }
     545             :     throw css::registry::InvalidValueException(
     546             :         OUString("com.sun.star.configuration.ConfigurationRegistry"),
     547           0 :         static_cast< cppu::OWeakObject * >(this));
     548             : }
     549             : 
     550           0 : void RegistryKey::setLongValue(sal_Int32)
     551             :     throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
     552             : {
     553             :     throw css::uno::RuntimeException(
     554             :         OUString("com.sun.star.configuration.ConfigurationRegistry: not"
     555             :                 " implemented"),
     556           0 :         static_cast< cppu::OWeakObject * >(this));
     557             : }
     558             : 
     559           0 : css::uno::Sequence< sal_Int32 > RegistryKey::getLongListValue()
     560             :     throw (
     561             :         css::registry::InvalidRegistryException,
     562             :         css::registry::InvalidValueException, css::uno::RuntimeException)
     563             : {
     564           0 :     osl::MutexGuard g(service_.mutex_);
     565           0 :     service_.checkValid();
     566           0 :     css::uno::Sequence< sal_Int32 > v;
     567           0 :     if (value_ >>= v) {
     568           0 :         return v;
     569             :     }
     570             :     throw css::registry::InvalidValueException(
     571             :         OUString("com.sun.star.configuration.ConfigurationRegistry"),
     572           0 :         static_cast< cppu::OWeakObject * >(this));
     573             : }
     574             : 
     575           0 : void RegistryKey::setLongListValue(css::uno::Sequence< sal_Int32 > const &)
     576             :     throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
     577             : {
     578             :     throw css::uno::RuntimeException(
     579             :         OUString("com.sun.star.configuration.ConfigurationRegistry: not"
     580             :                 " implemented"),
     581           0 :         static_cast< cppu::OWeakObject * >(this));
     582             : }
     583             : 
     584           0 : OUString RegistryKey::getAsciiValue()
     585             :     throw (
     586             :         css::registry::InvalidRegistryException,
     587             :         css::registry::InvalidValueException, css::uno::RuntimeException)
     588             : {
     589           0 :     osl::MutexGuard g(service_.mutex_);
     590           0 :     service_.checkValid();
     591           0 :     OUString v;
     592           0 :     if (value_ >>= v) {
     593           0 :         return v;
     594             :     }
     595             :     throw css::registry::InvalidValueException(
     596             :         OUString("com.sun.star.configuration.ConfigurationRegistry"),
     597           0 :         static_cast< cppu::OWeakObject * >(this));
     598             : }
     599             : 
     600           0 : void RegistryKey::setAsciiValue(OUString const &)
     601             :     throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
     602             : {
     603             :     throw css::uno::RuntimeException(
     604             :         OUString("com.sun.star.configuration.ConfigurationRegistry: not"
     605             :                 " implemented"),
     606           0 :         static_cast< cppu::OWeakObject * >(this));
     607             : }
     608             : 
     609           0 : css::uno::Sequence< OUString > RegistryKey::getAsciiListValue()
     610             :     throw (
     611             :         css::registry::InvalidRegistryException,
     612             :         css::registry::InvalidValueException, css::uno::RuntimeException)
     613             : {
     614           0 :     osl::MutexGuard g(service_.mutex_);
     615           0 :     service_.checkValid();
     616           0 :     css::uno::Sequence< OUString > v;
     617           0 :     if (value_ >>= v) {
     618           0 :         return v;
     619             :     }
     620             :     throw css::registry::InvalidValueException(
     621             :         OUString("com.sun.star.configuration.ConfigurationRegistry"),
     622           0 :         static_cast< cppu::OWeakObject * >(this));
     623             : }
     624             : 
     625           0 : void RegistryKey::setAsciiListValue(css::uno::Sequence< OUString > const &)
     626             :     throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
     627             : {
     628             :     throw css::uno::RuntimeException(
     629             :         OUString("com.sun.star.configuration.ConfigurationRegistry: not"
     630             :                 " implemented"),
     631           0 :         static_cast< cppu::OWeakObject * >(this));
     632             : }
     633             : 
     634           0 : OUString RegistryKey::getStringValue()
     635             :     throw (
     636             :         css::registry::InvalidRegistryException,
     637             :         css::registry::InvalidValueException, css::uno::RuntimeException)
     638             : {
     639           0 :     osl::MutexGuard g(service_.mutex_);
     640           0 :     service_.checkValid();
     641           0 :     OUString v;
     642           0 :     if (value_ >>= v) {
     643           0 :         return v;
     644             :     }
     645             :     throw css::registry::InvalidValueException(
     646             :         OUString("com.sun.star.configuration.ConfigurationRegistry"),
     647           0 :         static_cast< cppu::OWeakObject * >(this));
     648             : }
     649             : 
     650           0 : void RegistryKey::setStringValue(OUString const &)
     651             :     throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
     652             : {
     653             :     throw css::uno::RuntimeException(
     654             :         OUString("com.sun.star.configuration.ConfigurationRegistry: not"
     655             :                 " implemented"),
     656           0 :         static_cast< cppu::OWeakObject * >(this));
     657             : }
     658             : 
     659           0 : css::uno::Sequence< OUString > RegistryKey::getStringListValue()
     660             :     throw (
     661             :         css::registry::InvalidRegistryException,
     662             :         css::registry::InvalidValueException, css::uno::RuntimeException)
     663             : {
     664           0 :     osl::MutexGuard g(service_.mutex_);
     665           0 :     service_.checkValid();
     666           0 :     css::uno::Sequence< OUString > v;
     667           0 :     if (value_ >>= v) {
     668           0 :         return v;
     669             :     }
     670             :     throw css::registry::InvalidValueException(
     671             :         OUString("com.sun.star.configuration.ConfigurationRegistry"),
     672           0 :         static_cast< cppu::OWeakObject * >(this));
     673             : }
     674             : 
     675           0 : void RegistryKey::setStringListValue(
     676             :     css::uno::Sequence< OUString > const &)
     677             :     throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
     678             : {
     679             :     throw css::uno::RuntimeException(
     680             :         OUString("com.sun.star.configuration.ConfigurationRegistry: not"
     681             :                 " implemented"),
     682           0 :         static_cast< cppu::OWeakObject * >(this));
     683             : }
     684             : 
     685           0 : css::uno::Sequence< sal_Int8 > RegistryKey::getBinaryValue()
     686             :     throw (
     687             :         css::registry::InvalidRegistryException,
     688             :         css::registry::InvalidValueException, css::uno::RuntimeException)
     689             : {
     690           0 :     osl::MutexGuard g(service_.mutex_);
     691           0 :     service_.checkValid();
     692           0 :     css::uno::Sequence< sal_Int8 > v;
     693           0 :     if (value_ >>= v) {
     694           0 :         return v;
     695             :     }
     696             :     throw css::registry::InvalidValueException(
     697             :         OUString("com.sun.star.configuration.ConfigurationRegistry"),
     698           0 :         static_cast< cppu::OWeakObject * >(this));
     699             : }
     700             : 
     701           0 : void RegistryKey::setBinaryValue(css::uno::Sequence< sal_Int8 > const &)
     702             :     throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
     703             : {
     704             :     throw css::uno::RuntimeException(
     705             :         OUString("com.sun.star.configuration.ConfigurationRegistry: not"
     706             :                 " implemented"),
     707           0 :         static_cast< cppu::OWeakObject * >(this));
     708             : }
     709             : 
     710           0 : css::uno::Reference< css::registry::XRegistryKey > RegistryKey::openKey(
     711             :     OUString const & aKeyName)
     712             :     throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
     713             : {
     714           0 :     osl::MutexGuard g(service_.mutex_);
     715           0 :     service_.checkValid_RuntimeException();
     716           0 :     css::uno::Reference< css::container::XHierarchicalNameAccess > access;
     717           0 :     if (value_ >>= access) {
     718             :         try {
     719             :             return new RegistryKey(
     720           0 :                 service_, access->getByHierarchicalName(aKeyName));
     721           0 :         } catch (css::container::NoSuchElementException &) {}
     722             :     }
     723           0 :     return css::uno::Reference< css::registry::XRegistryKey >();
     724             : }
     725             : 
     726           0 : css::uno::Reference< css::registry::XRegistryKey > RegistryKey::createKey(
     727             :     OUString const &)
     728             :     throw (
     729             :         css::registry::InvalidRegistryException, css::uno::RuntimeException)
     730             : {
     731             :     throw css::uno::RuntimeException(
     732             :         OUString("com.sun.star.configuration.ConfigurationRegistry: not"
     733             :                 " implemented"),
     734           0 :         static_cast< cppu::OWeakObject * >(this));
     735             : }
     736             : 
     737           0 : void RegistryKey::closeKey()
     738             :     throw (
     739             :         css::registry::InvalidRegistryException, css::uno::RuntimeException)
     740             : {
     741           0 :     osl::MutexGuard g(service_.mutex_);
     742           0 :     service_.checkValid_RuntimeException();
     743           0 : }
     744             : 
     745           0 : void RegistryKey::deleteKey(OUString const &)
     746             :     throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
     747             : {
     748             :     throw css::uno::RuntimeException(
     749             :         OUString("com.sun.star.configuration.ConfigurationRegistry: not"
     750             :                 " implemented"),
     751           0 :         static_cast< cppu::OWeakObject * >(this));
     752             : }
     753             : 
     754             : css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
     755           0 : RegistryKey::openKeys()
     756             :     throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
     757             : {
     758             :     throw css::uno::RuntimeException(
     759             :         OUString("com.sun.star.configuration.ConfigurationRegistry: not"
     760             :                 " implemented"),
     761           0 :         static_cast< cppu::OWeakObject * >(this));
     762             : }
     763             : 
     764           0 : css::uno::Sequence< OUString > RegistryKey::getKeyNames()
     765             :     throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
     766             : {
     767             :     throw css::uno::RuntimeException(
     768             :         OUString("com.sun.star.configuration.ConfigurationRegistry: not"
     769             :                 " implemented"),
     770           0 :         static_cast< cppu::OWeakObject * >(this));
     771             : }
     772             : 
     773           0 : sal_Bool RegistryKey::createLink(OUString const &, OUString const &)
     774             :     throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
     775             : {
     776           0 :     osl::MutexGuard g(service_.mutex_);
     777           0 :     service_.checkValid_RuntimeException();
     778           0 :     return false;
     779             : }
     780             : 
     781           0 : void RegistryKey::deleteLink(OUString const &)
     782             :     throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
     783             : {
     784           0 :     osl::MutexGuard g(service_.mutex_);
     785           0 :     service_.checkValid_RuntimeException();
     786           0 : }
     787             : 
     788           0 : OUString RegistryKey::getLinkTarget(OUString const &)
     789             :     throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
     790             : {
     791           0 :     osl::MutexGuard g(service_.mutex_);
     792           0 :     service_.checkValid_RuntimeException();
     793           0 :     return OUString();
     794             : }
     795             : 
     796           0 : OUString RegistryKey::getResolvedName(OUString const & aKeyName)
     797             :     throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
     798             : {
     799           0 :     osl::MutexGuard g(service_.mutex_);
     800           0 :     service_.checkValid_RuntimeException();
     801           0 :     return aKeyName;
     802             : }
     803             : 
     804             : }
     805             : 
     806           0 : css::uno::Reference< css::uno::XInterface > create(
     807             :     css::uno::Reference< css::uno::XComponentContext > const & context)
     808             : {
     809           0 :     return static_cast< cppu::OWeakObject * >(new Service(context));
     810             : }
     811             : 
     812          66 : OUString getImplementationName() {
     813          66 :     return OUString("com.sun.star.comp.configuration.ConfigurationRegistry");
     814             : }
     815             : 
     816           0 : css::uno::Sequence< OUString > getSupportedServiceNames() {
     817           0 :     OUString name("com.sun.star.configuration.ConfigurationRegistry");
     818           0 :     return css::uno::Sequence< OUString >(&name, 1);
     819             : }
     820             : 
     821             : } }
     822             : 
     823             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10