LCOV - code coverage report
Current view: top level - configmgr/source - parsemanager.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 20 20 100.0 %
Date: 2012-08-25 Functions: 4 4 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 17 25 68.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                 :            : #include "sal/config.h"
      21                 :            : 
      22                 :            : #include <cassert>
      23                 :            : 
      24                 :            : #include "com/sun/star/container/NoSuchElementException.hpp"
      25                 :            : #include "com/sun/star/uno/RuntimeException.hpp"
      26                 :            : #include "sal/types.h"
      27                 :            : #include "xmlreader/span.hxx"
      28                 :            : #include "xmlreader/xmlreader.hxx"
      29                 :            : 
      30                 :            : #include "parsemanager.hxx"
      31                 :            : #include "parser.hxx"
      32                 :            : 
      33                 :            : namespace configmgr {
      34                 :            : 
      35                 :            : namespace {
      36                 :            : 
      37                 :            : namespace css = com::sun::star;
      38                 :            : 
      39                 :            : }
      40                 :            : 
      41                 :      44511 : ParseManager::ParseManager(
      42                 :            :     rtl::OUString const & url, rtl::Reference< Parser > const & parser)
      43                 :            :     SAL_THROW((
      44                 :            :         css::container::NoSuchElementException, css::uno::RuntimeException)):
      45 [ +  + ][ +  - ]:      44511 :     reader_(url), parser_(parser)
      46                 :            : {
      47                 :            :     assert(parser.is());
      48                 :            :     int id;
      49                 :            :     id = reader_.registerNamespaceIri(
      50                 :            :         xmlreader::Span(
      51         [ +  - ]:      44449 :             RTL_CONSTASCII_STRINGPARAM("http://openoffice.org/2001/registry")));
      52                 :            :     assert(id == NAMESPACE_OOR);
      53                 :            :     id = reader_.registerNamespaceIri(
      54                 :            :         xmlreader::Span(
      55         [ +  - ]:      44449 :             RTL_CONSTASCII_STRINGPARAM("http://www.w3.org/2001/XMLSchema")));
      56                 :            :     assert(id == NAMESPACE_XS);
      57                 :            :     id = reader_.registerNamespaceIri(
      58                 :            :         xmlreader::Span(
      59                 :            :             RTL_CONSTASCII_STRINGPARAM(
      60         [ +  - ]:      44449 :                 "http://www.w3.org/2001/XMLSchema-instance")));
      61                 :            :     assert(id == NAMESPACE_XSI);
      62                 :            :     (void)id;
      63                 :      44449 : }
      64                 :            : 
      65                 :   44202113 : bool ParseManager::parse() {
      66                 :   44202113 :     for (;;) {
      67 [ +  + ][ +  +  :   88403906 :         switch (itemData_.is()
                +  +  - ]
      68                 :            :                 ? xmlreader::XmlReader::RESULT_BEGIN
      69                 :            :                 : reader_.nextItem(
      70                 :   44201793 :                     parser_->getTextMode(), &itemData_, &itemNamespaceId_))
      71                 :            :         {
      72                 :            :         case xmlreader::XmlReader::RESULT_BEGIN:
      73         [ +  + ]:   18924564 :             if (!parser_->startElement(reader_, itemNamespaceId_, itemData_))
      74                 :            :             {
      75                 :        320 :                 return false;
      76                 :            :             }
      77                 :   18924244 :             break;
      78                 :            :         case xmlreader::XmlReader::RESULT_END:
      79                 :   18924244 :             parser_->endElement(reader_);
      80                 :   18924244 :             break;
      81                 :            :         case xmlreader::XmlReader::RESULT_TEXT:
      82                 :    6308856 :             parser_->characters(itemData_);
      83                 :    6308856 :             break;
      84                 :            :         case xmlreader::XmlReader::RESULT_DONE:
      85                 :      44449 :             return true;
      86                 :            :         }
      87                 :   44157344 :         itemData_.clear();
      88                 :            :     }
      89                 :            : }
      90                 :            : 
      91 [ +  - ][ +  - ]:      88898 : ParseManager::~ParseManager() {}
                 [ -  + ]
      92                 :            : 
      93                 :            : }
      94                 :            : 
      95                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10