LCOV - code coverage report
Current view: top level - drawinglayer/source/attribute - strokeattribute.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 38 0.0 %
Date: 2014-04-14 Functions: 0 16 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 <drawinglayer/attribute/strokeattribute.hxx>
      21             : #include <rtl/instance.hxx>
      22             : #include <numeric>
      23             : 
      24             : 
      25             : 
      26             : namespace drawinglayer
      27             : {
      28             :     namespace attribute
      29             :     {
      30           0 :         class ImpStrokeAttribute
      31             :         {
      32             :         public:
      33             :             // data definitions
      34             :             ::std::vector< double >                     maDotDashArray;         // array of double which defines the dot-dash pattern
      35             :             double                                      mfFullDotDashLen;       // sum of maDotDashArray (for convenience)
      36             : 
      37           0 :             ImpStrokeAttribute(
      38             :                 const ::std::vector< double >& rDotDashArray,
      39             :                 double fFullDotDashLen)
      40             :             :   maDotDashArray(rDotDashArray),
      41           0 :                 mfFullDotDashLen(fFullDotDashLen)
      42             :             {
      43           0 :             }
      44             : 
      45           0 :             ImpStrokeAttribute()
      46             :             :   maDotDashArray(std::vector< double >()),
      47           0 :                 mfFullDotDashLen(0.0)
      48             :             {
      49           0 :             }
      50             : 
      51             :             // data read access
      52           0 :             const ::std::vector< double >& getDotDashArray() const { return maDotDashArray; }
      53           0 :             double getFullDotDashLen() const
      54             :             {
      55           0 :                 if(0.0 == mfFullDotDashLen && maDotDashArray.size())
      56             :                 {
      57             :                     // calculate length on demand
      58           0 :                     const double fAccumulated(::std::accumulate(maDotDashArray.begin(), maDotDashArray.end(), 0.0));
      59           0 :                     const_cast< ImpStrokeAttribute* >(this)->mfFullDotDashLen = fAccumulated;
      60             :                 }
      61             : 
      62           0 :                 return mfFullDotDashLen;
      63             :             }
      64             : 
      65           0 :             bool operator==(const ImpStrokeAttribute& rCandidate) const
      66             :             {
      67           0 :                 return (getDotDashArray() == rCandidate.getDotDashArray()
      68           0 :                     && getFullDotDashLen() == rCandidate.getFullDotDashLen());
      69             :             }
      70             :         };
      71             : 
      72             :         namespace
      73             :         {
      74             :             struct theGlobalDefault :
      75             :                 public rtl::Static< StrokeAttribute::ImplType, theGlobalDefault > {};
      76             :         }
      77             : 
      78           0 :         StrokeAttribute::StrokeAttribute(
      79             :             const ::std::vector< double >& rDotDashArray,
      80             :             double fFullDotDashLen)
      81             :         :   mpStrokeAttribute(ImpStrokeAttribute(
      82           0 :                 rDotDashArray, fFullDotDashLen))
      83             :         {
      84           0 :         }
      85             : 
      86           0 :         StrokeAttribute::StrokeAttribute()
      87           0 :         :   mpStrokeAttribute(theGlobalDefault::get())
      88             :         {
      89           0 :         }
      90             : 
      91           0 :         StrokeAttribute::StrokeAttribute(const StrokeAttribute& rCandidate)
      92           0 :         :   mpStrokeAttribute(rCandidate.mpStrokeAttribute)
      93             :         {
      94           0 :         }
      95             : 
      96           0 :         StrokeAttribute::~StrokeAttribute()
      97             :         {
      98           0 :         }
      99             : 
     100           0 :         bool StrokeAttribute::isDefault() const
     101             :         {
     102           0 :             return mpStrokeAttribute.same_object(theGlobalDefault::get());
     103             :         }
     104             : 
     105           0 :         StrokeAttribute& StrokeAttribute::operator=(const StrokeAttribute& rCandidate)
     106             :         {
     107           0 :             mpStrokeAttribute = rCandidate.mpStrokeAttribute;
     108           0 :             return *this;
     109             :         }
     110             : 
     111           0 :         bool StrokeAttribute::operator==(const StrokeAttribute& rCandidate) const
     112             :         {
     113           0 :             return rCandidate.mpStrokeAttribute == mpStrokeAttribute;
     114             :         }
     115             : 
     116           0 :         const ::std::vector< double >& StrokeAttribute::getDotDashArray() const
     117             :         {
     118           0 :             return mpStrokeAttribute->getDotDashArray();
     119             :         }
     120             : 
     121           0 :         double StrokeAttribute::getFullDotDashLen() const
     122             :         {
     123           0 :             return mpStrokeAttribute->getFullDotDashLen();
     124             :         }
     125             :     } // end of namespace attribute
     126             : } // end of namespace drawinglayer
     127             : 
     128             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10