LCOV - code coverage report
Current view: top level - svgio/source/svgreader - svgdocument.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 34 0.0 %
Date: 2014-04-14 Functions: 0 8 0.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 <svgio/svgreader/svgdocument.hxx>
      21             : 
      22             : 
      23             : 
      24             : namespace svgio
      25             : {
      26             :     namespace svgreader
      27             :     {
      28           0 :         SvgDocument::SvgDocument(const OUString& rAbsolutePath)
      29             :         :   maNodes(),
      30             :             maAbsolutePath(rAbsolutePath),
      31             :             maIdTokenMapperList(),
      32           0 :             maIdStyleTokenMapperList()
      33             :         {
      34           0 :         }
      35             : 
      36           0 :         SvgDocument::~SvgDocument()
      37             :         {
      38           0 :             while(!maNodes.empty())
      39             :             {
      40           0 :                 SvgNode* pCandidate = maNodes[maNodes.size() - 1];
      41           0 :                 delete pCandidate;
      42           0 :                 maNodes.pop_back();
      43             :             }
      44           0 :         }
      45             : 
      46           0 :         void SvgDocument::appendNode(SvgNode* pNode)
      47             :         {
      48             :             OSL_ENSURE(pNode, "OOps, empty node added (!)");
      49           0 :             maNodes.push_back(pNode);
      50           0 :         }
      51             : 
      52           0 :         void SvgDocument::addSvgNodeToMapper(const OUString& rStr, const SvgNode& rNode)
      53             :         {
      54           0 :             if(!rStr.isEmpty())
      55             :             {
      56           0 :                 maIdTokenMapperList.insert(IdTokenValueType(rStr, &rNode));
      57             :             }
      58           0 :         }
      59             : 
      60           0 :         void SvgDocument::removeSvgNodeFromMapper(const OUString& rStr)
      61             :         {
      62           0 :             if(!rStr.isEmpty())
      63             :             {
      64           0 :                 maIdTokenMapperList.erase(rStr);
      65             :             }
      66           0 :         }
      67             : 
      68           0 :         const SvgNode* SvgDocument::findSvgNodeById(const OUString& rStr) const
      69             :         {
      70           0 :             const IdTokenMapper::const_iterator aResult(maIdTokenMapperList.find(rStr));
      71             : 
      72           0 :             if(aResult == maIdTokenMapperList.end())
      73             :             {
      74           0 :                 return 0;
      75             :             }
      76             :             else
      77             :             {
      78           0 :                 return aResult->second;
      79             :             }
      80             :         }
      81             : 
      82           0 :         void SvgDocument::addSvgStyleAttributesToMapper(const OUString& rStr, const SvgStyleAttributes& rSvgStyleAttributes)
      83             :         {
      84           0 :             if(!rStr.isEmpty())
      85             :             {
      86           0 :                 maIdStyleTokenMapperList.insert(IdStyleTokenValueType(rStr, &rSvgStyleAttributes));
      87             :             }
      88           0 :         }
      89             : 
      90           0 :         const SvgStyleAttributes* SvgDocument::findSvgStyleAttributesById(const OUString& rStr) const
      91             :         {
      92           0 :             const IdStyleTokenMapper::const_iterator aResult(maIdStyleTokenMapperList.find(rStr));
      93             : 
      94           0 :             if(aResult == maIdStyleTokenMapperList.end())
      95             :             {
      96           0 :                 return 0;
      97             :             }
      98             :             else
      99             :             {
     100           0 :                 return aResult->second;
     101             :             }
     102             :         }
     103             : 
     104             :     } // end of namespace svgreader
     105             : } // end of namespace svgio
     106             : 
     107             : 
     108             : // eof
     109             : 
     110             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10