diff options
author | Noel Grandin <noel@peralex.com> | 2016-02-16 15:18:33 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-02-17 11:22:26 +0200 |
commit | cd3bb3047d3f4c9cc9b4aa0c0eb8a42930b9bb86 (patch) | |
tree | 165452f259c416faaf18defe2fb6b80fc0c1f438 /idl | |
parent | 0f8f733eaf54c00f79d086c2b2867c7a8b1bcc6c (diff) |
move some more slot parsing to SvIdlParser
Change-Id: I186e80ed0446585aceaf4d25f32ecca7e8ed396c
Diffstat (limited to 'idl')
-rw-r--r-- | idl/inc/object.hxx | 1 | ||||
-rw-r--r-- | idl/inc/parser.hxx | 39 | ||||
-rw-r--r-- | idl/source/prj/parser.cxx | 38 |
3 files changed, 46 insertions, 32 deletions
diff --git a/idl/inc/object.hxx b/idl/inc/object.hxx index 6d56eebeceac..4c26597f7608 100644 --- a/idl/inc/object.hxx +++ b/idl/inc/object.hxx @@ -33,6 +33,7 @@ class SvClassElement tools::SvRef<SvMetaClass> xClass; public: SvClassElement(); + SvClassElement(SvMetaClass* pClass) { xClass = pClass; } void SetPrefix( const OString& rPrefix ) { aPrefix = rPrefix; } diff --git a/idl/inc/parser.hxx b/idl/inc/parser.hxx index 8059cfdd9dd5..612fda03b778 100644 --- a/idl/inc/parser.hxx +++ b/idl/inc/parser.hxx @@ -37,25 +37,26 @@ class SvIdlParser SvTokenStream & rInStm; public: SvIdlParser( SvIdlDataBase& rBase_, SvTokenStream & rInStrm_) : rBase(rBase_), rInStm(rInStrm_) {} - void ReadSvIdl( bool bImported, const OUString & rPath ); - void ReadModuleHeader(SvMetaModule& rModule); - void ReadModuleBody(SvMetaModule& rModule); - void ReadModuleElement( SvMetaModule& rModule ); - void ReadInclude( SvMetaModule& rModule ); - void ReadInterfaceOrShell( SvMetaModule& rModule, MetaTypeType aMetaTypeType ); - void ReadInterfaceOrShellEntry( SvMetaClass& rClass ); - bool ReadInterfaceOrShellSlot( SvMetaSlot& rSlot ); - bool ReadInterfaceOrShellMethodOrAttribute( SvMetaAttribute& rAttr ); - void ReadItem(); - void ReadStruct(); - void ReadEnum(); - void ReadEnumValue( SvMetaTypeEnum& rEnum ); - SvMetaType* ReadKnownType(); - void ReadChar(char cChar); - void ReadDelimiter(); - OString ReadIdentifier(); - OString ReadString(); - void ReadToken(SvStringHashEntry*); + void ReadSvIdl( bool bImported, const OUString & rPath ); + void ReadModuleHeader(SvMetaModule& rModule); + void ReadModuleBody(SvMetaModule& rModule); + void ReadModuleElement( SvMetaModule& rModule ); + void ReadInclude( SvMetaModule& rModule ); + void ReadInterfaceOrShell( SvMetaModule& rModule, MetaTypeType aMetaTypeType ); + void ReadInterfaceOrShellEntry( SvMetaClass& rClass ); + bool ReadInterfaceOrShellSlot( SvMetaSlot& rSlot ); + bool ReadInterfaceOrShellMethodOrAttribute( SvMetaAttribute& rAttr ); + void ReadItem(); + void ReadStruct(); + void ReadEnum(); + void ReadEnumValue( SvMetaTypeEnum& rEnum ); + SvMetaClass* ReadKnownClass(); + SvMetaType* ReadKnownType(); + void ReadChar(char cChar); + void ReadDelimiter(); + OString ReadIdentifier(); + OString ReadString(); + void ReadToken(SvStringHashEntry*); }; #endif // INCLUDED_IDL_INC_PARSER_HXX diff --git a/idl/source/prj/parser.cxx b/idl/source/prj/parser.cxx index d1793c89de2b..01cab6285d5e 100644 --- a/idl/source/prj/parser.cxx +++ b/idl/source/prj/parser.cxx @@ -282,9 +282,7 @@ void SvIdlParser::ReadInterfaceOrShell( SvMetaModule& rModule, MetaTypeType aMet if( rInStm.ReadIf( ':' ) ) { - aClass->aSuperClass = rBase.ReadKnownClass( rInStm ); - if( !aClass->aSuperClass.Is() ) - throw SvParseException( rInStm, "unknown super class" ); + aClass->aSuperClass = ReadKnownClass(); } if( rInStm.ReadIf( '{' ) ) { @@ -309,19 +307,15 @@ void SvIdlParser::ReadInterfaceOrShellEntry(SvMetaClass& rClass) if( rTok.Is( SvHash_import() ) ) { - SvMetaClass * pClass = rBase.ReadKnownClass( rInStm ); - if( !pClass ) - throw SvParseException( rInStm, "unknown imported interface" ); - SvClassElement xEle; - xEle.SetClass( pClass ); - rClass.aClassElementList.push_back( xEle ); - + SvMetaClass * pClass = ReadKnownClass(); + SvClassElement xEle(pClass); rTok = rInStm.GetToken(); if( rTok.IsString() ) { xEle.SetPrefix( rTok.GetString() ); rInStm.GetToken_Next(); } + rClass.aClassElementList.push_back( xEle ); return; } else @@ -363,12 +357,22 @@ bool SvIdlParser::ReadInterfaceOrShellSlot(SvMetaSlot& rSlot) SvMetaAttribute * pAttr = rBase.ReadKnownAttr( rInStm, rSlot.GetType() ); if( pAttr ) { - SvMetaSlot * pKnownSlot = dynamic_cast<SvMetaSlot*>( pAttr ); + SvMetaSlot * pKnownSlot = dynamic_cast<SvMetaSlot*>( pAttr ); if( !pKnownSlot ) throw SvParseException( rInStm, "attribute " + pAttr->GetName() + " is method or variable but not a slot" ); rSlot.SetRef( pKnownSlot ); rSlot.SetName( pKnownSlot->GetName() ); - bOk = rSlot.SvMetaObject::ReadSvIdl( rBase, rInStm ); + if( rInStm.ReadIf( '[' ) ) + { + sal_uInt32 nBeginPos = 0; // can not happen with Tell + while( nBeginPos != rInStm.Tell() ) + { + nBeginPos = rInStm.Tell(); + rSlot.ReadAttributesSvIdl( rBase, rInStm ); + rInStm.ReadIfDelimiter(); + } + bOk = rInStm.ReadIf( ']' ); + } } else { @@ -376,7 +380,7 @@ bool SvIdlParser::ReadInterfaceOrShellSlot(SvMetaSlot& rSlot) SvMetaAttribute *pAttr2 = rBase.SearchKnownAttr( rSlot.GetSlotId() ); if( pAttr2 ) { - SvMetaSlot * pKnownSlot = dynamic_cast<SvMetaSlot*>( pAttr2 ); + SvMetaSlot * pKnownSlot = dynamic_cast<SvMetaSlot*>( pAttr2 ); if( !pKnownSlot ) throw SvParseException( rInStm, "attribute " + pAttr2->GetName() + " is method or variable but not a slot" ); rSlot.SetRef( pKnownSlot ); @@ -435,6 +439,14 @@ bool SvIdlParser::ReadInterfaceOrShellMethodOrAttribute( SvMetaAttribute& rAttr return bOk; } +SvMetaClass * SvIdlParser::ReadKnownClass() +{ + SvMetaClass* pClass = rBase.ReadKnownClass( rInStm ); + if( !pClass ) + throw SvParseException( rInStm, "unknown class" ); + return pClass; +} + SvMetaType * SvIdlParser::ReadKnownType() { OString aName = ReadIdentifier(); |