LCOV - code coverage report
Current view: top level - dbaccess/source/filter/xml - xmlConnectionData.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 22 31 71.0 %
Date: 2012-08-25 Functions: 5 5 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 7 23 30.4 %

           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                 :            : #include "xmlConnectionData.hxx"
      21                 :            : #include "xmlLogin.hxx"
      22                 :            : #include "xmlTableFilterList.hxx"
      23                 :            : #include "xmlfilter.hxx"
      24                 :            : #include <xmloff/xmltoken.hxx>
      25                 :            : #include <xmloff/xmlnmspe.hxx>
      26                 :            : #include <xmloff/nmspmap.hxx>
      27                 :            : #include "xmlEnums.hxx"
      28                 :            : #include "xmlDatabaseDescription.hxx"
      29                 :            : #include "xmlConnectionResource.hxx"
      30                 :            : #include "xmlstrings.hrc"
      31                 :            : #include <tools/debug.hxx>
      32                 :            : #include <tools/diagnose_ex.h>
      33                 :            : 
      34                 :            : namespace dbaxml
      35                 :            : {
      36                 :            :     using namespace ::com::sun::star::uno;
      37                 :            :     using namespace ::com::sun::star::xml::sax;
      38                 :            : DBG_NAME(OXMLConnectionData)
      39                 :            : 
      40                 :         14 : OXMLConnectionData::OXMLConnectionData( ODBFilter& rImport,
      41                 :            :                 sal_uInt16 nPrfx, const ::rtl::OUString& _sLocalName) :
      42                 :            :     SvXMLImportContext( rImport, nPrfx, _sLocalName )
      43                 :         14 :     ,m_bFoundOne(false)
      44                 :            : {
      45                 :         14 :     rImport.setNewFormat(true);
      46                 :            :     DBG_CTOR(OXMLConnectionData,NULL);
      47                 :         14 : }
      48                 :            : // -----------------------------------------------------------------------------
      49                 :            : 
      50                 :         14 : OXMLConnectionData::~OXMLConnectionData()
      51                 :            : {
      52                 :            : 
      53                 :            :     DBG_DTOR(OXMLConnectionData,NULL);
      54         [ -  + ]:         28 : }
      55                 :            : // -----------------------------------------------------------------------------
      56                 :            : 
      57                 :         28 : SvXMLImportContext* OXMLConnectionData::CreateChildContext(
      58                 :            :         sal_uInt16 nPrefix,
      59                 :            :         const ::rtl::OUString& rLocalName,
      60                 :            :         const Reference< XAttributeList > & xAttrList )
      61                 :            : {
      62                 :         28 :     SvXMLImportContext *pContext = 0;
      63                 :         28 :     const SvXMLTokenMap&    rTokenMap   = GetOwnImport().GetDataSourceElemTokenMap();
      64                 :            : 
      65   [ +  +  -  -  :         28 :     switch( rTokenMap.Get( nPrefix, rLocalName ) )
                      - ]
      66                 :            :     {
      67                 :            :         case XML_TOK_LOGIN:
      68                 :         14 :             GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
      69         [ +  - ]:         14 :             pContext = new OXMLLogin( GetOwnImport(), nPrefix, rLocalName,xAttrList );
      70                 :         14 :             break;
      71                 :            :         case XML_TOK_DATABASE_DESCRIPTION:
      72         [ +  - ]:         14 :             if ( !m_bFoundOne )
      73                 :            :             {
      74                 :         14 :                 m_bFoundOne = true;
      75                 :         14 :                 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
      76         [ +  - ]:         14 :                 pContext = new OXMLDatabaseDescription( GetOwnImport(), nPrefix, rLocalName);
      77                 :            :             }
      78                 :         14 :             break;
      79                 :            :         case XML_TOK_CONNECTION_RESOURCE:
      80         [ #  # ]:          0 :             if ( !m_bFoundOne )
      81                 :            :             {
      82                 :          0 :                 m_bFoundOne = true;
      83                 :          0 :                 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
      84         [ #  # ]:          0 :                 pContext = new OXMLConnectionResource( GetOwnImport(), nPrefix, rLocalName,xAttrList );
      85                 :            :             }
      86                 :          0 :             break;
      87                 :            :         case XML_TOK_COMPOUND_DATABASE:
      88         [ #  # ]:          0 :             if ( !m_bFoundOne )
      89                 :            :             {
      90                 :          0 :                 m_bFoundOne = true;
      91                 :            :                 OSL_FAIL("Not supported yet!");
      92                 :            :             }
      93                 :          0 :             break;
      94                 :            :     }
      95                 :            : 
      96         [ -  + ]:         28 :     if( !pContext )
      97         [ #  # ]:          0 :         pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
      98                 :            : 
      99                 :         28 :     return pContext;
     100                 :            : }
     101                 :            : // -----------------------------------------------------------------------------
     102                 :         84 : ODBFilter& OXMLConnectionData::GetOwnImport()
     103                 :            : {
     104                 :         84 :     return static_cast<ODBFilter&>(GetImport());
     105                 :            : }
     106                 :            : // -----------------------------------------------------------------------------
     107                 :            : //----------------------------------------------------------------------------
     108                 :            : } // namespace dbaxml
     109                 :            : // -----------------------------------------------------------------------------
     110                 :            : 
     111                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10