basic: prefer passing OUString and OString by reference
Change-Id: I8121204cdb37d4e1d8967397f3e45bdab6aaddad
This commit is contained in:
@@ -24,8 +24,8 @@ private:
|
|||||||
int m_nb_tests_ok;
|
int m_nb_tests_ok;
|
||||||
int m_nb_tests_skipped;
|
int m_nb_tests_skipped;
|
||||||
OUString m_sCurrentTest;
|
OUString m_sCurrentTest;
|
||||||
void process_directory(OUString sDirName);
|
void process_directory(const OUString& sDirName);
|
||||||
void run_test(OUString sFileName);
|
void run_test(const OUString& sFileName);
|
||||||
void test_failed(void);
|
void test_failed(void);
|
||||||
void test_success(void);
|
void test_success(void);
|
||||||
StringVec get_subdirnames( const OUString& sDirName );
|
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() );
|
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;
|
m_sCurrentTest = sFileURL;
|
||||||
bool result = false;
|
bool result = false;
|
||||||
@@ -113,7 +113,7 @@ Coverage::StringVec Coverage::get_subdirnames( const OUString& sDirName )
|
|||||||
}
|
}
|
||||||
return sSubDirNames;
|
return sSubDirNames;
|
||||||
}
|
}
|
||||||
void Coverage::process_directory(OUString sDirName)
|
void Coverage::process_directory(const OUString& sDirName)
|
||||||
{
|
{
|
||||||
osl::Directory aDir(sDirName);
|
osl::Directory aDir(sDirName);
|
||||||
osl::DirectoryItem aItem;
|
osl::DirectoryItem aItem;
|
||||||
|
@@ -146,14 +146,14 @@ class BasMgrContainerListenerImpl: public ContainerListenerHelper
|
|||||||
OUString maLibName; // empty -> no lib, but lib container
|
OUString maLibName; // empty -> no lib, but lib container
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BasMgrContainerListenerImpl( BasicManager* pMgr, OUString aLibName )
|
BasMgrContainerListenerImpl( BasicManager* pMgr, const OUString& aLibName )
|
||||||
: mpMgr( pMgr )
|
: mpMgr( pMgr )
|
||||||
, maLibName( aLibName ) {}
|
, maLibName( aLibName ) {}
|
||||||
|
|
||||||
static void insertLibraryImpl( const uno::Reference< script::XLibraryContainer >& xScriptCont, BasicManager* pMgr,
|
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,
|
static void addLibraryModulesImpl( BasicManager* pMgr, uno::Reference< container::XNameAccess > xLibNameAccess,
|
||||||
OUString aLibName );
|
const OUString& aLibName );
|
||||||
|
|
||||||
|
|
||||||
// XEventListener
|
// XEventListener
|
||||||
@@ -175,7 +175,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
void BasMgrContainerListenerImpl::insertLibraryImpl( const uno::Reference< script::XLibraryContainer >& xScriptCont,
|
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;
|
Reference< container::XNameAccess > xLibNameAccess;
|
||||||
aLibAny >>= xLibNameAccess;
|
aLibAny >>= xLibNameAccess;
|
||||||
@@ -208,7 +208,7 @@ void BasMgrContainerListenerImpl::insertLibraryImpl( const uno::Reference< scrip
|
|||||||
|
|
||||||
|
|
||||||
void BasMgrContainerListenerImpl::addLibraryModulesImpl( BasicManager* pMgr,
|
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();
|
uno::Sequence< OUString > aModuleNames = xLibNameAccess->getElementNames();
|
||||||
sal_Int32 nModuleCount = aModuleNames.getLength();
|
sal_Int32 nModuleCount = aModuleNames.getLength();
|
||||||
|
@@ -484,7 +484,7 @@ OUString SbiImage::GetString( short nId ) const
|
|||||||
return OUString();
|
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;
|
return rTypes.Is() ? (SbxObject*)rTypes->Find(aTypeName,SbxCLASS_OBJECT) : NULL;
|
||||||
}
|
}
|
||||||
|
@@ -524,7 +524,7 @@ sal_Bool SbModule::IsCompiled() const
|
|||||||
return sal_Bool( pImage != 0 );
|
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;
|
return pImage ? pImage->FindType( aTypeName ) : NULL;
|
||||||
}
|
}
|
||||||
|
@@ -75,7 +75,7 @@ public:
|
|||||||
OUString& GetSource32() { return aOUSource; }
|
OUString& GetSource32() { return aOUSource; }
|
||||||
sal_uInt16 GetBase() const { return nDimBase; }
|
sal_uInt16 GetBase() const { return nDimBase; }
|
||||||
OUString GetString( short nId ) const;
|
OUString GetString( short nId ) const;
|
||||||
const SbxObject* FindType (OUString aTypeName) const;
|
const SbxObject* FindType (const OUString& aTypeName) const;
|
||||||
|
|
||||||
SbxArrayRef GetEnums() { return rEnums; }
|
SbxArrayRef GetEnums() { return rEnums; }
|
||||||
|
|
||||||
|
@@ -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 );
|
INetURLObject aDirURLObj( aDirURLStr );
|
||||||
bool bRoot = false;
|
bool bRoot = false;
|
||||||
|
@@ -104,14 +104,14 @@ double get_number_of_digits( double dNumber )
|
|||||||
|
|
||||||
|
|
||||||
SbxBasicFormater::SbxBasicFormater( sal_Unicode _cDecPoint, sal_Unicode _cThousandSep,
|
SbxBasicFormater::SbxBasicFormater( sal_Unicode _cDecPoint, sal_Unicode _cThousandSep,
|
||||||
OUString _sOnStrg,
|
const OUString& _sOnStrg,
|
||||||
OUString _sOffStrg,
|
const OUString& _sOffStrg,
|
||||||
OUString _sYesStrg,
|
const OUString& _sYesStrg,
|
||||||
OUString _sNoStrg,
|
const OUString& _sNoStrg,
|
||||||
OUString _sTrueStrg,
|
const OUString& _sTrueStrg,
|
||||||
OUString _sFalseStrg,
|
const OUString& _sFalseStrg,
|
||||||
OUString _sCurrencyStrg,
|
const OUString& _sCurrencyStrg,
|
||||||
OUString _sCurrencyFormatStrg )
|
const OUString& _sCurrencyFormatStrg )
|
||||||
: cDecPoint(_cDecPoint)
|
: cDecPoint(_cDecPoint)
|
||||||
, cThousandSep(_cThousandSep)
|
, cThousandSep(_cThousandSep)
|
||||||
, sOnStrg(_sOnStrg)
|
, sOnStrg(_sOnStrg)
|
||||||
@@ -954,7 +954,7 @@ void SbxBasicFormater::ScanFormatString( double dNumber,
|
|||||||
sReturnStrgFinal = sReturnStrg.makeStringAndClear();
|
sReturnStrgFinal = sReturnStrg.makeStringAndClear();
|
||||||
}
|
}
|
||||||
|
|
||||||
OUString SbxBasicFormater::BasicFormatNull( OUString sFormatStrg )
|
OUString SbxBasicFormater::BasicFormatNull( const OUString& sFormatStrg )
|
||||||
{
|
{
|
||||||
sal_Bool bNullFormatFound;
|
sal_Bool bNullFormatFound;
|
||||||
OUString sNullFormatStrg = GetNullFormatString( sFormatStrg, bNullFormatFound );
|
OUString sNullFormatStrg = GetNullFormatString( sFormatStrg, bNullFormatFound );
|
||||||
@@ -966,9 +966,10 @@ OUString SbxBasicFormater::BasicFormatNull( OUString sFormatStrg )
|
|||||||
return OUString("null");
|
return OUString("null");
|
||||||
}
|
}
|
||||||
|
|
||||||
OUString SbxBasicFormater::BasicFormat( double dNumber, OUString sFormatStrg )
|
OUString SbxBasicFormater::BasicFormat( double dNumber, const OUString& _sFormatStrg )
|
||||||
{
|
{
|
||||||
sal_Bool bPosFormatFound,bNegFormatFound,b0FormatFound;
|
sal_Bool bPosFormatFound,bNegFormatFound,b0FormatFound;
|
||||||
|
OUString sFormatStrg = _sFormatStrg;
|
||||||
|
|
||||||
// analyse format-string concerning predefined formats:
|
// analyse format-string concerning predefined formats:
|
||||||
if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_GENERALNUMBER ) )
|
if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_GENERALNUMBER ) )
|
||||||
@@ -1071,7 +1072,7 @@ OUString SbxBasicFormater::BasicFormat( double dNumber, OUString sFormatStrg )
|
|||||||
return sReturnStrg;
|
return sReturnStrg;
|
||||||
}
|
}
|
||||||
|
|
||||||
sal_Bool SbxBasicFormater::isBasicFormat( OUString sFormatStrg )
|
sal_Bool SbxBasicFormater::isBasicFormat( const OUString& sFormatStrg )
|
||||||
{
|
{
|
||||||
if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_GENERALNUMBER ) )
|
if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_GENERALNUMBER ) )
|
||||||
{
|
{
|
||||||
|
@@ -109,7 +109,7 @@ public:
|
|||||||
|
|
||||||
virtual sal_Bool Compile();
|
virtual sal_Bool Compile();
|
||||||
virtual sal_Bool IsCompiled() const;
|
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 IsBreakable( sal_uInt16 nLine ) const;
|
||||||
virtual sal_Bool IsBP( sal_uInt16 nLine ) const;
|
virtual sal_Bool IsBP( sal_uInt16 nLine ) const;
|
||||||
|
@@ -84,14 +84,14 @@ class BASIC_DLLPUBLIC SbxBasicFormater {
|
|||||||
// Constructor takes signs for decimal point, thousand separation sign
|
// Constructor takes signs for decimal point, thousand separation sign
|
||||||
// and necessary resource strings.
|
// and necessary resource strings.
|
||||||
SbxBasicFormater( sal_Unicode _cDecPoint, sal_Unicode _cThousandSep,
|
SbxBasicFormater( sal_Unicode _cDecPoint, sal_Unicode _cThousandSep,
|
||||||
OUString _sOnStrg,
|
const OUString& _sOnStrg,
|
||||||
OUString _sOffStrg,
|
const OUString& _sOffStrg,
|
||||||
OUString _sYesStrg,
|
const OUString& _sYesStrg,
|
||||||
OUString _sNoStrg,
|
const OUString& _sNoStrg,
|
||||||
OUString _sTrueStrg,
|
const OUString& _sTrueStrg,
|
||||||
OUString _sFalseStrg,
|
const OUString& _sFalseStrg,
|
||||||
OUString _sCurrencyStrg,
|
const OUString& _sCurrencyStrg,
|
||||||
OUString _sCurrencyFormatStrg );
|
const OUString& _sCurrencyFormatStrg );
|
||||||
|
|
||||||
/* Basic command: Format$( number,format-string )
|
/* Basic command: Format$( number,format-string )
|
||||||
|
|
||||||
@@ -102,10 +102,10 @@ class BASIC_DLLPUBLIC SbxBasicFormater {
|
|||||||
Return value:
|
Return value:
|
||||||
String containing the formatted output
|
String containing the formatted output
|
||||||
*/
|
*/
|
||||||
OUString BasicFormat( double dNumber, OUString sFormatStrg );
|
OUString BasicFormat( double dNumber, const OUString& sFormatStrg );
|
||||||
OUString BasicFormatNull( OUString sFormatStrg );
|
OUString BasicFormatNull( const OUString& sFormatStrg );
|
||||||
|
|
||||||
static sal_Bool isBasicFormat( OUString sFormatStrg );
|
static sal_Bool isBasicFormat( const OUString& sFormatStrg );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BASIC_DLLPRIVATE inline void ShiftString( OUStringBuffer& sStrg, sal_uInt16 nStartPos );
|
BASIC_DLLPRIVATE inline void ShiftString( OUStringBuffer& sStrg, sal_uInt16 nStartPos );
|
||||||
|
Reference in New Issue
Block a user