From e60296840bf9da3f61a3cce02e1369e4315354b3 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 11 Feb 2016 15:19:50 +0200 Subject: move parsing of "import" into own method Change-Id: Ib3b3fb6fea52b846ada6fb92478ae8f9f769a665 --- idl/inc/parser.hxx | 1 + idl/source/prj/parser.cxx | 46 ++++++++++++++++++++++++++-------------------- 2 files changed, 27 insertions(+), 20 deletions(-) (limited to 'idl') diff --git a/idl/inc/parser.hxx b/idl/inc/parser.hxx index 8a15bb48a7bc..97cb3d50d29d 100644 --- a/idl/inc/parser.hxx +++ b/idl/inc/parser.hxx @@ -32,6 +32,7 @@ class SvIdlParser public: SvIdlParser( SvIdlDataBase& rBase_, SvTokenStream & rInStrm_) : rBase(rBase_), rInStm(rInStrm_) {} bool ReadSvIdl( bool bImported, const OUString & rPath ); + bool ReadModuleImport(const OUString & rPath); }; diff --git a/idl/source/prj/parser.cxx b/idl/source/prj/parser.cxx index 34820f2f75a7..065c3e200949 100644 --- a/idl/source/prj/parser.cxx +++ b/idl/source/prj/parser.cxx @@ -32,26 +32,7 @@ bool SvIdlParser::ReadSvIdl( bool bImported, const OUString & rPath ) // only one import at the very beginning if( rTok.Is( SvHash_import() ) ) { - rTok = rInStm.GetToken_Next(); - if( rTok.IsString() ) - { - OUString aFullName; - if( osl::FileBase::E_None == osl::File::searchFileURL( - OStringToOUString(rTok.GetString(), RTL_TEXTENCODING_ASCII_US), - rPath, - aFullName) ) - { - osl::FileBase::getSystemPathFromFileURL( aFullName, aFullName ); - rBase.AddDepFile(aFullName); - SvTokenStream aTokStm( aFullName ); - SvIdlParser aInputParser(rBase, aTokStm); - bOk = aInputParser.ReadSvIdl( true, rPath ); - } - else - bOk = false; - } - else - bOk = false; + bOk = ReadModuleImport(rPath); } while( bOk ) @@ -80,4 +61,29 @@ bool SvIdlParser::ReadSvIdl( bool bImported, const OUString & rPath ) return true; } +bool SvIdlParser::ReadModuleImport(const OUString & rPath) +{ + SvToken& rTok = rInStm.GetToken_Next(); + bool bOk = true; + if( rTok.IsString() ) + { + OUString aFullName; + if( osl::FileBase::E_None == osl::File::searchFileURL( + OStringToOUString(rTok.GetString(), RTL_TEXTENCODING_ASCII_US), + rPath, + aFullName) ) + { + osl::FileBase::getSystemPathFromFileURL( aFullName, aFullName ); + rBase.AddDepFile(aFullName); + SvTokenStream aTokStm( aFullName ); + SvIdlParser aInputParser(rBase, aTokStm); + bOk = aInputParser.ReadSvIdl( true, rPath ); + } + else + bOk = false; + } + else + bOk = false; + return bOk; +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3