basic: prefer passing OUString and OString by reference

Change-Id: I8121204cdb37d4e1d8967397f3e45bdab6aaddad
This commit is contained in:
Noel Grandin
2014-03-12 15:36:41 +02:00
parent 18909ddb30
commit 39c7532933
9 changed files with 37 additions and 36 deletions

View File

@@ -24,8 +24,8 @@ private:
int m_nb_tests_ok;
int m_nb_tests_skipped;
OUString m_sCurrentTest;
void process_directory(OUString sDirName);
void run_test(OUString sFileName);
void process_directory(const OUString& sDirName);
void run_test(const OUString& sFileName);
void test_failed(void);
void test_success(void);
StringVec get_subdirnames( const OUString& sDirName );
@@ -70,7 +70,7 @@ void Coverage::test_success()
fprintf(stderr,"%s,PASS\n", OUStringToOString( m_sCurrentTest, RTL_TEXTENCODING_UTF8 ).getStr() );
}
void Coverage::run_test(OUString sFileURL)
void Coverage::run_test(const OUString& sFileURL)
{
m_sCurrentTest = sFileURL;
bool result = false;
@@ -113,7 +113,7 @@ Coverage::StringVec Coverage::get_subdirnames( const OUString& sDirName )
}
return sSubDirNames;
}
void Coverage::process_directory(OUString sDirName)
void Coverage::process_directory(const OUString& sDirName)
{
osl::Directory aDir(sDirName);
osl::DirectoryItem aItem;

View File

@@ -146,14 +146,14 @@ class BasMgrContainerListenerImpl: public ContainerListenerHelper
OUString maLibName; // empty -> no lib, but lib container
public:
BasMgrContainerListenerImpl( BasicManager* pMgr, OUString aLibName )
BasMgrContainerListenerImpl( BasicManager* pMgr, const OUString& aLibName )
: mpMgr( pMgr )
, maLibName( aLibName ) {}
static void insertLibraryImpl( const uno::Reference< script::XLibraryContainer >& xScriptCont, BasicManager* pMgr,
uno::Any aLibAny, OUString aLibName );
uno::Any aLibAny, const OUString& aLibName );
static void addLibraryModulesImpl( BasicManager* pMgr, uno::Reference< container::XNameAccess > xLibNameAccess,
OUString aLibName );
const OUString& aLibName );
// XEventListener
@@ -175,7 +175,7 @@ public:
void BasMgrContainerListenerImpl::insertLibraryImpl( const uno::Reference< script::XLibraryContainer >& xScriptCont,
BasicManager* pMgr, uno::Any aLibAny, OUString aLibName )
BasicManager* pMgr, uno::Any aLibAny, const OUString& aLibName )
{
Reference< container::XNameAccess > xLibNameAccess;
aLibAny >>= xLibNameAccess;
@@ -208,7 +208,7 @@ void BasMgrContainerListenerImpl::insertLibraryImpl( const uno::Reference< scrip
void BasMgrContainerListenerImpl::addLibraryModulesImpl( BasicManager* pMgr,
uno::Reference< container::XNameAccess > xLibNameAccess, OUString aLibName )
uno::Reference< container::XNameAccess > xLibNameAccess, const OUString& aLibName )
{
uno::Sequence< OUString > aModuleNames = xLibNameAccess->getElementNames();
sal_Int32 nModuleCount = aModuleNames.getLength();

View File

@@ -484,7 +484,7 @@ OUString SbiImage::GetString( short nId ) const
return OUString();
}
const SbxObject* SbiImage::FindType (OUString aTypeName) const
const SbxObject* SbiImage::FindType (const OUString& aTypeName) const
{
return rTypes.Is() ? (SbxObject*)rTypes->Find(aTypeName,SbxCLASS_OBJECT) : NULL;
}

View File

@@ -524,7 +524,7 @@ sal_Bool SbModule::IsCompiled() const
return sal_Bool( pImage != 0 );
}
const SbxObject* SbModule::FindType( OUString aTypeName ) const
const SbxObject* SbModule::FindType( const OUString& aTypeName ) const
{
return pImage ? pImage->FindType( aTypeName ) : NULL;
}

View File

@@ -75,7 +75,7 @@ public:
OUString& GetSource32() { return aOUSource; }
sal_uInt16 GetBase() const { return nDimBase; }
OUString GetString( short nId ) const;
const SbxObject* FindType (OUString aTypeName) const;
const SbxObject* FindType (const OUString& aTypeName) const;
SbxArrayRef GetEnums() { return rEnums; }

View File

