LCOV - code coverage report
Current view: top level - xml2cmp/source/xcd - xmlelem.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 68 108 63.0 %
Date: 2012-08-25 Functions: 23 33 69.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 25 70 35.7 %

           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                 :            : 
      21                 :            : #include <xmlelem.hxx>
      22                 :            : 
      23                 :            : 
      24                 :            : // NOT FULLY DEFINED SERVICES
      25                 :            : #include <parse.hxx>
      26                 :            : #include <cr_html.hxx>
      27                 :            : 
      28                 :        234 : XmlElement::XmlElement( const char * i_sName )
      29                 :        234 :     : sName(i_sName)
      30                 :            : {
      31                 :        234 : }
      32                 :            : 
      33                 :            : XmlElement *
      34                 :          0 : MultipleElement::FindChild( const Simstr & i_sChildName )
      35                 :            : {
      36                 :          0 :     unsigned i_max = aChildren.size();
      37         [ #  # ]:          0 :     for ( unsigned i = 0; i < i_max; ++i )
      38                 :            :     {
      39         [ #  # ]:          0 :         if ( aChildren[i]->Name() == i_sChildName )
      40                 :          0 :             return aChildren[i];
      41                 :            :     }
      42                 :            : 
      43                 :          0 :     return 0;
      44                 :            : }
      45                 :            : 
      46         [ +  - ]:         42 : MultipleElement::~MultipleElement()
      47                 :            : {
      48         [ -  + ]:         42 : }
      49                 :            : 
      50                 :         42 : MultipleElement::MultipleElement( const char * i_sName )
      51         [ +  - ]:         42 :     :   XmlElement(i_sName)
      52                 :            : {
      53                 :         42 : }
      54                 :            : 
      55                 :            : void
      56                 :        214 : MultipleElement::AddChild( XmlElement & let_drElement )
      57                 :            : {
      58         [ +  - ]:        214 :     aChildren.push_back(&let_drElement);
      59                 :        214 : }
      60                 :            : 
      61                 :            : void
      62                 :         20 : SequenceElement::Parse( X2CParser & io_rParser )
      63                 :            : {
      64                 :         20 :     io_rParser.Parse_Sequence( Children(), Name() );
      65                 :         20 : }
      66                 :            : 
      67                 :            : void
      68                 :          0 : SequenceElement::Write2Html( HtmlCreator & io_rHC ) const
      69                 :            : {
      70                 :          0 :     io_rHC.StartTable();
      71                 :            : 
      72                 :          0 :     Children()[nIndexNameElement]->Write2Html(io_rHC);
      73         [ #  # ]:          0 :     for ( unsigned i = 0; i < Children().size(); ++i )
      74                 :            :     {
      75         [ #  # ]:          0 :         if (i != nIndexNameElement)
      76                 :            :         {
      77                 :          0 :             Children()[i]->Write2Html(io_rHC);
      78                 :            :         }
      79                 :            :     }  // end for
      80                 :            : 
      81                 :          0 :     io_rHC.FinishTable();
      82                 :          0 : }
      83                 :            : 
      84                 :            : 
      85                 :         20 : SequenceElement::SequenceElement( const char * i_sName,
      86                 :            :                                   unsigned     i_nIndexNameElement )
      87                 :            :     :   MultipleElement(i_sName),
      88                 :         20 :         nIndexNameElement(i_nIndexNameElement)
      89                 :            : {
      90                 :         20 : }
      91                 :            : 
      92                 :         20 : FreeChoiceElement::FreeChoiceElement()
      93                 :         20 :     :   MultipleElement("")
      94                 :            : {
      95                 :         20 : }
      96                 :            : 
      97                 :            : void
      98                 :         20 : FreeChoiceElement::Parse( X2CParser & io_rParser )
      99                 :            : {
     100                 :         20 :     io_rParser.Parse_FreeChoice(Children());
     101                 :         20 : }
     102                 :            : 
     103                 :            : void
     104                 :          0 : FreeChoiceElement::Write2Html( HtmlCreator & io_rHC ) const
     105                 :            : {
     106         [ #  # ]:          0 :     for ( unsigned i = 0; i < Children().size(); ++i )
     107                 :            :     {
     108                 :          0 :         Children()[i]->Write2Html(io_rHC);
     109                 :            :     }  // end for
     110                 :          0 : }
     111                 :            : 
     112                 :          2 : ListElement::ListElement( const char * i_sElementsName,
     113                 :            :                           F_CREATE     i_fCreateNewElement )
     114                 :            :     :   MultipleElement(i_sElementsName),
     115                 :          2 :         fCreateNewElement(i_fCreateNewElement)
     116                 :            : {
     117                 :          2 : }
     118                 :            : 
     119                 :            : void
     120                 :          2 : ListElement::Parse( X2CParser & io_rParser )
     121                 :            : {
     122                 :          2 :     io_rParser.Parse_List(  *this );
     123                 :          2 : }
     124                 :            : 
     125                 :            : void
     126                 :          0 : ListElement::Write2Html( HtmlCreator & io_rHC ) const
     127                 :            : {
     128         [ #  # ]:          0 :     for ( unsigned i = 0; i < Children().size(); ++i )
     129                 :            :     {
     130                 :          0 :         Children()[i]->Write2Html(io_rHC);
     131                 :            :     }  // end for
     132                 :          0 : }
     133                 :            : 
     134                 :            : XmlElement *
     135                 :          0 : ListElement::Create_and_Add_NewElement()
     136                 :            : {
     137         [ #  # ]:          0 :     XmlElement * pNew = (*fCreateNewElement)(Name());
     138         [ #  # ]:          0 :     Children().push_back( pNew );
     139                 :          0 :     return pNew;
     140                 :            : }
     141                 :            : 
     142                 :        154 : TextElement::TextElement( const char *      i_sName,
     143                 :            :                           E_LinkType        i_eLinkType,
     144                 :            :                           bool              i_bReverseName )
     145                 :            :     :   XmlElement(i_sName),
     146                 :            :         eLinkType(i_eLinkType),
     147                 :        154 :         bReverseName(i_bReverseName)
     148                 :            : {
     149                 :        154 : }
     150                 :            : 
     151                 :         92 : SglTextElement::SglTextElement( const char *        i_sName,
     152                 :            :                                 E_LinkType          i_eLinkType,
     153                 :            :                                 bool                i_bReverseName )
     154         [ +  - ]:         92 :     :   TextElement(i_sName, i_eLinkType, i_bReverseName)
     155                 :            : {
     156                 :         92 : }
     157                 :            : 
     158                 :            : void
     159                 :         92 : SglTextElement::Parse( X2CParser & io_rParser )
     160                 :            : {
     161                 :         92 :     io_rParser.Parse_Text(sContent, Name(), IsReversedName());
     162                 :         92 : }
     163                 :            : 
     164                 :            : void
     165                 :          0 : SglTextElement::Write2Html( HtmlCreator & io_rHC ) const
     166                 :            : {
     167         [ #  # ]:          0 :     if ( !sContent.is_no_text() )
     168                 :          0 :         io_rHC.Write_SglTextElement( *this );
     169                 :          0 : }
     170                 :            : 
     171                 :         62 : MultipleTextElement::MultipleTextElement( const char *      i_sName,
     172                 :            :                                           E_LinkType        i_eLinkType,
     173                 :            :                                           bool              i_bReverseName )
     174         [ +  - ]:         62 :     :   TextElement(i_sName, i_eLinkType, i_bReverseName)
     175                 :            : {
     176                 :         62 : }
     177                 :            : 
     178                 :            : void
     179                 :         50 : MultipleTextElement::Parse( X2CParser & io_rParser )
     180                 :            : {
     181                 :         50 :     io_rParser.Parse_MultipleText(aContent, Name(), IsReversedName());
     182                 :         50 : }
     183                 :            : 
     184                 :            : void
     185                 :          0 : MultipleTextElement::Write2Html(    HtmlCreator & io_rHC ) const
     186                 :            : {
     187         [ #  # ]:          0 :     if (Size() > 0)
     188                 :          0 :         io_rHC.Write_MultiTextElement( *this );
     189                 :          0 : }
     190                 :            : 
     191                 :            : const Simstr &
     192                 :        406 : MultipleTextElement::Data( unsigned i_nNr ) const
     193                 :            : {
     194 [ +  + ][ +  - ]:        406 :     static const Simstr sNull_;
         [ +  - ][ #  # ]
     195                 :            : 
     196         [ +  - ]:        406 :     if (aContent.is_valid_index(i_nNr))
     197                 :        406 :         return aContent[i_nNr];
     198                 :        406 :     return sNull_;
     199                 :            : }
     200                 :            : 
     201                 :         38 : EmptyElement::EmptyElement( const char * i_sName )
     202                 :         38 :     :   XmlElement(i_sName)
     203                 :            : {
     204                 :         38 : }
     205                 :            : 
     206                 :         18 : SglAttrElement::SglAttrElement( const char *        i_sName,
     207                 :            :                                 const char *        i_sAttrName )
     208                 :            :     :   EmptyElement(i_sName),
     209 [ +  - ][ +  - ]:         18 :         sAttrName(i_sAttrName)
     210                 :            : {
     211                 :         18 : }
     212                 :            : 
     213                 :            : void
     214                 :         18 : SglAttrElement::Parse( X2CParser & io_rParser )
     215                 :            : {
     216                 :         18 :     io_rParser.Parse_SglAttr(sAttrValue, Name(), sAttrName);
     217                 :         18 : }
     218                 :            : 
     219                 :            : void
     220                 :          0 : SglAttrElement::Write2Html( HtmlCreator & io_rHC ) const
     221                 :            : {
     222                 :          0 :     io_rHC.Write_SglText( Name(), sAttrValue );
     223                 :          0 : }
     224                 :            : 
     225                 :         20 : MultipleAttrElement::MultipleAttrElement( const char *      i_sName,
     226                 :            :                                           const char **     i_sAttrNames,
     227                 :            :                                           unsigned          i_nSize )
     228 [ +  - ][ +  - ]:         20 :     :   EmptyElement(i_sName)
     229                 :            : {
     230         [ +  + ]:        120 :     for ( unsigned i = 0; i < i_nSize; ++i )
     231                 :            :     {
     232 [ +  - ][ +  - ]:        100 :         aAttrNames.push_back(Simstr(i_sAttrNames[i]));
                 [ +  - ]
     233 [ +  - ][ +  - ]:        100 :         aAttrValues.push_back(Simstr(""));
                 [ +  - ]
     234                 :            :     }
     235                 :         20 : }
     236                 :            : 
     237                 :            : void
     238                 :          2 : MultipleAttrElement::Parse( X2CParser & io_rParser )
     239                 :            : {
     240                 :          2 :     io_rParser.Parse_MultipleAttr(aAttrValues, Name(), aAttrNames);
     241                 :          2 : }
     242                 :            : 
     243                 :            : void
     244                 :          0 : MultipleAttrElement::Write2Html(    HtmlCreator & io_rHC ) const
     245                 :            : {
     246         [ #  # ]:          0 :     if ( ! aAttrValues[0].is_no_text() )
     247                 :          0 :         io_rHC.Write_ReferenceDocu( Name(), aAttrValues[0], aAttrValues[1], aAttrValues[2] );
     248 [ +  - ][ +  - ]:          6 : }
     249                 :            : 
     250                 :            : 
     251                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10