LCOV - code coverage report
Current view: top level - dbaccess/source/filter/xml - xmlConnectionData.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 27 31 87.1 %
Date: 2015-06-13 12:38:46 Functions: 5 5 100.0 %
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 "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             : 
      39          16 : OXMLConnectionData::OXMLConnectionData( ODBFilter& rImport,
      40             :                 sal_uInt16 nPrfx, const OUString& _sLocalName) :
      41             :     SvXMLImportContext( rImport, nPrfx, _sLocalName )
      42          16 :     ,m_bFoundOne(false)
      43             : {
      44          16 :     rImport.setNewFormat(true);
      45          16 : }
      46             : 
      47          32 : OXMLConnectionData::~OXMLConnectionData()
      48             : {
      49             : 
      50          32 : }
      51             : 
      52          32 : SvXMLImportContext* OXMLConnectionData::CreateChildContext(
      53             :         sal_uInt16 nPrefix,
      54             :         const OUString& rLocalName,
      55             :         const Reference< XAttributeList > & xAttrList )
      56             : {
      57          32 :     SvXMLImportContext *pContext = 0;
      58          32 :     const SvXMLTokenMap&    rTokenMap   = GetOwnImport().GetDataSourceElemTokenMap();
      59             : 
      60          32 :     switch( rTokenMap.Get( nPrefix, rLocalName ) )
      61             :     {
      62             :         case XML_TOK_LOGIN:
      63          16 :             GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
      64          16 :             pContext = new OXMLLogin( GetOwnImport(), nPrefix, rLocalName,xAttrList );
      65          16 :             break;
      66             :         case XML_TOK_DATABASE_DESCRIPTION:
      67           9 :             if ( !m_bFoundOne )
      68             :             {
      69           9 :                 m_bFoundOne = true;
      70           9 :                 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
      71           9 :                 pContext = new OXMLDatabaseDescription( GetOwnImport(), nPrefix, rLocalName);
      72             :             }
      73           9 :             break;
      74             :         case XML_TOK_CONNECTION_RESOURCE:
      75           7 :             if ( !m_bFoundOne )
      76             :             {
      77           7 :                 m_bFoundOne = true;
      78           7 :                 GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
      79           7 :                 pContext = new OXMLConnectionResource( GetOwnImport(), nPrefix, rLocalName,xAttrList );
      80             :             }
      81           7 :             break;
      82             :         case XML_TOK_COMPOUND_DATABASE:
      83           0 :             if ( !m_bFoundOne )
      84             :             {
      85           0 :                 m_bFoundOne = true;
      86             :                 OSL_FAIL("Not supported yet!");
      87             :             }
      88           0 :             break;
      89             :     }
      90             : 
      91          32 :     if( !pContext )
      92           0 :         pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
      93             : 
      94          32 :     return pContext;
      95             : }
      96             : 
      97          96 : ODBFilter& OXMLConnectionData::GetOwnImport()
      98             : {
      99          96 :     return static_cast<ODBFilter&>(GetImport());
     100             : }
     101             : 
     102             : } // namespace dbaxml
     103             : 
     104             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11