LCOV - code coverage report
Current view: top level - dbaccess/source/core/recovery - settingsimport.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 9 0.0 %
Date: 2012-08-25 Functions: 0 6 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 2 0.0 %

           Branch data     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                 :            : #ifndef SETTINGSIMPORT_HXX
      21                 :            : #define SETTINGSIMPORT_HXX
      22                 :            : 
      23                 :            : #include <com/sun/star/xml/sax/XAttributeList.hpp>
      24                 :            : 
      25                 :            : #include <comphelper/namedvaluecollection.hxx>
      26                 :            : #include <rtl/ref.hxx>
      27                 :            : #include <rtl/ustrbuf.hxx>
      28                 :            : 
      29                 :            : //........................................................................
      30                 :            : namespace dbaccess
      31                 :            : {
      32                 :            : //........................................................................
      33                 :            : 
      34                 :            :     //====================================================================
      35                 :            :     //= SettingsImport
      36                 :            :     //====================================================================
      37                 :            :     /** a simplified version of xmloff/DocumentSettingsContext
      38                 :            : 
      39                 :            :         It would be nice if the DocumentSettingsContext would not be that tightly interwoven with the SvXMLImport
      40                 :            :         class, so we could re-use it here ...
      41                 :            :     */
      42                 :            :     class SettingsImport : public ::rtl::IReference
      43                 :            :     {
      44                 :            :     public:
      45                 :            :         SettingsImport();
      46                 :            : 
      47                 :            :         // IReference
      48                 :            :         virtual oslInterlockedCount SAL_CALL acquire();
      49                 :            :         virtual oslInterlockedCount SAL_CALL release();
      50                 :            : 
      51                 :            :         // own overriables
      52                 :            :         virtual ::rtl::Reference< SettingsImport >  nextState(
      53                 :            :             const ::rtl::OUString& i_rElementName
      54                 :            :         ) = 0;
      55                 :            :         virtual void startElement(
      56                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& i_rAttributes
      57                 :            :         );
      58                 :            :         virtual void endElement();
      59                 :            :         virtual void characters( const ::rtl::OUString& i_rCharacters );
      60                 :            : 
      61                 :            :     protected:
      62                 :            :         virtual ~SettingsImport();
      63                 :            : 
      64                 :            :     protected:
      65                 :            :         static void split( const ::rtl::OUString& i_rElementName, ::rtl::OUString& o_rNamespace, ::rtl::OUString& o_rLocalName );
      66                 :            : 
      67                 :            :     protected:
      68                 :          0 :         const ::rtl::OUString&          getItemName() const                 { return m_sItemName; }
      69                 :          0 :         const ::rtl::OUString&          getItemType() const                 { return m_sItemType; }
      70                 :          0 :         const ::rtl::OUStringBuffer&    getAccumulatedCharacters() const    { return m_aCharacters; }
      71                 :            : 
      72                 :            :     private:
      73                 :            :         oslInterlockedCount     m_refCount;
      74                 :            :         // value of the config:name attribute, if any
      75                 :            :         ::rtl::OUString         m_sItemName;
      76                 :            :         // value of the config:type attribute, if any
      77                 :            :         ::rtl::OUString         m_sItemType;
      78                 :            :         // accumulated characters, if any
      79                 :            :         ::rtl::OUStringBuffer   m_aCharacters;
      80                 :            :     };
      81                 :            : 
      82                 :            :     //====================================================================
      83                 :            :     //= IgnoringSettingsImport
      84                 :            :     //====================================================================
      85                 :            :     class IgnoringSettingsImport : public SettingsImport
      86                 :            :     {
      87                 :            :     public:
      88                 :          0 :         IgnoringSettingsImport()
      89                 :          0 :         {
      90                 :          0 :         }
      91                 :            : 
      92                 :            :         // SettingsImport overridables
      93                 :            :         virtual ::rtl::Reference< SettingsImport >  nextState(
      94                 :            :             const ::rtl::OUString& i_rElementName
      95                 :            :         );
      96                 :            : 
      97                 :            :     private:
      98                 :          0 :         ~IgnoringSettingsImport()
      99                 :          0 :         {
     100         [ #  # ]:          0 :         }
     101                 :            :     };
     102                 :            : 
     103                 :            :     //====================================================================
     104                 :            :     //= OfficeSettingsImport
     105                 :            :     //====================================================================
     106                 :            :     class OfficeSettingsImport : public SettingsImport
     107                 :            :     {
     108                 :            :     public:
     109                 :            :         OfficeSettingsImport( ::comphelper::NamedValueCollection& o_rSettings );
     110                 :            : 
     111                 :            :         // SettingsImport overridables
     112                 :            :         virtual ::rtl::Reference< SettingsImport >  nextState(
     113                 :            :             const ::rtl::OUString& i_rElementName
     114                 :            :         );
     115                 :            : 
     116                 :            :     protected:
     117                 :            :         ~OfficeSettingsImport();
     118                 :            : 
     119                 :            :     private:
     120                 :            :         // the settings collection to which |this| will contribute a single setting
     121                 :            :         ::comphelper::NamedValueCollection& m_rSettings;
     122                 :            :     };
     123                 :            : 
     124                 :            :     //====================================================================
     125                 :            :     //= ConfigItemSetImport
     126                 :            :     //====================================================================
     127                 :            :     class ConfigItemImport : public SettingsImport
     128                 :            :     {
     129                 :            :     public:
     130                 :            :         ConfigItemImport( ::comphelper::NamedValueCollection& o_rSettings );
     131                 :            : 
     132                 :            :     protected:
     133                 :            :         ~ConfigItemImport();
     134                 :            : 
     135                 :            :     public:
     136                 :            :         // SettingsImport overridables
     137                 :            :         virtual ::rtl::Reference< SettingsImport >  nextState(
     138                 :            :             const ::rtl::OUString& i_rElementName
     139                 :            :         );
     140                 :            :         virtual void endElement();
     141                 :            : 
     142                 :            :     protected:
     143                 :            :         // own overridables
     144                 :            :         /// retrieves the value represented by the element
     145                 :            :         virtual void getItemValue( ::com::sun::star::uno::Any& o_rValue ) const;
     146                 :            : 
     147                 :            :     private:
     148                 :            :         // the settings collection to which |this| will contribute a single setting
     149                 :            :         ::comphelper::NamedValueCollection& m_rSettings;
     150                 :            :     };
     151                 :            : 
     152                 :            :     //====================================================================
     153                 :            :     //= ConfigItemSetImport
     154                 :            :     //====================================================================
     155                 :            :     class ConfigItemSetImport : public ConfigItemImport
     156                 :            :     {
     157                 :            :     public:
     158                 :            :         ConfigItemSetImport( ::comphelper::NamedValueCollection& o_rSettings );
     159                 :            : 
     160                 :            :     protected:
     161                 :            :         ~ConfigItemSetImport();
     162                 :            : 
     163                 :            :     public:
     164                 :            :         // SettingsImport overridables
     165                 :            :         virtual ::rtl::Reference< SettingsImport >  nextState(
     166                 :            :             const ::rtl::OUString& i_rElementName
     167                 :            :         );
     168                 :            : 
     169                 :            :     protected:
     170                 :            :         // ConfigItemImport overridables
     171                 :            :         virtual void getItemValue( ::com::sun::star::uno::Any& o_rValue ) const;
     172                 :            : 
     173                 :            :     private:
     174                 :            :         /// the settings represented by our child elements
     175                 :            :         ::comphelper::NamedValueCollection  m_aChildSettings;
     176                 :            :     };
     177                 :            : 
     178                 :            : //........................................................................
     179                 :            : } // namespace dbaccess
     180                 :            : //........................................................................
     181                 :            : 
     182                 :            : #endif // SETTINGSIMPORT_HXX
     183                 :            : 
     184                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10