diff options
Diffstat (limited to 'idl/source/prj/parser.cxx')
-rw-r--r-- | idl/source/prj/parser.cxx | 79 |
1 files changed, 53 insertions, 26 deletions
diff --git a/idl/source/prj/parser.cxx b/idl/source/prj/parser.cxx index f2bc458e4b24..cdd80dfecbff 100644 --- a/idl/source/prj/parser.cxx +++ b/idl/source/prj/parser.cxx @@ -118,16 +118,13 @@ bool SvIdlParser::ReadModuleBody(SvMetaModule& rModule) void SvIdlParser::ReadModuleElement( SvMetaModule& rModule ) { - if( rInStm.GetToken().Is( SvHash_interface() ) - || rInStm.GetToken().Is( SvHash_shell() ) ) + if( rInStm.GetToken().Is( SvHash_interface() ) ) { - tools::SvRef<SvMetaClass> aClass( new SvMetaClass() ); - if( aClass->ReadSvIdl( rBase, rInStm ) ) - { - rModule.aClassList.push_back( aClass ); - // announce globally - rBase.GetClassList().push_back( aClass ); - } + ReadInterfaceOrShell(rModule, MetaTypeType::Interface); + } + else if( rInStm.GetToken().Is( SvHash_shell() ) ) + { + ReadInterfaceOrShell(rModule, MetaTypeType::Shell); } else if( rInStm.GetToken().Is( SvHash_enum() ) ) { @@ -254,20 +251,6 @@ void SvIdlParser::ReadItem() rBase.GetTypeList().push_back( xItem ); } -SvMetaType * SvIdlParser::ReadKnownType() -{ - OString aName = ReadIdentifier(); - for( const auto& aType : rBase.GetTypeList() ) - { - if( aType->GetName().equals(aName) ) - { - return aType; - } - } - throw SvParseException( rInStm, "wrong typedef: "); -} - - void SvIdlParser::ReadEnum() { rInStm.GetToken_Next(); @@ -316,14 +299,52 @@ void SvIdlParser::ReadEnumValue( SvMetaTypeEnum& rEnum ) rEnum.aEnumValueList.push_back( aEnumVal ); } +void SvIdlParser::ReadInterfaceOrShell( SvMetaModule& rModule, MetaTypeType aMetaTypeType ) +{ + tools::SvRef<SvMetaClass> aClass( new SvMetaClass() ); + rInStm.GetToken_Next(); -void SvIdlParser::ReadChar(char cChar) + aClass->SetType( aMetaTypeType ); + + aClass->SetName( ReadIdentifier() ); + + if( rInStm.ReadIf( ':' ) ) + { + aClass->aSuperClass = rBase.ReadKnownClass( rInStm ); + if( !aClass->aSuperClass.Is() ) + throw SvParseException( rInStm, "unknown super class" ); + } + if( rInStm.ReadIf( '{' ) ) + { + sal_uInt32 nBeginPos = 0; // can not happen with Tell + while( nBeginPos != rInStm.Tell() ) + { + nBeginPos = rInStm.Tell(); + aClass->ReadContextSvIdl( rBase, rInStm ); + rInStm.ReadIfDelimiter(); + } + ReadChar( '}' ); + } + rModule.aClassList.push_back( aClass ); + // announce globally + rBase.GetClassList().push_back( aClass ); +} + +SvMetaType * SvIdlParser::ReadKnownType() { - if( !rInStm.ReadIf( cChar ) ) - throw SvParseException(rInStm, "expected char '" + OString(cChar) + "'"); + OString aName = ReadIdentifier(); + for( const auto& aType : rBase.GetTypeList() ) + { + if( aType->GetName().equals(aName) ) + { + return aType; + } + } + throw SvParseException( rInStm, "wrong typedef: "); } + void SvIdlParser::ReadDelimiter() { if( !rInStm.ReadIfDelimiter() ) @@ -346,6 +367,12 @@ OString SvIdlParser::ReadString() return rTok.GetString(); } +void SvIdlParser::ReadChar(char cChar) +{ + if( !rInStm.ReadIf( cChar ) ) + throw SvParseException(rInStm, "expected char '" + OString(cChar) + "'"); +} + void SvIdlParser::ReadToken(SvStringHashEntry* entry) { if( !rInStm.GetToken().Is(entry) ) |