[Libreoffice-commits] .: basctl/source comphelper/inc comphelper/qa comphelper/source dbaccess/source desktop/source extensions/source framework/source l10ntools/inc l10ntools/source linguistic/source oox/source padmin/source rsc/source sal/CppunitTest_sal_rtl_strings.mk sal/inc sal/qa sal/rtl sal/util sc/source sot/source starmath/source svtools/bmpmaker svtools/source tools/bootstrp tools/source vcl/generic vcl/unx
Stephan Bergmann
sbergmann at kemper.freedesktop.org
Wed Feb 15 06:41:45 PST 2012
basctl/source/basicide/baside3.cxx | 5
basctl/source/basicide/basides1.cxx | 5
basctl/source/basicide/bastypes.cxx | 7
basctl/source/basicide/brkdlg.cxx | 13
basctl/source/basicide/moduldl2.cxx | 14
basctl/source/dlged/managelang.cxx | 5
comphelper/inc/comphelper/string.hxx | 192 -------
comphelper/qa/string/test_string.cxx | 106 ---
comphelper/source/misc/string.cxx | 120 ----
dbaccess/source/core/dataaccess/datasource.cxx | 6
dbaccess/source/core/dataaccess/documentcontainer.cxx | 12
dbaccess/source/ext/macromigration/migrationengine.cxx | 39 -
dbaccess/source/ext/macromigration/migrationlog.cxx | 107 ++-
dbaccess/source/ui/app/AppController.cxx | 9
dbaccess/source/ui/uno/copytablewizard.cxx | 7
desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx | 26
desktop/source/deployment/misc/dp_dependencies.cxx | 5
extensions/source/scanner/sanedlg.cxx | 9
framework/source/services/autorecovery.cxx | 8
l10ntools/inc/export.hxx | 10
l10ntools/source/cfgmerge.cxx | 46 -
l10ntools/source/export.cxx | 215 +++-----
l10ntools/source/export2.cxx | 7
l10ntools/source/gsicheck.cxx | 2
l10ntools/source/helper.hxx | 78 --
l10ntools/source/helpmerge.cxx | 25
l10ntools/source/lngmerge.cxx | 26
l10ntools/source/localize.cxx | 8
l10ntools/source/merge.cxx | 3
l10ntools/source/xrmmerge.cxx | 39 -
linguistic/source/dicimp.cxx | 2
oox/source/export/drawingml.cxx | 4
padmin/source/adddlg.cxx | 11
rsc/source/rsc/rsc.cxx | 9
sal/CppunitTest_sal_rtl_strings.mk | 1
sal/inc/rtl/string.h | 60 ++
sal/inc/rtl/string.hxx | 152 +++++
sal/inc/rtl/ustring.h | 159 +++++
sal/inc/rtl/ustring.hxx | 204 +++++++
sal/qa/rtl/strings/test_strings_replace.cxx | 349 +++++++++++++
sal/rtl/source/string.cxx | 59 ++
sal/rtl/source/ustring.cxx | 178 ++++++
sal/util/sal.map | 8
sc/source/ui/app/inputhdl.cxx | 16
sot/source/sdstor/ucbstorage.cxx | 4
starmath/source/ooxmlimport.cxx | 7
svtools/bmpmaker/bmpcore.cxx | 10
svtools/bmpmaker/bmpsum.cxx | 10
svtools/source/filter/ixbm/xbmread.cxx | 5
svtools/source/filter/sgvtext.cxx | 33 -
svtools/source/misc/imap2.cxx | 8
svtools/source/svhtml/parhtml.cxx | 3
tools/bootstrp/cppdep.cxx | 9
tools/source/fsys/dirent.cxx | 4
tools/source/inet/inetstrm.cxx | 2
vcl/generic/print/common_gfx.cxx | 9
vcl/generic/print/genprnpsp.cxx | 11
vcl/unx/generic/printer/jobdata.cxx | 30 -
vcl/unx/gtk/app/gtksys.cxx | 5
59 files changed, 1618 insertions(+), 898 deletions(-)
New commits:
commit 9ab0b38e95133dab720408cc2c80093b8a201c10
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Feb 15 15:26:43 2012 +0100
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.
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index 7db5434..67c8b00 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -58,14 +58,12 @@
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
-#include <comphelper/string.hxx>
#include <comphelper/processfactory.hxx>
#include <tools/diagnose_ex.h>
#include <tools/urlobj.hxx>
#include <vcl/msgbox.hxx>
#include <xmlscript/xmldlg_imexp.hxx>
-using namespace comphelper;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::ucb;
@@ -1065,7 +1063,8 @@ sal_Bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const
{
::rtl::OUString aQueryBoxTitle(ResId::toString(IDEResId(RID_STR_DLGIMP_CLASH_TITLE)));
::rtl::OUString aQueryBoxText(ResId::toString(IDEResId(RID_STR_DLGIMP_CLASH_TEXT)));
- aQueryBoxText = ::comphelper::string::replace(aQueryBoxText, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$(ARG1)")), aXmlDlgName);
+ aQueryBoxText = aQueryBoxText.replaceAllAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("$(ARG1)"), aXmlDlgName);
NameClashQueryBox aQueryBox( pWin, aQueryBoxTitle, aQueryBoxText );
sal_uInt16 nRet = aQueryBox.Execute();
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index f404f37..63cc273 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -53,7 +53,6 @@
#include <com/sun/star/frame/XLayoutManager.hpp>
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
-#include <comphelper/string.hxx>
#include <svl/visitem.hxx>
#include <svtools/xtextedt.hxx>
#include <vcl/msgbox.hxx>
@@ -178,7 +177,9 @@ void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq )
nFound = ((ModulWindow*)pCurWin)->StartSearchAndReplace( (const SvxSearchItem&)rItem );
::rtl::OUString aReplStr(ResId::toString(IDEResId(RID_STR_SEARCHREPLACES)));
- aReplStr = ::comphelper::string::replace(aReplStr, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("XX")), ::rtl::OUString::valueOf(nFound));
+ aReplStr = aReplStr.replaceAllAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("XX"),
+ rtl::OUString::valueOf(nFound));
InfoBox( pCurWin, aReplStr ).Execute();
}
else
diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx
index f1987d1..67244ea 100644
--- a/basctl/source/basicide/bastypes.cxx
+++ b/basctl/source/basicide/bastypes.cxx
@@ -38,7 +38,6 @@
#include <basic/basmgr.hxx>
#include <com/sun/star/script/ModuleType.hpp>
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
-#include <comphelper/string.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/passwd.hxx>
#include <sfx2/viewfrm.hxx>
@@ -757,7 +756,8 @@ bool QueryDel( const ::rtl::OUString& rName, const ResId& rId, Window* pParent )
::rtl::OUStringBuffer aNameBuf( rName );
aNameBuf.append('\'');
aNameBuf.insert(sal_Int32(0), sal_Unicode('\''));
- aQuery = ::comphelper::string::replace(aQuery, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "XX")), aNameBuf.makeStringAndClear());
+ aQuery = aQuery.replaceAllAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("XX"), aNameBuf.makeStringAndClear());
QueryBox aQueryBox( pParent, WB_YES_NO | WB_DEF_YES, aQuery );
return ( aQueryBox.Execute() == RET_YES );
}
@@ -802,7 +802,8 @@ bool QueryPassword( const Reference< script::XLibraryContainer >& xLibContainer,
if ( bNewTitle )
{
::rtl::OUString aTitle(ResId::toString(IDEResId(RID_STR_ENTERPASSWORD)));
- aTitle = ::comphelper::string::replace(aTitle, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("XX")), rLibName);
+ aTitle = aTitle.replaceAllAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("XX"), rLibName);
pDlg->SetText( aTitle );
}
diff --git a/basctl/source/basicide/brkdlg.cxx b/basctl/source/basicide/brkdlg.cxx
index 3365e13..917a95f 100644
--- a/basctl/source/basicide/brkdlg.cxx
+++ b/basctl/source/basicide/brkdlg.cxx
@@ -36,28 +36,29 @@
#include "basidesh.hrc"
#include "iderdll.hxx"
-#include <comphelper/string.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/viewfrm.hxx>
// FIXME Why does BreakPointDialog allow only sal_uInt16 for break-point line
// numbers, whereas BreakPoint supports sal_uLong?
-bool lcl_ParseText( const String &rText, size_t& rLineNr )
+bool lcl_ParseText(rtl::OUString const &rText, size_t& rLineNr )
{
// aText should look like "# n" where
// n > 0 && n < std::numeric_limits< sal_uInt16 >::max().
// All spaces are ignored, so there can even be spaces within the
// number n. (Maybe it would be better to ignore all whitespace instead
// of just spaces.)
- String aText = comphelper::string::remove(rText, ' ');
- sal_Unicode cFirst = aText.GetChar(0);
+ rtl::OUString aText(
+ rText.replaceAllAsciiL(
+ RTL_CONSTASCII_STRINGPARAM(" "), rtl::OUString()));
+ sal_Unicode cFirst = aText[0];
if (cFirst != '#' && !(cFirst >= '0' && cFirst <= '9'))
return false;
if (cFirst == '#')
- aText.Erase(0, 1);
+ aText = aText.copy(1);
// XXX Assumes that sal_uInt16 is contained within sal_Int32:
- sal_Int32 n = aText.ToInt32();
+ sal_Int32 n = aText.toInt32();
if ( n <= 0 )
return false;
rLineNr = static_cast< size_t >(n);
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index 60f01a9..0f7a1ce 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -62,12 +62,10 @@
#include "com/sun/star/packages/manifest/XManifestWriter.hpp"
#include <unotools/pathoptions.hxx>
#include <comphelper/processfactory.hxx>
-#include <comphelper/string.hxx>
#include <com/sun/star/util/VetoException.hpp>
#include <com/sun/star/script/ModuleSizeExceededRequest.hpp>
-using namespace ::comphelper;
using ::rtl::OUString;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -964,7 +962,9 @@ void LibPage::InsertLib()
( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) && xDlgLibContainer->isLibraryReadOnly( aLibName ) && !xDlgLibContainer->isLibraryLink( aLibName ) ) )
{
::rtl::OUString aErrStr( ResId::toString( IDEResId( RID_STR_REPLACELIB ) ) );
- aErrStr = ::comphelper::string::replace(aErrStr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XX" ) ), aLibName);
+ aErrStr = aErrStr.replaceAllAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("XX"),
+ aLibName);
aErrStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n"));
aErrStr += ResId::toString( IDEResId( RID_STR_LIBISREADONLY ) );
ErrorBox( this, WB_OK | WB_DEF_OK, aErrStr ).Execute();
@@ -981,7 +981,9 @@ void LibPage::InsertLib()
aErrStr = ResId::toString( IDEResId( RID_STR_REFNOTPOSSIBLE ) );
else
aErrStr = ResId::toString( IDEResId( RID_STR_IMPORTNOTPOSSIBLE ) );
- aErrStr = ::comphelper::string::replace(aErrStr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XX" ) ), aLibName);
+ aErrStr = aErrStr.replaceAllAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("XX"),
+ aLibName);
aErrStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n"));
aErrStr += ResId::toString( IDEResId( RID_STR_SBXNAMEALLREADYUSED ) );
ErrorBox( this, WB_OK | WB_DEF_OK, aErrStr ).Execute();
@@ -1002,7 +1004,9 @@ void LibPage::InsertLib()
if ( !bOK )
{
::rtl::OUString aErrStr( ResId::toString( IDEResId( RID_STR_NOIMPORT ) ) );
- aErrStr = ::comphelper::string::replace(aErrStr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XX" ) ), aLibName);
+ aErrStr = aErrStr.replaceAllAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("XX"),
+ aLibName);
ErrorBox( this, WB_OK | WB_DEF_OK, aErrStr ).Execute();
continue;
}
diff --git a/basctl/source/dlged/managelang.cxx b/basctl/source/dlged/managelang.cxx
index 58fd948..c224f85 100644
--- a/basctl/source/dlged/managelang.cxx
+++ b/basctl/source/dlged/managelang.cxx
@@ -37,8 +37,9 @@
#include "helpid.hrc"
#include "managelang.hrc"
+#include <com/sun/star/i18n/Boundary.hpp>
#include <com/sun/star/i18n/WordType.hpp>
-#include <comphelper/string.hxx>
+#include <com/sun/star/i18n/XBreakIterator.hpp>
#include <editeng/unolingu.hxx>
#include <sfx2/bindings.hxx>
#include <svtools/langtab.hxx>
@@ -120,7 +121,7 @@ void ManageLanguageDialog::Init()
::rtl::OUString sLibName = pIDEShell->GetCurLibName();
// set dialog title with library name
::rtl::OUString sText = GetText();
- ::comphelper::string::replace(sText, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$1")), sLibName);
+ sText = sText.replaceAllAsciiL(RTL_CONSTASCII_STRINGPARAM("$1"), sLibName);
SetText( sText );
// set handler
m_aAddPB.SetClickHdl( LINK( this, ManageLanguageDialog, AddHdl ) );
diff --git a/comphelper/inc/comphelper/string.hxx b/comphelper/inc/comphelper/string.hxx
index 2c63954..f52021d 100644
--- a/comphelper/inc/comphelper/string.hxx
+++ b/comphelper/inc/comphelper/string.hxx
@@ -112,113 +112,33 @@ COMPHELPER_DLLPUBLIC inline rtl_String * SAL_CALL rtl_string_alloc(sal_Int32 nLe
return detail::string_alloc<rtl_String, sal_Char>(nLen);
}
-/**
- Replace the first occurrence of a substring with another string.
-
- @param source
- The source string, in which the search will take place.
-
- @param from
- The ASCII substring to search for. Must point to at least fromLength ASCII
- characters.
-
- @param fromLength
- The length of the from substring. Must not be negative.
-
- @param to
- The string to use as replacement.
-
- @param beginAt
- The index at which to begin the search. Must be between zero and the length
- of source, inclusive.
-
- @param replacedAt
- If non-null, receives the starting index at which the replacement took place
- or -1 if from was not found.
-
- @return
- The resulting string, in which the replacement has taken place.
-*/
-COMPHELPER_DLLPUBLIC rtl::OUString searchAndReplaceAsciiL(
- rtl::OUString const & source, char const * from, sal_Int32 fromLength,
- rtl::OUString const & to, sal_Int32 beginAt = 0,
- sal_Int32 * replacedAt = NULL);
-
-/** replaces, in the given source string, all occurrences of a given ASCII pattern
- with another ASCII pattern
-*/
-COMPHELPER_DLLPUBLIC ::rtl::OUString searchAndReplaceAllAsciiWithAscii(
- const ::rtl::OUString& source, const sal_Char* from, const sal_Char* to,
- const sal_Int32 beginAt = 0 );
-
-/** does an in-place replacement of the first occurrence of a sub string with
- another string
-
- @param source
- the string to search and replace in.
- @param asciiPattern
- the ASCII sub string to search for. Must point to a 0-terminated string.
- @param replace
- The string to use as replacement.
- @param beginAt
- The index at which to begin the search. Must be between zero and the length
- of source, inclusive.
-
- @param replacedAt
- If non-null, receives the starting index at which the replacement took place
- or -1 if from was not found.
-
- @return
- a reference to <code>source</code>
-*/
-COMPHELPER_DLLPUBLIC ::rtl::OUString&
- searchAndReplaceAsciiI( ::rtl::OUString & source, sal_Char const * asciiPattern,
- ::rtl::OUString const & replace, sal_Int32 beginAt = 0,
- sal_Int32 * replacedAt = NULL );
-
-/** Replaces each substring of this OString that matches the search OString
- with the specified replacement OString
-
- @param rIn The input OString
- @param rSearch The substring to be replaced
- @param rReplace The replacement substring
-
- @return The resulting OString
- */
-COMPHELPER_DLLPUBLIC rtl::OString replace(const rtl::OString &rIn,
- const rtl::OString &rSearch, const rtl::OString &rReplace);
-
-/** Replaces each substring of this OUString that matches the search OUString
- with the specified replacement OUString
-
- @param rIn The input OUString
- @param rSearch The substring to be replaced
- @param rReplace The replacement substring
-
- @return The resulting OUString
- */
-COMPHELPER_DLLPUBLIC rtl::OUString replace(const rtl::OUString &rIn,
- const rtl::OUString &rSearch, const rtl::OUString &rReplace);
-
/** Removes all occurrences of a character from within the source string
+ @deprecated Use rtl::OString::replaceAll(rtl::OString(c), rtl::OString())
+ instead.
+
@param rIn The input OString
@param c The character to be removed
@return The resulting OString
*/
-COMPHELPER_DLLPUBLIC rtl::OString remove(const rtl::OString &rIn,
- sal_Char c);
+inline rtl::OString remove(const rtl::OString &rIn,
+ sal_Char c)
+{ return rIn.replaceAll(rtl::OString(c), rtl::OString()); }
/** Removes all occurrences of a character from within the source string
+ @deprecated Use
+ rtl::OUString::replaceAll(rtl::OUString(c), rtl::OUString()) instead.
+
@param rIn The input OUString
@param c The character to be removed
@return The resulting OUString
*/
-COMPHELPER_DLLPUBLIC rtl::OUString remove(const rtl::OUString &rIn,
- sal_Unicode c);
+inline rtl::OUString remove(const rtl::OUString &rIn,
+ sal_Unicode c)
+{ return rIn.replaceAll(rtl::OUString(c), rtl::OUString()); }
/** Strips occurrences of a character from the start of the source string
@@ -282,32 +202,34 @@ COMPHELPER_DLLPUBLIC rtl::OUString strip(const rtl::OUString &rIn,
/** Returns a token in an OString
+ @deprecated Use rtl::OString::getToken(nToken, cTok) instead.
+
@param rIn the input OString
@param nToken the number of the token to return
@param cTok the character which seperate the tokens.
@return the token if token is negative or doesn't exist an empty token
is returned
*/
-COMPHELPER_DLLPUBLIC inline rtl::OString getToken(const rtl::OString &rIn,
+inline rtl::OString getToken(const rtl::OString &rIn,
sal_Int32 nToken, sal_Char cTok) SAL_THROW(())
{
- sal_Int32 nIndex = 0;
- return rIn.getToken(nToken, cTok, nIndex);
+ return rIn.getToken(nToken, cTok);
}
/** Returns a token in an OUString
+ @deprecated Use rtl::OUString::getToken(nToken, cTok) instead.
+
@param rIn the input OUString
@param nToken the number of the token to return
@param cTok the character which seperate the tokens.
@return the token if token is negative or doesn't exist an empty token
is returned
*/
-COMPHELPER_DLLPUBLIC inline rtl::OUString getToken(const rtl::OUString &rIn,
+inline rtl::OUString getToken(const rtl::OUString &rIn,
sal_Int32 nToken, sal_Unicode cTok) SAL_THROW(())
{
- sal_Int32 nIndex = 0;
- return rIn.getToken(nToken, cTok, nIndex);
+ return rIn.getToken(nToken, cTok);
}
/** Returns number of tokens in an OUString
@@ -326,80 +248,6 @@ COMPHELPER_DLLPUBLIC sal_Int32 getTokenCount(const rtl::OString &rIn, sal_Char c
*/
COMPHELPER_DLLPUBLIC sal_Int32 getTokenCount(const rtl::OUString &rIn, sal_Unicode cTok);
-/**
- Match against a substring appearing in another string.
-
- The result is true if and only if the second string appears as a substring
- of the first string, at the given position.
- This function can't be used for language specific comparison.
-
- @param rStr The string that pMatch will be compared to.
- @param pMatch The substring rStr is to be compared against
- @param nMatchLen The length of pMatch
- @param fromIndex The index to start the comparion from.
- The index must be greater or equal than 0
- and less or equal as the string length.
- @return sal_True if pMatch match with the characters in the string
- at the given position;
- sal_False, otherwise.
-*/
-COMPHELPER_DLLPUBLIC inline sal_Bool matchL(const rtl::OString& rStr, const char *pMatch, sal_Int32 nMatchLen, sal_Int32 fromIndex = 0) SAL_THROW(())
-{
- return rtl_str_shortenedCompare_WithLength( rStr.pData->buffer+fromIndex,
- rStr.pData->length-fromIndex, pMatch, nMatchLen, nMatchLen ) == 0;
-}
-
-/**
- Match against a substring appearing in this string, ignoring the case of
- ASCII letters.
-
- The result is true if and only if the second string appears as a substring
- of this string, at the given position.
- Character values between 65 and 90 (ASCII A-Z) are interpreted as
- values between 97 and 122 (ASCII a-z).
- This function can't be used for language specific comparison.
-
- @param rStr The string that pMatch will be compared to.
- @param pMatch The substring rStr is to be compared against
- @param nMatchLen The length of pMatch
- @param fromIndex the index to start the comparion from.
- The index must be greater or equal than 0
- and less or equal as the string length.
- @return sal_True if str match with the characters in the string
- at the given position;
- sal_False, otherwise.
-*/
-COMPHELPER_DLLPUBLIC inline sal_Bool matchIgnoreAsciiCaseL(const rtl::OString& rStr, const char *pMatch, sal_Int32 nMatchLen, sal_Int32 fromIndex = 0) SAL_THROW(())
-{
- return rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( rStr.pData->buffer+fromIndex, rStr.pData->length-fromIndex,
- pMatch, nMatchLen,
- nMatchLen ) == 0;
-}
-
-/**
- Returns the index within this string of the first occurrence of the
- specified substring, starting at the specified index.
-
- If str doesn't include any character, always -1 is
- returned. This is also the case, if both strings are empty.
-
- @param rStr The string that pSearch will be searched within.
- @param pSearch the substring to search for.
- @param nSearchLen the length of pSearch
- @param fromIndex the index to start the search from.
- @return If the string argument occurs one or more times as a substring
- within this string at the starting index, then the index
- of the first character of the first such substring is
- returned. If it does not occur as a substring starting
- at fromIndex or beyond, -1 is returned.
-*/
-COMPHELPER_DLLPUBLIC inline sal_Int32 indexOfL(const rtl::OString& rStr, const char *pSearch, sal_Int32 nSearchLen, sal_Int32 fromIndex = 0) SAL_THROW(())
-{
- sal_Int32 ret = rtl_str_indexOfStr_WithLength(rStr.pData->buffer+fromIndex,
- rStr.pData->length-fromIndex, pSearch, nSearchLen);
- return (ret < 0 ? ret : ret+fromIndex);
-}
-
namespace detail
{
template<typename B> B& truncateToLength(B& rBuffer, sal_Int32 nLen)
diff --git a/comphelper/qa/string/test_string.cxx b/comphelper/qa/string/test_string.cxx
index e53ae90..b775e01 100644
--- a/comphelper/qa/string/test_string.cxx
+++ b/comphelper/qa/string/test_string.cxx
@@ -44,9 +44,7 @@ namespace {
class TestString: public CppUnit::TestFixture
{
public:
- void testSearchAndReplaceAsciiL();
void testNatural();
- void testReplace();
void testRemove();
void testStripStart();
void testStripEnd();
@@ -56,12 +54,9 @@ public:
void testDecimalStringToNumber();
void testIsdigitAsciiString();
void testIndexOfL();
- void testMatchIgnoreAsciiCaseL();
CPPUNIT_TEST_SUITE(TestString);
- CPPUNIT_TEST(testSearchAndReplaceAsciiL);
CPPUNIT_TEST(testNatural);
- CPPUNIT_TEST(testReplace);
CPPUNIT_TEST(testRemove);
CPPUNIT_TEST(testStripStart);
CPPUNIT_TEST(testStripEnd);
@@ -70,41 +65,9 @@ public:
CPPUNIT_TEST(testTokenCount);
CPPUNIT_TEST(testDecimalStringToNumber);
CPPUNIT_TEST(testIsdigitAsciiString);
- CPPUNIT_TEST(testIndexOfL);
- CPPUNIT_TEST(testMatchIgnoreAsciiCaseL);
CPPUNIT_TEST_SUITE_END();
};
-void TestString::testSearchAndReplaceAsciiL()
-{
- rtl::OUString s1(RTL_CONSTASCII_USTRINGPARAM("foobarbar"));
- sal_Int32 n1;
- rtl::OUString s2(
- comphelper::string::searchAndReplaceAsciiL(
- s1, RTL_CONSTASCII_STRINGPARAM("bar"),
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("baaz")), 0, &n1));
- CPPUNIT_ASSERT(
- s2 == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobaazbar")));
- CPPUNIT_ASSERT(n1 == 3);
- sal_Int32 n2;
- rtl::OUString s3(
- comphelper::string::searchAndReplaceAsciiL(
- s2, RTL_CONSTASCII_STRINGPARAM("bar"),
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bz")),
- n1 + RTL_CONSTASCII_LENGTH("baaz"), &n2));
- CPPUNIT_ASSERT(
- s3 == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobaazbz")));
- CPPUNIT_ASSERT(n2 == 7);
- sal_Int32 n3;
- rtl::OUString s4(
- comphelper::string::searchAndReplaceAsciiL(
- s3, RTL_CONSTASCII_STRINGPARAM("bar"),
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("baz")),
- n2 + RTL_CONSTASCII_LENGTH("bz"), &n3));
- CPPUNIT_ASSERT(s4 == s3);
- CPPUNIT_ASSERT(n3 == -1);
-}
-
void TestString::testDecimalStringToNumber()
{
rtl::OUString s1(RTL_CONSTASCII_USTRINGPARAM("1234"));
@@ -129,40 +92,6 @@ void TestString::testIsdigitAsciiString()
CPPUNIT_ASSERT_EQUAL(comphelper::string::isdigitAsciiString(s3), true);
}
-void TestString::testIndexOfL()
-{
- rtl::OString s1(RTL_CONSTASCII_STRINGPARAM("one two three"));
-
- CPPUNIT_ASSERT_EQUAL(comphelper::string::indexOfL(s1,
- RTL_CONSTASCII_STRINGPARAM("one")), static_cast<sal_Int32>(0));
-
- CPPUNIT_ASSERT_EQUAL(comphelper::string::indexOfL(s1,
- RTL_CONSTASCII_STRINGPARAM("two")), static_cast<sal_Int32>(4));
-
- CPPUNIT_ASSERT_EQUAL(comphelper::string::indexOfL(s1,
- RTL_CONSTASCII_STRINGPARAM("four")), static_cast<sal_Int32>(-1));
-
- CPPUNIT_ASSERT_EQUAL(comphelper::string::indexOfL(s1,
- RTL_CONSTASCII_STRINGPARAM("two"), 5), static_cast<sal_Int32>(-1));
-}
-
-void TestString::testMatchIgnoreAsciiCaseL()
-{
- rtl::OString s1(RTL_CONSTASCII_STRINGPARAM("one two three"));
-
- CPPUNIT_ASSERT_EQUAL(comphelper::string::matchIgnoreAsciiCaseL(s1,
- RTL_CONSTASCII_STRINGPARAM("one")), sal_True);
-
- CPPUNIT_ASSERT_EQUAL(comphelper::string::matchIgnoreAsciiCaseL(s1,
- RTL_CONSTASCII_STRINGPARAM("ONE")), sal_True);
-
- CPPUNIT_ASSERT_EQUAL(comphelper::string::matchIgnoreAsciiCaseL(s1,
- RTL_CONSTASCII_STRINGPARAM("two")), sal_False);
-
- CPPUNIT_ASSERT_EQUAL(comphelper::string::matchIgnoreAsciiCaseL(s1,
- RTL_CONSTASCII_STRINGPARAM("two"), 4), sal_True);
-}
-
using namespace ::com::sun::star;
class testCollator : public cppu::WeakImplHelper1< i18n::XCollator >
@@ -357,41 +286,6 @@ void TestString::testNatural()
);
}
-void TestString::testReplace()
-{
- ::rtl::OString aIn(RTL_CONSTASCII_STRINGPARAM("aaa"));
- ::rtl::OString aOut;
-
- aOut = ::comphelper::string::replace(aIn,
- rtl::OString(RTL_CONSTASCII_STRINGPARAM("aa")),
- rtl::OString(RTL_CONSTASCII_STRINGPARAM("b")));
- CPPUNIT_ASSERT(aOut.equalsL(RTL_CONSTASCII_STRINGPARAM("ba")));
-
- aOut = ::comphelper::string::replace(aIn,
- rtl::OString(),
- rtl::OString(RTL_CONSTASCII_STRINGPARAM("whatever")));
- CPPUNIT_ASSERT(aOut.equalsL(RTL_CONSTASCII_STRINGPARAM("aaa")));
-
- aOut = ::comphelper::string::replace(aIn,
- rtl::OString(RTL_CONSTASCII_STRINGPARAM("aaa")),
- rtl::OString());
- CPPUNIT_ASSERT(aOut.isEmpty());
-
- aIn = rtl::OString(RTL_CONSTASCII_STRINGPARAM("aaa foo aaa foo bbb"));
-
- aOut = ::comphelper::string::replace(aIn,
- rtl::OString(RTL_CONSTASCII_STRINGPARAM("foo")),
- rtl::OString(RTL_CONSTASCII_STRINGPARAM("bar")));
- CPPUNIT_ASSERT(aOut.equalsL(
- RTL_CONSTASCII_STRINGPARAM("aaa bar aaa bar bbb")));
-
- aOut = ::comphelper::string::replace(aIn,
- rtl::OString(' '),
- rtl::OString());
- CPPUNIT_ASSERT(aOut.equalsL(
- RTL_CONSTASCII_STRINGPARAM("aaafooaaafoobbb")));
-}
-
void TestString::testRemove()
{
::rtl::OString aIn(RTL_CONSTASCII_STRINGPARAM("abc"));
diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx
index 8514a83..3547de6 100644
--- a/comphelper/source/misc/string.cxx
+++ b/comphelper/source/misc/string.cxx
@@ -48,126 +48,6 @@
namespace comphelper { namespace string {
-rtl::OUString searchAndReplaceAsciiL(
- rtl::OUString const & source, char const * from, sal_Int32 fromLength,
- rtl::OUString const & to, sal_Int32 beginAt, sal_Int32 * replacedAt)
-{
- sal_Int32 n = source.indexOfAsciiL(from, fromLength, beginAt);
- if (replacedAt != NULL) {
- *replacedAt = n;
- }
- return n == -1 ? source : source.replaceAt(n, fromLength, to);
-}
-
-::rtl::OUString searchAndReplaceAllAsciiWithAscii(
- const ::rtl::OUString& _source, const sal_Char* _from, const sal_Char* _to,
- const sal_Int32 _beginAt )
-{
- sal_Int32 fromLength = strlen( _from );
- sal_Int32 n = _source.indexOfAsciiL( _from, fromLength, _beginAt );
- if ( n == -1 )
- return _source;
-
- ::rtl::OUString dest( _source );
- ::rtl::OUString to( ::rtl::OUString::createFromAscii( _to ) );
- do
- {
- dest = dest.replaceAt( n, fromLength, to );
- n = dest.indexOfAsciiL( _from, fromLength, n + to.getLength() );
- }
- while ( n != -1 );
-
- return dest;
-}
-
-::rtl::OUString& searchAndReplaceAsciiI(
- ::rtl::OUString & _source, sal_Char const * _asciiPattern, ::rtl::OUString const & _replace,
- sal_Int32 _beginAt, sal_Int32 * _replacedAt )
-{
- sal_Int32 fromLength = strlen( _asciiPattern );
- sal_Int32 n = _source.indexOfAsciiL( _asciiPattern, fromLength, _beginAt );
- if ( _replacedAt != NULL )
- *_replacedAt = n;
-
- if ( n != -1 )
- _source = _source.replaceAt( n, fromLength, _replace );
-
- return _source;
-}
-
-namespace
-{
- template <typename T, typename O> T tmpl_replace(const T &rIn,
- const T &rSearch, const T &rReplace)
- {
- if (rIn.isEmpty() || rSearch.isEmpty())
- return rIn;
-
- O aRet;
-
- sal_Int32 nFromIndex = 0;
- while (nFromIndex < rIn.getLength())
- {
- sal_Int32 nIndex = rIn.indexOf(rSearch, nFromIndex);
- if (nIndex == -1)
- {
- aRet.append(rIn.copy(nFromIndex));
- break;
- }
- aRet.append(rIn.copy(nFromIndex, nIndex-nFromIndex));
- aRet.append(rReplace);
- nFromIndex = nIndex+rSearch.getLength();
- }
-
- return aRet.makeStringAndClear();
- }
-}
-
-rtl::OString replace(const rtl::OString &rIn, const rtl::OString &rSearch,
- const rtl::OString &rReplace)
-{
- return tmpl_replace<rtl::OString, rtl::OStringBuffer>(rIn, rSearch,
- rReplace);
-}
-
-rtl::OUString replace(const rtl::OUString &rIn, const rtl::OUString &rSearch,
- const rtl::OUString &rReplace)
-{
- return tmpl_replace<rtl::OUString, rtl::OUStringBuffer>(rIn, rSearch,
- rReplace);
-}
-
-namespace
-{
- template <typename T, typename C, typename O> T tmpl_remove(const T &rIn,
- const C cRemove)
- {
- if (rIn.isEmpty())
- return rIn;
-
- O aRet;
-
- for (sal_Int32 i = 0; i < rIn.getLength(); ++i)
- {
- C cChar = rIn[i];
- if (cChar != cRemove)
- aRet.append(cChar);
- }
-
- return aRet.makeStringAndClear();
- }
-}
-
-rtl::OString remove(const rtl::OString &rIn, sal_Char c)
-{
- return tmpl_remove<rtl::OString, sal_Char, rtl::OStringBuffer>(rIn, c);
-}
-
-rtl::OUString remove(const rtl::OUString &rIn, sal_Unicode c)
-{
- return tmpl_remove<rtl::OUString, sal_Unicode, rtl::OUStringBuffer>(rIn, c);
-}
-
namespace
{
template <typename T, typename C> T tmpl_stripStart(const T &rIn,
diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx
index 8a077a5..ae89717 100644
--- a/dbaccess/source/core/dataaccess/datasource.cxx
+++ b/dbaccess/source/core/dataaccess/datasource.cxx
@@ -66,7 +66,6 @@
#include <comphelper/property.hxx>
#include <comphelper/seqstream.hxx>
#include <comphelper/sequence.hxx>
-#include <comphelper/string.hxx>
#include <connectivity/dbexception.hxx>
#include <connectivity/dbtools.hxx>
#include <cppuhelper/typeprovider.hxx>
@@ -747,8 +746,9 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const ::rtl::O
::rtl::OUString sMessage = DBACORE_RESSTRING( nExceptionMessageId );
SQLContext aContext;
- aContext.Message = DBACORE_RESSTRING( RID_STR_CONNECTION_REQUEST );
- ::comphelper::string::searchAndReplaceAsciiI( aContext.Message, "$name$", m_pImpl->m_sConnectURL );
+ aContext.Message = DBACORE_RESSTRING(RID_STR_CONNECTION_REQUEST).
+ replaceFirstAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("$name$"), m_pImpl->m_sConnectURL);
throwGenericSQLException( sMessage, static_cast< XDataSource* >( this ), makeAny( aContext ) );
}
diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx
index e5c485e..082a6f3 100644
--- a/dbaccess/source/core/dataaccess/documentcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx
@@ -43,7 +43,6 @@
#include "datasource.hxx"
#include <comphelper/classids.hxx>
#include <comphelper/mimeconfighelper.hxx>
-#include <comphelper/string.hxx>
#include <connectivity/sqlerror.hxx>
#include "core_resource.hxx"
#include "core_resource.hrc"
@@ -542,8 +541,9 @@ Reference< XComponent > SAL_CALL ODocumentContainer::loadComponentFromURL( const
::rtl::OUString sName;
if ( !lcl_queryContent(_sURL,xNameContainer,aContent,sName) )
{
- ::rtl::OUString sMessage( DBA_RES( RID_STR_NAME_NOT_FOUND ) );
- ::comphelper::string::searchAndReplaceAsciiI( sMessage, "$name$", _sURL );
+ ::rtl::OUString sMessage(
+ DBA_RES(RID_STR_NAME_NOT_FOUND).replaceFirstAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("$name$"), _sURL));
throw IllegalArgumentException( sMessage, *this, 1 );
}
@@ -611,9 +611,11 @@ void SAL_CALL ODocumentContainer::insertByHierarchicalName( const ::rtl::OUStrin
if ( !xNameContainer.is() )
{
- ::rtl::OUString sMessage( DBA_RES( RID_STR_NO_SUB_FOLDER ) );
sal_Int32 index = sName.getLength();
- ::comphelper::string::searchAndReplaceAsciiI( sMessage, "$folder$", _sName.getToken(0,'/',index) );
+ ::rtl::OUString sMessage(
+ DBA_RES(RID_STR_NO_SUB_FOLDER).replaceFirstAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("$folder$"),
+ _sName.getToken(0,'/',index)));
throw IllegalArgumentException( sMessage, *this, 1 );
}
diff --git a/dbaccess/source/ext/macromigration/migrationengine.cxx b/dbaccess/source/ext/macromigration/migrationengine.cxx
index 6515586..5bdde99 100644
--- a/dbaccess/source/ext/macromigration/migrationengine.cxx
+++ b/dbaccess/source/ext/macromigration/migrationengine.cxx
@@ -72,7 +72,6 @@
#include <comphelper/interaction.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/storagehelper.hxx>
-#include <comphelper/string.hxx>
#include <comphelper/types.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <tools/diagnose_ex.h>
@@ -254,8 +253,13 @@ namespace dbmm
//----------------------------------------------------------------
::rtl::OUString lcl_getSubDocumentDescription( const SubDocument& _rDocument )
{
- ::rtl::OUString sObjectName = ResId::toString(MacroMigrationResId( _rDocument.eType == eForm ? STR_FORM : STR_REPORT));
- ::comphelper::string::searchAndReplaceAsciiI( sObjectName, "$name$", _rDocument.sHierarchicalName );
+ ::rtl::OUString sObjectName(
+ ResId::toString(
+ MacroMigrationResId(
+ _rDocument.eType == eForm ? STR_FORM : STR_REPORT)).
+ replaceFirstAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("$name$"),
+ _rDocument.sHierarchicalName));
return sObjectName;
}
@@ -1025,8 +1029,11 @@ namespace dbmm
// initialize global progress
sal_Int32 nOverallRange( m_aSubDocs.size() );
- String sProgressSkeleton = ResId::toString(MacroMigrationResId( STR_OVERALL_PROGRESS));
- sProgressSkeleton.SearchAndReplaceAscii( "$overall$", String::CreateFromInt32( nOverallRange ) );
+ rtl::OUString sProgressSkeleton(
+ ResId::toString(MacroMigrationResId( STR_OVERALL_PROGRESS)).
+ replaceFirstAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("$overall$"),
+ rtl::OUString::valueOf(nOverallRange)));
m_rProgress.start( nOverallRange );
@@ -1037,8 +1044,10 @@ namespace dbmm
{
sal_Int32 nOverallProgressValue( doc - m_aSubDocs.begin() + 1 );
// update overall progress text
- ::rtl::OUString sOverallProgress( sProgressSkeleton );
- ::comphelper::string::searchAndReplaceAsciiI( sOverallProgress, "$current$", ::rtl::OUString::valueOf( nOverallProgressValue ) );
+ ::rtl::OUString sOverallProgress(
+ sProgressSkeleton.replaceFirstAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("$current$"),
+ ::rtl::OUString::valueOf(nOverallProgressValue)));
m_rProgress.setOverallProgressText( sOverallProgress );
// migrate document
@@ -1927,12 +1936,16 @@ namespace dbmm
const ScriptType _eScriptType, const ::rtl::OUString& _rLibraryName ) const
{
// a human-readable description of the affected library
- ::rtl::OUString sLibraryDescription( ResId::toString(
- MacroMigrationResId( STR_LIBRARY_TYPE_AND_NAME ) ) );
- ::comphelper::string::searchAndReplaceAsciiI( sLibraryDescription, "$type$",
- getScriptTypeDisplayName( _eScriptType ) );
- ::comphelper::string::searchAndReplaceAsciiI( sLibraryDescription, "$library$",
- _rLibraryName );
+ ::rtl::OUString sLibraryDescription(
+ ResId::toString(MacroMigrationResId(STR_LIBRARY_TYPE_AND_NAME)).
+ replaceFirstAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("$type$"),
+ getScriptTypeDisplayName(_eScriptType)).
+ replaceFirstAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("$library$"), _rLibraryName));
+ //TODO: probably broken if first replaceFirstAsciiL can produce
+ // fresh instance of "$library$" in subject string of second
+ // replaceFirstAsciiL
InteractionHandler aHandler( m_aContext, m_xDocumentModel );
::rtl::OUString sPassword;
diff --git a/dbaccess/source/ext/macromigration/migrationlog.cxx b/dbaccess/source/ext/macromigration/migrationlog.cxx
index 38ded5a..06391ce 100644
--- a/dbaccess/source/ext/macromigration/migrationlog.cxx
+++ b/dbaccess/source/ext/macromigration/migrationlog.cxx
@@ -36,7 +36,6 @@
/** === end UNO includes === **/
#include <comphelper/anytostring.hxx>
-#include <comphelper/string.hxx>
#include <tools/string.hxx>
#include <rtl/ustrbuf.hxx>
@@ -240,22 +239,25 @@ namespace dbmm
static void lcl_appendErrorDescription( ::rtl::OUStringBuffer& _inout_rBuffer, const MigrationError& _rError )
{
const sal_Char* pAsciiErrorDescription( NULL );
- ::std::vector< const sal_Char* > aAsciiParameterNames;
+ ::std::vector< rtl::OUString > aParameterNames;
switch ( _rError.eType )
{
case ERR_OPENING_SUB_DOCUMENT_FAILED:
pAsciiErrorDescription = "opening '#doc#' failed";
- aAsciiParameterNames.push_back( "#doc#" );
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
break;
case ERR_CLOSING_SUB_DOCUMENT_FAILED:
pAsciiErrorDescription = "closing '#doc#' failed";
- aAsciiParameterNames.push_back( "#doc#" );
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
break;
case ERR_STORAGE_COMMIT_FAILED:
pAsciiErrorDescription = "committing the changes for document '#doc#' failed";
- aAsciiParameterNames.push_back( "#doc#" );
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
break;
case ERR_STORING_DATABASEDOC_FAILED:
@@ -268,52 +270,66 @@ namespace dbmm
case ERR_UNEXPECTED_LIBSTORAGE_ELEMENT:
pAsciiErrorDescription = "unexpected #lib# storage element in document '#doc#', named '#element#'";
- aAsciiParameterNames.push_back( "#doc#" );
- aAsciiParameterNames.push_back( "#libstore#" );
- aAsciiParameterNames.push_back( "#element#" );
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#libstore#")));
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#element#")));
break;
case ERR_CREATING_DBDOC_SCRIPT_STORAGE_FAILED:
pAsciiErrorDescription = "creating the database document's storage for #scripttype# scripts failed";
- aAsciiParameterNames.push_back( "#scripttype#" );
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#scripttype#")));
break;
case ERR_COMMITTING_SCRIPT_STORAGES_FAILED:
pAsciiErrorDescription = "saving the #scripttype# scripts for document '#doc#' failed";
- aAsciiParameterNames.push_back( "#scripttype#" );
- aAsciiParameterNames.push_back( "#doc#" );
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#scripttype#")));
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
break;
case ERR_GENERAL_SCRIPT_MIGRATION_FAILURE:
pAsciiErrorDescription = "general error while migrating #scripttype# scripts of document '#doc#'";
- aAsciiParameterNames.push_back( "#scripttype#" );
- aAsciiParameterNames.push_back( "#doc#" );
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#scripttype#")));
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
break;
case ERR_GENERAL_MACRO_MIGRATION_FAILURE:
pAsciiErrorDescription = "general error during macro migration of document '#doc#'";
- aAsciiParameterNames.push_back( "#doc#" );
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
break;
case ERR_UNKNOWN_SCRIPT_TYPE:
pAsciiErrorDescription = "unknown script type: #type#";
- aAsciiParameterNames.push_back( "#type#" );
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#type#")));
break;
case ERR_UNKNOWN_SCRIPT_LANGUAGE:
pAsciiErrorDescription = "unknown script language: #lang#";
- aAsciiParameterNames.push_back( "#lang#" );
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#lang#")));
break;
case ERR_UNKNOWN_SCRIPT_NAME_FORMAT:
pAsciiErrorDescription = "unknown script name format: #script#";
- aAsciiParameterNames.push_back( "#script#" );
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#script#")));
break;
case ERR_SCRIPT_TRANSLATION_FAILURE:
pAsciiErrorDescription = "analyzing/translating the script URL failed; script type: #type#; script: #code#";
- aAsciiParameterNames.push_back( "#type#" );
- aAsciiParameterNames.push_back( "#code#" );
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#type#")));
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#code#")));
break;
case ERR_INVALID_SCRIPT_DESCRIPTOR_FORMAT:
@@ -322,57 +338,72 @@ namespace dbmm
case ERR_ADJUSTING_DOCUMENT_EVENTS_FAILED:
pAsciiErrorDescription = "adjusting events for document '#doc#' failed";
- aAsciiParameterNames.push_back( "#doc#" );
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
break;
case ERR_ADJUSTING_DIALOG_EVENTS_FAILED:
pAsciiErrorDescription = "adjusting events for dialog #lib#.#dlg# in document '#doc#' failed";
- aAsciiParameterNames.push_back( "#doc#" );
- aAsciiParameterNames.push_back( "#lib#" );
- aAsciiParameterNames.push_back( "#dlg#" );
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#lib#")));
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#dlg#")));
break;
case ERR_ADJUSTING_FORMCOMP_EVENTS_FAILED:
pAsciiErrorDescription = "adjusting form component events for '#doc#' failed";
- aAsciiParameterNames.push_back( "#doc#" );
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
break;
case ERR_BIND_SCRIPT_STORAGE_FAILED:
pAsciiErrorDescription = "binding to the script storage failed for document '#doc#'";
- aAsciiParameterNames.push_back( "#doc#" );
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
break;
case ERR_REMOVE_SCRIPTS_STORAGE_FAILED:
pAsciiErrorDescription = "removing a scripts storage failed for document '#doc#'";
- aAsciiParameterNames.push_back( "#doc#" );
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
break;
case ERR_DOCUMENT_BACKUP_FAILED:
pAsciiErrorDescription = "backing up the document to #location# failed";
- aAsciiParameterNames.push_back( "#location#" );
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#location#")));
break;
case ERR_UNKNOWN_SCRIPT_FOLDER:
pAsciiErrorDescription = "unknown script folder '#name#' in document '#doc#'";
- aAsciiParameterNames.push_back( "#doc#" );
- aAsciiParameterNames.push_back( "#name#" );
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#name#")));
break;
case ERR_EXAMINING_SCRIPTS_FOLDER_FAILED:
pAsciiErrorDescription = "examining the 'Scripts' folder failed for document '#doc#'";
- aAsciiParameterNames.push_back( "#doc#" );
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
break;
case ERR_PASSWORD_VERIFICATION_FAILED:
pAsciiErrorDescription = "password verification failed for document '#doc#', #libtype# library '#name#'";
- aAsciiParameterNames.push_back( "#doc#" );
- aAsciiParameterNames.push_back( "#libtype#" );
- aAsciiParameterNames.push_back( "#name#" );
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#libtype#")));
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#name#")));
break;
case ERR_NEW_STYLE_REPORT:
pAsciiErrorDescription = "#doc# could not be processed, since you don't have the Oracle Report Builder (TM) extension installed.";
- aAsciiParameterNames.push_back( "#doc#" );
+ aParameterNames.push_back(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("#doc#")));
break;
// do *not* add a default case here: Without a default, some compilers will warn you when
@@ -382,13 +413,13 @@ namespace dbmm
if ( pAsciiErrorDescription )
{
::rtl::OUString sSubstituted( ::rtl::OUString::createFromAscii( pAsciiErrorDescription ) );
- OSL_ENSURE( aAsciiParameterNames.size() == _rError.aErrorDetails.size(),
+ OSL_ENSURE( aParameterNames.size() == _rError.aErrorDetails.size(),
"lcl_appendErrorDescription: unexpected number of error message parameters!" );
- for ( size_t i=0; i < ::std::min( aAsciiParameterNames.size(), _rError.aErrorDetails.size() ); ++i )
+ for ( size_t i=0; i < ::std::min( aParameterNames.size(), _rError.aErrorDetails.size() ); ++i )
{
- ::comphelper::string::searchAndReplaceAsciiI( sSubstituted, aAsciiParameterNames[i],
- _rError.aErrorDetails[i] );
+ sSubstituted = sSubstituted.replaceFirst(
+ aParameterNames[i], _rError.aErrorDetails[i]);
}
_inout_rBuffer.append( sSubstituted );
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index 3fd0762..b3f34f3 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -90,7 +90,6 @@
#include <comphelper/sequence.hxx>
#include <comphelper/uno3.hxx>
-#include <comphelper/string.hxx>
#include <comphelper/types.hxx>
#include <comphelper/interaction.hxx>
#include <comphelper/componentcontext.hxx>
@@ -2964,8 +2963,12 @@ void SAL_CALL OApplicationController::removeSelectionChangeListener( const Refer
default:
case DatabaseObjectContainer::DATA_SOURCE:
{
- ::rtl::OUString sMessage = String(ModuleRes( RID_STR_UNSUPPORTED_OBJECT_TYPE ));
- ::comphelper::string::searchAndReplaceAsciiI( sMessage, "$type$", ::rtl::OUString::valueOf(sal_Int32( pObject->Type )) );
+ ::rtl::OUString sMessage(
+ rtl::OUString(
+ String(ModuleRes(RID_STR_UNSUPPORTED_OBJECT_TYPE))).
+ replaceFirstAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("$type$"),
+ ::rtl::OUString::valueOf(sal_Int32(pObject->Type))));
throw IllegalArgumentException(sMessage, *this, sal_Int16( pObject - aSelectedObjects.getConstArray() ));
}
}
diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx
index 129721b..cfcadfc 100644
--- a/dbaccess/source/ui/uno/copytablewizard.cxx
+++ b/dbaccess/source/ui/uno/copytablewizard.cxx
@@ -68,7 +68,6 @@
#include <comphelper/interaction.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/proparrhlp.hxx>
-#include <comphelper/string.hxx>
#include <connectivity/dbexception.hxx>
#include <connectivity/dbtools.hxx>
#include <cppuhelper/exc_hlp.hxx>
@@ -762,8 +761,10 @@ void CopyTableWizard::impl_checkForUnsupportedSettings_throw( const Reference< X
if ( !sUnsupportedSetting.isEmpty() )
{
- ::rtl::OUString sMessage( String(ModuleRes( STR_CTW_ERROR_UNSUPPORTED_SETTING )) );
- ::comphelper::string::searchAndReplaceAsciiI( sMessage, "$name$", sUnsupportedSetting );
+ ::rtl::OUString sMessage(
+ rtl::OUString(String(ModuleRes(STR_CTW_ERROR_UNSUPPORTED_SETTING))).
+ replaceFirstAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("$name$"), sUnsupportedSetting));
throw IllegalArgumentException(
sMessage,
*const_cast< CopyTableWizard* >( this ),
diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
index 53a1794..62347ce 100644
--- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
@@ -75,10 +75,8 @@
#include "cppuhelper/exc_hlp.hxx"
#include "cppuhelper/implbase3.hxx"
#include "comphelper/anytostring.hxx"
-#include "comphelper/string.hxx"
#include "vcl/msgbox.hxx"
#include "toolkit/helper/vclunohelper.hxx"
-#include "comphelper/processfactory.hxx"
#include "dp_gui.h"
#include "dp_gui_thread.hxx"
@@ -899,7 +897,9 @@ void ExtensionCmdQueue::Thread::_addExtension( ::rtl::Reference< ProgressCmdEnv
rCmdEnv->setWarnUser( bWarnUser );
uno::Reference< deployment::XExtensionManager > xExtMgr = m_pManager->getExtensionManager();
uno::Reference< task::XAbortChannel > xAbortChannel( xExtMgr->createAbortChannel() );
- OUString sTitle = comphelper::string::replace(m_sAddingPackages, OUSTR("%EXTENSION_NAME"), sName);
+ OUString sTitle(
+ m_sAddingPackages.replaceAllAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("%EXTENSION_NAME"), sName));
rCmdEnv->progressSection( sTitle, xAbortChannel );
try
@@ -926,7 +926,10 @@ void ExtensionCmdQueue::Thread::_removeExtension( ::rtl::Reference< ProgressCmdE
{
uno::Reference< deployment::XExtensionManager > xExtMgr = m_pManager->getExtensionManager();
uno::Reference< task::XAbortChannel > xAbortChannel( xExtMgr->createAbortChannel() );
- OUString sTitle = comphelper::string::replace(m_sRemovingPackages, OUSTR("%EXTENSION_NAME"), xPackage->getDisplayName());
+ OUString sTitle(
+ m_sRemovingPackages.replaceAllAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("%EXTENSION_NAME"),
+ xPackage->getDisplayName()));
rCmdEnv->progressSection( sTitle, xAbortChannel );
OUString id( dp_misc::getIdentifier( xPackage ) );
@@ -1009,7 +1012,10 @@ void ExtensionCmdQueue::Thread::_enableExtension( ::rtl::Reference< ProgressCmdE
uno::Reference< deployment::XExtensionManager > xExtMgr = m_pManager->getExtensionManager();
uno::Reference< task::XAbortChannel > xAbortChannel( xExtMgr->createAbortChannel() );
- OUString sTitle = comphelper::string::replace(m_sEnablingPackages, OUSTR("%EXTENSION_NAME"), xPackage->getDisplayName());
+ OUString sTitle(
+ m_sEnablingPackages.replaceAllAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("%EXTENSION_NAME"),
+ xPackage->getDisplayName()));
rCmdEnv->progressSection( sTitle, xAbortChannel );
try
@@ -1031,7 +1037,10 @@ void ExtensionCmdQueue::Thread::_disableExtension( ::rtl::Reference< ProgressCmd
uno::Reference< deployment::XExtensionManager > xExtMgr = m_pManager->getExtensionManager();
uno::Reference< task::XAbortChannel > xAbortChannel( xExtMgr->createAbortChannel() );
- OUString sTitle = comphelper::string::replace(m_sDisablingPackages, OUSTR("%EXTENSION_NAME"), xPackage->getDisplayName());
+ OUString sTitle(
+ m_sDisablingPackages.replaceAllAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("%EXTENSION_NAME"),
+ xPackage->getDisplayName()));
rCmdEnv->progressSection( sTitle, xAbortChannel );
try
@@ -1053,7 +1062,10 @@ void ExtensionCmdQueue::Thread::_acceptLicense( ::rtl::Reference< ProgressCmdEnv
uno::Reference< deployment::XExtensionManager > xExtMgr = m_pManager->getExtensionManager();
uno::Reference< task::XAbortChannel > xAbortChannel( xExtMgr->createAbortChannel() );
- OUString sTitle = comphelper::string::replace(m_sAcceptLicense, OUSTR("%EXTENSION_NAME"), xPackage->getDisplayName());
+ OUString sTitle(
+ m_sAcceptLicense.replaceAllAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("%EXTENSION_NAME"),
+ xPackage->getDisplayName()));
rCmdEnv->progressSection( sTitle, xAbortChannel );
try
diff --git a/desktop/source/deployment/misc/dp_dependencies.cxx b/desktop/source/deployment/misc/dp_dependencies.cxx
index 7581af8..e24873f 100644
--- a/desktop/source/deployment/misc/dp_dependencies.cxx
+++ b/desktop/source/deployment/misc/dp_dependencies.cxx
@@ -32,7 +32,6 @@
#include "com/sun/star/uno/Sequence.hxx"
#include "com/sun/star/xml/dom/XElement.hpp"
#include "com/sun/star/xml/dom/XNodeList.hpp"
-#include "comphelper/string.hxx"
#include "rtl/bootstrap.hxx"
#include "rtl/string.h"
#include "rtl/ustring.h"
@@ -94,8 +93,8 @@ bool satisfiesMaximalVersion(
rtl::OUString produceErrorText(
rtl::OUString const & reason, rtl::OUString const & version)
{
- return comphelper::string::searchAndReplaceAsciiL(
- reason, RTL_CONSTASCII_STRINGPARAM("%VERSION"),
+ return reason.replaceFirstAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("%VERSION"),
(version.isEmpty()
? ResId::toString(
dp_misc::getResId(RID_DEPLOYMENT_DEPENDENCIES_UNKNOWN))
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx
index d08a175..e12e640 100644
--- a/extensions/source/scanner/sanedlg.cxx
+++ b/extensions/source/scanner/sanedlg.cxx
@@ -38,7 +38,6 @@
#include <math.h>
#include <sal/macros.h>
#include <rtl/strbuf.hxx>
-#include <comphelper/string.hxx>
ResId SaneResId( sal_uInt32 nID )
{
@@ -1212,20 +1211,18 @@ sal_Bool SaneDlg::LoadState()
if( nOption == -1 )
continue;
- using comphelper::string::matchL;
-
- if (matchL(aValue, RTL_CONSTASCII_USTRINGPARAM("BOOL=")))
+ if (aValue.matchL(RTL_CONSTASCII_STRINGPARAM("BOOL=")))
{
aValue = aValue.copy(RTL_CONSTASCII_LENGTH("BOOL="));
sal_Bool aBOOL = (sal_Bool)aValue.toInt32();
mrSane.SetOptionValue( nOption, aBOOL );
}
- else if (matchL(aValue, RTL_CONSTASCII_USTRINGPARAM("STRING=")))
+ else if (aValue.matchL(RTL_CONSTASCII_STRINGPARAM("STRING=")))
{
aValue = aValue.copy(RTL_CONSTASCII_LENGTH("STRING="));
mrSane.SetOptionValue(nOption,rtl::OStringToOUString(aValue, osl_getThreadTextEncoding()) );
}
- else if (matchL(aValue, RTL_CONSTASCII_USTRINGPARAM("NUMERIC=")))
+ else if (aValue.matchL(RTL_CONSTASCII_STRINGPARAM("NUMERIC=")))
{
aValue = aValue.copy(RTL_CONSTASCII_LENGTH("NUMERIC="));
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index cae935b..6bbfc29 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -81,7 +81,6 @@
#include <comphelper/configurationhelper.hxx>
#include <comphelper/mediadescriptor.hxx>
#include <comphelper/namedvaluecollection.hxx>
-#include <comphelper/string.hxx>
#include <vcl/svapp.hxx>
#include <unotools/pathoptions.hxx>
#include <tools/diagnose_ex.h>
@@ -3483,8 +3482,6 @@ sal_Bool AutoRecovery::impl_enoughDiscSpace(sal_Int32 nRequiredSpace)
//-----------------------------------------------
void AutoRecovery::impl_showFullDiscError()
{
- rtl::OUString PLACEHOLDER_PATH(RTL_CONSTASCII_USTRINGPARAM("%PATH"));
-
rtl::OUString sBtn(ResId::toString(FwkResId(STR_FULL_DISC_RETRY_BUTTON)));
rtl::OUString sMsg(ResId::toString(FwkResId(STR_FULL_DISC_MSG)));
@@ -3495,7 +3492,10 @@ void AutoRecovery::impl_showFullDiscError()
if (sBackupPath.getLength() < 1)
sBackupPath = sBackupURL;
- ErrorBox dlgError(0, WB_OK, comphelper::string::replace(sMsg, PLACEHOLDER_PATH, sBackupPath));
+ ErrorBox dlgError(
+ 0, WB_OK,
+ sMsg.replaceAllAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("%PATH"), sBackupPath));
dlgError.SetButtonText(dlgError.GetButtonId(0), sBtn);
dlgError.Execute();
}
diff --git a/l10ntools/inc/export.hxx b/l10ntools/inc/export.hxx
index 5e08239..2355f5b 100644
--- a/l10ntools/inc/export.hxx
+++ b/l10ntools/inc/export.hxx
@@ -54,8 +54,6 @@
#include <direct.h>
#endif
-#include "helper.hxx"
-
#define NO_TRANSLATE_ISO "x-no-translate"
class PFormEntrys;
@@ -196,8 +194,8 @@ public:
pPairedList( NULL ),
sPForm( rPF )
{
- helper::searchAndReplaceAll(&sGId, "\r", rtl::OString());
- helper::searchAndReplaceAll(&sPForm, "\r", rtl::OString());
+ sGId = sGId.replaceAll("\r", rtl::OString());
+ sPForm = sPForm.replaceAll("\r", rtl::OString());
}
ResData(const rtl::OString &rPF, const rtl::OString &rGId , const rtl::OString &rFilename)
@@ -227,8 +225,8 @@ public:
pPairedList( NULL ),
sPForm( rPF )
{
- helper::searchAndReplaceAll(&sGId, "\r", rtl::OString());
- helper::searchAndReplaceAll(&sPForm, "\r", rtl::OString());
+ sGId = sGId.replaceAll("\r", rtl::OString());
+ sPForm = sPForm.replaceAll("\r", rtl::OString());
}
};
diff --git a/l10ntools/source/cfgmerge.cxx b/l10ntools/source/cfgmerge.cxx
index 1d15fc7..2c39fc6 100644
--- a/l10ntools/source/cfgmerge.cxx
+++ b/l10ntools/source/cfgmerge.cxx
@@ -37,7 +37,6 @@
#include "rtl/strbuf.hxx"
#include "common.hxx"
-#include "helper.hxx"
#include "export.hxx"
#include "cfgmerge.hxx"
#include "tokens.h"
@@ -235,18 +234,12 @@ void CfgParser::AddText(
)
/*****************************************************************************/
{
- sal_Int32 nTextLen = 0;
- while ( rText.getLength() != nTextLen ) {
- nTextLen = rText.getLength();
- rText = rText.replace( '\n', ' ' );
- rText = rText.replace( '\r', ' ' );
- rText = rText.replace( '\t', ' ' );
- while (helper::searchAndReplace(&rText, " ", " ") != -1) {}
- }
- pStackData->sResTyp = rResTyp;
- WorkOnText( rText, rIsoLang );
-
- pStackData->sText[ rIsoLang ] = rText;
+ rText = rText.replaceAll(rtl::OString('\n'), rtl::OString()).
+ replaceAll(rtl::OString('\r'), rtl::OString()).
+ replaceAll(rtl::OString('\t'), rtl::OString());
+ pStackData->sResTyp = rResTyp;
+ WorkOnText( rText, rIsoLang );
+ pStackData->sText[ rIsoLang ] = rText;
}
/*****************************************************************************/
@@ -274,12 +267,8 @@ int CfgParser::ExecuteAnalyzedToken( int nToken, char *pToken )
case ANYTOKEN:
case CFG_TEXT_START:
{
- sal_Int32 n = 0;
- rtl::OString t(sToken.getToken(1, '<', n));
- n = 0;
- t = t.getToken(0, '>', n);
- n = 0;
- sTokenName = t.getToken(0, ' ', n);
+ sTokenName = sToken.getToken(1, '<').getToken(0, '>').
+ getToken(0, ' ');
if ( !IsTokenClosed( sToken )) {
rtl::OString sSearch;
@@ -315,8 +304,7 @@ int CfgParser::ExecuteAnalyzedToken( int nToken, char *pToken )
sCurrentResTyp = sTokenName;
rtl::OString sTemp = sToken.copy( sToken.indexOf( "xml:lang=" ));
- n = 0;
- sCurrentIsoLang = sTemp.getToken(1, '"', n);
+ sCurrentIsoLang = sTemp.getToken(1, '"');
if ( sCurrentIsoLang == NO_TRANSLATE_ISO )
bLocalize = sal_False;
@@ -330,8 +318,7 @@ int CfgParser::ExecuteAnalyzedToken( int nToken, char *pToken )
if ( !sSearch.isEmpty())
{
rtl::OString sTemp = sToken.copy( sToken.indexOf( sSearch ));
- n = 0;
- sTokenId = sTemp.getToken(1, '"', n);
+ sTokenId = sTemp.getToken(1, '"');
}
pStackData = aStack.Push( sTokenName, sTokenId );
@@ -356,12 +343,8 @@ int CfgParser::ExecuteAnalyzedToken( int nToken, char *pToken )
break;
case CFG_CLOSETAG:
{
- sal_Int32 n = 0;
- rtl::OString t(sToken.getToken(1, '/', n));
- n = 0;
- t = t.getToken(0, '>', n);
- n = 0;
- sTokenName = t.getToken(0, ' ', n);
+ sTokenName = sToken.getToken(1, '/').getToken(0, '>').
+ getToken(0, ' ');
if ( aStack.GetStackData() && ( aStack.GetStackData()->GetTagType() == sTokenName ))
{
if (sCurrentText.isEmpty())
@@ -660,13 +643,12 @@ void CfgMerge::WorkOnRessourceEnd()
sSearch += sTemp.getToken(0, '"', n);
sSearch += "\"";
- n = 0;
- rtl::OString sReplace = sTemp.getToken(0, '"', n);
+ rtl::OString sReplace = sTemp.getToken(0, '"');
sReplace += "\"";
sReplace += sCur;
sReplace += "\"";
- helper::searchAndReplace(&sTextTag, sSearch, sReplace);
+ sTextTag = sTextTag.replaceFirst(sSearch, sReplace);
sAdditionalLine += sTextTag;
sAdditionalLine += sText;
diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx
index c57591b..6a43da8 100644
--- a/l10ntools/source/export.cxx
+++ b/l10ntools/source/export.cxx
@@ -243,7 +243,7 @@ sal_Bool ResData::SetId( const rtl::OString& rId, sal_uInt16 nLevel )
if ( sId.getLength() > 255 )
{
YYWarning( "LocalId > 255 chars, truncating..." );
- sId = helper::trimAscii(sId.copy(0, 255));
+ sId = sId.copy(0, 255).trim();
}
return sal_True;
@@ -362,8 +362,8 @@ int Export::Execute( int nToken, const char * pToken )
if ( nToken == CONDITION )
{
rtl::OString sTestToken(pToken);
- helper::searchAndReplaceAll(&sTestToken, "\t", rtl::OString());
- helper::searchAndReplaceAll(&sTestToken, " ", rtl::OString());
+ sTestToken = sTestToken.replaceAll("\t", rtl::OString()).
+ replaceAll(" ", rtl::OString());
if (( !bReadOver ) && ( sTestToken.indexOf("#ifndef__RSC_PARSER") == 0 ))
bReadOver = sal_True;
else if (( bReadOver ) && ( sTestToken.indexOf("#endif") == 0 ))
@@ -456,9 +456,14 @@ int Export::Execute( int nToken, const char * pToken )
switch ( nToken ) {
case NORMDEFINE:
- while( helper::searchAndReplace(&sToken, "\r", " " ) != -1 ) {};
- while( helper::searchAndReplace(&sToken, "\t", " " ) != -1 ) {};
- while( helper::searchAndReplace(&sToken, " ", " " ) != -1 ) {};
+ sToken = sToken.replace('\r', ' ').replace('\t', ' ');
+ for (;;) {
+ sal_Int32 n = 0;
+ sToken = sToken.replaceFirst(" ", " ", &n);
+ if (n == -1) {
+ break;
+ }
+ }
if( sToken.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("#define NO_LOCALIZE_EXPORT")) ){
bSkipFile = true;
return 0;
@@ -487,13 +492,11 @@ int Export::Execute( int nToken, const char * pToken )
pResData = new ResData( sActPForm, FullId() , sFilename );
aResStack.push_back( pResData );
- helper::searchAndReplaceAll(&sToken, "\n", rtl::OString());
- helper::searchAndReplaceAll(&sToken, "\r", rtl::OString());
- helper::searchAndReplaceAll(&sToken, "{", rtl::OString());
- helper::searchAndReplaceAll(&sToken, "\t", " ");
- sToken = helper::trimAscii(sToken);
- sal_Int32 n = 0;
- rtl::OString sTLower = sToken.getToken(0, ' ', n).toAsciiLowerCase();
+ sToken = sToken.replaceAll("\n", rtl::OString()).
+ replaceAll("\r", rtl::OString()).
+ replaceAll("{", rtl::OString()).replace('\t', ' ');
+ sToken = sToken.trim();
+ rtl::OString sTLower = sToken.getToken(0, ' ').toAsciiLowerCase();
pResData->sResTyp = sTLower;
rtl::OString sId( sToken.copy( pResData->sResTyp.getLength() + 1 ));
rtl::OString sCondition;
@@ -501,14 +504,13 @@ int Export::Execute( int nToken, const char * pToken )
{
// between ResTyp, Id and paranthes is a precomp. condition
sCondition = "#";
- n = 0;
+ sal_Int32 n = 0;
sId = sId.getToken(0, '#', n);
sCondition += sId.getToken(0, '#', n);
}
- n = 0;
- sId = sId.getToken(0, '/', n);
+ sId = sId.getToken(0, '/');
CleanValue( sId );
- helper::searchAndReplaceAll(&sId, "\t", rtl::OString());
+ sId = sId.replaceAll("\t", rtl::OString());
pResData->SetId( sId, ID_LEVEL_IDENTIFIER );
if (!sCondition.isEmpty())
{
@@ -529,13 +531,12 @@ int Export::Execute( int nToken, const char * pToken )
pResData = new ResData( sActPForm, FullId() , sFilename );
aResStack.push_back( pResData );
- helper::searchAndReplaceAll(&sToken, "\n", rtl::OString());
- helper::searchAndReplaceAll(&sToken, "\r", rtl::OString());
- helper::searchAndReplaceAll(&sToken, "{", rtl::OString());
- helper::searchAndReplaceAll(&sToken, "\t", rtl::OString());
- helper::searchAndReplaceAll(&sToken, " ", rtl::OString());
- helper::searchAndReplaceAll(&sToken, "\\", rtl::OString());
- sToken = sToken.toAsciiLowerCase();
+ sToken = sToken.replaceAll("\n", rtl::OString()).
+ replaceAll("\r", rtl::OString()).
+ replaceAll("{", rtl::OString()).
+ replaceAll("\t", rtl::OString()).
+ replaceAll(" ", rtl::OString()).
+ replaceAll("\\", rtl::OString()).toAsciiLowerCase();
pResData->sResTyp = sToken;
}
break;
@@ -595,17 +596,17 @@ int Export::Execute( int nToken, const char * pToken )
bDontWriteOutput = sal_False;
// interpret different types of assignement
sal_Int32 n = 0;
- rtl::OString sKey = sToken.getToken(0, '=', n);
- helper::searchAndReplaceAll(&sKey, " ", rtl::OString());
- helper::searchAndReplaceAll(&sKey, "\t", rtl::OString());
+ rtl::OString sKey = sToken.getToken(0, '=', n).
+ replaceAll(" ", rtl::OString()).
+ replaceAll("\t", rtl::OString());
rtl::OString sValue = sToken.getToken(0, '=', n);
CleanValue( sValue );
sKey = sKey.toAsciiUpperCase();
if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("IDENTIFIER")))
{
- rtl::OString sId(sValue);
- helper::searchAndReplaceAll(&sId, "\t", rtl::OString());
- helper::searchAndReplaceAll(&sId, " ", rtl::OString());
+ rtl::OString sId(
+ sValue.replaceAll("\t", rtl::OString()).
+ replaceAll(" ", rtl::OString()));
pResData->SetId(sId, ID_LEVEL_IDENTIFIER);
}
else if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("HELPID")))
@@ -648,16 +649,14 @@ int Export::Execute( int nToken, const char * pToken )
case LISTASSIGNMENT:
{
bDontWriteOutput = sal_False;
- rtl::OString sTmpToken(sToken);
- helper::searchAndReplaceAll(&sTmpToken, " ", rtl::OString());
- sTmpToken = sTmpToken.toAsciiLowerCase();
+ rtl::OString sTmpToken(
+ sToken.replaceAll(" ", rtl::OString()).toAsciiLowerCase());
sal_Int32 nPos = sTmpToken.indexOf("[en-us]=");
if (nPos != -1) {
- rtl::OString sKey(sTmpToken.copy(0 , nPos));
- helper::searchAndReplaceAll(&sKey, " ", rtl::OString());
- helper::searchAndReplaceAll(&sKey, "\t", rtl::OString());
- sal_Int32 n = 0;
- rtl::OString sValue = sToken.getToken(1, '=', n);
+ rtl::OString sKey(
+ sTmpToken.copy(0 , nPos).replaceAll(" ", rtl::OString()).
+ replaceAll("\t", rtl::OString()));
+ rtl::OString sValue = sToken.getToken(1, '=');
CleanValue( sValue );
sKey = sKey.toAsciiUpperCase();
if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("STRINGLIST")))
@@ -706,10 +705,9 @@ int Export::Execute( int nToken, const char * pToken )
{
// new res. is a String- or FilterList
sal_Int32 n = 0;
- rtl::OString sKey = sToken.getToken(0, '[', n);
- helper::searchAndReplaceAll(&sKey, " ", rtl::OString());
- helper::searchAndReplaceAll(&sKey, "\t", rtl::OString());
- sKey = sKey.toAsciiUpperCase();
+ rtl::OString sKey(
+ sToken.getToken(0, '[', n).replaceAll(" ", rtl::OString()).
+ replaceAll("\t", rtl::OString()).toAsciiUpperCase());
if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("STRINGLIST")))
nList = LIST_STRING;
else if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("FILTERLIST")))
@@ -758,23 +756,16 @@ int Export::Execute( int nToken, const char * pToken )
CutComment( sToken );
// this is a text line!!!
- sal_Int32 n = 0;
- rtl::OString t(sToken.getToken(0, '=', n));
- n = 0;
- rtl::OString sKey = t.getToken(0, '[', n);
- helper::searchAndReplaceAll(&sKey, " ", rtl::OString());
- helper::searchAndReplaceAll(&sKey, "\t", rtl::OString());
+ rtl::OString t(sToken.getToken(0, '='));
+ rtl::OString sKey(
+ t.getToken(0, '[').replaceAll(" ", rtl::OString()).
+ replaceAll("\t", rtl::OString()));
rtl::OString sText( GetText( sToken, nToken ));
rtl::OString sLang;
- n = 0;
- if ( sToken.getToken(0, '=', n).indexOf('[') != -1 )
+ if ( sToken.getToken(0, '=').indexOf('[') != -1 )
{
- n = 0;
- t = sToken.getToken(0, '=', n);
- n = 0;
- t = t.getToken(1, '[', n);
- n = 0;
- sLang = t.getToken(0, ']', n);
+ sLang = sToken.getToken(0, '=').getToken(1, '[').
+ getToken(0, ']');
CleanValue( sLang );
}
rtl::OString sLangIndex = sLang;
@@ -879,25 +870,19 @@ int Export::Execute( int nToken, const char * pToken )
// this is a AppfontMapping, so look if its a definition
// of field size
sal_Int32 n = 0;
- rtl::OString sKey = sToken.getToken(0, '=', n);
- helper::searchAndReplaceAll(&sKey, " ", rtl::OString());
- helper::searchAndReplaceAll(&sKey, "\t", rtl::OString());
+ rtl::OString sKey(
+ sToken.getToken(0, '=', n).replaceAll(" ", rtl::OString()).
+ replaceAll("\t", rtl::OString()));
rtl::OString sMapping = sToken.getToken(0, '=', n);
- n = 0;
- sMapping = sMapping.getToken(1, '(', n);
- n = 0;
- sMapping = sMapping.getToken(0, ')', n);
- helper::searchAndReplaceAll(
- &sMapping, rtl::OString(' '), rtl::OString());
- helper::searchAndReplaceAll(
- &sMapping, rtl::OString('\t'), rtl::OString());
- sKey = sKey.toAsciiUpperCase();
+ sMapping = sMapping.getToken(1, '(');
+ sMapping = sMapping.getToken(0, ')').
+ replaceAll(rtl::OString(' '), rtl::OString()).
+ replaceAll(rtl::OString('\t'), rtl::OString()).
+ toAsciiUpperCase();
if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("SIZE"))) {
- n = 0;
- pResData->nWidth = sMapping.getToken(0, ',', n).toInt32();
+ pResData->nWidth = sMapping.getToken(0, ',').toInt32();
} else if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("POSSIZE"))) {
- n = 0;
- pResData->nWidth = sMapping.getToken(2, ',', n).toInt32();
+ pResData->nWidth = sMapping.getToken(2, ',').toInt32();
}
}
break;
@@ -906,9 +891,14 @@ int Export::Execute( int nToken, const char * pToken )
break;
case CONDITION: {
bDontWriteOutput = sal_False;
- while( helper::searchAndReplace(&sToken, "\r", " " ) != -1 ) {};
- while( helper::searchAndReplace(&sToken, "\t", " " ) != -1 ) {};
- while( helper::searchAndReplace(&sToken, " ", " " ) != -1 ) {};
+ sToken = sToken.replace('\r', ' ').replace('\t', ' ');
+ for (;;) {
+ sal_Int32 n = 0;
+ sToken = sToken.replaceFirst(" ", " ", &n);
+ if (n == -1) {
+ break;
+ }
+ }
sal_Int32 n = 0;
rtl::OString sCondition(sToken.getToken(0, ' ', n));
if ( sCondition == "#ifndef" ) {
@@ -920,12 +910,10 @@ int Export::Execute( int nToken, const char * pToken )
sActPForm += sToken.getToken(0, ' ', n);
}
else if ( sCondition == "#if" ) {
- sActPForm = sToken.copy( 4 );
- while ( helper::searchAndReplace(&sActPForm, "||", "\\or" ) != -1 ) {};
+ sActPForm = sToken.copy( 4 ).replaceAll("||", "\\or");
}
else if ( sCondition == "#elif" ) {
- sActPForm = sToken.copy( 6 );
- while ( helper::searchAndReplace(&sActPForm, "||", "\\or" ) != -1 ) {};
+ sActPForm = sToken.copy( 6 ).replaceAll("||", "\\or");
}
else if ( sCondition == "#else" ) {
sActPForm = sCondition;
@@ -985,8 +973,7 @@ void Export::CutComment( rtl::OString &rText )
/*****************************************************************************/
{
if (rText.indexOf("//") != -1) {
- rtl::OString sWork(rText);
- helper::searchAndReplaceAll(&sWork, "\\\"", "XX");
+ rtl::OString sWork(rText.replaceAll("\\\"", "XX"));
bool bInner = false;
for (sal_Int32 i = 0; i < sWork.getLength() - 1; ++i) {
if (sWork[i] == '"') {
@@ -1135,20 +1122,17 @@ sal_Bool Export::WriteData( ResData *pResData, sal_Bool bCreateNew )
rtl::OString Export::GetPairedListID(const rtl::OString& rText)
{
// < "STRING" ; IDENTIFIER ; > ;
- sal_Int32 n = 0;
- return helper::trimAscii(
- rText.getToken(1, ';', n).toAsciiUpperCase().replace('\t', ' '));
+ return rText.getToken(1, ';').toAsciiUpperCase().replace('\t', ' ').trim();
}
rtl::OString Export::GetPairedListString(const rtl::OString& rText)
{
// < "STRING" ; IDENTIFIER ; > ;
- sal_Int32 n = 0;
- rtl::OString sString(rText.getToken(0, ';', n).replace('\t', ' '));
- sString = helper::trimAscii(sString);
+ rtl::OString sString(rText.getToken(0, ';').replace('\t', ' '));
+ sString = sString.trim();
rtl::OString s1(sString.copy(sString.indexOf('"') + 1));
sString = s1.copy(0, s1.lastIndexOf('"'));
- return helper::trimAscii(sString);
+ return sString.trim();
}
rtl::OString Export::StripList(const rtl::OString & rText)
@@ -1360,20 +1344,17 @@ rtl::OString Export::GetText(const rtl::OString &rSource, int nToken)
{
rtl::OString sTmp(rSource.copy(rSource.indexOf("=")));
CleanValue( sTmp );
- helper::searchAndReplaceAll(&sTmp, "\n", rtl::OString());
- helper::searchAndReplaceAll(&sTmp, "\r", rtl::OString());
-
- helper::searchAndReplaceAll(
- &sTmp, "\\\\\"", "-=<[BSlashBSlashHKom]>=-\"");
- helper::searchAndReplaceAll(&sTmp, "\\\"", "-=<[Hochkomma]>=-");
- helper::searchAndReplaceAll(&sTmp, "\\", "-=<[0x7F]>=-");
- helper::searchAndReplaceAll(&sTmp, "\\0x7F", "-=<[0x7F]>=-");
+ sTmp = sTmp.replaceAll("\n", rtl::OString()).
+ replaceAll("\r", rtl::OString()).
+ replaceAll("\\\\\"", "-=<[BSlashBSlashHKom]>=-\"").
+ replaceAll("\\\"", "-=<[Hochkomma]>=-").
+ replaceAll("\\", "-=<[0x7F]>=-").
+ replaceAll("\\0x7F", "-=<[0x7F]>=-");
sal_uInt16 nState = TXT_STATE_TEXT;
for (sal_Int32 i = 1; i <= helper::countOccurrences(sTmp, '"'); ++i)
{
- sal_Int32 n = 0;
- rtl::OString sToken(sTmp.getToken(i, '"', n));
+ rtl::OString sToken(sTmp.getToken(i, '"'));
if (!sToken.isEmpty()) {
if ( nState == TXT_STATE_TEXT ) {
sReturn += sToken;
@@ -1381,10 +1362,14 @@ rtl::OString Export::GetText(const rtl::OString &rSource, int nToken)
}
else {
sToken = sToken.replace('\t', ' ');
- while (helper::searchAndReplace(&sToken, " ", " ")
- != -1)
- {}
- sToken = helper::trimAscii(sToken);
+ for (;;) {
+ sal_Int32 n = 0;
+ sToken = sToken.replaceFirst(" ", " ", &n);
+ if (n == -1) {
+ break;
+ }
+ }
+ sToken = sToken.trim();
if (!sToken.isEmpty()) {
sReturn += "\\\" ";
sReturn += sToken;
@@ -1395,13 +1380,11 @@ rtl::OString Export::GetText(const rtl::OString &rSource, int nToken)
}
}
- helper::searchAndReplaceAll(&sReturn, "-=<[0x7F]>=-", "");
- helper::searchAndReplaceAll(&sReturn, "-=<[Hochkomma]>=-", "\"");
- helper::searchAndReplaceAll(
- &sReturn, "-=<[BSlashBSlashHKom]>=-", "\\\\");
- helper::searchAndReplaceAll(
- &sReturn, "\\\\", "-=<[BSlashBSlash]>=-");
- helper::searchAndReplaceAll(&sReturn, "-=<[BSlashBSlash]>=-", "\\");
+ sReturn = sReturn.replaceAll("-=<[0x7F]>=-", "").
+ replaceAll("-=<[Hochkomma]>=-", "\"").
+ replaceAll("-=<[BSlashBSlashHKom]>=-", "\\\\").
+ replaceAll("\\\\", "-=<[BSlashBSlash]>=-").
+ replaceAll("-=<[BSlashBSlash]>=-", "\\");
}
break;
}
@@ -1411,7 +1394,13 @@ rtl::OString Export::GetText(const rtl::OString &rSource, int nToken)
void Export::WriteToMerged(const rtl::OString &rText , bool bSDFContent)
{
rtl::OString sText(rText);
- while (helper::searchAndReplace(&sText, " \n", "\n") != -1) {}
+ for (;;) {
+ sal_Int32 n = 0;
+ sText = sText.replaceFirst(" \n", "\n", &n);
+ if (n == -1) {
+ break;
+ }
+ }
if (pParseQueue->bNextIsM && bSDFContent && sText.getLength() > 2) {
for (sal_Int32 n = 0; n < sText.getLength(); ++n) {
if (sText[n] == '\n' && sText[n - 1] != '\\') {
@@ -1456,7 +1445,7 @@ void Export::ConvertMergeContent( rtl::OString &rText )
/*****************************************************************************/
{
sal_Bool bNoOpen = ( rText.indexOf( "\\\"" ) != 0 );
- sal_Bool bNoClose = !helper::endsWith(rText, "\\\"");
+ sal_Bool bNoClose = !rText.endsWithL(RTL_CONSTASCII_STRINGPARAM("\\\""));
rtl::OStringBuffer sNew;
for ( sal_Int32 i = 0; i < rText.getLength(); i++ )
{
@@ -1886,7 +1875,7 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode )
(( sLine.indexOf( '<' ) == -1 ) ||
( sLine.indexOf( '<' ) >= sLine.indexOf( '"' ))))
{
- helper::searchAndReplace(&sLine, "\"", "< \"" );
+ sLine = sLine.replaceFirst("\"", "< \"" );
}
}
@@ -1992,7 +1981,7 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode )
(( sLine.indexOf( '<' ) == -1 ) ||
( sLine.indexOf( '<' ) >= sLine.indexOf( '"' ))))
{
- helper::searchAndReplace(&sLine, "\"", "< \"" );
+ sLine = sLine.replaceFirst("\"", "< \"");
}
}
diff --git a/l10ntools/source/export2.cxx b/l10ntools/source/export2.cxx
index 1a1ae91..bad5964 100644
--- a/l10ntools/source/export2.cxx
+++ b/l10ntools/source/export2.cxx
@@ -29,7 +29,6 @@
#include "sal/config.h"
#include "export.hxx"
-#include "helper.hxx"
#include <stdio.h>
#include <osl/time.h>
#include <osl/process.h>
@@ -302,8 +301,7 @@ void Export::InitLanguages( bool bMergeMode ){
do
{
rtl::OString aToken = sLanguages.getToken(0, ',', nIndex);
- sal_Int32 n = 0;
- sTmp = helper::trimAscii(aToken.getToken(0, '=', n));
+ sTmp = aToken.getToken(0, '=').trim();
if( bMergeMode && !isAllowed( sTmp ) ){}
else if( !( (sTmp[0]=='x' || sTmp[0]=='X') && sTmp[1]=='-' ) ){
aLanguages.push_back( sTmp );
@@ -326,8 +324,7 @@ void Export::InitForcedLanguages( bool bMergeMode ){
{
rtl::OString aToken = sForcedLanguages.getToken(0, ',', nIndex);
- sal_Int32 n = 0;
- sTmp = helper::trimAscii(aToken.getToken(0, '=', n));
+ sTmp = aToken.getToken(0, '=').trim();
if( bMergeMode && isAllowed( sTmp ) ){}
else if( !( (sTmp[0]=='x' || sTmp[0]=='X') && sTmp[1]=='-' ) )
aForcedLanguages.push_back( sTmp );
diff --git a/l10ntools/source/gsicheck.cxx b/l10ntools/source/gsicheck.cxx
index 76b7928..d1665ff 100644
--- a/l10ntools/source/gsicheck.cxx
+++ b/l10ntools/source/gsicheck.cxx
@@ -363,7 +363,7 @@ void GSIBlock::PrintList( ParserMessageList *pList, rtl::OString const & aPrefix
aContext = pLine->GetText().copy( 0, 300 );
else
aContext = pLine->data_.copy( pMsg->GetTagBegin()-150, 300 );
- aContext = helper::trimAscii(aContext);
+ aContext = aContext.trim();
}
PrintMessage( pMsg->Prefix(), pMsg->GetErrorText(), aPrefix, aContext, pLine->GetLineNumber(), pLine->GetUniqId() );
diff --git a/l10ntools/source/helper.hxx b/l10ntools/source/helper.hxx
index b2ff952..59f8628 100644
--- a/l10ntools/source/helper.hxx
+++ b/l10ntools/source/helper.hxx
@@ -40,10 +40,6 @@
namespace helper {
-inline bool isAsciiWhitespace(char c) {
- return (c >= 0x09 && c <= 0x0D) || c == ' '; // HT, LF, VT, FF, CR
-}
-
// cf. comphelper::string::isdigitAsciiString:
inline bool isAllAsciiDigits(rtl::OString const & text) {
for (sal_Int32 i = 0; i != text.getLength(); ++i) {
@@ -74,19 +70,6 @@ inline bool isAllAsciiLowerCase(rtl::OString const & text) {
return true;
}
-inline bool endsWith(rtl::OString const & text, rtl::OString const & search) {
- return text.getLength() >= search.getLength()
- && text.match(search, text.getLength() - search.getLength());
-}
-
-inline bool endsWithAsciiL(
- rtl::OUString const & text, char const * search, sal_Int32 searchLength)
-{
- return text.getLength() >= searchLength
- && text.matchAsciiL(
- search, searchLength, text.getLength() - searchLength);
-}
-
inline sal_Int32 countOccurrences(rtl::OString const & text, char c) {
sal_Int32 n = 0;
for (sal_Int32 i = 0;; ++i) {
@@ -99,67 +82,6 @@ inline sal_Int32 countOccurrences(rtl::OString const & text, char c) {
return n;
}
-inline rtl::OString trimAscii(rtl::OString const & text) {
- sal_Int32 i1 = 0;
- while (i1 != text.getLength() && isAsciiWhitespace(text[i1])) {
- ++i1;
- }
- sal_Int32 i2 = text.getLength();
- while (i2 != i1 && isAsciiWhitespace(text[i2 - 1])) {
- --i2;
- }
- return text.copy(i1, i2 - i1);
-}
-
-inline sal_Int32 searchAndReplace(
- rtl::OString * text, rtl::OString const & search,
- rtl::OString const & replace)
-{
- assert(text != 0);
- sal_Int32 i = text->indexOf(search);
- if (i != -1) {
- *text = text->replaceAt(i, search.getLength(), replace);
- }
- return i;
-}
-
-inline void searchAndReplaceAll(
- rtl::OString * text, rtl::OString const & search,
- rtl::OString const & replace)
-{
- assert(text != 0);
- for (sal_Int32 i = 0;;) {
- i = text->indexOf(search, i);
- if (i == -1) {
- break;
- }
- *text = text->replaceAt(i, search.getLength(), replace);
- i += replace.getLength();
- }
-}
-
-inline void searchAndReplaceAll(
- rtl::OUString * text, rtl::OUString const & search,
- rtl::OUString const & replace)
-{
- assert(text != 0);
- for (sal_Int32 i = 0;;) {
- i = text->indexOf(search, i);
- if (i == -1) {
- break;
- }
- *text = text->replaceAt(i, search.getLength(), replace);
- i += replace.getLength();
- }
-}
-
-inline rtl::OString getToken(
- rtl::OString const & text, sal_Int32 token, char separator)
-{
- sal_Int32 i = 0;
- return text.getToken(token, separator, i);
-}
-
inline sal_Int32 indexOfAnyAsciiL(
rtl::OUString const & text, char const * chars, sal_Int32 charsLen,
sal_Int32 index = 0)
diff --git a/l10ntools/source/helpmerge.cxx b/l10ntools/source/helpmerge.cxx
index d3895e6..ceb0f1e 100644
--- a/l10ntools/source/helpmerge.cxx
+++ b/l10ntools/source/helpmerge.cxx
@@ -143,13 +143,14 @@ bool HelpParser::CreateSDF(
if( pXMLElement != NULL )
{
- OUString data = pXMLElement->ToOUString();
- helper::searchAndReplaceAll(
- &data, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")),
- rtl::OUString()); // remove \n
- helper::searchAndReplaceAll(
- &data, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t")),
- rtl::OUString()); // remove \t
+ OUString data(
+ pXMLElement->ToOUString().
+ replaceAll(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")),
+ rtl::OUString()).
+ replaceAll(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t")),
+ rtl::OUString()));
sBuffer.append( sOUPrj );
sBuffer.append('\t');
if ( !rRoot_in.isEmpty())
@@ -306,13 +307,13 @@ bool HelpParser::MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile
rtl::OString HelpParser::GetOutpath( const rtl::OString& rPathX , const rtl::OString& sCur , const rtl::OString& rPathY )
{
rtl::OString testpath = rPathX;
- if (!helper::endsWith(testpath, "/")) {
+ if (!testpath.endsWithL(RTL_CONSTASCII_STRINGPARAM("/"))) {
testpath += "/";
}
testpath += sCur;
testpath += "/";
rtl::OString sRelativePath( rPathY );
- if (sRelativePath.getLength() != 0 && sRelativePath[0] == '/') {
+ if (sRelativePath.matchL(RTL_CONSTASCII_STRINGPARAM("/"))) {
sRelativePath = sRelativePath.copy(1);
}
testpath += sRelativePath;
@@ -322,14 +323,12 @@ rtl::OString HelpParser::GetOutpath( const rtl::OString& rPathX , const rtl::OSt
void HelpParser::MakeDir(const rtl::OString& rPath)
{
- rtl::OString sTPath(rPath);
- helper::searchAndReplaceAll(&sTPath, "\\", "/");
+ rtl::OString sTPath(rPath.replaceAll("\\", "/"));
sal_Int32 cnt = helper::countOccurrences(sTPath, '/');
rtl::OStringBuffer sCreateDir;
for (sal_uInt16 i = 0; i <= cnt; ++i)
{
- sal_Int32 n = 0;
- sCreateDir.append(sTPath.getToken(i , '/', n));
+ sCreateDir.append(sTPath.getToken(i , '/'));
sCreateDir.append('/');
#ifdef WNT
_mkdir( sCreateDir.getStr() );
diff --git a/l10ntools/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx
index 00a997a..6541bd9 100644
--- a/l10ntools/source/lngmerge.cxx
+++ b/l10ntools/source/lngmerge.cxx
@@ -34,16 +34,12 @@
#include <string>
#include "common.hxx"
-#include "helper.hxx"
#include "lngmerge.hxx"
namespace {
rtl::OString getBracketedContent(rtl::OString text) {
- sal_Int32 n = 0;
- rtl::OString t(text.getToken(1, '[', n));
- n = 0;
- return t.getToken(0, ']', n);
+ return text.getToken(1, '[').getToken(0, ']');
}
}
@@ -162,10 +158,10 @@ void LngParser::WriteSDF(std::ofstream &aSDFStream,
bool LngParser::isNextGroup(rtl::OString &sGroup_out, rtl::OString &sLine_in)
{
- sLine_in = helper::trimAscii(sLine_in);
+ sLine_in = sLine_in.trim();
if ((sLine_in[0] == '[') && (sLine_in[sLine_in.getLength() - 1] == ']'))
{
- sGroup_out = helper::trimAscii(getBracketedContent(sLine_in));
+ sGroup_out = getBracketedContent(sLine_in).trim();
return true;
}
return false;
@@ -174,11 +170,9 @@ bool LngParser::isNextGroup(rtl::OString &sGroup_out, rtl::OString &sLine_in)
void LngParser::ReadLine(const rtl::OString &rLine_in,
OStringHashMap &rText_inout)
{
- sal_Int32 n = 0;
- rtl::OString sLang(helper::trimAscii(rLine_in.getToken(0, '=', n)));
+ rtl::OString sLang(rLine_in.getToken(0, '=').trim());
if (!sLang.isEmpty()) {
- n = 0;
- rtl::OString sText(rLine_in.getToken(1, '"', n));
+ rtl::OString sText(rLine_in.getToken(1, '"'));
rText_inout[sLang] = sText;
}
}
@@ -209,11 +203,11 @@ sal_Bool LngParser::Merge(
while ( nPos < pLines->size() && !bGroup )
{
rtl::OString sLine( *(*pLines)[ nPos ] );
- sLine = helper::trimAscii(sLine);
+ sLine = sLine.trim();
if (( sLine[0] == '[' ) &&
( sLine[sLine.getLength() - 1] == ']' ))
{
- sGroup = helper::trimAscii(getBracketedContent(sLine));
+ sGroup = getBracketedContent(sLine).trim();
bGroup = sal_True;
}
nPos ++;
@@ -235,11 +229,11 @@ sal_Bool LngParser::Merge(
while ( nPos < pLines->size() && !bGroup )
{
rtl::OString sLine( *(*pLines)[ nPos ] );
- sLine = helper::trimAscii(sLine);
+ sLine = sLine.trim();
if (( sLine[0] == '[' ) &&
( sLine[sLine.getLength() - 1] == ']' ))
{
- sGroup = helper::trimAscii(getBracketedContent(sLine));
+ sGroup = getBracketedContent(sLine).trim();
bGroup = sal_True;
nPos ++;
sLanguagesDone = "";
@@ -254,7 +248,7 @@ sal_Bool LngParser::Merge(
}
else
{
- sLang = helper::trimAscii(sLang);
+ sLang = sLang.trim();
rtl::OString sSearch( ";" );
sSearch += sLang;
diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx
index e259ef7..6fb83e1 100644
--- a/l10ntools/source/localize.cxx
+++ b/l10ntools/source/localize.cxx
@@ -50,8 +50,6 @@
#include "sal/main.h"
#include "sal/types.h"
-#include "helper.hxx"
-
using namespace std;
namespace {
@@ -104,7 +102,7 @@ bool matchList(
rtl::OUString const & url, AsciiString const * list, std::size_t length)
{
for (std::size_t i = 0; i != length; ++i) {
- if (helper::endsWithAsciiL(url, list[i].string, list[i].length)) {
+ if (url.endsWithAsciiL(list[i].string, list[i].length)) {
return true;
}
}
@@ -272,8 +270,8 @@ void handleFile(
{ RTL_CONSTASCII_STRINGPARAM(".xhp"), "helpex", false },
{ RTL_CONSTASCII_STRINGPARAM(".properties"), "propex", false } };
for (std::size_t i = 0; i != SAL_N_ELEMENTS(commands); ++i) {
- if (helper::endsWithAsciiL(
- url, commands[i].extension, commands[i].extensionLength))
+ if (url.endsWithAsciiL(
+ commands[i].extension, commands[i].extensionLength))
{
handleCommand(
project, projectRoot, url,
diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx
index c56bdaf..b9b8d40 100644
--- a/l10ntools/source/merge.cxx
+++ b/l10ntools/source/merge.cxx
@@ -34,7 +34,6 @@
#include <vector>
#include "export.hxx"
-#include "helper.hxx"
namespace
{
@@ -201,7 +200,7 @@ MergeDataFile::MergeDataFile(
rtl::OString sPFO = sLine.getToken( 1, '\t', n ); // token 7
sPFO = sHACK;
rtl::OString nLANG = sLine.getToken( 1, '\t', n ); // token 9
- nLANG = helper::trimAscii(nLANG);
+ nLANG = nLANG.trim();
const rtl::OString sTEXT = sLine.getToken( 0, '\t', n ); // token 10
const rtl::OString sQHTEXT = sLine.getToken( 1, '\t', n ); // token 12
const rtl::OString sTITLE = sLine.getToken( 0, '\t', n ); // token 13
diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx
index 1e25534..0f1e3e0 100644
--- a/l10ntools/source/xrmmerge.cxx
+++ b/l10ntools/source/xrmmerge.cxx
@@ -34,7 +34,6 @@
#include "common.hxx"
#include "export.hxx"
-#include "helper.hxx"
#include "xrmmerge.hxx"
#include "tokens.h"
#include <iostream>
@@ -390,11 +389,10 @@ rtl::OString XRMResParser::GetAttribute( const rtl::OString &rToken, const rtl::
if ( nPos != -1 )
{
sTmp = sTmp.copy( nPos );
- sal_Int32 n = 0;
- rtl::OString sId = sTmp.getToken(1, '"', n);
+ rtl::OString sId = sTmp.getToken(1, '"');
return sId;
}
- return "";
+ return rtl::OString();
}
@@ -409,15 +407,14 @@ void XRMResParser::Error( const rtl::OString &rError )
void XRMResParser::ConvertStringToDBFormat( rtl::OString &rString )
/*****************************************************************************/
{
- rString = helper::trimAscii(rString);
- helper::searchAndReplaceAll(&rString, "\t", "\\t");
+ rString = rString.trim().replaceAll("\t", "\\t");
}
/*****************************************************************************/
void XRMResParser::ConvertStringToXMLFormat( rtl::OString &rString )
/*****************************************************************************/
{
- helper::searchAndReplaceAll(&rString, "\\t", "\t");
+ rString = rString.replaceAll("\\t", "\t");
}
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list