LCOV - code coverage report
Current view: top level - include/xmlscript - xml_helper.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 4 4 100.0 %
Date: 2015-06-13 12:38:46 Functions: 3 3 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             : #ifndef INCLUDED_XMLSCRIPT_XML_HELPER_HXX
      20             : #define INCLUDED_XMLSCRIPT_XML_HELPER_HXX
      21             : 
      22             : #include <vector>
      23             : #include <rtl/byteseq.hxx>
      24             : #include <cppuhelper/implbase1.hxx>
      25             : #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
      26             : #include <com/sun/star/io/XInputStream.hpp>
      27             : #include <com/sun/star/io/XOutputStream.hpp>
      28             : 
      29             : #include <xmlscript/xmlscriptdllapi.h>
      30             : 
      31             : namespace xmlscript
      32             : {
      33             : 
      34             : /*##################################################################################################
      35             : 
      36             :     EXPORTING
      37             : 
      38             : ##################################################################################################*/
      39             : 
      40             : 
      41          73 : class XMLSCRIPT_DLLPUBLIC XMLElement
      42             :     : public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XAttributeList >
      43             : {
      44             : public:
      45          53 :     inline XMLElement( OUString const & name )
      46          53 :         : _name( name )
      47          53 :         {}
      48             : 
      49             :     /** Adds a sub element of element.
      50             : 
      51             :         @param xElem element reference
      52             :     */
      53             :     void SAL_CALL addSubElement(
      54             :         ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > const & xElem );
      55             : 
      56             :     /** Gets sub element of given index.  The index follows order in which sub elements were added.
      57             : 
      58             :         @param nIndex index of sub element
      59             :     */
      60             :     ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > SAL_CALL getSubElement( sal_Int32 nIndex );
      61             : 
      62             :     /** Adds an attribute to elements.
      63             : 
      64             :         @param rAttrName qname of attribute
      65             :         @param rValue value string of element
      66             :     */
      67             :     void SAL_CALL addAttribute( OUString const & rAttrName, OUString const & rValue );
      68             : 
      69             :     /** Gets the tag name (qname) of element.
      70             : 
      71             :         @return
      72             :                 qname of element
      73             :     */
      74             :     inline OUString SAL_CALL getName()
      75             :         { return _name; }
      76             : 
      77             :     /** Dumps out element (and all sub elements).
      78             : 
      79             :         @param xOut document handler to be written to
      80             :     */
      81             :     void SAL_CALL dump(
      82             :         ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > const & xOut );
      83             :     /** Dumps out sub elements (and all further sub elements).
      84             : 
      85             :         @param xOut document handler to be written to
      86             :     */
      87             :     void SAL_CALL dumpSubElements(
      88             :         ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > const & xOut );
      89             : 
      90             :     // XAttributeList
      91             :     virtual sal_Int16 SAL_CALL getLength()
      92             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      93             :     virtual OUString SAL_CALL getNameByIndex( sal_Int16 nPos )
      94             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      95             :     virtual OUString SAL_CALL getTypeByIndex( sal_Int16 nPos )
      96             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      97             :     virtual OUString SAL_CALL getTypeByName( OUString const & rName )
      98             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      99             :     virtual OUString SAL_CALL getValueByIndex( sal_Int16 nPos )
     100             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     101             :     virtual OUString SAL_CALL getValueByName( OUString const & rName )
     102             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     103             : 
     104             : protected:
     105             :     OUString _name;
     106             : 
     107             :     ::std::vector< OUString > _attrNames;
     108             :     ::std::vector< OUString > _attrValues;
     109             : 
     110             :     ::std::vector< ::com::sun::star::uno::Reference<
     111             :                    ::com::sun::star::xml::sax::XAttributeList > > _subElems;
     112             : };
     113             : 
     114             : 
     115             : /*##################################################################################################
     116             : 
     117             :     STREAMING
     118             : 
     119             : ##################################################################################################*/
     120             : 
     121             : XMLSCRIPT_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
     122             : SAL_CALL createInputStream(
     123             :     ::rtl::ByteSequence const & rInData );
     124             : 
     125             : XMLSCRIPT_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
     126             : SAL_CALL createOutputStream(
     127             :     ::rtl::ByteSequence * pOutData );
     128             : 
     129             : }
     130             : 
     131             : #endif
     132             : 
     133             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11