ByteString->rtl::OString

This commit is contained in:
Caolán McNamara
2011-11-19 21:02:35 +00:00
parent 1777dfacf2
commit 2bad94e6b5
5 changed files with 38 additions and 37 deletions

View File

@@ -32,6 +32,7 @@
#include <module.hxx> #include <module.hxx>
#include <hash.hxx> #include <hash.hxx>
#include <lex.hxx> #include <lex.hxx>
#include <rtl/string.hxx>
#include <tools/pstm.hxx> #include <tools/pstm.hxx>
#ifdef IDL_COMPILER #ifdef IDL_COMPILER
@@ -45,7 +46,7 @@ class SvCommand;
class SvIdlError class SvIdlError
{ {
ByteString aText; rtl::OString aText;
public: public:
sal_uInt32 nLine, nColumn; sal_uInt32 nLine, nColumn;
@@ -53,8 +54,8 @@ public:
SvIdlError( sal_uInt32 nL, sal_uInt32 nC ) SvIdlError( sal_uInt32 nL, sal_uInt32 nC )
: nLine(nL), nColumn(nC) {} : nLine(nL), nColumn(nC) {}
const ByteString & GetText() const { return aText; } const rtl::OString& GetText() const { return aText; }
void SetText( const ByteString & rT ) { aText = rT; } void SetText( const rtl::OString& rT ) { aText = rT; }
sal_Bool IsError() const { return nLine != 0; } sal_Bool IsError() const { return nLine != 0; }
void Clear() { nLine = nColumn = 0; } void Clear() { nLine = nColumn = 0; }
SvIdlError & operator = ( const SvIdlError & rRef ) SvIdlError & operator = ( const SvIdlError & rRef )
@@ -94,7 +95,7 @@ protected:
void WriteReset() void WriteReset()
{ {
aUsedTypes.Clear(); aUsedTypes.Clear();
aIFaceName.Erase(); aIFaceName = rtl::OString();
} }
#endif #endif
public: public:
@@ -110,11 +111,11 @@ public:
SvMetaTypeMemberList & GetTypeList(); SvMetaTypeMemberList & GetTypeList();
SvMetaClassMemberList & GetClassList() { return aClassList; } SvMetaClassMemberList & GetClassList() { return aClassList; }
SvMetaModuleMemberList & GetModuleList() { return aModuleList; } SvMetaModuleMemberList & GetModuleList() { return aModuleList; }
SvMetaModule * GetModule( const ByteString & rName ); SvMetaModule * GetModule( const rtl::OString& rName );
// list of used types while writing // list of used types while writing
SvMetaTypeMemberList aUsedTypes; SvMetaTypeMemberList aUsedTypes;
ByteString aIFaceName; rtl::OString aIFaceName;
SvNumberIdentifier aStructSlotId; SvNumberIdentifier aStructSlotId;
#ifdef IDL_COMPILER #ifdef IDL_COMPILER
@@ -130,12 +131,12 @@ public:
SvMetaObjectMemberStack & GetStack() { return aContextStack; } SvMetaObjectMemberStack & GetStack() { return aContextStack; }
void Write(const rtl::OString& rText); void Write(const rtl::OString& rText);
void WriteError( const ByteString & rErrWrn, void WriteError(const rtl::OString& rErrWrn,
const ByteString & rFileName, const rtl::OString& rFileName,
const rtl::OString& rErrorText, const rtl::OString& rErrorText,
sal_uLong nRow = 0, sal_uLong nColumn = 0 ) const; sal_uLong nRow = 0, sal_uLong nColumn = 0 ) const;
void WriteError( SvTokenStream & rInStm ); void WriteError( SvTokenStream & rInStm );
void SetError( const ByteString & rError, SvToken * pTok ); void SetError( const rtl::OString& rError, SvToken * pTok );
void Push( SvMetaObject * pObj ); void Push( SvMetaObject * pObj );
sal_Bool Pop( sal_Bool bOk, SvTokenStream & rInStm, sal_uInt32 nTokPos ) sal_Bool Pop( sal_Bool bOk, SvTokenStream & rInStm, sal_uInt32 nTokPos )
{ {
@@ -147,11 +148,11 @@ public:
return bOk; return bOk;
} }
sal_uInt32 GetUniqueId() { return ++nUniqueId; } sal_uInt32 GetUniqueId() { return ++nUniqueId; }
sal_Bool FindId( const ByteString & rIdName, sal_uLong * pVal ); sal_Bool FindId( const rtl::OString& rIdName, sal_uLong * pVal );
sal_Bool InsertId( const ByteString & rIdName, sal_uLong nVal ); sal_Bool InsertId( const rtl::OString& rIdName, sal_uLong nVal );
sal_Bool ReadIdFile( const String & rFileName ); sal_Bool ReadIdFile( const String & rFileName );
SvMetaType * FindType( const ByteString & rName ); SvMetaType * FindType( const rtl::OString& rName );
static SvMetaType * FindType( const SvMetaType *, SvMetaTypeMemberList & ); static SvMetaType * FindType( const SvMetaType *, SvMetaTypeMemberList & );
SvMetaType * ReadKnownType( SvTokenStream & rInStm ); SvMetaType * ReadKnownType( SvTokenStream & rInStm );

View File

@@ -134,8 +134,8 @@ class SvTokenStream
int nBufPos; int nBufPos;
int c; // next character int c; // next character
sal_uInt16 nTabSize; // length of tabulator sal_uInt16 nTabSize; // length of tabulator
ByteString aStrTrue; rtl::OString aStrTrue;
ByteString aStrFalse; rtl::OString aStrFalse;
sal_uLong nMaxPos; sal_uLong nMaxPos;
SvFileStream * pInStream; SvFileStream * pInStream;

View File

@@ -99,8 +99,8 @@ SvToken & SvToken::operator = ( const SvToken & rObj )
void SvTokenStream::InitCtor() void SvTokenStream::InitCtor()
{ {
aStrTrue = "TRUE"; aStrTrue = rtl::OString(RTL_CONSTASCII_STRINGPARAM("TRUE"));
aStrFalse = "FALSE"; aStrFalse = rtl::OString(RTL_CONSTASCII_STRINGPARAM("FALSE"));
nLine = nColumn = 0; nLine = nColumn = 0;
nBufPos = 0; nBufPos = 0;
nTabSize = 4; nTabSize = 4;

View File

@@ -470,7 +470,7 @@ void SvMetaAttribute::WriteCSource( SvIdlDataBase & rBase, SvStream & rOutStm,
<< rtl::OString::valueOf(static_cast<sal_Int32>(MakeSlotValue(rBase, IsVariable()))).getStr(); << rtl::OString::valueOf(static_cast<sal_Int32>(MakeSlotValue(rBase, IsVariable()))).getStr();
rOutStm << ',' << endl; rOutStm << ',' << endl;
WriteTab( rOutStm, 3 ); WriteTab( rOutStm, 3 );
rOutStm << " h" << rBase.aIFaceName.GetBuffer() << " , "; rOutStm << " h" << rBase.aIFaceName.getStr() << " , ";
ByteString aParserStr; ByteString aParserStr;
if( pBaseType->GetType() == TYPE_METHOD || bSet ) if( pBaseType->GetType() == TYPE_METHOD || bSet )
@@ -625,9 +625,9 @@ void SvMetaAttribute::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
// allocation // allocation
WriteTab( rOutStm, nTab ); WriteTab( rOutStm, nTab );
rOutStm << "void "; rOutStm << "void ";
rOutStm << rBase.aIFaceName.GetBuffer() rOutStm << rBase.aIFaceName.getStr()
<< "Set" << name.GetBuffer() << "( " << C_PREF << "Set" << name.GetBuffer() << "( " << C_PREF
<< "Object h" << rBase.aIFaceName.GetBuffer() << ", " << endl; << "Object h" << rBase.aIFaceName.getStr() << ", " << endl;
WriteTab( rOutStm, nTab+1 ); WriteTab( rOutStm, nTab+1 );
pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT ); pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT );
rOutStm << ' ' << name.GetBuffer() << " )"; rOutStm << ' ' << name.GetBuffer() << " )";
@@ -641,9 +641,9 @@ void SvMetaAttribute::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
WriteTab( rOutStm, nTab ); WriteTab( rOutStm, nTab );
pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT ); pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT );
rOutStm << ' '; rOutStm << ' ';
rOutStm << rBase.aIFaceName.GetBuffer() rOutStm << rBase.aIFaceName.getStr()
<< "Get" << name.GetBuffer() << "( " << C_PREF << "Get" << name.GetBuffer() << "( " << C_PREF
<< "Object h" << rBase.aIFaceName.GetBuffer() << " )"; << "Object h" << rBase.aIFaceName.getStr() << " )";
if( nT == WRITE_C_HEADER ) if( nT == WRITE_C_HEADER )
rOutStm << ';' << endl << endl; rOutStm << ';' << endl << endl;
else else
@@ -1536,7 +1536,7 @@ void SvMetaType::WriteMethodArgs
rOutStm << '('; rOutStm << '(';
if( nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE ) if( nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE )
{ {
rOutStm << ' ' << C_PREF << "Object h" << rBase.aIFaceName.GetBuffer(); rOutStm << ' ' << C_PREF << "Object h" << rBase.aIFaceName.getStr();
if( GetAttrCount() ) if( GetAttrCount() )
rOutStm << ','; rOutStm << ',';
else else

View File

@@ -87,10 +87,10 @@ SvMetaTypeMemberList & SvIdlDataBase::GetTypeList()
return aTypeList; return aTypeList;
} }
SvMetaModule * SvIdlDataBase::GetModule( const ByteString & rName ) SvMetaModule * SvIdlDataBase::GetModule( const rtl::OString& rName )
{ {
for( sal_uLong n = 0; n < aModuleList.Count(); n++ ) for( sal_uLong n = 0; n < aModuleList.Count(); n++ )
if( aModuleList.GetObject( n )->GetName() == rName ) if( aModuleList.GetObject( n )->GetName().Equals(rName) )
return aModuleList.GetObject( n ); return aModuleList.GetObject( n );
return NULL; return NULL;
} }
@@ -169,7 +169,7 @@ void SvIdlDataBase::Save( SvStream & rStm, sal_uInt32 nFlags )
aPStm << nUniqueId; aPStm << nUniqueId;
} }
void SvIdlDataBase::SetError( const ByteString & rError, SvToken * pTok ) void SvIdlDataBase::SetError( const rtl::OString& rError, SvToken * pTok )
{ {
if( pTok->GetLine() > 10000 ) if( pTok->GetLine() > 10000 )
aError.SetText( "hgchcg" ); aError.SetText( "hgchcg" );
@@ -188,7 +188,7 @@ void SvIdlDataBase::Push( SvMetaObject * pObj )
} }
#ifdef IDL_COMPILER #ifdef IDL_COMPILER
sal_Bool SvIdlDataBase::FindId( const ByteString & rIdName, sal_uLong * pVal ) sal_Bool SvIdlDataBase::FindId( const rtl::OString& rIdName, sal_uLong * pVal )
{ {
if( pIdTable ) if( pIdTable )
{ {
@@ -202,7 +202,7 @@ sal_Bool SvIdlDataBase::FindId( const ByteString & rIdName, sal_uLong * pVal )
return sal_False; return sal_False;
} }
sal_Bool SvIdlDataBase::InsertId( const ByteString & rIdName, sal_uLong nVal ) sal_Bool SvIdlDataBase::InsertId( const rtl::OString& rIdName, sal_uLong nVal )
{ {
if( !pIdTable ) if( !pIdTable )
pIdTable = new SvStringHashTable( 20003 ); pIdTable = new SvStringHashTable( 20003 );
@@ -364,10 +364,10 @@ SvMetaType * SvIdlDataBase::FindType( const SvMetaType * pPType,
return pType; return pType;
} }
SvMetaType * SvIdlDataBase::FindType( const ByteString & rName ) SvMetaType * SvIdlDataBase::FindType( const rtl::OString& rName )
{ {
SvMetaType * pType = aTypeList.First(); SvMetaType * pType = aTypeList.First();
while( pType && rName != pType->GetName() ) while( pType && !rName.equals(pType->GetName()) )
pType = aTypeList.Next(); pType = aTypeList.Next();
return pType; return pType;
} }
@@ -544,14 +544,14 @@ void SvIdlDataBase::Write(const rtl::OString& rText)
fprintf( stdout, "%s", rText.getStr() ); fprintf( stdout, "%s", rText.getStr() );
} }
void SvIdlDataBase::WriteError( const ByteString & rErrWrn, void SvIdlDataBase::WriteError( const rtl::OString& rErrWrn,
const ByteString & rFileName, const rtl::OString& rFileName,
const rtl::OString& rErrorText, const rtl::OString& rErrorText,
sal_uLong nRow, sal_uLong nColumn ) const sal_uLong nRow, sal_uLong nColumn ) const
{ {
// error treatment // error treatment
fprintf( stderr, "\n%s --- %s: ( %ld, %ld )\n", fprintf( stderr, "\n%s --- %s: ( %ld, %ld )\n",
rFileName.GetBuffer(), rErrWrn.GetBuffer(), nRow, nColumn ); rFileName.getStr(), rErrWrn.getStr(), nRow, nColumn );
if( !rErrorText.isEmpty() ) if( !rErrorText.isEmpty() )
{ // error set { // error set
@@ -577,7 +577,7 @@ void SvIdlDataBase::WriteError( SvTokenStream & rInStm )
{ // error set { // error set
// search error token // search error token
// error text // error text
if( aError.GetText().Len() ) if( aError.GetText().getLength() )
{ {
aErrorText.append(RTL_CONSTASCII_STRINGPARAM("may be <")); aErrorText.append(RTL_CONSTASCII_STRINGPARAM("may be <"));
aErrorText.append(aError.GetText()); aErrorText.append(aError.GetText());