summaryrefslogtreecommitdiff
path: root/idl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-09-20 23:30:51 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-09-21 09:47:38 +0100
commit2cd8d42be0379e897c8331175ea9bd7f32e171a0 (patch)
tree4a8b60bb5a5a66520f2ab916071ed469fd841b72 /idl
parent3eb62d6899534023fac60b1aa57dce337aa94cf9 (diff)
ByteString->rtl::OStringBuffer
Diffstat (limited to 'idl')
-rw-r--r--idl/inc/types.hxx5
-rw-r--r--idl/source/cmptools/lex.cxx23
-rw-r--r--idl/source/objects/object.cxx13
-rw-r--r--idl/source/objects/slot.cxx44
-rw-r--r--idl/source/objects/types.cxx32
-rw-r--r--idl/source/prj/database.cxx8
6 files changed, 72 insertions, 53 deletions
diff --git a/idl/inc/types.hxx b/idl/inc/types.hxx
index a40cc68c6ff8..4ee6889ec4d3 100644
--- a/idl/inc/types.hxx
+++ b/idl/inc/types.hxx
@@ -29,6 +29,7 @@
#ifndef _TYPES_HXX
#define _TYPES_HXX
+#include <rtl/strbuf.hxx>
#include <tools/ref.hxx>
#include <basobj.hxx>
@@ -116,7 +117,7 @@ public:
WriteType, WriteAttribute );
virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab,
WriteType, WriteAttribute = 0 );
- sal_uLong MakeSfx( ByteString& rAtrrArray );
+ sal_uLong MakeSfx( rtl::OStringBuffer& rAtrrArray );
virtual void Insert( SvSlotElementList&, const ByteString & rPrefix,
SvIdlDataBase& );
virtual void WriteHelpId( SvIdlDataBase & rBase, SvStream & rOutStm,
@@ -238,7 +239,7 @@ public:
void WriteOdlType( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab );
void AppendParserString (ByteString &rString);
- sal_uLong MakeSfx( ByteString& rAtrrArray );
+ sal_uLong MakeSfx( rtl::OStringBuffer& rAtrrArray );
virtual void WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm );
sal_Bool ReadMethodArgs( SvIdlDataBase & rBase,
SvTokenStream & rInStm );
diff --git a/idl/source/cmptools/lex.cxx b/idl/source/cmptools/lex.cxx
index ace8e064d0de..fcb33fa47859 100644
--- a/idl/source/cmptools/lex.cxx
+++ b/idl/source/cmptools/lex.cxx
@@ -37,6 +37,7 @@
#include <lex.hxx>
#include <globals.hxx>
#include <tools/bigint.hxx>
+#include <rtl/strbuf.hxx>
rtl::OString SvToken::GetTokenAsString() const
{
@@ -288,7 +289,7 @@ sal_Bool SvTokenStream::MakeToken( SvToken & rToken )
}
else if( c == '"' )
{
- ByteString aStr;
+ rtl::OStringBuffer aStr;
sal_Bool bDone = sal_False;
while( !bDone && !IsEof() && c )
{
@@ -296,7 +297,7 @@ sal_Bool SvTokenStream::MakeToken( SvToken & rToken )
if( '\0' == c )
{
// read strings beyond end of line
- aStr += '\n';
+ aStr.append('\n');
c = GetNextChar();
if( IsEof() )
return sal_False;
@@ -306,26 +307,26 @@ sal_Bool SvTokenStream::MakeToken( SvToken & rToken )
c = GetFastNextChar();
if( c == '"' )
{
- aStr += '"';
- aStr += '"';
+ aStr.append('"');
+ aStr.append('"');
}
else
bDone = sal_True;
}
else if( c == '\\' )
{
- aStr += '\\';
+ aStr.append('\\');
c = GetFastNextChar();
if( c )
- aStr += (char)c;
+ aStr.append(static_cast<char>(c));
}
else
- aStr += (char)c;
+ aStr.append(static_cast<char>(c));
}
if( IsEof() || ( SVSTREAM_OK != rInStream.GetError() ) )
return sal_False;
rToken.nType = SVTOKEN_STRING;
- rToken.aString = aStr;
+ rToken.aString = aStr.makeStringAndClear();
}
else if( isdigit( c ) )
{
@@ -335,13 +336,13 @@ sal_Bool SvTokenStream::MakeToken( SvToken & rToken )
}
else if( isalpha (c) || (c == '_') )
{
- ByteString aStr;
-
+ rtl::OStringBuffer aBuf;
while( isalnum( c ) || c == '_' )
{
- aStr += (char)c;
+ aBuf.append(static_cast<char>(c));
c = GetFastNextChar();
}
+ ByteString aStr = aBuf.makeStringAndClear();
if( aStr.EqualsIgnoreCaseAscii( aStrTrue ) )
{
rToken.nType = SVTOKEN_BOOL;
diff --git a/idl/source/objects/object.cxx b/idl/source/objects/object.cxx
index a393ee1c98b9..676dcdd30f82 100644
--- a/idl/source/objects/object.cxx
+++ b/idl/source/objects/object.cxx
@@ -32,6 +32,8 @@
#include <ctype.h>
#include <stdio.h>
+#include <rtl/strbuf.hxx>
+
#include <tools/debug.hxx>
#include <object.hxx>
@@ -516,13 +518,14 @@ void SvMetaClass::InsertSlots( SvSlotElementList& rList, std::vector<sal_uLong>&
{
SvClassElement * pEle = aClassList.GetObject( n );
SvMetaClass * pCl = pEle->GetClass();
- ByteString rPre = rPrefix;
- if( rPre.Len() && pEle->GetPrefix().Len() )
- rPre += '.';
- rPre += pEle->GetPrefix();
+ rtl::OStringBuffer rPre(rPrefix);
+ if( rPre.getLength() && pEle->GetPrefix().Len() )
+ rPre.append('.');
+ rPre.append(pEle->GetPrefix());
// first of all write direct imported interfaces
- pCl->InsertSlots( rList, rSuperList, rClassList, rPre, rBase );
+ pCl->InsertSlots( rList, rSuperList, rClassList,
+ rPre.makeStringAndClear(), rBase );
}
// only write superclass if no shell and not in the list
diff --git a/idl/source/objects/slot.cxx b/idl/source/objects/slot.cxx
index e56d95776960..8f2eeb76b61e 100644
--- a/idl/source/objects/slot.cxx
+++ b/idl/source/objects/slot.cxx
@@ -31,6 +31,7 @@
#include <ctype.h>
#include <stdio.h>
+#include <rtl/strbuf.hxx>
#include <tools/debug.hxx>
#include <slot.hxx>
#include <globals.hxx>
@@ -1011,17 +1012,21 @@ void SvMetaSlot::Insert( SvSlotElementList& rList, const ByteString & rPrefix,
// create SlotId
SvMetaEnumValue *enumValue = pEnum->GetObject(n);
ByteString aValName = enumValue->GetName();
- ByteString aSId( GetSlotId() );
+ rtl::OStringBuffer aBuf;
if( GetPseudoPrefix().Len() )
- aSId = GetPseudoPrefix();
- aSId += '_';
- aSId += aValName.Copy( pEnum->GetPrefix().Len() );
+ aBuf.append(GetPseudoPrefix());
+ else
+ aBuf.append(GetSlotId());
+ aBuf.append('_');
+ aBuf.append(aValName.Copy(pEnum->GetPrefix().Len()));
+
+ rtl::OString aSId = aBuf.makeStringAndClear();
xEnumSlot = NULL;
for( m=0; m<rBase.GetAttrList().Count(); m++ )
{
SvMetaAttribute * pAttr = rBase.GetAttrList().GetObject( m );
- if( pAttr->GetSlotId() == aSId )
+ if (aSId.equals(pAttr->GetSlotId()))
{
SvMetaSlot* pSlot = PTR_CAST( SvMetaSlot, pAttr );
xEnumSlot = pSlot->Clone();
@@ -1520,11 +1525,15 @@ void SvMetaSlot::WriteSrc( SvIdlDataBase & rBase, SvStream & rOutStm,
for( sal_uLong n = 0; n < pEnum->Count(); n++ )
{
ByteString aValName = pEnum->GetObject( n )->GetName();
- ByteString aSId( GetSlotId() );
+ rtl::OStringBuffer aBuf;
if( GetPseudoPrefix().Len() )
- aSId = GetPseudoPrefix();
- aSId += '_';
- aSId += aValName.Copy( pEnum->GetPrefix().Len() );
+ aBuf.append(GetPseudoPrefix());
+ else
+ aBuf.append(GetSlotId());
+ aBuf.append('_');
+ aBuf.append(aValName.Copy(pEnum->GetPrefix().Len()));
+
+ rtl::OString aSId = aBuf.makeStringAndClear();
sal_uLong nSId2;
sal_Bool bIdOk = sal_False;
@@ -1538,7 +1547,7 @@ void SvMetaSlot::WriteSrc( SvIdlDataBase & rBase, SvStream & rOutStm,
if( !bIdOk || !pTable->IsKeyValid( nSId2 ) )
{
pTable->Insert( nSId2, this );
- rOutStm << "SfxSlotInfo " << aSId.GetBuffer()
+ rOutStm << "SfxSlotInfo " << aSId.getStr()
<< endl << '{' << endl;
WriteTab( rOutStm, 1 );
@@ -1574,11 +1583,16 @@ void SvMetaSlot::WriteHelpId( SvIdlDataBase & rBase, SvStream & rOutStm,
for( sal_uLong n = 0; n < pEnum->Count(); n++ )
{
ByteString aValName = pEnum->GetObject( n )->GetName();
- ByteString aSId( GetSlotId() );
+
+ rtl::OStringBuffer aBuf;
if( GetPseudoPrefix().Len() )
- aSId = GetPseudoPrefix();
- aSId += '_';
- aSId += aValName.Copy( pEnum->GetPrefix().Len() );
+ aBuf.append(GetPseudoPrefix());
+ else
+ aBuf.append( GetSlotId() );
+ aBuf.append('_');
+ aBuf.append(aValName.Copy(pEnum->GetPrefix().Len()));
+
+ rtl::OString aSId = aBuf.makeStringAndClear();
sal_uLong nSId2;
sal_Bool bIdOk = sal_False;
@@ -1593,7 +1607,7 @@ void SvMetaSlot::WriteHelpId( SvIdlDataBase & rBase, SvStream & rOutStm,
{
pTable->Insert( nSId2, this );
- rOutStm << "#define " << aSId.GetBuffer() << '\t'
+ rOutStm << "#define " << aSId.getStr() << '\t'
<< rtl::OString::valueOf(
static_cast<sal_Int32>(nSId2)).getStr()
<< endl;
diff --git a/idl/source/objects/types.cxx b/idl/source/objects/types.cxx
index a32bff132fb7..c6d980f20a4b 100644
--- a/idl/source/objects/types.cxx
+++ b/idl/source/objects/types.cxx
@@ -722,7 +722,7 @@ void SvMetaAttribute::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
}
}
-sal_uLong SvMetaAttribute::MakeSfx( ByteString& rAttrArray )
+sal_uLong SvMetaAttribute::MakeSfx( rtl::OStringBuffer& rAttrArray )
{
SvMetaType * pType = GetType();
DBG_ASSERT( pType, "no type for attribute" );
@@ -732,11 +732,11 @@ sal_uLong SvMetaAttribute::MakeSfx( ByteString& rAttrArray )
return pBaseType->MakeSfx( rAttrArray );
else
{
- rAttrArray += '{';
- rAttrArray += GetSlotId();
- rAttrArray += ",\"";
- rAttrArray += GetName();
- rAttrArray += "\"}";
+ rAttrArray.append('{');
+ rAttrArray.append(GetSlotId());
+ rAttrArray.append(",\"");
+ rAttrArray.append(GetName());
+ rAttrArray.append("\"}");
return 1;
}
}
@@ -1035,16 +1035,16 @@ sal_Bool SvMetaType::SetName( const ByteString & rName, SvIdlDataBase * pBase )
#ifdef IDL_COMPILER
ByteString SvMetaType::GetCString() const
{
- ByteString out( GetSvName() );
+ rtl::OStringBuffer out( GetSvName() );
if( aCall0 == (int)CALL_POINTER )
- out += " *";
+ out.append(" *");
else if( aCall0 == (int)CALL_REFERENCE )
- out += " &";
+ out.append(" &");
if( aCall1 == (int)CALL_POINTER )
- out += '*';
+ out.append('*');
else if( aCall1 == (int)CALL_REFERENCE )
- out += '&';
- return out;
+ out.append('&');
+ return out.makeStringAndClear();
}
sal_Bool SvMetaType::ReadHeaderSvIdl( SvIdlDataBase & rBase,
@@ -1399,7 +1399,7 @@ void SvMetaType::WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm,
SvMetaExtern::WriteAttributes( rBase, rOutStm, nTab, nT, nA );
}
-sal_uLong SvMetaType::MakeSfx( ByteString& rAttrArray )
+sal_uLong SvMetaType::MakeSfx( rtl::OStringBuffer& rAttrArray )
{
sal_uLong nC = 0;
@@ -1411,7 +1411,7 @@ sal_uLong SvMetaType::MakeSfx( ByteString& rAttrArray )
{
nC += pAttrList->GetObject( n )->MakeSfx( rAttrArray );
if( n +1 < nAttrCount )
- rAttrArray += ", ";
+ rAttrArray.append(", ");
}
}
return nC;
@@ -1426,7 +1426,7 @@ void SvMetaType::WriteSfxItem(
aVarName += "_Impl";
ByteString aTypeName = "SfxType";
- ByteString aAttrArray;
+ rtl::OStringBuffer aAttrArray;
sal_uLong nAttrCount = MakeSfx( aAttrArray );
ByteString aAttrCount(
rtl::OString::valueOf(static_cast<sal_Int32>(nAttrCount)));
@@ -1446,7 +1446,7 @@ void SvMetaType::WriteSfxItem(
{
rOutStm << ", { ";
// write the single attributes
- rOutStm << aAttrArray.GetBuffer();
+ rOutStm << aAttrArray.getStr();
rOutStm << " }";
}
rOutStm << endl << "};" << endl
diff --git a/idl/source/prj/database.cxx b/idl/source/prj/database.cxx
index e823bdf7f5f7..b97fcd0a9939 100644
--- a/idl/source/prj/database.cxx
+++ b/idl/source/prj/database.cxx
@@ -275,11 +275,11 @@ sal_Bool SvIdlDataBase::ReadIdFile( const String & rFileName )
|| pTok->GetChar() == '^'
|| pTok->GetChar() == '~' )
{
- ByteString aStr( "unknown operator '" );
- aStr += pTok->GetChar();
- aStr += "'in define";
+ rtl::OStringBuffer aStr("unknown operator '");
+ aStr.append(pTok->GetChar());
+ aStr.append("'in define");
// set error
- SetError( aStr, pTok );
+ SetError( aStr.makeStringAndClear(), pTok );
WriteError( aTokStm );
return sal_False;
}