diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-02-15 15:26:43 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-02-15 15:41:09 +0100 |
commit | 9ab0b38e95133dab720408cc2c80093b8a201c10 (patch) | |
tree | 416dde227ed5c4ded99292feb94f36a64c327999 /vcl | |
parent | 42422f2599220b678aa41c4aadeec28df113c3ec (diff) |
Various string function clean up
Added:
* rtl::OString::matchL
* rtl::OString::endsWith
* rtl::OString::endsWithL
* rtl::OString::indexOfL
* rtl::OString::replaceFirst
* rtl::OString::replaceAll
* rtl::OString::getToken
* rtl::OUString::endsWith
* rtl::OUString::replaceFirst
* rtl::OUString::replaceFirstAsciiL
* rtl::OUString::replaceFirstAsciiLAsciiL
* rtl::OUString::replaceAll
* rtl::OUString::replaceAllAsciiL
* rtl::OUString::replaceAllAsciiLAsciiL
* rtl::OUString::getToken
plus underlying C functions where necessary
Deprecated:
* comphelper::string::remove
* comphelper::string::getToken
Removed:
* comphelper::string::searchAndReplaceAsciiL
* comphelper::string::searchAndReplaceAllAsciiWithAscii
* comphelper::string::searchAndReplaceAsciiI
* comphelper::string::replace
* comphelper::string::matchL
* comphelper::string::matchIgnoreAsciiCaseL
* comphelper::string::indexOfL
Also fixed some apparent misuses of RTL_CONSTASCII_USTRINGPARAM ->
RTL_CONSTASCII_STRINGPARAM.
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/generic/print/common_gfx.cxx | 9 | ||||
-rw-r--r-- | vcl/generic/print/genprnpsp.cxx | 11 | ||||
-rw-r--r-- | vcl/unx/generic/printer/jobdata.cxx | 30 | ||||
-rw-r--r-- | vcl/unx/gtk/app/gtksys.cxx | 5 |
4 files changed, 26 insertions, 29 deletions
diff --git a/vcl/generic/print/common_gfx.cxx b/vcl/generic/print/common_gfx.cxx index 8de0134283f3..941a5ccc51c9 100644 --- a/vcl/generic/print/common_gfx.cxx +++ b/vcl/generic/print/common_gfx.cxx @@ -30,7 +30,6 @@ #include "psputil.hxx" #include "glyphset.hxx" -#include <comphelper/string.hxx> #include "generic/printergfx.hxx" #include "generic/printerjob.hxx" #include "vcl/fontmanager.hxx" @@ -1204,9 +1203,9 @@ PrinterGfx::DrawEPS( const Rectangle& rBoundingBox, void* pPtr, sal_uInt32 nSize char cChar = aLine[1]; if( cChar == '%' ) { - if( comphelper::string::matchIgnoreAsciiCaseL( aLine, RTL_CONSTASCII_STRINGPARAM("%%BoundingBox:") ) ) + if( aLine.matchIgnoreAsciiCase( rtl::OString( RTL_CONSTASCII_STRINGPARAM("%%BoundingBox:") ) ) ) { - aLine = WhitespaceToSpace( comphelper::string::getToken(aLine, 1, ':') ); + aLine = WhitespaceToSpace( aLine.getToken(1, ':') ); if( !aLine.isEmpty() && aLine.indexOf( "atend" ) == -1 ) { fLeft = StringToDouble( GetCommandLineToken( 0, aLine ) ); @@ -1215,9 +1214,9 @@ PrinterGfx::DrawEPS( const Rectangle& rBoundingBox, void* pPtr, sal_uInt32 nSize fTop = StringToDouble( GetCommandLineToken( 3, aLine ) ); } } - else if( comphelper::string::matchIgnoreAsciiCaseL( aLine, RTL_CONSTASCII_STRINGPARAM("%%Title:") ) ) + else if( aLine.matchIgnoreAsciiCase( rtl::OString( RTL_CONSTASCII_STRINGPARAM("%%Title:") ) ) ) aDocTitle = WhitespaceToSpace( aLine.copy( 8 ) ); - else if( comphelper::string::matchIgnoreAsciiCaseL( aLine, RTL_CONSTASCII_STRINGPARAM("%%EndComments") ) ) + else if( aLine.matchIgnoreAsciiCase( rtl::OString( RTL_CONSTASCII_STRINGPARAM("%%EndComments") ) ) ) bEndComments = true; } else if( cChar == ' ' || cChar == '\t' || cChar == '\r' || cChar == '\n' ) diff --git a/vcl/generic/print/genprnpsp.cxx b/vcl/generic/print/genprnpsp.cxx index 18980a421e28..9bc8731016c3 100644 --- a/vcl/generic/print/genprnpsp.cxx +++ b/vcl/generic/print/genprnpsp.cxx @@ -47,7 +47,6 @@ #endif #include "rtl/ustring.hxx" -#include "comphelper/string.hxx" #include "osl/module.h" @@ -243,7 +242,7 @@ static bool passFileToCommandLine( const OUString& rFilename, const OUString& rC // setup command line for exec if( ! bPipe ) - aCmdLine = comphelper::string::replace( aCmdLine, rtl::OString("(TMP)"), aFilename ); + aCmdLine = aCmdLine.replaceAll(rtl::OString("(TMP)"), aFilename); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "%s commandline: \"%s\"\n", @@ -359,7 +358,9 @@ static bool sendAFax( const OUString& rFaxNumber, const OUString& rFileName, con { OUString aFaxNumber( aFaxNumbers.front() ); aFaxNumbers.pop_front(); - OUString aCmdLine = comphelper::string::replace( rCommand, OUString( RTL_CONSTASCII_USTRINGPARAM( "(PHONE)" ) ), aFaxNumber ); + OUString aCmdLine( + rCommand.replaceAllAsciiL( + RTL_CONSTASCII_STRINGPARAM("(PHONE)"), aFaxNumber)); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "sending fax to \"%s\"\n", OUStringToOString( aFaxNumber, osl_getThreadTextEncoding() ).getStr() ); #endif @@ -382,7 +383,9 @@ static bool sendAFax( const OUString& rFaxNumber, const OUString& rFileName, con static bool createPdf( const OUString& rToFile, const OUString& rFromFile, const OUString& rCommandLine ) { #if defined( UNX ) - OUString aCommandLine = comphelper::string::replace( rCommandLine, OUString( RTL_CONSTASCII_USTRINGPARAM( "(OUTFILE)" ) ), rToFile ); + OUString aCommandLine( + rCommandLine.replaceAllAsciiL( + RTL_CONSTASCII_STRINGPARAM("(OUTFILE)"), rToFile)); return passFileToCommandLine( rFromFile, aCommandLine ); #else diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx index 9bd1d57b54af..5644a6720402 100644 --- a/vcl/unx/generic/printer/jobdata.cxx +++ b/vcl/unx/generic/printer/jobdata.cxx @@ -34,7 +34,6 @@ #include <sal/alloca.h> #include <rtl/strbuf.hxx> -#include <comphelper/string.hxx> using namespace psp; @@ -207,54 +206,51 @@ bool JobData::constructFromStreamBuffer( void* pData, int bytes, JobData& rJobDa const char pslevelEquals[] = "pslevel="; const char pdfdeviceEquals[] = "pdfdevice="; - using comphelper::string::matchL; - while( ! aStream.IsEof() ) { aStream.ReadLine( aLine ); - if (matchL(aLine, RTL_CONSTASCII_STRINGPARAM("JobData"))) + if (aLine.matchL(RTL_CONSTASCII_STRINGPARAM("JobData"))) bVersion = true; - else if (matchL(aLine, RTL_CONSTASCII_STRINGPARAM(printerEquals))) + else if (aLine.matchL(RTL_CONSTASCII_STRINGPARAM(printerEquals))) { bPrinter = true; rJobData.m_aPrinterName = rtl::OStringToOUString(aLine.copy(RTL_CONSTASCII_LENGTH(printerEquals)), RTL_TEXTENCODING_UTF8); } - else if (matchL(aLine, RTL_CONSTASCII_STRINGPARAM(orientatationEquals))) + else if (aLine.matchL(RTL_CONSTASCII_STRINGPARAM(orientatationEquals))) { bOrientation = true; rJobData.m_eOrientation = aLine.copy(RTL_CONSTASCII_LENGTH(orientatationEquals)).equalsIgnoreAsciiCase("landscape") ? orientation::Landscape : orientation::Portrait; } - else if (matchL(aLine, RTL_CONSTASCII_STRINGPARAM(copiesEquals))) + else if (aLine.matchL(RTL_CONSTASCII_STRINGPARAM(copiesEquals))) { bCopies = true; rJobData.m_nCopies = aLine.copy(RTL_CONSTASCII_LENGTH(copiesEquals)).toInt32(); } - else if (matchL(aLine, RTL_CONSTASCII_STRINGPARAM(margindajustmentEquals))) + else if (aLine.matchL(RTL_CONSTASCII_STRINGPARAM(margindajustmentEquals))) { bMargin = true; rtl::OString aValues(aLine.copy(RTL_CONSTASCII_LENGTH(margindajustmentEquals))); - using comphelper::string::getToken; - rJobData.m_nLeftMarginAdjust = getToken(aValues, 0, ',').toInt32(); - rJobData.m_nRightMarginAdjust = getToken(aValues, 1, ',').toInt32(); - rJobData.m_nTopMarginAdjust = getToken(aValues, 2, ',').toInt32(); - rJobData.m_nBottomMarginAdjust = getToken(aValues, 3, ',').toInt32(); + rJobData.m_nLeftMarginAdjust = aValues.getToken(0, ',').toInt32(); + rJobData.m_nRightMarginAdjust = aValues.getToken(1, ',').toInt32(); + rJobData.m_nTopMarginAdjust = aValues.getToken(2, ',').toInt32(); + rJobData.m_nBottomMarginAdjust = aValues.getToken(3, ',').toInt32(); } - else if (matchL(aLine, RTL_CONSTASCII_STRINGPARAM(colordepthEquals))) + else if (aLine.matchL(RTL_CONSTASCII_STRINGPARAM(colordepthEquals))) { bColorDepth = true; rJobData.m_nColorDepth = aLine.copy(RTL_CONSTASCII_LENGTH(colordepthEquals)).toInt32(); } - else if (matchL(aLine, RTL_CONSTASCII_STRINGPARAM(colordeviceEquals))) + else if (aLine.matchL(RTL_CONSTASCII_STRINGPARAM(colordeviceEquals))) { bColorDevice = true; rJobData.m_nColorDevice = aLine.copy(RTL_CONSTASCII_LENGTH(colordeviceEquals)).toInt32(); } - else if (matchL(aLine, RTL_CONSTASCII_STRINGPARAM(pslevelEquals))) + else if (aLine.matchL(RTL_CONSTASCII_STRINGPARAM(pslevelEquals))) { bPSLevel = true; rJobData.m_nPSLevel = aLine.copy(RTL_CONSTASCII_LENGTH(pslevelEquals)).toInt32(); } - else if (matchL(aLine, RTL_CONSTASCII_STRINGPARAM(pdfdeviceEquals))) + else if (aLine.matchL(RTL_CONSTASCII_STRINGPARAM(pdfdeviceEquals))) { bPDFDevice = true; rJobData.m_nPDFDevice = aLine.copy(RTL_CONSTASCII_LENGTH(pdfdeviceEquals)).toInt32(); diff --git a/vcl/unx/gtk/app/gtksys.cxx b/vcl/unx/gtk/app/gtksys.cxx index 6690d5f0b70e..7c3b3f0e0cc1 100644 --- a/vcl/unx/gtk/app/gtksys.cxx +++ b/vcl/unx/gtk/app/gtksys.cxx @@ -30,7 +30,6 @@ #include <string.h> #include <gmodule.h> #include <gtk/gtk.h> -#include <comphelper/string.hxx> #include <unx/gtk/gtkinst.hxx> #include <unx/gtk/gtksys.hxx> @@ -243,8 +242,8 @@ static rtl::OString MapToGtkAccelerator(const rtl::OUString &rStr) { const rtl::OUString aRep(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "_" ))); return rtl::OUStringToOString( - comphelper::string::searchAndReplaceAsciiL( - rStr, RTL_CONSTASCII_STRINGPARAM( "~" ), aRep), RTL_TEXTENCODING_UTF8); + rStr.replaceFirstAsciiL(RTL_CONSTASCII_STRINGPARAM( "~" ), aRep), + RTL_TEXTENCODING_UTF8); } int GtkSalSystem::ShowNativeDialog (const rtl::OUString& rTitle, const rtl::OUString& rMessage, |