idl/Executable_svidl.mk | 1 idl/inc/basobj.hxx | 2 idl/inc/database.hxx | 4 - idl/inc/lex.hxx | 2 idl/inc/parser.hxx | 37 ++++++++++++ idl/source/objects/basobj.cxx | 6 +- idl/source/objects/bastype.cxx | 23 +++----- idl/source/objects/module.cxx | 9 +-- idl/source/objects/object.cxx | 37 ++++-------- idl/source/objects/slot.cxx | 117 ++++++++++++++++++----------------------- idl/source/objects/types.cxx | 28 +++------ idl/source/prj/command.cxx | 4 + idl/source/prj/database.cxx | 85 ++++------------------------- idl/source/prj/parser.cxx | 84 +++++++++++++++++++++++++++++ 14 files changed, 233 insertions(+), 206 deletions(-)
New commits: commit cf6c21e7f11fa7e438700478d61d5341cb614bd0 Author: Noel Grandin <n...@peralex.com> Date: Thu Feb 11 10:03:18 2016 +0200 ReadDelemiter->ReadDelimiter Change-Id: I311eb27e3d287f3ef409cb54f19a152793f940d9 diff --git a/idl/inc/lex.hxx b/idl/inc/lex.hxx index 412bb33..14b91cd 100644 --- a/idl/inc/lex.hxx +++ b/idl/inc/lex.hxx @@ -199,7 +199,7 @@ public: return false; } - void ReadDelemiter() + void ReadDelimiter() { if( (*pCurToken)->IsChar() && (';' == (*pCurToken)->GetChar() diff --git a/idl/source/objects/basobj.cxx b/idl/source/objects/basobj.cxx index 3a99061..5812626 100644 --- a/idl/source/objects/basobj.cxx +++ b/idl/source/objects/basobj.cxx @@ -100,7 +100,7 @@ void SvMetaObject::DoReadContextSvIdl( SvIdlDataBase & rBase, { nBeginPos = rInStm.Tell(); ReadContextSvIdl( rBase, rInStm ); - rInStm.ReadDelemiter(); + rInStm.ReadDelimiter(); } } @@ -124,7 +124,7 @@ bool SvMetaObject::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm ) { nBeginPos = rInStm.Tell(); ReadAttributesSvIdl( rBase, rInStm ); - rInStm.ReadDelemiter(); + rInStm.ReadDelimiter(); } bOk = rInStm.Read( ']' ); } diff --git a/idl/source/objects/module.cxx b/idl/source/objects/module.cxx index e501939..ea040f5 100644 --- a/idl/source/objects/module.cxx +++ b/idl/source/objects/module.cxx @@ -115,7 +115,7 @@ void SvMetaModule::ReadContextSvIdl( SvIdlDataBase & rBase, { nBeginPos = aTokStm.Tell(); ReadContextSvIdl( rBase, aTokStm ); - aTokStm.ReadDelemiter(); + aTokStm.ReadDelimiter(); } bOk = aTokStm.GetToken().IsEof(); if( !bOk ) @@ -164,7 +164,7 @@ bool SvMetaModule::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm ) sal_uInt32 nTokPos = rInStm.Tell(); SvToken * pTok = rInStm.GetToken_Next(); bool bOk = pTok->Is( SvHash_module() ); - rInStm.ReadDelemiter(); + rInStm.ReadDelimiter(); if( bOk ) { rBase.Push( this ); // onto the context stack commit 78a072f0a18cc90275b8d2ba630b3be693586327 Author: Noel Grandin <n...@peralex.com> Date: Thu Feb 11 10:01:26 2016 +0200 improve the parsing loop for the module keyword Change-Id: I0931ae0edfb45c5d4c67f545a1a5e513c8210e88 diff --git a/idl/source/prj/parser.cxx b/idl/source/prj/parser.cxx index 4bb0320..db594ab 100644 --- a/idl/source/prj/parser.cxx +++ b/idl/source/prj/parser.cxx @@ -55,18 +55,12 @@ bool SvIdlParser::ReadSvIdl( SvIdlDataBase& rBase, SvTokenStream & rInStm, bool bOk = false; } - sal_uInt32 nBeginPos = 0xFFFFFFFF; // can not happen with Tell - - while( bOk && nBeginPos != rInStm.Tell() ) + while( bOk ) { - nBeginPos = rInStm.Tell(); pTok = &rInStm.GetToken(); if( pTok->IsEof() ) return true; - if( pTok->IsEmpty() ) - bOk = false; - // only one import at the very beginning if( pTok->Is( SvHash_module() ) ) { tools::SvRef<SvMetaModule> aModule = new SvMetaModule( bImported ); commit 401b7468bdaae0626d1179bc1c98c2882cc38d1d Author: Noel Grandin <n...@peralex.com> Date: Thu Feb 11 09:26:19 2016 +0200 create a new class SvIdlParser and start the process of moving the parsing code to one central file Change-Id: If6d8def37ec8c8415c22d39f9d8b7a09ec423873 diff --git a/idl/Executable_svidl.mk b/idl/Executable_svidl.mk index b2b3ecd..090bdd6 100644 --- a/idl/Executable_svidl.mk +++ b/idl/Executable_svidl.mk @@ -47,6 +47,7 @@ $(eval $(call gb_Executable_add_exception_objects,svidl,\ idl/source/prj/database \ idl/source/prj/globals \ idl/source/prj/svidl \ + idl/source/prj/parser \ )) # vim: set noet sw=4 ts=4: diff --git a/idl/inc/database.hxx b/idl/inc/database.hxx index c435aaf..3b7f15f 100644 --- a/idl/inc/database.hxx +++ b/idl/inc/database.hxx @@ -102,6 +102,7 @@ public: { aError = r; } const OUString & GetPath() const { return aPath; } + void SetPath(const OUString &s) { aPath = s; } SvRefMemberList<SvMetaObject *>& GetStack() { return aContextStack; } void Write(const OString& rText); @@ -135,8 +136,6 @@ class SvIdlWorkingBase : public SvIdlDataBase public: explicit SvIdlWorkingBase( const SvCommand& rCmd ); - bool ReadSvIdl( SvTokenStream &, bool bImported, const OUString & rPath ); - bool WriteSfx( SvStream & ); }; diff --git a/idl/inc/parser.hxx b/idl/inc/parser.hxx new file mode 100644 index 0000000..c06287b --- /dev/null +++ b/idl/inc/parser.hxx @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_IDL_INC_PARSER_HXX +#define INCLUDED_IDL_INC_PARSER_HXX + +#include <rtl/ustring.hxx> + +class SvTokenStream; +class SvIdlDataBase; + +class SvIdlParser +{ +public: + bool ReadSvIdl( SvIdlDataBase& rBase, SvTokenStream &, bool bImported, const OUString & rPath ); + +}; + +#endif // INCLUDED_IDL_INC_PARSER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/idl/source/prj/command.cxx b/idl/source/prj/command.cxx index 4db8ca5..2967e05 100644 --- a/idl/source/prj/command.cxx +++ b/idl/source/prj/command.cxx @@ -29,6 +29,7 @@ #include <command.hxx> #include <globals.hxx> #include <database.hxx> +#include <parser.hxx> char const * SyntaxStrings[] = { "basic-type:", @@ -126,7 +127,8 @@ bool ReadIdl( SvIdlWorkingBase * pDataBase, const SvCommand & rCommand ) if( aStm.GetError() == SVSTREAM_OK ) { SvTokenStream aTokStm( aStm, aFileName ); - if( !pDataBase->ReadSvIdl( aTokStm, false, rCommand.aPath ) ) + SvIdlParser aParser; + if( !aParser.ReadSvIdl( *pDataBase, aTokStm, false, rCommand.aPath ) ) return false; } else diff --git a/idl/source/prj/database.cxx b/idl/source/prj/database.cxx index b6539fc..0a15351 100644 --- a/idl/source/prj/database.cxx +++ b/idl/source/prj/database.cxx @@ -478,68 +478,6 @@ SvIdlWorkingBase::SvIdlWorkingBase(const SvCommand& rCmd) : SvIdlDataBase(rCmd) { } -bool SvIdlWorkingBase::ReadSvIdl( SvTokenStream & rInStm, bool bImported, const OUString & rPath ) -{ - aPath = rPath; // only valid for this iteration - bool bOk = true; - SvToken * pTok = &rInStm.GetToken(); - // only one import at the very beginning - if( pTok->Is( SvHash_import() ) ) - { - rInStm.GetToken_Next(); - pTok = rInStm.GetToken_Next(); - if( pTok && pTok->IsString() ) - { - OUString aFullName; - if( osl::FileBase::E_None == osl::File::searchFileURL( - OStringToOUString(pTok->GetString(), RTL_TEXTENCODING_ASCII_US), - rPath, - aFullName) ) - { - osl::FileBase::getSystemPathFromFileURL( aFullName, aFullName ); - this->AddDepFile(aFullName); - SvFileStream aStm( aFullName, STREAM_STD_READ | StreamMode::NOCREATE ); - SvTokenStream aTokStm( aStm, aFullName ); - bOk = ReadSvIdl( aTokStm, true, rPath ); - } - else - bOk = false; - } - else - bOk = false; - } - - sal_uInt32 nBeginPos = 0xFFFFFFFF; // can not happen with Tell - - while( bOk && nBeginPos != rInStm.Tell() ) - { - nBeginPos = rInStm.Tell(); - pTok = &rInStm.GetToken(); - if( pTok->IsEof() ) - return true; - if( pTok->IsEmpty() ) - bOk = false; - - // only one import at the very beginning - if( pTok->Is( SvHash_module() ) ) - { - tools::SvRef<SvMetaModule> aModule = new SvMetaModule( bImported ); - if( aModule->ReadSvIdl( *this, rInStm ) ) - GetModuleList().push_back( aModule ); - else - bOk = false; - } - else - bOk = false; - } - if( !bOk || !pTok->IsEof() ) - { - // error treatment - WriteError( rInStm ); - return false; - } - return true; -} bool SvIdlWorkingBase::WriteSfx( SvStream & rOutStm ) { diff --git a/idl/source/prj/parser.cxx b/idl/source/prj/parser.cxx new file mode 100644 index 0000000..4bb0320 --- /dev/null +++ b/idl/source/prj/parser.cxx @@ -0,0 +1,90 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <sal/config.h> + +#include <parser.hxx> +#include <database.hxx> +#include <globals.hxx> +#include <osl/file.hxx> + +bool SvIdlParser::ReadSvIdl( SvIdlDataBase& rBase, SvTokenStream & rInStm, bool bImported, const OUString & rPath ) +{ + rBase.SetPath(rPath); // only valid for this iteration + bool bOk = true; + SvToken * pTok = &rInStm.GetToken(); + // only one import at the very beginning + if( pTok->Is( SvHash_import() ) ) + { + rInStm.GetToken_Next(); + pTok = rInStm.GetToken_Next(); + if( pTok && pTok->IsString() ) + { + OUString aFullName; + if( osl::FileBase::E_None == osl::File::searchFileURL( + OStringToOUString(pTok->GetString(), RTL_TEXTENCODING_ASCII_US), + rPath, + aFullName) ) + { + osl::FileBase::getSystemPathFromFileURL( aFullName, aFullName ); + rBase.AddDepFile(aFullName); + SvFileStream aStm( aFullName, STREAM_STD_READ | StreamMode::NOCREATE ); + SvTokenStream aTokStm( aStm, aFullName ); + bOk = ReadSvIdl( rBase, aTokStm, true, rPath ); + } + else + bOk = false; + } + else + bOk = false; + } + + sal_uInt32 nBeginPos = 0xFFFFFFFF; // can not happen with Tell + + while( bOk && nBeginPos != rInStm.Tell() ) + { + nBeginPos = rInStm.Tell(); + pTok = &rInStm.GetToken(); + if( pTok->IsEof() ) + return true; + if( pTok->IsEmpty() ) + bOk = false; + + // only one import at the very beginning + if( pTok->Is( SvHash_module() ) ) + { + tools::SvRef<SvMetaModule> aModule = new SvMetaModule( bImported ); + if( aModule->ReadSvIdl( rBase, rInStm ) ) + rBase.GetModuleList().push_back( aModule ); + else + bOk = false; + } + else + bOk = false; + } + if( !bOk || !pTok->IsEof() ) + { + // error treatment + rBase.WriteError( rInStm ); + return false; + } + return true; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 6b00d851672ecdde1833cf3ce3d90e34480af5e5 Author: Noel Grandin <n...@peralex.com> Date: Thu Feb 11 09:08:55 2016 +0200 we don't use the optional "(" in import statements in .SDI files Change-Id: I74595786754381fef8105e3acfeb0f693bdbea83 diff --git a/idl/source/prj/database.cxx b/idl/source/prj/database.cxx index e647b96..b6539fc 100644 --- a/idl/source/prj/database.cxx +++ b/idl/source/prj/database.cxx @@ -487,8 +487,7 @@ bool SvIdlWorkingBase::ReadSvIdl( SvTokenStream & rInStm, bool bImported, const if( pTok->Is( SvHash_import() ) ) { rInStm.GetToken_Next(); - bOk = rInStm.Read( '(' ); // optional - pTok = bOk ? rInStm.GetToken_Next() : nullptr; + pTok = rInStm.GetToken_Next(); if( pTok && pTok->IsString() ) { OUString aFullName; commit d542cf3e63aaa1b4c200796b9151cb5a869d1ce0 Author: Noel Grandin <n...@peralex.com> Date: Thu Feb 11 08:44:02 2016 +0200 spelling Change-Id: Ic6464cd4d2c4fdb302f6337719ad937c0d3f8135 diff --git a/idl/source/objects/bastype.cxx b/idl/source/objects/bastype.cxx index d74aeb3..26877f8 100644 --- a/idl/source/objects/bastype.cxx +++ b/idl/source/objects/bastype.cxx @@ -36,8 +36,8 @@ bool SvBOOL::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ) if( pTok->Is( pName ) ) { bool bOk = true; - bool bBraket = rInStm.Read( '(' ); - if( bBraket || rInStm.Read( '=' ) ) + bool bBracket = rInStm.Read( '(' ); + if( bBracket || rInStm.Read( '=' ) ) { pTok = &rInStm.GetToken(); if( pTok->IsBool() ) @@ -46,7 +46,7 @@ bool SvBOOL::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm ) rInStm.GetToken_Next(); } - if( bOk && bBraket ) + if( bOk && bBracket ) bOk = rInStm.Read( ')' ); } else @@ -66,8 +66,8 @@ bool SvIdentifier::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm if( pTok->Is( pName ) ) { bool bOk = true; - bool bBraket = rInStm.Read( '(' ); - if( bBraket || rInStm.Read( '=' ) ) + bool bBracket = rInStm.Read( '(' ); + if( bBracket || rInStm.Read( '=' ) ) { pTok = &rInStm.GetToken(); if( pTok->IsIdentifier() ) @@ -75,7 +75,7 @@ bool SvIdentifier::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm setString(pTok->GetString()); rInStm.GetToken_Next(); } - if( bOk && bBraket ) + if( bOk && bBracket ) bOk = rInStm.Read( ')' ); } if( bOk ) @@ -116,8 +116,8 @@ bool ReadStringSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm, OString if( pTok->Is( pName ) ) { bool bOk = true; - bool bBraket = rInStm.Read( '(' ); - if( bBraket || rInStm.Read( '=' ) ) + bool bBracket = rInStm.Read( '(' ); + if( bBracket || rInStm.Read( '=' ) ) { pTok = &rInStm.GetToken(); if( pTok->IsString() ) @@ -125,7 +125,7 @@ bool ReadStringSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm, OString aRetString = pTok->GetString(); rInStm.GetToken_Next(); } - if( bOk && bBraket ) + if( bOk && bBracket ) bOk = rInStm.Read( ')' ); } if( bOk ) commit 81372804aed6d935cd917f86380ba22097613b6b Author: Noel Grandin <n...@peralex.com> Date: Thu Feb 11 08:38:13 2016 +0200 simplify some OStringBuffer code Change-Id: Ic1b0e13a8d77154fa780f6804ee36b5a5d9c7334 diff --git a/idl/source/objects/slot.cxx b/idl/source/objects/slot.cxx index 49ab9cd..6cdeea7 100644 --- a/idl/source/objects/slot.cxx +++ b/idl/source/objects/slot.cxx @@ -554,9 +554,7 @@ void SvMetaSlot::Insert( SvSlotElementList& rList, const OString& rPrefix, static OString MakeSlotName( SvStringHashEntry * pEntry ) { - OStringBuffer aName("SfxSlotMode::"); - aName.append(pEntry->GetName().toAsciiUpperCase()); - return aName.makeStringAndClear(); + return "SfxSlotMode::" + pEntry->GetName().toAsciiUpperCase(); }; void SvMetaSlot::WriteSlotStubs( const OString& rShellName, diff --git a/idl/source/prj/database.cxx b/idl/source/prj/database.cxx index 03c82c2..e647b96 100644 --- a/idl/source/prj/database.cxx +++ b/idl/source/prj/database.cxx @@ -184,11 +184,9 @@ bool SvIdlDataBase::ReadIdFile( const OUString & rFileName ) || pTok->GetChar() == '^' || pTok->GetChar() == '~' ) { - OStringBuffer aStr("unknown operator '"); - aStr.append(pTok->GetChar()); - aStr.append("'in define"); + OString aStr = "unknown operator '" + OString(pTok->GetChar()) + "'in define"; // set error - SetError( aStr.makeStringAndClear(), *pTok ); + SetError( aStr, *pTok ); WriteError( aTokStm ); return false; } @@ -244,9 +242,7 @@ bool SvIdlDataBase::ReadIdFile( const OUString & rFileName ) if (!ReadIdFile(OStringToOUString(aName.toString(), RTL_TEXTENCODING_ASCII_US))) { - OStringBuffer aStr("cannot read file: "); - aStr.append(aName.makeStringAndClear()); - SetError(aStr.makeStringAndClear(), *pTok); + SetError("cannot read file: " + aName, *pTok); WriteError( aTokStm ); return false; } commit 4bcc7ddf78ac987dc4b9c80aab203c2e719fb5aa Author: Noel Grandin <n...@peralex.com> Date: Thu Feb 11 08:31:53 2016 +0200 simplify error handling code Change-Id: I8f70d6bde7018d5b4455f95373f1b7d5dbc4d76e diff --git a/idl/inc/database.hxx b/idl/inc/database.hxx index 680f569..c435aaf 100644 --- a/idl/inc/database.hxx +++ b/idl/inc/database.hxx @@ -111,6 +111,7 @@ public: sal_uLong nRow = 0, sal_uLong nColumn = 0 ); void WriteError( SvTokenStream & rInStm ); void SetError( const OString& rError, SvToken& rTok ); + void SetAndWriteError( SvTokenStream & rInStm, const OString& rError ); void Push( SvMetaObject * pObj ); sal_uInt32 GetUniqueId() { return ++nUniqueId; } bool FindId( const OString& rIdName, sal_uLong * pVal ); diff --git a/idl/source/objects/bastype.cxx b/idl/source/objects/bastype.cxx index ae60b55..d74aeb3 100644 --- a/idl/source/objects/bastype.cxx +++ b/idl/source/objects/bastype.cxx @@ -102,10 +102,7 @@ void SvIdentifier::ReadSvIdl( SvIdlDataBase & rBase, } else { - OStringBuffer aStr("no value for identifier <"); - aStr.append(getString()).append("> "); - rBase.SetError( aStr.makeStringAndClear(), rInStm.GetToken() ); - rBase.WriteError( rInStm ); + rBase.SetAndWriteError( rInStm, "no value for identifier <" + getString() + "> " ); } } rInStm.Seek( nTokPos ); diff --git a/idl/source/objects/module.cxx b/idl/source/objects/module.cxx index ad339b7..e501939 100644 --- a/idl/source/objects/module.cxx +++ b/idl/source/objects/module.cxx @@ -43,10 +43,7 @@ void SvMetaModule::ReadAttributesSvIdl( SvIdlDataBase & rBase, sal_uInt32 nTokPos = rInStm.Tell(); if( !rBase.ReadIdFile( OStringToOUString(aSlotIdFile, RTL_TEXTENCODING_ASCII_US)) ) { - OStringBuffer aStr("cannot read file: "); - aStr.append(aSlotIdFile); - rBase.SetError( aStr.makeStringAndClear(), rInStm.GetToken() ); - rBase.WriteError( rInStm ); + rBase.SetAndWriteError( rInStm, "cannot read file: " + aSlotIdFile ); rInStm.Seek( nTokPos ); } diff --git a/idl/source/objects/object.cxx b/idl/source/objects/object.cxx index 1d02176..38cfe6b 100644 --- a/idl/source/objects/object.cxx +++ b/idl/source/objects/object.cxx @@ -65,8 +65,7 @@ void SvMetaClass::ReadContextSvIdl( SvIdlDataBase & rBase, else { // set error - rBase.SetError( "unknown imported interface", rInStm.GetToken() ); - rBase.WriteError( rInStm ); + rBase.SetAndWriteError( rInStm, "unknown imported interface" ); } } else @@ -120,8 +119,7 @@ bool SvMetaClass::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm ) if( !bOk ) { // set error - rBase.SetError( "unknown super class", rInStm.GetToken() ); - rBase.WriteError( rInStm ); + rBase.SetAndWriteError( rInStm, "unknown super class" ); } } if( bOk ) @@ -158,11 +156,7 @@ bool SvMetaClass::TestAttribute( SvIdlDataBase & rBase, SvTokenStream & rInStm, OSL_FAIL( pS->GetSlotId().getString().getStr() ); OSL_FAIL( rAttr.GetSlotId().getString().getStr() ); - OStringBuffer aStr("Attribute's "); - aStr.append(pS->GetName()); - aStr.append(" with different id's"); - rBase.SetError(aStr.makeStringAndClear(), rInStm.GetToken()); - rBase.WriteError( rInStm ); + rBase.SetAndWriteError(rInStm, "Attribute's " + pS->GetName() + " with different id's"); return false; } } @@ -177,13 +171,8 @@ bool SvMetaClass::TestAttribute( SvIdlDataBase & rBase, SvTokenStream & rInStm, OSL_FAIL( pS->GetSlotId().getString().getStr() ); OSL_FAIL( rAttr.GetSlotId().getString().getStr() ); - OStringBuffer aStr("Attribute "); - aStr.append(pS->GetName()); - aStr.append(" and Attribute "); - aStr.append(rAttr.GetName()); - aStr.append(" with equal id's"); - rBase.SetError(aStr.makeStringAndClear(), rInStm.GetToken()); - rBase.WriteError( rInStm ); + OString aStr = "Attribute " + pS->GetName() + " and Attribute " + rAttr.GetName() + " with equal id's"; + rBase.SetAndWriteError(rInStm, aStr); return false; } } diff --git a/idl/source/objects/slot.cxx b/idl/source/objects/slot.cxx index 7ed275f..49ab9cd 100644 --- a/idl/source/objects/slot.cxx +++ b/idl/source/objects/slot.cxx @@ -292,11 +292,9 @@ void SvMetaSlot::ReadAttributesSvIdl( SvIdlDataBase & rBase, { return; } - rBase.SetError( "the SlotType is not a item", rInStm.GetToken() ); - rBase.WriteError( rInStm ); + rBase.SetAndWriteError( rInStm, "the SlotType is not a item" ); } - rBase.SetError( "SlotType with unknown item type", rInStm.GetToken() ); - rBase.WriteError( rInStm ); + rBase.SetAndWriteError( rInStm, "SlotType with unknown item type" ); } } rInStm.Seek( nTokPos ); @@ -335,8 +333,7 @@ bool SvMetaSlot::Test( SvIdlDataBase & rBase, SvTokenStream & rInStm ) pType = pType->GetReturnType(); if( !pType->IsItem() ) { - rBase.SetError( "this attribute is not a slot", rInStm.GetToken() ); - rBase.WriteError( rInStm ); + rBase.SetAndWriteError( rInStm, "this attribute is not a slot" ); bOk = false; } } @@ -362,11 +359,7 @@ bool SvMetaSlot::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm ) } else { - OStringBuffer aStr( "attribute " ); - aStr.append(pAttr->GetName()); - aStr.append(" is method or variable but not a slot"); - rBase.SetError( aStr.makeStringAndClear(), rInStm.GetToken() ); - rBase.WriteError( rInStm ); + rBase.SetAndWriteError( rInStm, "attribute " + pAttr->GetName() + " is method or variable but not a slot" ); bOk = false; } } @@ -395,11 +388,7 @@ bool SvMetaSlot::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm ) } else { - OStringBuffer aStr("attribute "); - aStr.append(pAttr2->GetName()); - aStr.append(" is method or variable but not a slot"); - rBase.SetError( aStr.makeStringAndClear(), rInStm.GetToken() ); - rBase.WriteError( rInStm ); + rBase.SetAndWriteError( rInStm, "attribute " + pAttr2->GetName() + " is method or variable but not a slot" ); bOk = false; } } diff --git a/idl/source/objects/types.cxx b/idl/source/objects/types.cxx index b171fbd..50fe11b 100644 --- a/idl/source/objects/types.cxx +++ b/idl/source/objects/types.cxx @@ -56,8 +56,7 @@ bool SvMetaAttribute::Test( SvIdlDataBase & rBase, bool bOk = true; if( GetType()->IsItem() && !GetSlotId().IsSet() ) { - rBase.SetError( "slot without id declared", rInStm.GetToken() ); - rBase.WriteError( rInStm ); + rBase.SetAndWriteError( rInStm, "slot without id declared" ); bOk = false; } return bOk; @@ -208,9 +207,7 @@ bool SvMetaType::ReadHeaderSvIdl( SvIdlDataBase & rBase, } else { - OString aStr("wrong typedef: "); - rBase.SetError( aStr, rInStm.GetToken() ); - rBase.WriteError( rInStm ); + rBase.SetAndWriteError( rInStm, "wrong typedef: "); } } if( !bOk ) diff --git a/idl/source/prj/database.cxx b/idl/source/prj/database.cxx index 5e10fc7..03c82c2 100644 --- a/idl/source/prj/database.cxx +++ b/idl/source/prj/database.cxx @@ -85,6 +85,12 @@ void SvIdlDataBase::SetError( const OString& rError, SvToken& rTok ) } } +void SvIdlDataBase::SetAndWriteError( SvTokenStream & rInStm, const OString& rError ) +{ + SetError( rError, rInStm.GetToken() ); + WriteError( rInStm ); +} + void SvIdlDataBase::Push( SvMetaObject * pObj ) { GetStack().push_back( pObj ); commit e755ac76e04e696493b0557193b1a41f7eeb0657 Author: Noel Grandin <n...@peralex.com> Date: Wed Feb 10 15:08:46 2016 +0200 rename Back2Delemitter->Back2Delimiter Change-Id: I8e4cf6fa936bc94db3f8a865731d00878354ad99 diff --git a/idl/inc/basobj.hxx b/idl/inc/basobj.hxx index af85f47..8b30126 100644 --- a/idl/inc/basobj.hxx +++ b/idl/inc/basobj.hxx @@ -97,7 +97,7 @@ public: SvMetaObject(); static void WriteTab( SvStream & rOutStm, sal_uInt16 nTab ); - static void Back2Delemitter( SvStream & ); + static void Back2Delimiter( SvStream & ); static void WriteStars( SvStream & ); void SetName( const OString& rName ); diff --git a/idl/source/objects/basobj.cxx b/idl/source/objects/basobj.cxx index 272b526..3a99061 100644 --- a/idl/source/objects/basobj.cxx +++ b/idl/source/objects/basobj.cxx @@ -42,7 +42,7 @@ void SvMetaObject::WriteStars( SvStream & rOutStm ) rOutStm.WriteChar( '/' ) << endl; } -void SvMetaObject::Back2Delemitter( SvStream & rOutStm ) +void SvMetaObject::Back2Delimiter( SvStream & rOutStm ) { // write no empty brackets sal_uLong nPos = rOutStm.Tell(); diff --git a/idl/source/objects/object.cxx b/idl/source/objects/object.cxx index acc92f8..1d02176 100644 --- a/idl/source/objects/object.cxx +++ b/idl/source/objects/object.cxx @@ -356,7 +356,7 @@ void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ) // write all attributes sal_uInt16 nArgCount = WriteSlotParamArray( rBase, aSlotList, rOutStm ); if( nArgCount ) - Back2Delemitter( rOutStm ); + Back2Delimiter( rOutStm ); else { // at least one dummy @@ -381,7 +381,7 @@ void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ) // write all attributes WriteSlots( GetName(), 0, aSlotList, rBase, rOutStm ); if( nSlotCount ) - Back2Delemitter( rOutStm ); + Back2Delimiter( rOutStm ); else { // at least one dummy commit ae7f6dc8afd3b5723ca11f1cdebc1564649e243d Author: Noel Grandin <n...@peralex.com> Date: Wed Feb 10 15:01:23 2016 +0200 use WriteOString to reduce the code a little Change-Id: I5378478500a18b2d7156b7047867bc53f6513b45 diff --git a/idl/source/objects/object.cxx b/idl/source/objects/object.cxx index 4f29c94..acc92f8 100644 --- a/idl/source/objects/object.cxx +++ b/idl/source/objects/object.cxx @@ -326,10 +326,10 @@ void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ) { WriteStars( rOutStm ); // define class - rOutStm.WriteCharPtr( "#ifdef " ).WriteCharPtr( GetName().getStr() ) << endl; + rOutStm.WriteCharPtr( "#ifdef " ).WriteOString( GetName() ) << endl; rOutStm.WriteCharPtr( "#undef ShellClass" ) << endl; - rOutStm.WriteCharPtr( "#undef " ).WriteCharPtr( GetName().getStr() ) << endl; - rOutStm.WriteCharPtr( "#define ShellClass " ).WriteCharPtr( GetName().getStr() ) << endl; + rOutStm.WriteCharPtr( "#undef " ).WriteOString( GetName() ) << endl; + rOutStm.WriteCharPtr( "#define ShellClass " ).WriteOString( GetName() ) << endl; // no slotmaps get written for interfaces if( GetMetaTypeType() != MetaTypeType::Shell ) @@ -338,7 +338,7 @@ void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ) return; } // write parameter array - rOutStm.WriteCharPtr("static SfxFormalArgument a").WriteCharPtr(GetName().getStr()).WriteCharPtr("Args_Impl[] =") << endl; + rOutStm.WriteCharPtr("static SfxFormalArgument a").WriteOString(GetName()).WriteCharPtr("Args_Impl[] =") << endl; rOutStm.WriteChar('{') << endl; std::vector<sal_uLong> aSuperList; @@ -375,7 +375,7 @@ void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ) rOutStm << endl; // write slotmap - rOutStm.WriteCharPtr("static SfxSlot a").WriteCharPtr(GetName().getStr()).WriteCharPtr("Slots_Impl[] =") << endl; + rOutStm.WriteCharPtr("static SfxSlot a").WriteOString(GetName()).WriteCharPtr("Slots_Impl[] =") << endl; rOutStm.WriteChar( '{' ) << endl; // write all attributes @@ -386,7 +386,7 @@ void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ) { // at least one dummy WriteTab( rOutStm, 1 ); - rOutStm.WriteCharPtr( "SFX_SLOT_ARG(" ).WriteCharPtr( GetName().getStr() ) + rOutStm.WriteCharPtr( "SFX_SLOT_ARG(" ).WriteOString( GetName() ) .WriteCharPtr( ", 0, 0, " ) .WriteCharPtr( "SFX_STUB_PTR_EXEC_NONE," ) .WriteCharPtr( "SFX_STUB_PTR_STATE_NONE," ) diff --git a/idl/source/objects/slot.cxx b/idl/source/objects/slot.cxx index 4717f5d..7ed275f 100644 --- a/idl/source/objects/slot.cxx +++ b/idl/source/objects/slot.cxx @@ -595,9 +595,9 @@ void SvMetaSlot::WriteSlotStubs( const OString& rShellName, { rList.push_back( new OString(aMethodName) ); rOutStm.WriteCharPtr( "SFX_EXEC_STUB(" ) - .WriteCharPtr( rShellName.getStr() ) + .WriteOString( rShellName ) .WriteChar( ',' ) - .WriteCharPtr( aMethodName.getStr() ) + .WriteOString( aMethodName ) .WriteChar( ')' ) << endl; } } @@ -620,9 +620,9 @@ void SvMetaSlot::WriteSlotStubs( const OString& rShellName, { rList.push_back( new OString(aMethodName) ); rOutStm.WriteCharPtr( "SFX_STATE_STUB(" ) - .WriteCharPtr( rShellName.getStr() ) + .WriteOString( rShellName ) .WriteChar( ',' ) - .WriteCharPtr( aMethodName.getStr() ) + .WriteOString( aMethodName ) .WriteChar( ')' ) << endl; } } @@ -640,21 +640,21 @@ void SvMetaSlot::WriteSlot( const OString& rShellName, sal_uInt16 nCount, bool bIsEnumSlot = nullptr != pEnumValue; rOutStm.WriteCharPtr( "// Slot Nr. " ) - .WriteCharPtr( OString::number(nListPos).getStr() ) + .WriteOString( OString::number(nListPos) ) .WriteCharPtr( " : " ); OString aSlotIdValue(OString::number(GetSlotId().GetValue())); - rOutStm.WriteCharPtr( aSlotIdValue.getStr() ) << endl; + rOutStm.WriteOString( aSlotIdValue ) << endl; WriteTab( rOutStm, 1 ); if( bIsEnumSlot ) rOutStm.WriteCharPtr( "SFX_NEW_SLOT_ENUM( " ); else - rOutStm.WriteCharPtr( "SFX_NEW_SLOT_ARG( " ).WriteCharPtr( rShellName.getStr() ).WriteChar( ',' ) ; + rOutStm.WriteCharPtr( "SFX_NEW_SLOT_ARG( " ).WriteOString( rShellName ).WriteChar( ',' ) ; - rOutStm.WriteCharPtr( rSlotId.getStr() ).WriteChar( ',' ); + rOutStm.WriteOString( rSlotId ).WriteChar( ',' ); // GroupId if( !GetGroupId().isEmpty() ) - rOutStm.WriteCharPtr( GetGroupId().getStr() ); + rOutStm.WriteOString( GetGroupId() ); else rOutStm.WriteChar( '0' ); rOutStm.WriteChar( ',' ) << endl; @@ -662,23 +662,23 @@ void SvMetaSlot::WriteSlot( const OString& rShellName, sal_uInt16 nCount, if( bIsEnumSlot ) { - rOutStm.WriteCharPtr( "&a" ).WriteCharPtr( rShellName.getStr() ).WriteCharPtr( "Slots_Impl[" ) - .WriteCharPtr( OString::number(pLinkedSlot->GetListPos()).getStr() ) + rOutStm.WriteCharPtr( "&a" ).WriteOString( rShellName ).WriteCharPtr( "Slots_Impl[" ) + .WriteOString( OString::number(pLinkedSlot->GetListPos()) ) .WriteCharPtr( "] /*Offset Master*/, " ) << endl; WriteTab( rOutStm, 4 ); - rOutStm.WriteCharPtr( "&a" ).WriteCharPtr( rShellName.getStr() ).WriteCharPtr( "Slots_Impl[" ) - .WriteCharPtr( OString::number(pNextSlot->GetListPos()).getStr() ) + rOutStm.WriteCharPtr( "&a" ).WriteOString( rShellName ).WriteCharPtr( "Slots_Impl[" ) + .WriteOString( OString::number(pNextSlot->GetListPos()) ) .WriteCharPtr( "] /*Offset Next*/, " ) << endl; WriteTab( rOutStm, 4 ); // SlotId if( !GetSlotId().getString().isEmpty() ) - rOutStm.WriteCharPtr( pLinkedSlot->GetSlotId().getString().getStr() ); + rOutStm.WriteOString( pLinkedSlot->GetSlotId().getString() ); else rOutStm.WriteChar( '0' ); rOutStm.WriteChar( ',' ); - rOutStm.WriteCharPtr( pEnumValue->GetName().getStr() ); + rOutStm.WriteOString( pEnumValue->GetName() ); } else { @@ -721,14 +721,14 @@ void SvMetaSlot::WriteSlot( const OString& rShellName, sal_uInt16 nCount, } else { - rOutStm.WriteCharPtr( "&a" ).WriteCharPtr( rShellName.getStr() ).WriteCharPtr( "Slots_Impl[" ) - .WriteCharPtr( OString::number(pLinkedSlot->GetListPos()).getStr() ) + rOutStm.WriteCharPtr( "&a" ).WriteOString( rShellName ).WriteCharPtr( "Slots_Impl[" ) + .WriteOString( OString::number(pLinkedSlot->GetListPos()) ) .WriteCharPtr( "] /*Offset Linked*/, " ) << endl; WriteTab( rOutStm, 4 ); } - rOutStm.WriteCharPtr( "&a" ).WriteCharPtr( rShellName.getStr() ).WriteCharPtr( "Slots_Impl[" ) - .WriteCharPtr( OString::number(pNextSlot->GetListPos()).getStr() ) + rOutStm.WriteCharPtr( "&a" ).WriteOString( rShellName ).WriteCharPtr( "Slots_Impl[" ) + .WriteOString( OString::number(pNextSlot->GetListPos()) ) .WriteCharPtr( "] /*Offset Next*/, " ) << endl; WriteTab( rOutStm, 4 ); @@ -737,8 +737,8 @@ void SvMetaSlot::WriteSlot( const OString& rShellName, sal_uInt16 nCount, if( !GetExecMethod().isEmpty() && GetExecMethod() != "NoExec") { - rOutStm.WriteCharPtr( "SFX_STUB_PTR(" ).WriteCharPtr( rShellName.getStr() ).WriteChar( ',' ) - .WriteCharPtr( GetExecMethod().getStr() ).WriteChar( ')' ); + rOutStm.WriteCharPtr( "SFX_STUB_PTR(" ).WriteOString( rShellName ).WriteChar( ',' ) + .WriteOString( GetExecMethod() ).WriteChar( ')' ); } else rOutStm.WriteCharPtr( "SFX_STUB_PTR_EXEC_NONE" ); @@ -748,8 +748,8 @@ void SvMetaSlot::WriteSlot( const OString& rShellName, sal_uInt16 nCount, if( !GetStateMethod().isEmpty() && GetStateMethod() != "NoState") { - rOutStm.WriteCharPtr( "SFX_STUB_PTR(" ).WriteCharPtr( rShellName.getStr() ).WriteChar( ',' ) - .WriteCharPtr( GetStateMethod().getStr() ).WriteChar( ')' ); + rOutStm.WriteCharPtr( "SFX_STUB_PTR(" ).WriteOString( rShellName ).WriteChar( ',' ) + .WriteOString( GetStateMethod() ).WriteChar( ')' ); } else rOutStm.WriteCharPtr( "SFX_STUB_PTR_STATE_NONE" ); @@ -759,35 +759,35 @@ void SvMetaSlot::WriteSlot( const OString& rShellName, sal_uInt16 nCount, // write flags if( GetToggle() ) - rOutStm.WriteCharPtr( MakeSlotName( SvHash_Toggle() ).getStr() ).WriteChar( '|' ); + rOutStm.WriteOString( MakeSlotName( SvHash_Toggle() ) ).WriteChar( '|' ); if( GetAutoUpdate() ) - rOutStm.WriteCharPtr( MakeSlotName( SvHash_AutoUpdate() ).getStr() ).WriteChar( '|' ); + rOutStm.WriteOString( MakeSlotName( SvHash_AutoUpdate() ) ).WriteChar( '|' ); if( GetAsynchron() ) - rOutStm.WriteCharPtr( MakeSlotName( SvHash_Asynchron() ).getStr() ).WriteChar( '|' ); + rOutStm.WriteOString( MakeSlotName( SvHash_Asynchron() ) ).WriteChar( '|' ); if( GetRecordPerItem() ) - rOutStm.WriteCharPtr( MakeSlotName( SvHash_RecordPerItem() ).getStr() ).WriteChar( '|' ); + rOutStm.WriteOString( MakeSlotName( SvHash_RecordPerItem() ) ).WriteChar( '|' ); if( GetRecordPerSet() ) - rOutStm.WriteCharPtr( MakeSlotName( SvHash_RecordPerSet() ).getStr() ).WriteChar( '|' ); + rOutStm.WriteOString( MakeSlotName( SvHash_RecordPerSet() ) ).WriteChar( '|' ); if( GetNoRecord() ) - rOutStm.WriteCharPtr( MakeSlotName( SvHash_NoRecord() ).getStr() ).WriteChar( '|' ); + rOutStm.WriteOString( MakeSlotName( SvHash_NoRecord() ) ).WriteChar( '|' ); if( GetRecordAbsolute() ) - rOutStm.WriteCharPtr( MakeSlotName( SvHash_RecordAbsolute() ).getStr() ).WriteChar( '|' ); + rOutStm.WriteOString( MakeSlotName( SvHash_RecordAbsolute() ) ).WriteChar( '|' ); if( GetMenuConfig() ) - rOutStm.WriteCharPtr( MakeSlotName( SvHash_MenuConfig() ).getStr() ).WriteChar( '|' ); + rOutStm.WriteOString( MakeSlotName( SvHash_MenuConfig() ) ).WriteChar( '|' ); if( GetToolBoxConfig() ) - rOutStm.WriteCharPtr( MakeSlotName( SvHash_ToolBoxConfig() ).getStr() ).WriteChar( '|' ); + rOutStm.WriteOString( MakeSlotName( SvHash_ToolBoxConfig() ) ).WriteChar( '|' ); if( GetAccelConfig() ) - rOutStm.WriteCharPtr( MakeSlotName( SvHash_AccelConfig() ).getStr() ).WriteChar( '|' ); + rOutStm.WriteOString( MakeSlotName( SvHash_AccelConfig() ) ).WriteChar( '|' ); if( GetFastCall() ) - rOutStm.WriteCharPtr( MakeSlotName( SvHash_FastCall() ).getStr() ).WriteChar( '|' ); + rOutStm.WriteOString( MakeSlotName( SvHash_FastCall() ) ).WriteChar( '|' ); if( GetContainer() ) - rOutStm.WriteCharPtr( MakeSlotName( SvHash_Container() ).getStr() ).WriteChar( '|' ); + rOutStm.WriteOString( MakeSlotName( SvHash_Container() ) ).WriteChar( '|' ); if ( GetReadOnlyDoc() ) - rOutStm.WriteCharPtr( MakeSlotName( SvHash_ReadOnlyDoc() ).getStr() ).WriteChar( '|' ); + rOutStm.WriteOString( MakeSlotName( SvHash_ReadOnlyDoc() ) ).WriteChar( '|' ); if( GetImageRotation() ) - rOutStm.WriteCharPtr( MakeSlotName( SvHash_ImageRotation() ).getStr() ).WriteChar( '|' ); + rOutStm.WriteOString( MakeSlotName( SvHash_ImageRotation() ) ).WriteChar( '|' ); if( GetImageReflection() ) - rOutStm.WriteCharPtr( MakeSlotName( SvHash_ImageReflection() ).getStr() ).WriteChar( '|' ); + rOutStm.WriteOString( MakeSlotName( SvHash_ImageReflection() ) ).WriteChar( '|' ); rOutStm.WriteCharPtr( "SfxSlotMode::NONE" ); rOutStm.WriteChar( ',' ) << endl; @@ -795,7 +795,7 @@ void SvMetaSlot::WriteSlot( const OString& rShellName, sal_uInt16 nCount, if ( GetDisableFlags().isEmpty() ) rOutStm.WriteCharPtr( "0" ); else - rOutStm.WriteCharPtr( GetDisableFlags().getStr() ); + rOutStm.WriteOString( GetDisableFlags() ); // write attribute type if( !bIsEnumSlot ) @@ -813,7 +813,7 @@ void SvMetaSlot::WriteSlot( const OString& rShellName, sal_uInt16 nCount, } if( pT ) { - rOutStm.WriteCharPtr( pT->GetName().getStr() ); + rOutStm.WriteOString( pT->GetName() ); if( !SvIdlDataBase::FindType( pT, rBase.aUsedTypes ) ) rBase.aUsedTypes.push_back( pT ); } @@ -832,7 +832,7 @@ void SvMetaSlot::WriteSlot( const OString& rShellName, sal_uInt16 nCount, rOutStm.WriteChar( ',' ) << endl; WriteTab( rOutStm, 4 ); rOutStm - .WriteCharPtr( OString::number(nCount).getStr() ) + .WriteOString( OString::number(nCount) ) .WriteCharPtr( "/*Offset*/, " ); if( IsMethod() ) @@ -845,7 +845,7 @@ void SvMetaSlot::WriteSlot( const OString& rShellName, sal_uInt16 nCount, pType = GetType(); sal_uLong nSCount = pType->GetAttrCount(); rOutStm - .WriteCharPtr( OString::number(nSCount).getStr() ) + .WriteOString( OString::number(nSCount) ) .WriteCharPtr( "/*Count*/," ); } else @@ -862,7 +862,7 @@ void SvMetaSlot::WriteSlot( const OString& rShellName, sal_uInt16 nCount, { rOutStm.WriteCharPtr( ",\"" ); - rOutStm.WriteCharPtr( GetMangleName().getStr() ); + rOutStm.WriteOString( GetMangleName() ); rOutStm.WriteCharPtr( "\"" ); } @@ -895,11 +895,11 @@ sal_uInt16 SvMetaSlot::WriteSlotParamArray( SvIdlDataBase & rBase, SvStream & rO WriteTab( rOutStm, 1 ); rOutStm.WriteCharPtr("{ (const SfxType*) &a") // item type - .WriteCharPtr(pPType->GetName().getStr()).WriteCharPtr("_Impl, ") + .WriteOString(pPType->GetName()).WriteCharPtr("_Impl, ") // parameter name - .WriteCharPtr("\"").WriteCharPtr(pPar->GetName().getStr()).WriteCharPtr("\", ") + .WriteCharPtr("\"").WriteOString(pPar->GetName()).WriteCharPtr("\", ") // slot id - .WriteCharPtr(pPar->GetSlotId().getString().getStr()).WriteCharPtr(" },") << endl; + .WriteOString(pPar->GetSlotId().getString()).WriteCharPtr(" },") << endl; if( !SvIdlDataBase::FindType( pPType, rBase.aUsedTypes ) ) rBase.aUsedTypes.push_back( pPType ); } diff --git a/idl/source/objects/types.cxx b/idl/source/objects/types.cxx index 19726d1..b171fbd 100644 --- a/idl/source/objects/types.cxx +++ b/idl/source/objects/types.cxx @@ -267,15 +267,12 @@ void SvMetaType::WriteSfxItem( const OString& rItemName, SvIdlDataBase& rBase, SvStream& rOutStm ) { WriteStars( rOutStm ); - OStringBuffer aVarName(" a"); - aVarName.append(rItemName).append("_Impl"); + OString aVarName = " a" + rItemName + "_Impl"; - OStringBuffer aTypeName("SfxType"); OStringBuffer aAttrArray; sal_uLong nAttrCount = MakeSfx( aAttrArray ); - OString aAttrCount( - OString::number(nAttrCount)); - aTypeName.append(aAttrCount); + OString aAttrCount( OString::number(nAttrCount)); + OString aTypeName = "SfxType" + aAttrCount; bool bExport = false, bReturn = false; // these are exported from sfx library @@ -293,8 +290,8 @@ void SvMetaType::WriteSfxItem( rOutStm.WriteCharPtr( "extern " ); if (bExport) rOutStm.WriteCharPtr( "SFX2_DLLPUBLIC " ); - rOutStm.WriteCharPtr( aTypeName.getStr() ) - .WriteCharPtr( aVarName.getStr() ).WriteChar( ';' ) << endl; + rOutStm.WriteOString( aTypeName ) + .WriteOString( aVarName ).WriteChar( ';' ) << endl; if (bReturn) return; @@ -303,13 +300,13 @@ void SvMetaType::WriteSfxItem( rOutStm.WriteCharPtr( "#if !defined(_WIN32) && ((defined(DISABLE_DYNLOADING) && (defined(ANDROID) || defined(IOS))) || STATIC_LINKING)" ) << endl; rOutStm.WriteCharPtr( "__attribute__((__weak__))" ) << endl; rOutStm.WriteCharPtr( "#endif" ) << endl; - rOutStm.WriteCharPtr( aTypeName.getStr() ).WriteCharPtr( aVarName.getStr() ) + rOutStm.WriteOString( aTypeName ).WriteOString( aVarName ) .WriteCharPtr( " = " ) << endl; rOutStm.WriteChar( '{' ) << endl; - rOutStm.WriteCharPtr( "\tcreateSfxPoolItem<" ).WriteCharPtr( rItemName.getStr() ) - .WriteCharPtr(">, &typeid(").WriteCharPtr( rItemName.getStr() ).WriteCharPtr( "), " ); - rOutStm.WriteCharPtr( aAttrCount.getStr() ); + rOutStm.WriteCharPtr( "\tcreateSfxPoolItem<" ).WriteOString( rItemName ) + .WriteCharPtr(">, &typeid(").WriteOString( rItemName ).WriteCharPtr( "), " ); + rOutStm.WriteOString( aAttrCount ); if( nAttrCount ) { rOutStm.WriteCharPtr( ", { " ); diff --git a/idl/source/prj/database.cxx b/idl/source/prj/database.cxx index 865ad47..5e10fc7 100644 --- a/idl/source/prj/database.cxx +++ b/idl/source/prj/database.cxx @@ -590,7 +590,7 @@ struct WriteDep void operator() (OUString const& rItem) { m_rStream.WriteCharPtr( " \\\n " ); - m_rStream.WriteCharPtr( OUStringToOString(rItem, RTL_TEXTENCODING_UTF8).getStr() ); + m_rStream.WriteOString( OUStringToOString(rItem, RTL_TEXTENCODING_UTF8) ); } }; @@ -602,7 +602,7 @@ struct WriteDummy explicit WriteDummy(SvFileStream & rStream) : m_rStream(rStream) { } void operator() (OUString const& rItem) { - m_rStream.WriteCharPtr( OUStringToOString(rItem, RTL_TEXTENCODING_UTF8).getStr() ); + m_rStream.WriteOString( OUStringToOString(rItem, RTL_TEXTENCODING_UTF8) ); m_rStream.WriteCharPtr( " :\n\n" ); } }; @@ -610,7 +610,7 @@ struct WriteDummy void SvIdlDataBase::WriteDepFile( SvFileStream & rStream, OUString const& rTarget) { - rStream.WriteCharPtr( OUStringToOString(rTarget, RTL_TEXTENCODING_UTF8).getStr() ); + rStream.WriteOString( OUStringToOString(rTarget, RTL_TEXTENCODING_UTF8) ); rStream.WriteCharPtr( " :" ); ::std::for_each(m_DepFiles.begin(), m_DepFiles.end(), WriteDep(rStream)); rStream.WriteCharPtr( "\n\n" ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits