LCOV - code coverage report
Current view: top level - libreoffice/configmgr/source - xcuparser.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 10 10 100.0 %
Date: 2012-12-27 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             : #ifndef INCLUDED_CONFIGMGR_SOURCE_XCUPARSER_HXX
      21             : #define INCLUDED_CONFIGMGR_SOURCE_XCUPARSER_HXX
      22             : 
      23             : #include "sal/config.h"
      24             : 
      25             : #include <set>
      26             : #include <stack>
      27             : 
      28             : #include "rtl/ref.hxx"
      29             : #include "rtl/ustring.hxx"
      30             : #include "xmlreader/xmlreader.hxx"
      31             : 
      32             : #include "additions.hxx"
      33             : #include "node.hxx"
      34             : #include "nodemap.hxx"
      35             : #include "parser.hxx"
      36             : #include "path.hxx"
      37             : #include "type.hxx"
      38             : #include "valueparser.hxx"
      39             : #include "xmldata.hxx"
      40             : 
      41             : namespace xmlreader { struct Span; }
      42             : 
      43             : namespace configmgr {
      44             : 
      45             : class GroupNode;
      46             : class LocalizedPropertyNode;
      47             : class Modifications;
      48             : class Partial;
      49             : class PropertyNode;
      50             : class SetNode;
      51             : struct Data;
      52             : 
      53             : class XcuParser: public Parser {
      54             : public:
      55             :     XcuParser(
      56             :         int layer, Data & data, Partial const * partial,
      57             :         Modifications * broadcastModifications, Additions * additions);
      58             : 
      59             : private:
      60             :     virtual ~XcuParser();
      61             : 
      62             :     virtual xmlreader::XmlReader::Text getTextMode();
      63             : 
      64             :     virtual bool startElement(
      65             :         xmlreader::XmlReader & reader, int nsId, xmlreader::Span const & name,
      66             :         std::set< OUString > const * existingDependencies);
      67             : 
      68             :     virtual void endElement(xmlreader::XmlReader const & reader);
      69             : 
      70             :     virtual void characters(xmlreader::Span const & span);
      71             : 
      72             :     enum Operation {
      73             :         OPERATION_MODIFY, OPERATION_REPLACE, OPERATION_FUSE, OPERATION_REMOVE };
      74             : 
      75             :     static Operation parseOperation(xmlreader::Span const & text);
      76             : 
      77             :     void handleComponentData(xmlreader::XmlReader & reader);
      78             : 
      79             :     void handleItem(xmlreader::XmlReader & reader);
      80             : 
      81             :     void handlePropValue(xmlreader::XmlReader & reader, PropertyNode * prop);
      82             : 
      83             :     void handleLocpropValue(
      84             :         xmlreader::XmlReader & reader, LocalizedPropertyNode * locprop);
      85             : 
      86             :     void handleGroupProp(xmlreader::XmlReader & reader, GroupNode * group);
      87             : 
      88             :     void handleUnknownGroupProp(
      89             :         xmlreader::XmlReader const & reader, GroupNode * group,
      90             :         OUString const & name, Type type, Operation operation,
      91             :         bool finalized);
      92             : 
      93             :     void handlePlainGroupProp(
      94             :         xmlreader::XmlReader const & reader, GroupNode * group,
      95             :         NodeMap::iterator const & propertyIndex, OUString const & name,
      96             :         Type type, Operation operation, bool finalized);
      97             : 
      98             :     void handleLocalizedGroupProp(
      99             :         xmlreader::XmlReader const & reader, LocalizedPropertyNode * property,
     100             :         OUString const & name, Type type, Operation operation,
     101             :         bool finalized);
     102             : 
     103             :     void handleGroupNode(
     104             :         xmlreader::XmlReader & reader, rtl::Reference< Node > const & group);
     105             : 
     106             :     void handleSetNode(xmlreader::XmlReader & reader, SetNode * set);
     107             : 
     108             :     void recordModification(bool addition);
     109             : 
     110     2592804 :     struct State {
     111             :         rtl::Reference< Node > node; // empty if ignore or <items>
     112             :         OUString name; // empty and ignored if !insert
     113             :         bool ignore;
     114             :         bool insert;
     115             :         bool locked;
     116             :         bool pop;
     117             : 
     118         894 :         inline State(bool thePop):
     119         894 :             ignore(true), insert(false), locked(false), pop(thePop)
     120         894 :         {}
     121             : 
     122      613346 :         inline State(rtl::Reference< Node > const & theNode, bool theLocked):
     123             :             node(theNode), ignore(false), insert(false), locked(theLocked),
     124      613346 :             pop(true)
     125      613346 :         {}
     126             : 
     127      250028 :         inline State(
     128             :             rtl::Reference< Node > const & theNode,
     129             :             OUString const & theName, bool theLocked):
     130             :             node(theNode), name(theName), ignore(false), insert(true),
     131      250028 :             locked(theLocked), pop(true)
     132      250028 :         {}
     133             :     };
     134             : 
     135             :     typedef std::stack< State > StateStack;
     136             : 
     137             :     ValueParser valueParser_;
     138             :     Data & data_;
     139             :     Partial const * partial_;
     140             :     Modifications * broadcastModifications_;
     141             :     Additions * additions_;
     142             :     bool recordModifications_;
     143             :     bool trackPath_;
     144             :     OUString componentName_;
     145             :     StateStack state_;
     146             :     Path path_;
     147             : };
     148             : 
     149             : }
     150             : 
     151             : #endif
     152             : 
     153             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10