@@ -2800,7 +2800,7 @@ inline sal_Bool implCheckWildcard( const OUString& rName, SbiRTLData* pRTLData )
}
bool isRootDir( OUString aDirURLStr )
bool isRootDir( const OUString& aDirURLStr )
{
INetURLObject aDirURLObj( aDirURLStr );
bool bRoot = false;

View File

@@ -104,14 +104,14 @@ double get_number_of_digits( double dNumber )
SbxBasicFormater::SbxBasicFormater( sal_Unicode _cDecPoint, sal_Unicode _cThousandSep,
OUString _sOnStrg,
OUString _sOffStrg,
OUString _sYesStrg,
OUString _sNoStrg,
OUString _sTrueStrg,
OUString _sFalseStrg,
OUString _sCurrencyStrg,
OUString _sCurrencyFormatStrg )
const OUString& _sOnStrg,
const OUString& _sOffStrg,
const OUString& _sYesStrg,
const OUString& _sNoStrg,
const OUString& _sTrueStrg,
const OUString& _sFalseStrg,
const OUString& _sCurrencyStrg,
const OUString& _sCurrencyFormatStrg )
: cDecPoint(_cDecPoint)
, cThousandSep(_cThousandSep)
, sOnStrg(_sOnStrg)
@@ -954,7 +954,7 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
sReturnStrgFinal = sReturnStrg.makeStringAndClear();
}
OUString SbxBasicFormater::BasicFormatNull( OUString sFormatStrg )
OUString SbxBasicFormater::BasicFormatNull( const OUString& sFormatStrg )
{
sal_Bool bNullFormatFound;
OUString sNullFormatStrg = GetNullFormatString( sFormatStrg, bNullFormatFound );
@@ -966,9 +966,10 @@ OUString SbxBasicFormater::BasicFormatNull( OUString sFormatStrg )
return OUString("null");
}
OUString SbxBasicFormater::BasicFormat( double dNumber, OUString sFormatStrg )
OUString SbxBasicFormater::BasicFormat( double dNumber, const OUString& _sFormatStrg )
{
sal_Bool bPosFormatFound,bNegFormatFound,b0FormatFound;
OUString sFormatStrg = _sFormatStrg;
// analyse format-string concerning predefined formats:
if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_GENERALNUMBER ) )
@@ -1071,7 +1072,7 @@ OUString SbxBasicFormater::BasicFormat( double dNumber, OUString sFormatStrg )
return sReturnStrg;
}
sal_Bool SbxBasicFormater::isBasicFormat( OUString sFormatStrg )
sal_Bool SbxBasicFormater::isBasicFormat( const OUString& sFormatStrg )
{
if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_GENERALNUMBER ) )
{

View File

@@ -109,7 +109,7 @@ public:
virtual sal_Bool Compile();
virtual sal_Bool IsCompiled() const;
const SbxObject* FindType( OUString aTypeName ) const;
const SbxObject* FindType( const OUString& aTypeName ) const;
virtual sal_Bool IsBreakable( sal_uInt16 nLine ) const;
virtual sal_Bool IsBP( sal_uInt16 nLine ) const;

View File

@@ -84,14 +84,14 @@ class BASIC_DLLPUBLIC SbxBasicFormater {
// Constructor takes signs for decimal point, thousand separation sign
// and necessary resource strings.
SbxBasicFormater( sal_Unicode _cDecPoint, sal_Unicode _cThousandSep,
OUString _sOnStrg,
OUString _sOffStrg,
OUString _sYesStrg,
OUString _sNoStrg,
OUString _sTrueStrg,
OUString _sFalseStrg,
OUString _sCurrencyStrg,
OUString _sCurrencyFormatStrg );
const OUString& _sOnStrg,
const OUString& _sOffStrg,
const OUString& _sYesStrg,
const OUString& _sNoStrg,
const OUString& _sTrueStrg,
const OUString& _sFalseStrg,
const OUString& _sCurrencyStrg,
const OUString& _sCurrencyFormatStrg );
/* Basic command: Format$( number,format-string )
@@ -102,10 +102,10 @@ class BASIC_DLLPUBLIC SbxBasicFormater {
Return value:
String containing the formatted output
*/
OUString BasicFormat( double dNumber, OUString sFormatStrg );
OUString BasicFormatNull( OUString sFormatStrg );
OUString BasicFormat( double dNumber, const OUString& sFormatStrg );
OUString BasicFormatNull( const OUString& sFormatStrg );
static sal_Bool isBasicFormat( OUString sFormatStrg );
static sal_Bool isBasicFormat( const OUString& sFormatStrg );
private:
BASIC_DLLPRIVATE inline void ShiftString( OUStringBuffer& sStrg, sal_uInt16 nStartPos );