From 87ceb5c987f8bf546bbc0c0fc3447c640780be91 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 12 Jan 2012 09:30:09 +0000 Subject: VCL_DLLPUBLIC is in the wrong place and there's a unused duplicate header here too which can go --- vcl/inc/unx/strhelper.hxx | 44 -------------------------- vcl/inc/vcl/strhelper.hxx | 70 ++++++++++++++++++++--------------------- vcl/source/helper/strhelper.cxx | 7 ++--- 3 files changed, 38 insertions(+), 83 deletions(-) delete mode 100644 vcl/inc/unx/strhelper.hxx (limited to 'vcl') diff --git a/vcl/inc/unx/strhelper.hxx b/vcl/inc/unx/strhelper.hxx deleted file mode 100644 index 78db60567133..000000000000 --- a/vcl/inc/unx/strhelper.hxx +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SV_STRHELPER_HXX -#define _SV_STRHELPER_HXX -#include - -String GetCommandLineToken( int, const String& ); -// gets one token of a unix command line style string -// doublequote, singlequote and singleleftquote protect their respective -// contents - -int GetCommandLineTokenCount( const String& ); -// returns number of tokens (zero if empty or whitespace only) - -String WhitespaceToSpace( const String&, BOOL bProtect = TRUE ); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/strhelper.hxx b/vcl/inc/vcl/strhelper.hxx index 62e4fc072bdd..fa8258d5042b 100644 --- a/vcl/inc/vcl/strhelper.hxx +++ b/vcl/inc/vcl/strhelper.hxx @@ -35,47 +35,47 @@ #include -namespace psp { +namespace psp +{ + VCL_DLLPUBLIC String GetCommandLineToken( int, const String& ); + VCL_DLLPUBLIC rtl::OString GetCommandLineToken(int, const rtl::OString&); + // gets one token of a unix command line style string + // doublequote, singlequote and singleleftquote protect their respective + // contents -String VCL_DLLPUBLIC GetCommandLineToken( int, const String& ); -rtl::OString VCL_DLLPUBLIC GetCommandLineToken(int, const rtl::OString&); -// gets one token of a unix command line style string -// doublequote, singlequote and singleleftquote protect their respective -// contents + VCL_DLLPUBLIC int GetCommandLineTokenCount(const rtl::OUString&); + VCL_DLLPUBLIC int GetCommandLineTokenCount(const rtl::OString&); + // returns number of tokens (zero if empty or whitespace only) -int VCL_DLLPUBLIC GetCommandLineTokenCount( const String& ); -int VCL_DLLPUBLIC GetCommandLineTokenCount(const rtl::OString&); -// returns number of tokens (zero if empty or whitespace only) + VCL_DLLPUBLIC String WhitespaceToSpace( const String&, sal_Bool bProtect = sal_True ); + VCL_DLLPUBLIC rtl::OString WhitespaceToSpace(const rtl::OString&, sal_Bool bProtect = sal_True); + // returns a string with multiple adjacent occurrences of whitespace + // converted to a single space. if bProtect is sal_True (nonzero), then + // doublequote, singlequote and singleleftquote protect their respective + // contents -String VCL_DLLPUBLIC WhitespaceToSpace( const String&, sal_Bool bProtect = sal_True ); -rtl::OString VCL_DLLPUBLIC WhitespaceToSpace(const rtl::OString&, sal_Bool bProtect = sal_True); -// returns a string with multiple adjacent occurrences of whitespace -// converted to a single space. if bProtect is sal_True (nonzero), then -// doublequote, singlequote and singleleftquote protect their respective -// contents + // parses the first double in the string; decimal is '.' only + VCL_DLLPUBLIC inline double StringToDouble( const String& rStr ) + { + return rtl::math::stringToDouble(rStr, sal_Unicode('.'), sal_Unicode(0)); + } -// parses the first double in the string; decimal is '.' only -inline double VCL_DLLPUBLIC StringToDouble( const String& rStr ) -{ - return rtl::math::stringToDouble(rStr, sal_Unicode('.'), sal_Unicode(0)); -} + VCL_DLLPUBLIC inline double StringToDouble(const rtl::OString& rStr) + { + return rtl::math::stringToDouble(rStr, '.', static_cast(0)); + } -inline double VCL_DLLPUBLIC StringToDouble(const rtl::OString& rStr) -{ - return rtl::math::stringToDouble(rStr, '.', static_cast(0)); -} - -// fills a character buffer with the string representation of a double -// the buffer has to be long enough (e.g. 128 bytes) -// returns the string len -inline int VCL_DLLPUBLIC getValueOfDouble( char* pBuffer, double f, int nPrecision = 0) -{ - rtl::OString aStr( rtl::math::doubleToString( f, rtl_math_StringFormat_G, nPrecision, '.', true ) ); - int nLen = aStr.getLength(); - std::strncpy( pBuffer, aStr.getStr(), nLen+1 ); // copy string including terminating zero - return nLen; -} + // fills a character buffer with the string representation of a double + // the buffer has to be long enough (e.g. 128 bytes) + // returns the string len + VCL_DLLPUBLIC inline int getValueOfDouble( char* pBuffer, double f, int nPrecision = 0) + { + rtl::OString aStr( rtl::math::doubleToString( f, rtl_math_StringFormat_G, nPrecision, '.', true ) ); + int nLen = aStr.getLength(); + std::strncpy( pBuffer, aStr.getStr(), nLen+1 ); // copy string including terminating zero + return nLen; + } } // namespace diff --git a/vcl/source/helper/strhelper.cxx b/vcl/source/helper/strhelper.cxx index e13f0f36110e..14b61a56e5e6 100644 --- a/vcl/source/helper/strhelper.cxx +++ b/vcl/source/helper/strhelper.cxx @@ -221,14 +221,13 @@ rtl::OString GetCommandLineToken(int nToken, const rtl::OString& rLine) return rtl::OString(pBuffer); } -int GetCommandLineTokenCount( const String& rLine ) +int GetCommandLineTokenCount(const rtl::OUString& rLine) { - if( ! rLine.Len() ) + if (rLine.isEmpty()) return 0; int nTokenCount = 0; - const sal_Unicode *pRun = rLine.GetBuffer(); - + const sal_Unicode *pRun = rLine.getStr(); while( *pRun ) { -- cgit