LCOV - code coverage report
Current view: top level - basegfx/source/inc - stringconversiontools.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 10 10 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_BASEGFX_SOURCE_INC_STRINGCONVERSIONTOOLS_HXX
      20             : #define INCLUDED_BASEGFX_SOURCE_INC_STRINGCONVERSIONTOOLS_HXX
      21             : 
      22             : #include <sal/types.h>
      23             : #include <rtl/ustring.hxx>
      24             : #include <rtl/ustrbuf.hxx>
      25             : 
      26             : namespace basegfx
      27             : {
      28             :     namespace internal
      29             :     {
      30             :         void skipSpaces(sal_Int32&      io_rPos,
      31             :                         const OUString& rStr,
      32             :                         const sal_Int32 nLen);
      33             : 
      34             :         void skipSpacesAndCommas(sal_Int32&      io_rPos,
      35             :                                  const OUString& rStr,
      36             :                                  const sal_Int32 nLen);
      37             : 
      38       93302 :         inline bool isOnNumberChar(const sal_Unicode aChar,
      39             :                                    bool              bSignAllowed = true,
      40             :                                    bool              bDotAllowed = true)
      41             :         {
      42       81808 :             const bool bPredicate( (sal_Unicode('0') <= aChar && sal_Unicode('9') >= aChar)
      43       56619 :                                     || (bSignAllowed && sal_Unicode('+') == aChar)
      44       56619 :                                     || (bSignAllowed && sal_Unicode('-') == aChar)
      45      138427 :                                     || (bDotAllowed && sal_Unicode('.') == aChar));
      46             : 
      47       93302 :             return bPredicate;
      48             :         }
      49             : 
      50       90110 :         inline bool isOnNumberChar(const OUString& rStr,
      51             :                                    const sal_Int32 nPos,
      52             :                                    bool            bSignAllowed = true,
      53             :                                    bool            bDotAllowed = true)
      54             :         {
      55       90110 :             return isOnNumberChar(rStr[nPos], bSignAllowed, bDotAllowed);
      56             :         }
      57             : 
      58             :         bool getDoubleChar(double&          o_fRetval,
      59             :                            sal_Int32&       io_rPos,
      60             :                            const OUString&  rStr);
      61             : 
      62             :         bool importDoubleAndSpaces(double&          o_fRetval,
      63             :                                    sal_Int32&       io_rPos,
      64             :                                    const OUString&  rStr,
      65             :                                    const sal_Int32  nLen );
      66             : 
      67             :         bool importFlagAndSpaces(sal_Int32&      o_nRetval,
      68             :                                  sal_Int32&      io_rPos,
      69             :                                  const OUString& rStr,
      70             :                                  const sal_Int32 nLen);
      71             : 
      72             :         void skipNumber(sal_Int32&       io_rPos,
      73             :                         const OUString&  rStr,
      74             :                         const sal_Int32  nLen);
      75             : 
      76             :         void skipDouble(sal_Int32&       io_rPos,
      77             :                         const OUString&  rStr);
      78             : 
      79             :         void putNumberCharWithSpace(OUStringBuffer& rStr,
      80             :                                     double          fValue,
      81             :                                     double          fOldValue,
      82             :                                     bool            bUseRelativeCoordinates);
      83             : 
      84        2210 :         inline sal_Unicode getCommand(sal_Char cUpperCaseCommand,
      85             :                                       sal_Char cLowerCaseCommand,
      86             :                                       bool     bUseRelativeCoordinates)
      87             :         {
      88        2210 :             return bUseRelativeCoordinates ? cLowerCaseCommand : cUpperCaseCommand;
      89             :         }
      90             :     } // namespace internal
      91             : } // namespace basegfx
      92             : 
      93             : #endif // INCLUDED_BASEGFX_SOURCE_INC_STRINGCONVERSIONTOOLS_HXX
      94             : 
      95             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11