summaryrefslogtreecommitdiff
path: root/basic/source/comp
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2012-11-06 23:34:23 -0600
committerNorbert Thiebaud <nthiebaud@gmail.com>2012-11-07 02:14:53 -0600
commit27239ad23006b1fd1ddb21467f4c1fd637b560d5 (patch)
tree605b30a50f25ef7e8f0d6511d6df24790ece90b9 /basic/source/comp
parentf510217832a6edaf6a44169cabdf739985d00125 (diff)
basic: String -> OUString
Change-Id: I42479b4bade5111e38d69f04c889c166f340d5ba
Diffstat (limited to 'basic/source/comp')
-rw-r--r--basic/source/comp/buffer.cxx91
-rw-r--r--basic/source/comp/codegen.cxx84
-rw-r--r--basic/source/comp/dim.cxx173
-rw-r--r--basic/source/comp/exprgen.cxx2
-rw-r--r--basic/source/comp/exprnode.cxx51
-rw-r--r--basic/source/comp/exprtree.cxx57
-rw-r--r--basic/source/comp/loops.cxx4
-rw-r--r--basic/source/comp/parser.cxx25
-rw-r--r--basic/source/comp/sbcomp.cxx80
-rw-r--r--basic/source/comp/symtbl.cxx65
-rw-r--r--basic/source/comp/token.cxx2
11 files changed, 381 insertions, 253 deletions
diff --git a/basic/source/comp/buffer.cxx b/basic/source/comp/buffer.cxx
index 6eb01f59a2f4..e3312c91e9c4 100644
--- a/basic/source/comp/buffer.cxx
+++ b/basic/source/comp/buffer.cxx
@@ -58,18 +58,33 @@ char* SbiBuffer::GetBuffer()
// Test, if the buffer can contain n Bytes.
// In case of doubt it will be enlarged
-bool SbiBuffer::Check( sal_uInt16 n )
+bool SbiBuffer::Check( sal_Int32 n )
{
- if( !n ) return true;
- if( ( static_cast<sal_uInt32>( nOff )+ n ) > static_cast<sal_uInt32>( nSize ) )
+ if( !n )
+ {
+ return true;
+ }
+ if( nOff + n > nSize )
{
if( nInc == 0 )
+ {
return false;
- sal_uInt16 nn = 0;
- while( nn < n ) nn = nn + nInc;
+ }
+
+ sal_Int32 nn = 0;
+ while( nn < n )
+ {
+ nn = nn + nInc;
+ }
char* p;
- if( ( static_cast<sal_uInt32>( nSize ) + nn ) > UP_LIMIT ) p = NULL;
- else p = new char [nSize + nn];
+ if( ( nSize + nn ) > UP_LIMIT )
+ {
+ p = NULL;
+ }
+ else
+ {
+ p = new char [nSize + nn];
+ }
if( !p )
{
pParser->Error( SbERR_PROG_TOO_LARGE );
@@ -140,16 +155,28 @@ bool SbiBuffer::operator +=( sal_Int8 n )
{
if( Check( 1 ) )
{
- *pCur++ = (char) n; nOff++; return true;
- } else return false;
+ *pCur++ = (char) n;
+ nOff += 1;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
bool SbiBuffer::operator +=( sal_uInt8 n )
{
if( Check( 1 ) )
{
- *pCur++ = (char) n; nOff++; return true;
- } else return false;
+ *pCur++ = (char) n;
+ nOff += 1;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
bool SbiBuffer::operator +=( sal_Int16 n )
@@ -158,8 +185,13 @@ bool SbiBuffer::operator +=( sal_Int16 n )
{
*pCur++ = (char) ( n & 0xFF );
*pCur++ = (char) ( n >> 8 );
- nOff += 2; return true;
- } else return false;
+ nOff += 2;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
bool SbiBuffer::operator +=( sal_uInt16 n )
@@ -168,8 +200,13 @@ bool SbiBuffer::operator +=( sal_uInt16 n )
{
*pCur++ = (char) ( n & 0xFF );
*pCur++ = (char) ( n >> 8 );
- nOff += 2; return true;
- } else return false;
+ nOff += 2;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
bool SbiBuffer::operator +=( sal_uInt32 n )
@@ -179,10 +216,15 @@ bool SbiBuffer::operator +=( sal_uInt32 n )
sal_uInt16 n1 = static_cast<sal_uInt16>( n & 0xFFFF );
sal_uInt16 n2 = static_cast<sal_uInt16>( n >> 16 );
if ( operator +=( n1 ) && operator +=( n2 ) )
+ {
return true;
+ }
return true;
}
- return false;
+ else
+ {
+ return false;
+ }
}
bool SbiBuffer::operator +=( sal_Int32 n )
@@ -191,18 +233,21 @@ bool SbiBuffer::operator +=( sal_Int32 n )
}
-bool SbiBuffer::operator +=( const String& n )
+bool SbiBuffer::operator +=( const OUString& n )
{
- sal_uInt16 l = n.Len() + 1;
- if( Check( l ) )
+ sal_uInt32 len = n.getLength() + 1;
+ if( Check( len ) )
{
rtl::OString aByteStr(rtl::OUStringToOString(n, osl_getThreadTextEncoding()));
- memcpy( pCur, aByteStr.getStr(), l );
- pCur += l;
- nOff = nOff + l;
+ memcpy( pCur, aByteStr.getStr(), len );
+ pCur += len;
+ nOff += len;
return true;
}
- else return false;
+ else
+ {
+ return false;
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx
index 3f389eb04188..77542dd58ae9 100644
--- a/basic/source/comp/codegen.cxx
+++ b/basic/source/comp/codegen.cxx
@@ -135,7 +135,7 @@ void SbiCodeGen::Save()
{
for( int i = 0 ; i < nIfaceCount ; i++ )
{
- const String& rIfaceName = pParser->aIfaceVector[i];
+ const OUString& rIfaceName = pParser->aIfaceVector[i];
SbxVariable* pIfaceVar = new SbxVariable( SbxVARIANT );
pIfaceVar->SetName( rIfaceName );
SbxArray* pIfaces = rMod.pClassData->mxIfaces;
@@ -168,30 +168,31 @@ void SbiCodeGen::Save()
SbiProcDef* pProc = pDef->GetProcDef();
if( pProc && pProc->IsDefined() )
{
- String aProcName = pProc->GetName();
- String aIfaceProcName;
- String aIfaceName;
+ OUString aProcName = pProc->GetName();
+ OUString aIfaceProcName;
+ OUString aIfaceName;
sal_uInt16 nPassCount = 1;
if( nIfaceCount )
{
- int nPropPrefixFound =
- aProcName.Search( String( RTL_CONSTASCII_USTRINGPARAM("Property ") ) );
- String aPureProcName = aProcName;
- String aPropPrefix;
+ int nPropPrefixFound = aProcName.indexOf(OUString("Property "));
+ OUString aPureProcName = aProcName;
+ OUString aPropPrefix;
if( nPropPrefixFound == 0 )
{
- aPropPrefix = aProcName.Copy( 0, 13 ); // 13 == Len( "Property ?et " )
- aPureProcName = aProcName.Copy( 13 );
+ aPropPrefix = aProcName.copy( 0, 13 ); // 13 == Len( "Property ?et " )
+ aPureProcName = aProcName.copy( 13 );
}
for( int i = 0 ; i < nIfaceCount ; i++ )
{
- const String& rIfaceName = pParser->aIfaceVector[i];
- int nFound = aPureProcName.Search( rIfaceName );
- if( nFound == 0 && '_' == aPureProcName.GetChar( rIfaceName.Len() ) )
+ const OUString& rIfaceName = pParser->aIfaceVector[i];
+ int nFound = aPureProcName.indexOf( rIfaceName );
+ if( nFound == 0 && '_' == aPureProcName[rIfaceName.getLength()] )
{
if( nPropPrefixFound == 0 )
+ {
aIfaceProcName += aPropPrefix;
- aIfaceProcName += aPureProcName.Copy( rIfaceName.Len() + 1 );
+ }
+ aIfaceProcName += aPureProcName.copy( rIfaceName.getLength() + 1 );
aIfaceName = rIfaceName;
nPassCount = 2;
break;
@@ -211,34 +212,38 @@ void SbiCodeGen::Save()
SbxDataType ePropType = SbxEMPTY;
switch( ePropMode )
{
- case PROPERTY_MODE_GET:
- ePropType = pProc->GetType();
- break;
- case PROPERTY_MODE_LET:
+ case PROPERTY_MODE_GET:
+ ePropType = pProc->GetType();
+ break;
+ case PROPERTY_MODE_LET:
+ {
+ // type == type of first parameter
+ ePropType = SbxVARIANT; // Default
+ SbiSymPool* pPool = &pProc->GetParams();
+ if( pPool->GetSize() > 1 )
{
- // type == type of first parameter
- ePropType = SbxVARIANT; // Default
- SbiSymPool* pPool = &pProc->GetParams();
- if( pPool->GetSize() > 1 )
+ SbiSymDef* pPar = pPool->Get( 1 );
+ if( pPar )
{
- SbiSymDef* pPar = pPool->Get( 1 );
- if( pPar )
- ePropType = pPar->GetType();
+ ePropType = pPar->GetType();
}
- break;
}
- case PROPERTY_MODE_SET:
- ePropType = SbxOBJECT;
- break;
- case PROPERTY_MODE_NONE:
- OSL_FAIL( "Illegal PropertyMode PROPERTY_MODE_NONE" );
- break;
+ break;
}
- String aPropName = pProc->GetPropName();
+ case PROPERTY_MODE_SET:
+ ePropType = SbxOBJECT;
+ break;
+ case PROPERTY_MODE_NONE:
+ OSL_FAIL( "Illegal PropertyMode PROPERTY_MODE_NONE" );
+ break;
+ }
+ OUString aPropName = pProc->GetPropName();
if( nPass == 1 )
- aPropName = aPropName.Copy( aIfaceName.Len() + 1 );
+ {
+ aPropName = aPropName.copy( aIfaceName.getLength() + 1 );
+ }
OSL_TRACE("*** getProcedureProperty for thing %s",
- rtl::OUStringToOString( aPropName,RTL_TEXTENCODING_UTF8 ).getStr() );
+ rtl::OUStringToOString( aPropName,RTL_TEXTENCODING_UTF8 ).getStr() );
rMod.GetProcedureProperty( aPropName, ePropType );
}
if( nPass == 1 )
@@ -250,10 +255,11 @@ void SbiCodeGen::Save()
pMeth = rMod.GetMethod( aProcName, pProc->GetType() );
if( !pProc->IsPublic() )
+ {
pMeth->SetFlag( SBX_PRIVATE );
-
+ }
// Declare? -> Hidden
- if( pProc->GetLib().Len() > 0 )
+ if( !pProc->GetLib().isEmpty())
{
pMeth->SetFlag( SBX_HIDDEN );
}
@@ -262,7 +268,7 @@ void SbiCodeGen::Save()
pMeth->nLine2 = pProc->GetLine2();
// The parameter:
SbxInfo* pInfo = pMeth->GetInfo();
- String aHelpFile, aComment;
+ OUString aHelpFile, aComment;
sal_uIntPtr nHelpId = 0;
if( pInfo )
{
@@ -289,7 +295,7 @@ void SbiCodeGen::Save()
t = (SbxDataType) ( t | SbxARRAY );
}
// #33677 hand-over an Optional-Info
- sal_uInt16 nFlags = SBX_READ;
+ sal_uInt16 nFlags = SBX_READ;
if( pPar->IsOptional() )
{
nFlags |= SBX_OPTIONAL;
diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx
index b2f5dc55080b..3a6c5c93d971 100644
--- a/basic/source/comp/dim.cxx
+++ b/basic/source/comp/dim.cxx
@@ -124,7 +124,7 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, bool bAsNewAlreadyParsed )
Error( SbERR_SYNTAX );
else
{
- String aCompleteName = aSym;
+ OUString aCompleteName = aSym;
// #52709 DIM AS NEW for Uno with full-qualified name
if( Peek() == DOT )
@@ -154,7 +154,7 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, bool bAsNewAlreadyParsed )
break;
}
- // Take over in the String pool
+ // Take over in the string pool
rDef.SetTypeId( aGblStrings.Add( aCompleteName ) );
if( rDef.IsNew() && pProc == NULL )
@@ -390,9 +390,11 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic )
{
if( !bCompatible && !pDef->IsNew() )
{
- String aTypeName( aGblStrings.Find( pDef->GetTypeId() ) );
+ OUString aTypeName( aGblStrings.Find( pDef->GetTypeId() ) );
if( rTypeArray->Find( aTypeName, SbxCLASS_OBJECT ) == NULL )
+ {
Error( SbERR_UNDEF_TYPE, aTypeName );
+ }
}
if( bConst )
@@ -595,9 +597,11 @@ void SbiParser::DefType( bool bPrivate )
if( pElem )
{
SbxArray *pTypeMembers = pType->GetProperties();
- String aElemName = pElem->GetName();
+ OUString aElemName = pElem->GetName();
if( pTypeMembers->Find( aElemName, SbxCLASS_DONTCARE) )
+ {
Error (SbERR_VAR_DEFINED);
+ }
else
{
SbxDataType eElemType = pElem->GetType();
@@ -644,7 +648,7 @@ void SbiParser::DefType( bool bPrivate )
sal_uInt16 nElemTypeId = pElem->GetTypeId();
if( nElemTypeId != 0 )
{
- String aTypeName( aGblStrings.Find( nElemTypeId ) );
+ OUString aTypeName( aGblStrings.Find( nElemTypeId ) );
SbxObject* pTypeObj = static_cast< SbxObject* >( rTypeArray->Find( aTypeName, SbxCLASS_OBJECT ) );
if( pTypeObj != NULL )
{
@@ -680,7 +684,7 @@ void SbiParser::DefEnum( bool bPrivate )
if (!TestSymbol())
return;
- String aEnumName = aSym;
+ OUString aEnumName = aSym;
if( rEnumArray->Find(aEnumName,SbxCLASS_OBJECT) )
{
Error( SbERR_VAR_DEFINED, aSym );
@@ -689,8 +693,9 @@ void SbiParser::DefEnum( bool bPrivate )
SbxObject *pEnum = new SbxObject( aEnumName );
if( bPrivate )
+ {
pEnum->SetFlag( SBX_PRIVATE );
-
+ }
SbiSymDef* pElem;
SbiDimList* pDim;
bool bDone = false;
@@ -812,7 +817,7 @@ SbiProcDef* SbiParser::ProcDecl( bool bDecl )
bool bFunc = ( eCurTok == FUNCTION );
bool bProp = ( eCurTok == GET || eCurTok == SET || eCurTok == LET );
if( !TestSymbol() ) return NULL;
- String aName( aSym );
+ OUString aName( aSym );
SbxDataType eType = eScanType;
SbiProcDef* pDef = new SbiProcDef( this, aName, true );
pDef->SetType( eType );
@@ -847,22 +852,26 @@ SbiProcDef* SbiParser::ProcDecl( bool bDecl )
if( !bDecl )
{
// CDECL, LIB and ALIAS are invalid
- if( pDef->GetLib().Len() )
+ if( !pDef->GetLib().isEmpty() )
+ {
Error( SbERR_UNEXPECTED, LIB );
- if( pDef->GetAlias().Len() )
+ }
+ if( !pDef->GetAlias().isEmpty() )
+ {
Error( SbERR_UNEXPECTED, ALIAS );
+ }
if( pDef->IsCdecl() )
{
Error( SbERR_UNEXPECTED, _CDECL_ );
}
pDef->SetCdecl( false );
- pDef->GetLib().Erase();
- pDef->GetAlias().Erase();
+ pDef->GetLib() = "";
+ pDef->GetAlias() = "";
}
- else if( !pDef->GetLib().Len() )
+ else if( pDef->GetLib().isEmpty() )
{
// ALIAS and CDECL only together with LIB
- if( pDef->GetAlias().Len() )
+ if( !pDef->GetAlias().isEmpty() )
{
Error( SbERR_UNEXPECTED, ALIAS );
}
@@ -871,72 +880,104 @@ SbiProcDef* SbiParser::ProcDecl( bool bDecl )
Error( SbERR_UNEXPECTED, _CDECL_ );
}
pDef->SetCdecl( false );
- pDef->GetAlias().Erase();
+ pDef->GetAlias() = "";
}
// Brackets?
if( Peek() == LPAREN )
{
Next();
if( Peek() == RPAREN )
+ {
Next();
+ }
else
- for(;;) {
- bool bByVal = false;
- bool bOptional = false;
- bool bParamArray = false;
- while( Peek() == BYVAL || Peek() == BYREF || Peek() == _OPTIONAL_ )
- {
- if ( Peek() == BYVAL ) Next(), bByVal = true;
- else if ( Peek() == BYREF ) Next(), bByVal = false;
- else if ( Peek() == _OPTIONAL_ ) Next(), bOptional = true;
- }
- if( bCompatible && Peek() == PARAMARRAY )
- {
- if( bByVal || bOptional )
- Error( SbERR_UNEXPECTED, PARAMARRAY );
- Next();
- bParamArray = true;
- }
- SbiSymDef* pPar = VarDecl( NULL, false, false );
- if( !pPar )
- break;
- if( bByVal )
- pPar->SetByVal();
- if( bOptional )
- pPar->SetOptional();
- if( bParamArray )
- pPar->SetParamArray();
- pDef->GetParams().Add( pPar );
- SbiToken eTok = Next();
- if( eTok != COMMA && eTok != RPAREN )
+ {
+ for(;;)
{
- bool bError2 = true;
- if( bOptional && bCompatible && eTok == EQ )
+ bool bByVal = false;
+ bool bOptional = false;
+ bool bParamArray = false;
+ while( Peek() == BYVAL || Peek() == BYREF || Peek() == _OPTIONAL_ )
{
- SbiConstExpression* pDefaultExpr = new SbiConstExpression( this );
- SbxDataType eType2 = pDefaultExpr->GetType();
-
- sal_uInt16 nStringId;
- if( eType2 == SbxSTRING )
- nStringId = aGblStrings.Add( pDefaultExpr->GetString() );
- else
- nStringId = aGblStrings.Add( pDefaultExpr->GetValue(), eType2 );
+ if( Peek() == BYVAL )
+ {
+ bByVal = true;
+ }
+ else if ( Peek() == BYREF )
+ {
+ bByVal = false;
+ }
+ else if ( Peek() == _OPTIONAL_ )
+ {
+ bOptional = true;
+ }
+ Next();
+ }
+ if( bCompatible && Peek() == PARAMARRAY )
+ {
+ if( bByVal || bOptional )
+ {
+ Error( SbERR_UNEXPECTED, PARAMARRAY );
+ }
+ Next();
+ bParamArray = true;
+ }
+ SbiSymDef* pPar = VarDecl( NULL, false, false );
+ if( !pPar )
+ {
+ break;
+ }
+ if( bByVal )
+ {
+ pPar->SetByVal();
+ }
+ if( bOptional )
+ {
+ pPar->SetOptional();
+ }
+ if( bParamArray )
+ {
+ pPar->SetParamArray();
+ }
+ pDef->GetParams().Add( pPar );
+ SbiToken eTok = Next();
+ if( eTok != COMMA && eTok != RPAREN )
+ {
+ bool bError2 = true;
+ if( bOptional && bCompatible && eTok == EQ )
+ {
+ SbiConstExpression* pDefaultExpr = new SbiConstExpression( this );
+ SbxDataType eType2 = pDefaultExpr->GetType();
- pPar->SetDefaultId( nStringId );
- delete pDefaultExpr;
+ sal_uInt16 nStringId;
+ if( eType2 == SbxSTRING )
+ {
+ nStringId = aGblStrings.Add( pDefaultExpr->GetString() );
+ }
+ else
+ {
+ nStringId = aGblStrings.Add( pDefaultExpr->GetValue(), eType2 );
+ }
+ pPar->SetDefaultId( nStringId );
+ delete pDefaultExpr;
- eTok = Next();
- if( eTok == COMMA || eTok == RPAREN )
- bError2 = false;
+ eTok = Next();
+ if( eTok == COMMA || eTok == RPAREN )
+ {
+ bError2 = false;
+ }
+ }
+ if( bError2 )
+ {
+ Error( SbERR_EXPECTED, RPAREN );
+ break;
+ }
}
- if( bError2 )
+ if( eTok == RPAREN )
{
- Error( SbERR_EXPECTED, RPAREN );
break;
}
}
- if( eTok == RPAREN )
- break;
}
}
TypeDecl( *pDef );
@@ -972,7 +1013,7 @@ void SbiParser::DefDeclare( bool bPrivate )
SbiProcDef* pDef = ProcDecl( true );
if( pDef )
{
- if( !pDef->GetLib().Len() )
+ if( pDef->GetLib().isEmpty() )
{
Error( SbERR_EXPECTED, LIB );
}
@@ -1002,7 +1043,7 @@ void SbiParser::DefDeclare( bool bPrivate )
pDef->SetPublic( !bPrivate );
// New declare handling
- if( pDef->GetLib().Len() > 0 )
+ if( !pDef->GetLib().isEmpty())
{
if( bNewGblDefs && nGblChain == 0 )
{
@@ -1051,7 +1092,7 @@ void SbiParser::DefDeclare( bool bPrivate )
SbiOpcode eOp = pDef->IsCdecl() ? _CALLC : _CALL;
sal_uInt16 nId = pDef->GetId();
- if( pDef->GetAlias().Len() )
+ if( !pDef->GetAlias().isEmpty() )
{
nId = ( nId & 0x8000 ) | aGblStrings.Add( pDef->GetAlias() );
}
diff --git a/basic/source/comp/exprgen.cxx b/basic/source/comp/exprgen.cxx
index 13ce100fe1cb..357809757c5a 100644
--- a/basic/source/comp/exprgen.cxx
+++ b/basic/source/comp/exprgen.cxx
@@ -216,7 +216,7 @@ void SbiExprList::Gen()
for( SbiExpression* pExpr = pFirst; pExpr; pExpr = pExpr->pNext,nCount++ )
{
pExpr->Gen();
- if( pExpr->GetName().Len() )
+ if( !pExpr->GetName().isEmpty() )
{
// named arg
sal_uInt16 nSid = pParser->aGblStrings.Add( pExpr->GetName() );
diff --git a/basic/source/comp/exprnode.cxx b/basic/source/comp/exprnode.cxx
index a863413a65ba..10c98942d492 100644
--- a/basic/source/comp/exprnode.cxx
+++ b/basic/source/comp/exprnode.cxx
@@ -53,7 +53,7 @@ SbiExprNode::SbiExprNode( SbiParser* p, double n, SbxDataType t )
nVal = n;
}
-SbiExprNode::SbiExprNode( SbiParser* p, const String& rVal )
+SbiExprNode::SbiExprNode( SbiParser* p, const OUString& rVal )
{
BaseInit( p );
@@ -256,8 +256,8 @@ void SbiExprNode::FoldConstants()
eType = SbxSTRING;
if( eType == SbxSTRING )
{
- String rl( pLeft->GetString() );
- String rr( pRight->GetString() );
+ OUString rl( pLeft->GetString() );
+ OUString rr( pRight->GetString() );
delete pLeft; pLeft = NULL;
delete pRight; pRight = NULL;
if( eTok == PLUS || eTok == CAT )
@@ -273,30 +273,31 @@ void SbiExprNode::FoldConstants()
{
eType = SbxDOUBLE;
eNodeType = SbxNUMVAL;
- StringCompare eRes = rr.CompareTo( rl );
+ int eRes = rr.compareTo( rl );
switch( eTok )
{
- case EQ:
- nVal = ( eRes == COMPARE_EQUAL ) ? SbxTRUE : SbxFALSE;
- break;
- case NE:
- nVal = ( eRes != COMPARE_EQUAL ) ? SbxTRUE : SbxFALSE;
- break;
- case LT:
- nVal = ( eRes == COMPARE_LESS ) ? SbxTRUE : SbxFALSE;
- break;
- case GT:
- nVal = ( eRes == COMPARE_GREATER ) ? SbxTRUE : SbxFALSE;
- break;
- case LE:
- nVal = ( eRes != COMPARE_GREATER ) ? SbxTRUE : SbxFALSE;
- break;
- case GE:
- nVal = ( eRes != COMPARE_LESS ) ? SbxTRUE : SbxFALSE;
- break;
- default:
- pGen->GetParser()->Error( SbERR_CONVERSION );
- bError = true;
+ case EQ:
+ nVal = ( eRes == 0 ) ? SbxTRUE : SbxFALSE;
+ break;
+ case NE:
+ nVal = ( eRes != 0 ) ? SbxTRUE : SbxFALSE;
+ break;
+ case LT:
+ nVal = ( eRes < 0 ) ? SbxTRUE : SbxFALSE;
+ break;
+ case GT:
+ nVal = ( eRes > 0 ) ? SbxTRUE : SbxFALSE;
+ break;
+ case LE:
+ nVal = ( eRes <= 0 ) ? SbxTRUE : SbxFALSE;
+ break;
+ case GE:
+ nVal = ( eRes >= 0 ) ? SbxTRUE : SbxFALSE;
+ break;
+ default:
+ pGen->GetParser()->Error( SbERR_CONVERSION );
+ bError = true;
+ break;
}
}
}
diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx
index 33857568b8bc..1037e77e190f 100644
--- a/basic/source/comp/exprtree.cxx
+++ b/basic/source/comp/exprtree.cxx
@@ -116,9 +116,8 @@ static sal_Bool DoParametersFollow( SbiParser* p, SbiExprType eCurExpr, SbiToken
// definition of a new symbol
-static SbiSymDef* AddSym
- ( SbiToken eTok, SbiSymPool& rPool, SbiExprType eCurExpr,
- const String& rName, SbxDataType eType, SbiParameters* pPar )
+static SbiSymDef* AddSym ( SbiToken eTok, SbiSymPool& rPool, SbiExprType eCurExpr,
+ const OUString& rName, SbxDataType eType, SbiParameters* pPar )
{
SbiSymDef* pDef;
// A= is not a procedure
@@ -145,12 +144,13 @@ static SbiSymDef* AddSym
if( pPar )
{
// generate dummy parameters
- sal_uInt16 n = 1;
+ sal_Int32 n = 1;
for( short i = 0; i < pPar->GetSize(); i++ )
{
- String aPar = rtl::OUString("PAR");
- aPar += ++n;
- pProc->GetParams().AddSym( aPar );
+ n += 1;
+ OUStringBuffer aPar("PAR");
+ aPar.append(n);
+ pProc->GetParams().AddSym( aPar.makeStringAndClear() );
}
}
}
@@ -196,7 +196,7 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
SbiToken eTok = (pKeywordSymbolInfo == NULL) ? pParser->Next() : pKeywordSymbolInfo->m_eTok;
// memorize the parsing's begin
pParser->LockColumn();
- String aSym( (pKeywordSymbolInfo == NULL) ? pParser->GetSym() : pKeywordSymbolInfo->m_aKeywordSymbol );
+ OUString aSym( (pKeywordSymbolInfo == NULL) ? pParser->GetSym() : pKeywordSymbolInfo->m_aKeywordSymbol );
SbxDataType eType = (pKeywordSymbolInfo == NULL) ? pParser->GetType() : pKeywordSymbolInfo->m_eSbxDataType;
SbiParameters* pPar = NULL;
SbiExprListVector* pvMoreParLcl = NULL;
@@ -332,10 +332,12 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
bError = true;
}
else if ( eType == SbxVARIANT )
+ {
// if there's nothing named, take the type of the entry,
// but only if the var hasn't been defined with AS XXX
// so that we catch n% = 5 : print n
eType = eDefType;
+ }
}
// checking type of variables:
// is there named anything different in the scanner?
@@ -360,7 +362,9 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
}
SbiExprNode* pNd = new SbiExprNode( pParser, *pDef, eType );
if( !pPar )
+ {
pPar = new SbiParameters( pParser,sal_False,sal_False );
+ }
pNd->aVar.pPar = pPar;
pNd->aVar.pvMorePar = pvMoreParLcl;
if( bObj )
@@ -409,9 +413,10 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj )
}
if( bError )
+ {
return NULL;
-
- String aSym( pParser->GetSym() );
+ }
+ OUString aSym( pParser->GetSym() );
SbxDataType eType = pParser->GetType();
SbiParameters* pPar = NULL;
SbiExprListVector* pvMoreParLcl = NULL;
@@ -609,7 +614,7 @@ SbiExprNode* SbiExpression::Unary()
bool bUsedForTypeOf = true;
SbiExprNode* pObjNode = Operand( bUsedForTypeOf );
pParser->TestToken( IS );
- String aDummy;
+ OUString aDummy;
SbiSymDef* pTypeDef = new SbiSymDef( aDummy );
pParser->TypeDecl( *pTypeDef, sal_True );
pNd = new SbiExprNode( pParser, pObjNode, pTypeDef->GetTypeId() );
@@ -618,7 +623,7 @@ SbiExprNode* SbiExpression::Unary()
case NEW:
{
pParser->Next();
- String aStr;
+ OUString aStr;
SbiSymDef* pTypeDef = new SbiSymDef( aStr );
pParser->TypeDecl( *pTypeDef, sal_True );
pNd = new SbiExprNode( pParser, pTypeDef->GetTypeId() );
@@ -739,10 +744,14 @@ SbiExprNode* SbiExpression::Comp()
{
SbiToken eTok = pParser->Peek();
if( m_eMode == EXPRMODE_ARRAY_OR_OBJECT )
+ {
break;
- if( eTok != EQ && eTok != NE && eTok != LT
- && eTok != GT && eTok != LE && eTok != GE )
+ }
+ if( eTok != EQ && eTok != NE && eTok != LT &&
+ eTok != GT && eTok != LE && eTok != GE )
+ {
break;
+ }
eTok = pParser->Next();
pNd = new SbiExprNode( pParser, pNd, eTok, Cat() );
nCount++;
@@ -775,7 +784,8 @@ SbiExprNode* SbiExpression::Like()
if( m_eMode != EXPRMODE_EMPTY_PAREN )
{
short nCount = 0;
- while( pParser->Peek() == LIKE ) {
+ while( pParser->Peek() == LIKE )
+ {
SbiToken eTok = pParser->Next();
pNd = new SbiExprNode( pParser, pNd, eTok, Comp() ), nCount++;
}
@@ -797,9 +807,12 @@ SbiExprNode* SbiExpression::Boolean()
for( ;; )
{
SbiToken eTok = pParser->Peek();
- if( eTok != AND && eTok != OR && eTok != XOR
- && eTok != EQV && eTok != IMP && eTok != IS )
+ if( (eTok != AND) && (eTok != OR) &&
+ (eTok != XOR) && (eTok != EQV) &&
+ (eTok != IMP) && (eTok != IS) )
+ {
break;
+ }
eTok = pParser->Next();
pNd = new SbiExprNode( pParser, pNd, eTok, Like() );
}
@@ -837,12 +850,12 @@ SbiConstExpression::SbiConstExpression( SbiParser* p ) : SbiExpression( p )
SbiSymDef* pVarDef = pExpr->GetVar();
sal_Bool bBoolVal = sal_False;
- if( pVarDef->GetName().EqualsIgnoreCaseAscii( "true" ) )
+ if( pVarDef->GetName().equalsIgnoreAsciiCase( "true" ) )
{
bIsBool = sal_True;
bBoolVal = sal_True;
}
- else if( pVarDef->GetName().EqualsIgnoreCaseAscii( "false" ) )
+ else if( pVarDef->GetName().equalsIgnoreAsciiCase( "false" ) )
//else if( pVarDef->GetName().ICompare( "false" ) == COMPARE_EQUAL )
{
bIsBool = sal_True;
@@ -1002,15 +1015,17 @@ SbiParameters::SbiParameters( SbiParser* p, bool bStandaloneExpression, bool bPa
if( ( bBracket && eTok == RPAREN ) || pParser->IsEoln( eTok ) )
{
if( eTok == RPAREN )
+ {
pParser->Next();
+ }
return;
}
// read in parameter table and lay down in correct order!
SbiExpression* pLast = NULL;
- String aName;
+ OUString aName;
while( !bError )
{
- aName.Erase();
+ aName = "";
// missing argument
if( eTok == COMMA )
{
diff --git a/basic/source/comp/loops.cxx b/basic/source/comp/loops.cxx
index 51953e068ca9..388911be93c7 100644
--- a/basic/source/comp/loops.cxx
+++ b/basic/source/comp/loops.cxx
@@ -458,8 +458,8 @@ done:
void SbiParser::On()
{
SbiToken eTok = Peek();
- String aString = SbiTokenizer::Symbol(eTok);
- if (aString.EqualsIgnoreCaseAscii("ERROR"))
+ OUString aString = SbiTokenizer::Symbol(eTok);
+ if (aString.equalsIgnoreAsciiCase("ERROR"))
{
eTok = _ERROR_; // Error comes as SYMBOL
}
diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx
index 587b478fcf9e..a4a4501077d9 100644
--- a/basic/source/comp/parser.cxx
+++ b/basic/source/comp/parser.cxx
@@ -155,7 +155,7 @@ SbiParser::SbiParser( StarBASIC* pb, SbModule* pm )
// part of the runtime-library?
-SbiSymDef* SbiParser::CheckRTLForSym( const String& rSym, SbxDataType eType )
+SbiSymDef* SbiParser::CheckRTLForSym( const OUString& rSym, SbxDataType eType )
{
SbxVariable* pVar = GetBasic()->GetRtl()->Find( rSym, SbxCLASS_DONTCARE );
SbiSymDef* pDef = NULL;
@@ -495,8 +495,8 @@ void SbiParser::Symbol( const KeywordSymbolInfo* pKeywordSymbolInfo )
SbiSymDef* pDef = aVar.GetRealVar();
if( bEQ && pDef && pDef->GetScope() == SbRTL )
{
- String aRtlName = pDef->GetName();
- if( aRtlName.EqualsIgnoreCaseAscii("Mid") )
+ OUString aRtlName = pDef->GetName();
+ if( aRtlName.equalsIgnoreAsciiCase("Mid") )
{
SbiExprNode* pExprNode = aVar.GetExprNode();
if( pExprNode && pExprNode->GetNodeType() == SbxVARVAL )
@@ -588,7 +588,7 @@ void SbiParser::Set()
if( eTok == NEW )
{
Next();
- String aStr;
+ OUString aStr;
SbiSymDef* pTypeDef = new SbiSymDef( aStr );
TypeDecl( *pTypeDef, sal_True );
@@ -715,11 +715,11 @@ void SbiParser::Implements()
return;
}
- String aImplementedIface = aSym;
+ OUString aImplementedIface = aSym;
Next();
if( Peek() == DOT )
{
- rtl::OUString aDotStr( '.' );
+ OUString aDotStr( '.' );
while( Peek() == DOT )
{
aImplementedIface += aDotStr;
@@ -769,9 +769,11 @@ void SbiParser::Option()
break;
case PRIVATE:
{
- String aString = SbiTokenizer::Symbol(Next());
- if( !aString.EqualsIgnoreCaseAscii("Module") )
+ OUString aString = SbiTokenizer::Symbol(Next());
+ if( !aString.equalsIgnoreAsciiCase("Module") )
+ {
Error( SbERR_EXPECTED, "Module" );
+ }
break;
}
case COMPARE:
@@ -825,9 +827,9 @@ void SbiParser::Option()
}
}
-void addStringConst( SbiSymPool& rPool, const char* pSym, const String& rStr )
+void addStringConst( SbiSymPool& rPool, const char* pSym, const OUString& rStr )
{
- SbiConstDef* pConst = new SbiConstDef( rtl::OUString::createFromAscii( pSym ) );
+ SbiConstDef* pConst = new SbiConstDef( OUString::createFromAscii( pSym ) );
pConst->SetType( SbxSTRING );
pConst->Set( rStr );
rPool.Add( pConst );
@@ -855,8 +857,7 @@ void SbiParser::AddConstants( void )
addStringConst( aPublics, "vbVerticalTab", "\x0B" );
// Force length 1 and make char 0 afterwards
- String aNullCharStr( rtl::OUString(" ") );
- aNullCharStr.SetChar( 0, 0 );
+ OUString aNullCharStr((sal_Unicode)0);
addStringConst( aPublics, "vbNullChar", aNullCharStr );
}
diff --git a/basic/source/comp/sbcomp.cxx b/basic/source/comp/sbcomp.cxx
index a9288d3d1d2a..45c94148529c 100644
--- a/basic/source/comp/sbcomp.cxx
+++ b/basic/source/comp/sbcomp.cxx
@@ -257,7 +257,7 @@ const char* lcl_getSpaces( int nSpaceCount )
return pSpacesEnd - nSpaceCount;
}
-static rtl::OString lcl_toOStringSkipLeadingWhites( const String& aStr )
+static rtl::OString lcl_toOStringSkipLeadingWhites( const OUString& aStr )
{
static sal_Char Buffer[1000];
@@ -282,7 +282,7 @@ static rtl::OString lcl_toOStringSkipLeadingWhites( const String& aStr )
String lcl_dumpMethodParameters( SbMethod* pMethod )
{
- String aStr;
+ OUString aStr;
if( pMethod == NULL )
{
return aStr;
@@ -299,7 +299,7 @@ String lcl_dumpMethodParameters( SbMethod* pMethod )
{
SbxVariable* pVar = pParams->Get( nParam );
DBG_ASSERT( pVar, "Parameter?!" );
- if ( pVar->GetName().Len() )
+ if ( !pVar->GetName().isEmpty() )
{
aStr += pVar->GetName();
}
@@ -314,11 +314,17 @@ String lcl_dumpMethodParameters( SbMethod* pMethod )
aStr += '=';
SbxDataType eType = pVar->GetType();
if( eType & SbxARRAY )
- aStr += String( RTL_CONSTASCII_USTRINGPARAM( "..." ) );
+ {
+ aStr += "...";
+ }
else if( eType != SbxOBJECT )
+ {
aStr += pVar->GetString();
+ }
if ( nParam < ( pParams->Count() - 1 ) )
- aStr += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) );
+ {
+ aStr += ", ";
+ }
}
aStr += ')';
}
@@ -344,7 +350,7 @@ static bool GbBlockAll = false;
struct FunctionItem
{
- String m_aCompleteFunctionName;
+ OUString m_aCompleteFunctionName;
double m_dTotalTime;
double m_dNetTime;
int m_nCallCount;
@@ -405,7 +411,7 @@ void lcl_printTimeOutput( void )
FunctionItem* pFunctionItem = *itv;
if( pFunctionItem != NULL )
{
- rtl::OUString aCompleteFunctionName = pFunctionItem->m_aCompleteFunctionName;
+ OUString aCompleteFunctionName = pFunctionItem->m_aCompleteFunctionName;
const char* pName = OUStringToOString( aCompleteFunctionName, RTL_TEXTENCODING_ASCII_US ).getStr();
int nNameLen = aCompleteFunctionName.getLength();
@@ -512,7 +518,7 @@ void dbg_DeInitTrace( void )
static sal_Int32 GnLastCallLvl = 0;
-void dbg_tracePrint( const String& aStr, sal_Int32 nCallLvl, bool bCallLvlRelativeToCurrent )
+void dbg_tracePrint( const OUString& aStr, sal_Int32 nCallLvl, bool bCallLvlRelativeToCurrent )
{
if( bCallLvlRelativeToCurrent )
{
@@ -554,7 +560,7 @@ void dbg_traceStep( SbModule* pModule, sal_uInt32 nPC, sal_Int32 nCallLvl )
pTraceMod = pClassModuleObj->getClassModule();
}
- String aModuleName = pTraceMod->GetName();
+ OUString aModuleName = pTraceMod->GetName();
ModuleTraceMap::iterator it = rModuleTraceMap.find( aModuleName );
if( it == rModuleTraceMap.end() )
{
@@ -663,16 +669,16 @@ void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, sal_Int32 nCallL
pTraceMod = pClassModuleObj->getClassModule();
}
- String aCompleteFunctionName = pTraceMod->GetName();
+ OUString aCompleteFunctionName = pTraceMod->GetName();
if( pMethod != NULL )
{
- aCompleteFunctionName.AppendAscii( "::" );
- String aMethodName = pMethod->GetName();
+ aCompleteFunctionName += "::";
+ OUString aMethodName = pMethod->GetName();
aCompleteFunctionName += aMethodName;
}
else
{
- aCompleteFunctionName.AppendAscii( "/RunInit" );
+ aCompleteFunctionName += "/RunInit";
}
bool bOwnBlockSteps = false;
@@ -761,27 +767,28 @@ void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, sal_Int32 nCallL
lcl_lineOut( pSeparator, lcl_getSpaces( nIndent ) );
}
- String aStr;
+ OUString aStr;
if( bLeave )
{
if( !bOwnBlockSteps )
{
lcl_lineOut( "}", lcl_getSpaces( nIndent ) );
- aStr.AppendAscii( "' Leaving " );
+ aStr = "' Leaving ";
}
}
else
{
- aStr.AppendAscii( "Entering " );
+ aStr = "Entering " ;
}
if( !bLeave || !bOwnBlockSteps )
+ {
aStr += aCompleteFunctionName;
-
+ }
if( !bOwnBlockSteps && pClassModuleObj != NULL )
{
- aStr.AppendAscii( "[this=" );
+ aStr += "[this=";
aStr += pClassModuleObj->GetName();
- aStr.AppendAscii( "]" );
+ aStr += "]" ;
}
if( !bLeave )
{
@@ -814,7 +821,8 @@ void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, sal_Int32 nCallL
#endif
}
-void dbg_traceNotifyError( SbError nTraceErr, const String& aTraceErrMsg, bool bTraceErrHandled, sal_Int32 nCallLvl )
+void dbg_traceNotifyError( SbError nTraceErr, const OUString& aTraceErrMsg,
+ bool bTraceErrHandled, sal_Int32 nCallLvl )
{
if( !GbTraceOn )
{
@@ -838,9 +846,9 @@ void dbg_traceNotifyError( SbError nTraceErr, const String& aTraceErrMsg, bool b
}
void dbg_RegisterTraceTextForPC( SbModule* pModule, sal_uInt32 nPC,
- const String& aTraceStr_STMNT, const String& aTraceStr_PCode )
+ const OUString& aTraceStr_STMNT, const OUString& aTraceStr_PCode )
{
- String aModuleName = pModule->GetName();
+ OUString aModuleName = pModule->GetName();
ModuleTraceMap::iterator it = rModuleTraceMap.find( aModuleName );
PCToTextDataMap* pInnerMap;
if( it == rModuleTraceMap.end() )
@@ -875,21 +883,25 @@ void RTL_Impl_TraceCommand( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite )
return;
}
- String aCommand = rPar.Get(1)->GetString();
+ OUString aCommand = rPar.Get(1)->GetString();
- if( aCommand.EqualsIgnoreCaseAscii( "TraceOn" ) )
+ if( aCommand.equalsIngoreAsciiCase( "TraceOn" ) )
+ {
GbTraceOn = true;
- else
- if( aCommand.EqualsIgnoreCaseAscii( "TraceOff" ) )
+ }
+ else if( aCommand.equalsIngoreAsciiCase( "TraceOff" ) )
+ {
GbTraceOn = false;
- else
- if( aCommand.EqualsIgnoreCaseAscii( "PCodeOn" ) )
+ }
+ else if( aCommand.equalsIngoreAsciiCase( "PCodeOn" ) )
+ {
GbIncludePCodes = true;
- else
- if( aCommand.EqualsIgnoreCaseAscii( "PCodeOff" ) )
+ }
+ else if( aCommand.equalsIngoreAsciiCase( "PCodeOff" ) )
+ {
GbIncludePCodes = false;
- else
- if( aCommand.EqualsIgnoreCaseAscii( "Print" ) )
+ }
+ else if( aCommand.equalsIngoreAsciiCase( "Print" ) )
{
if ( rPar.Count() < 3 )
{
@@ -901,11 +913,11 @@ void RTL_Impl_TraceCommand( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite )
if( eOld != SbxERR_OK )
SbxBase::ResetError();
- String aValStr = rPar.Get(2)->GetString();
+ OUString aValStr = rPar.Get(2)->GetString();
SbxError eErr = SbxBase::GetError();
if( eErr != SbxERR_OK )
{
- aValStr = String( RTL_CONSTASCII_USTRINGPARAM( "<ERROR converting value to String>" ) );
+ aValStr = "<ERROR converting value to String>";
SbxBase::ResetError();
}
diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx
index 4c550497a423..005ae381ebcc 100644
--- a/basic/source/comp/symtbl.cxx
+++ b/basic/source/comp/symtbl.cxx
@@ -51,12 +51,12 @@ const rtl::OUString& SbiStringPool::Find( sal_uInt32 n ) const
return aData[n - 1];
}
-short SbiStringPool::Add( const rtl::OUString& rVal, bool bNoCase )
+short SbiStringPool::Add( const OUString& rVal, bool bNoCase )
{
sal_uInt32 n = aData.size();
for( sal_uInt32 i = 0; i < n; ++i )
{
- rtl::OUString& p = aData[i];
+ OUString& p = aData[i];
if( ( bNoCase && p == rVal )
|| ( !bNoCase && p.equalsIgnoreAsciiCase( rVal ) ) )
return i+1;
@@ -114,7 +114,7 @@ SbiSymDef* SbiSymPool::Next()
}
-SbiSymDef* SbiSymPool::AddSym( const String& rName )
+SbiSymDef* SbiSymPool::AddSym( const OUString& rName )
{
SbiSymDef* p = new SbiSymDef( rName );
p->nPos = aData.size();
@@ -125,7 +125,7 @@ SbiSymDef* SbiSymPool::AddSym( const String& rName )
return p;
}
-SbiProcDef* SbiSymPool::AddProc( const String& rName )
+SbiProcDef* SbiSymPool::AddProc( const OUString& rName )
{
SbiProcDef* p = new SbiProcDef( pParser, rName );
p->nPos = aData.size();
@@ -157,11 +157,11 @@ void SbiSymPool::Add( SbiSymDef* pDef )
{
// A unique name must be created in the string pool
// for static variables (Form ProcName:VarName)
- String aName( pDef->aName );
+ OUString aName( pDef->aName );
if( pDef->IsStatic() )
{
aName = pParser->aGblStrings.Find( nProcId );
- aName += ':';
+ aName += ":";
aName += pDef->aName;
}
pDef->nId = rStrings.Add( aName );
@@ -177,15 +177,17 @@ void SbiSymPool::Add( SbiSymDef* pDef )
}
-SbiSymDef* SbiSymPool::Find( const String& rName ) const
+SbiSymDef* SbiSymPool::Find( const OUString& rName ) const
{
sal_uInt16 nCount = aData.size();
for( sal_uInt16 i = 0; i < nCount; i++ )
{
SbiSymDef* p = aData[ nCount - i - 1 ];
- if( ( !p->nProcId || ( p->nProcId == nProcId ) )
- && ( p->aName.EqualsIgnoreCaseAscii( rName ) ) )
+ if( ( !p->nProcId || ( p->nProcId == nProcId)) &&
+ ( p->aName.equalsIgnoreAsciiCase(rName)))
+ {
return p;
+ }
}
if( pParent )
{
@@ -232,7 +234,7 @@ SbiSymDef* SbiSymPool::Get( sal_uInt16 n ) const
}
}
-sal_uInt32 SbiSymPool::Define( const String& rName )
+sal_uInt32 SbiSymPool::Define( const OUString& rName )
{
SbiSymDef* p = Find( rName );
if( p )
@@ -249,7 +251,7 @@ sal_uInt32 SbiSymPool::Define( const String& rName )
return p->Define();
}
-sal_uInt32 SbiSymPool::Reference( const String& rName )
+sal_uInt32 SbiSymPool::Reference( const OUString& rName )
{
SbiSymDef* p = Find( rName );
if( !p )
@@ -280,7 +282,7 @@ void SbiSymPool::CheckRefs()
|*
***************************************************************************/
-SbiSymDef::SbiSymDef( const String& rName ) : aName( rName )
+SbiSymDef::SbiSymDef( const OUString& rName ) : aName( rName )
{
eType = SbxEMPTY;
nDims = 0;
@@ -322,7 +324,7 @@ SbiConstDef* SbiSymDef::GetConstDef()
}
-const String& SbiSymDef::GetName()
+const OUString& SbiSymDef::GetName()
{
if( pIn )
{
@@ -336,15 +338,20 @@ void SbiSymDef::SetType( SbxDataType t )
{
if( t == SbxVARIANT && pIn )
{
- sal_Unicode cu = aName.GetBuffer()[0];
+ sal_Unicode cu = aName[0];
if( cu < 256 )
{
- char ch = (char)aName.GetBuffer()[0];
- if( ch == '_' ) ch = 'Z';
+ char ch = (char)cu;
+ if( ch == '_' )
+ {
+ ch = 'Z';
+ }
int ch2 = toupper( ch );
unsigned char c = (unsigned char)ch2;
if( c > 0 && c < 128 )
+ {
t = pIn->pParser->eDefTypes[ ch2 - 'A' ];
+ }
}
}
eType = t;
@@ -369,7 +376,10 @@ sal_uInt32 SbiSymDef::Define()
{
sal_uInt32 n = pIn->pParser->aGen.GetPC();
pIn->pParser->aGen.GenStmnt();
- if( nChain ) pIn->pParser->aGen.BackChain( nChain );
+ if( nChain )
+ {
+ pIn->pParser->aGen.BackChain( nChain );
+ }
nChain = n;
bChained = true;
return nChain;
@@ -400,7 +410,7 @@ SbiSymScope SbiSymDef::GetScope() const
// 2) pPool: all local variables
// 3) aLabels: labels
-SbiProcDef::SbiProcDef( SbiParser* pParser, const String& rName,
+SbiProcDef::SbiProcDef( SbiParser* pParser, const OUString& rName,
bool bProcDecl )
: SbiSymDef( rName )
, aParams( pParser->aGblStrings, SbPARAM ) // is dumped
@@ -484,16 +494,13 @@ void SbiProcDef::setPropertyMode( PropertyMode ePropMode )
// CompleteProcName includes "Property xxx "
// to avoid conflicts with other symbols
- String aCompleteProcName;
- aCompleteProcName.AppendAscii( "Property " );
+ OUString aCompleteProcName = "Property ";
switch( mePropMode )
{
- case PROPERTY_MODE_GET: aCompleteProcName.AppendAscii( "Get " ); break;
- case PROPERTY_MODE_LET: aCompleteProcName.AppendAscii( "Let " ); break;
- case PROPERTY_MODE_SET: aCompleteProcName.AppendAscii( "Set " ); break;
- case PROPERTY_MODE_NONE:
- OSL_FAIL( "Illegal PropertyMode PROPERTY_MODE_NONE" );
- break;
+ case PROPERTY_MODE_GET: aCompleteProcName += "Get "; break;
+ case PROPERTY_MODE_LET: aCompleteProcName += "Let "; break;
+ case PROPERTY_MODE_SET: aCompleteProcName += "Set "; break;
+ case PROPERTY_MODE_NONE: OSL_FAIL( "Illegal PropertyMode PROPERTY_MODE_NONE" ); break;
}
aCompleteProcName += aName;
aName = aCompleteProcName;
@@ -502,7 +509,7 @@ void SbiProcDef::setPropertyMode( PropertyMode ePropMode )
-SbiConstDef::SbiConstDef( const String& rName )
+SbiConstDef::SbiConstDef( const OUString& rName )
: SbiSymDef( rName )
{
nVal = 0; eType = SbxINTEGER;
@@ -510,10 +517,10 @@ SbiConstDef::SbiConstDef( const String& rName )
void SbiConstDef::Set( double n, SbxDataType t )
{
- aVal.Erase(); nVal = n; eType = t;
+ aVal = ""; nVal = n; eType = t;
}
-void SbiConstDef::Set( const String& n )
+void SbiConstDef::Set( const OUString& n )
{
aVal = n; nVal = 0; eType = SbxSTRING;
}
diff --git a/basic/source/comp/token.cxx b/basic/source/comp/token.cxx
index 7ebcb17eeb43..a6054c19415a 100644
--- a/basic/source/comp/token.cxx
+++ b/basic/source/comp/token.cxx
@@ -452,7 +452,7 @@ special:
sal_uInt16 nOldCol = nCol;
sal_uInt16 nOldCol1 = nCol1;
sal_uInt16 nOldCol2 = nCol2;
- String aOldSym = aSym;
+ OUString aOldSym = aSym;
SaveLine(); // save pLine in the scanner
eCurTok = Peek();