summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-01-02 10:55:27 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-01-05 09:18:19 +0000
commitbacfd2dc4cea1a5d87658ed8592116acd931e000 (patch)
treed22172a33fdd13a440b6882a28c23ea2d639bbad /basic
parent6281eb0e0792da0194c07da18296e94dd944b8e5 (diff)
add a comphelper::string::getTokenCount
suitable for conversion from [Byte]String::GetTokenCount converted low-hanging variants to rtl::O[UString]::getToken loops added unit test
Diffstat (limited to 'basic')
-rw-r--r--basic/source/basmgr/basmgr.cxx15
-rw-r--r--basic/source/classes/eventatt.cxx4
2 files changed, 10 insertions, 9 deletions
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 9052458e84db..f452adc54d7c 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -42,6 +42,7 @@
#include <basic/sbmod.hxx>
#include <unotools/intlwrapper.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/string.hxx>
#include <basic/sbuno.hxx>
#include <basic/basmgr.hxx>
@@ -1049,12 +1050,12 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage )
{
String aCurStorageName( aStorName );
INetURLObject aCurStorage( aCurStorageName, INET_PROT_FILE );
- sal_uInt16 nLibs = aLibs.GetTokenCount( LIB_SEP );
- for ( sal_uInt16 nLib = 0; nLib < nLibs; nLib++ )
+ sal_Int32 nLibs = comphelper::string::getTokenCount(aLibs, LIB_SEP);
+ for ( sal_Int32 nLib = 0; nLib < nLibs; nLib++ )
{
- String aLibInfo( aLibs.GetToken( nLib, LIB_SEP ) );
+ String aLibInfo(comphelper::string::getToken(aLibs, nLib, LIB_SEP));
// TODO: Remove == 2
- DBG_ASSERT( ( aLibInfo.GetTokenCount( LIBINFO_SEP ) == 2 ) || ( aLibInfo.GetTokenCount( LIBINFO_SEP ) == 3 ), "Ungueltige Lib-Info!" );
+ DBG_ASSERT( ( comphelper::string::getTokenCount(aLibInfo, LIBINFO_SEP) == 2 ) || ( comphelper::string::getTokenCount(aLibInfo, LIBINFO_SEP) == 3 ), "Ungueltige Lib-Info!" );
String aLibName( aLibInfo.GetToken( 0, LIBINFO_SEP ) );
String aLibAbsStorageName( aLibInfo.GetToken( 1, LIBINFO_SEP ) );
String aLibRelStorageName( aLibInfo.GetToken( 2, LIBINFO_SEP ) );
@@ -1895,11 +1896,11 @@ ErrCode BasicManager::ExecuteMacro( String const& i_fullyQualifiedName, String c
sQuotedArgs = '(';
- sal_uInt16 nCount = sArgs.GetTokenCount(',');
- for ( sal_uInt16 n=0; n<nCount; ++n )
+ sal_Int32 nCount = comphelper::string::getTokenCount(sArgs, ',');
+ for (sal_Int32 n=0; n < nCount; ++n)
{
sQuotedArgs += '\"';
- sQuotedArgs += sArgs.GetToken( n, ',' );
+ sQuotedArgs += comphelper::string::getToken(sArgs, n, ',');
sQuotedArgs += '\"';
if ( n<nCount-1 )
sQuotedArgs += ',';
diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx
index d83d69958fb4..0e7b3b989ead 100644
--- a/basic/source/classes/eventatt.cxx
+++ b/basic/source/classes/eventatt.cxx
@@ -29,7 +29,7 @@
#include <osl/mutex.hxx>
#include <comphelper/processfactory.hxx>
-
+#include <comphelper/string.hxx>
#include <com/sun/star/script/XEventAttacher.hpp>
#include <com/sun/star/script/XAllListener.hpp>
@@ -218,7 +218,7 @@ void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any
String aMacro( aScriptEvent.ScriptCode );
String aLibName;
String aLocation;
- if( aMacro.GetTokenCount( '.' ) == 3 )
+ if( comphelper::string::getTokenCount(aMacro, '.') == 3 )
{
sal_uInt16 nLast = 0;
::rtl::OUString aFullLibName = aMacro.GetToken( 0, '.', nLast );