/

option value='feature/unocrsrptr'>feature/unocrsrptr LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-02-17 09:01:27 +0200
committerNoel Grandin <noel@peralex.com>2016-02-17 11:22:26 +0200
commitb94272a55ee208b22cf73e8738152d9feaa7916f (patch)
tree3f37e456b9f8ae68fa06fa8f4de9bc6232b76fba
parentcd3bb3047d3f4c9cc9b4aa0c0eb8a42930b9bb86 (diff)
cleanup the Read*() methods in SvIdlParser
to be consistent about when they move to the next token Change-Id: I8f5b1eab497fb4a7cb2a2267e815668c3d363de7
Diffstat
-rw-r--r--idl/inc/lex.hxx50
-rw-r--r--idl/inc/parser.hxx7
-rw-r--r--idl/source/prj/parser.cxx130
-rw-r--r--svx/sdi/svxitems.sdi2
4 files changed, 114 insertions, 75 deletions
diff --git a/idl/inc/lex.hxx b/idl/inc/lex.hxx
index f513e9ec68fb..7a715206211e 100644
--- a/idl/inc/lex.hxx
+++ b/idl/inc/lex.hxx
@@ -181,28 +181,38 @@ public:
SvToken& GetToken() const { return *(*pCurToken).get(); }
bool ReadIf( char cChar )
- {
- if( (*pCurToken)->IsChar()
- && cChar == (*pCurToken)->GetChar() )
- {
- GetToken_Next();
- return true;
- }
- else
- return false;
- }
+ {
+ if( GetToken().IsChar() && cChar == GetToken().GetChar() )
+ {
+ GetToken_Next();
+ return true;
+ }
+ else
+ return false;
+ }
+
+ bool ReadIf( SvStringHashEntry* pEntry )
+ {
+ if( GetToken().Is( pEntry ) )
+ {
+ GetToken_Next();
+ return true;
+ }
+ else
+ return false;
+ }
bool ReadIfDelimiter()
- {
- if( (*pCurToken)->IsChar()
- && (';' == (*pCurToken)->GetChar()
- || ',' == (*pCurToken)->GetChar()) )
- {
- GetToken_Next();
- return true;
- }
- return false;
- }
+ {
+ if( GetToken().IsChar()
+ && (';' == GetToken().GetChar()
+ || ',' == GetToken().GetChar()) )
+ {
+ GetToken_Next();
+ return true;
+ }
+ return false;
+ }
sal_uInt32 Tell() const { return pCurToken-aTokList.begin(); }
diff --git a/idl/inc/parser.hxx b/idl/inc/parser.hxx
index 612fda03b778..fd1a3526a1a2 100644
--- a/idl/inc/parser.hxx
+++ b/idl/inc/parser.hxx
@@ -52,11 +52,14 @@ public:
void ReadEnumValue( SvMetaTypeEnum& rEnum );
SvMetaClass* ReadKnownClass();
SvMetaType* ReadKnownType();
- void ReadChar(char cChar);
+ void Read(char cChar);
+ bool ReadIf(char cChar);
void ReadDelimiter();
+ bool ReadIfDelimiter();
OString ReadIdentifier();
OString ReadString();
- void ReadToken(SvStringHashEntry*);
+ void Read(SvStringHashEntry*);
+ bool ReadIf(SvStringHashEntry*);
};
#endif // INCLUDED_IDL_INC_PARSER_HXX
diff --git a/idl/source/prj/parser.cxx b/idl/source/prj/parser.cxx
index 01cab6285d5e..fe1e2b93e511 100644
--- a/idl/source/prj/parser.cxx
+++ b/idl/source/prj/parser.cxx
@@ -37,18 +37,15 @@ void SvIdlParser::ReadSvIdl( bool bImported, const OUString & rPath )
if( rTok.IsEof() )
return;
- if( rTok.Is( SvHash_module() ) )
- {
- tools::SvRef<SvMetaModule> aModule = new SvMetaModule( bImported );
- ReadModuleHeader(*aModule);
- rBase.GetModuleList().push_back( aModule );
- }
+ Read( SvHash_module() );
+ tools::SvRef<SvMetaModule> aModule = new SvMetaModule( bImported );
+ ReadModuleHeader(*aModule);
+ rBase.GetModuleList().push_back( aModule );
}
}
void SvIdlParser::ReadModuleHeader(SvMetaModule& rModule)
{
- rInStm.GetToken_Next();
OString aName = ReadIdentifier();
rBase.Push( &rModule ); // onto the context stack
rModule.SetName( aName );
@@ -58,7 +55,7 @@ void SvIdlParser::ReadModuleHeader(SvMetaModule& rModule)
void SvIdlParser::ReadModuleBody(SvMetaModule& rModule)
{
- if( rInStm.ReadIf( '[' ) )
+ if( ReadIf( '[' ) )
{
while( true )
{
@@ -69,12 +66,12 @@ void SvIdlParser::ReadModuleBody(SvMetaModule& rModule)
{
throw SvParseException( rInStm, "cannot read file: " + aSlotIdFile );
}
- rInStm.ReadIfDelimiter();
+ ReadIfDelimiter();
}
- ReadChar( ']' );
+ Read( ']' );
}
- if( !rInStm.ReadIf( '{' ) )
+ if( !ReadIf( '{' ) )
return;
sal_uInt32 nBeginPos = 0;
@@ -82,34 +79,34 @@ void SvIdlParser::ReadModuleBody(SvMetaModule& rModule)
{
nBeginPos = rInStm.Tell();
ReadModuleElement( rModule );
- rInStm.ReadIfDelimiter();
+ ReadIfDelimiter();
}
- ReadChar( '}' );
+ Read( '}' );
}
void SvIdlParser::ReadModuleElement( SvMetaModule& rModule )
{
- if( rInStm.GetToken().Is( SvHash_interface() ) )
+ if( ReadIf( SvHash_interface() ) )
{
ReadInterfaceOrShell(rModule, MetaTypeType::Interface);
}
- else if( rInStm.GetToken().Is( SvHash_shell() ) )
+ else if( ReadIf( SvHash_shell() ) )