LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/vcl - strhelper.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 4 9 44.4 %
Date: 2012-08-25 Functions: 2 3 66.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : #ifndef _PSPRINT_STRHELPER_HXX_
      29                 :            : #define _PSPRINT_STRHELPER_HXX_
      30                 :            : 
      31                 :            : #include "vcl/dllapi.h"
      32                 :            : 
      33                 :            : #include <tools/string.hxx>
      34                 :            : #include <rtl/math.hxx>
      35                 :            : 
      36                 :            : #include <cstring>
      37                 :            : 
      38                 :            : namespace psp
      39                 :            : {
      40                 :            :     VCL_DLLPUBLIC String GetCommandLineToken( int, const String& );
      41                 :            :     VCL_DLLPUBLIC rtl::OString GetCommandLineToken(int, const rtl::OString&);
      42                 :            :     // gets one token of a unix command line style string
      43                 :            :     // doublequote, singlequote and singleleftquote protect their respective
      44                 :            :     // contents
      45                 :            : 
      46                 :            :     VCL_DLLPUBLIC int GetCommandLineTokenCount(const rtl::OUString&);
      47                 :            :     // returns number of tokens (zero if empty or whitespace only)
      48                 :            : 
      49                 :            :     VCL_DLLPUBLIC String WhitespaceToSpace( const String&, sal_Bool bProtect = sal_True );
      50                 :            :     VCL_DLLPUBLIC rtl::OString WhitespaceToSpace(const rtl::OString&, sal_Bool bProtect = sal_True);
      51                 :            :     // returns a string with multiple adjacent occurrences of whitespace
      52                 :            :     // converted to a single space. if bProtect is sal_True (nonzero), then
      53                 :            :     // doublequote, singlequote and singleleftquote protect their respective
      54                 :            :     // contents
      55                 :            : 
      56                 :            : 
      57                 :            :     // parses the first double in the string; decimal is '.' only
      58                 :       1120 :     VCL_DLLPUBLIC inline double StringToDouble( const String& rStr )
      59                 :            :     {
      60                 :       1120 :         return rtl::math::stringToDouble(rStr, sal_Unicode('.'), sal_Unicode(0));
      61                 :            :     }
      62                 :            : 
      63                 :       4327 :     VCL_DLLPUBLIC inline double StringToDouble(const rtl::OString& rStr)
      64                 :            :     {
      65                 :       4327 :         return rtl::math::stringToDouble(rStr, '.', static_cast<sal_Char>(0));
      66                 :            :     }
      67                 :            : 
      68                 :            :     // fills a character buffer with the string representation of a double
      69                 :            :     // the buffer has to be long enough (e.g. 128 bytes)
      70                 :            :     // returns the string len
      71                 :          0 :     VCL_DLLPUBLIC inline int getValueOfDouble( char* pBuffer, double f, int nPrecision = 0)
      72                 :            :     {
      73                 :          0 :         rtl::OString aStr( rtl::math::doubleToString( f, rtl_math_StringFormat_G, nPrecision, '.', true ) );
      74                 :          0 :         int nLen = aStr.getLength();
      75                 :          0 :         std::strncpy( pBuffer, aStr.getStr(), nLen+1 ); // copy string including terminating zero
      76                 :          0 :         return nLen;
      77                 :            :     }
      78                 :            : 
      79                 :            : } // namespace
      80                 :            : 
      81                 :            : #endif // _PSPRINT_STRHELPER_HXX_
      82                 :            : 
      83                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10