move some more slot parsing to SvIdlParser

Change-Id: I186e80ed0446585aceaf4d25f32ecca7e8ed396c
This commit is contained in:
Noel Grandin
2016-02-16 15:18:33 +02:00
parent 0f8f733eaf
commit cd3bb3047d
3 changed files with 46 additions and 32 deletions

View File

@@ -33,6 +33,7 @@ class SvClassElement
tools::SvRef<SvMetaClass> xClass; tools::SvRef<SvMetaClass> xClass;
public: public:
SvClassElement(); SvClassElement();
SvClassElement(SvMetaClass* pClass) { xClass = pClass; }
void SetPrefix( const OString& rPrefix ) void SetPrefix( const OString& rPrefix )
{ aPrefix = rPrefix; } { aPrefix = rPrefix; }

View File

@@ -50,6 +50,7 @@ public:
void ReadStruct(); void ReadStruct();
void ReadEnum(); void ReadEnum();
void ReadEnumValue( SvMetaTypeEnum& rEnum ); void ReadEnumValue( SvMetaTypeEnum& rEnum );
SvMetaClass* ReadKnownClass();
SvMetaType* ReadKnownType(); SvMetaType* ReadKnownType();
void ReadChar(char cChar); void ReadChar(char cChar);
void ReadDelimiter(); void ReadDelimiter();

View File

@@ -282,9 +282,7 @@ void SvIdlParser::ReadInterfaceOrShell( SvMetaModule& rModule, MetaTypeType aMet
if( rInStm.ReadIf( ':' ) ) if( rInStm.ReadIf( ':' ) )
{ {
aClass->aSuperClass = rBase.ReadKnownClass( rInStm ); aClass->aSuperClass = ReadKnownClass();
if( !aClass->aSuperClass.Is() )
throw SvParseException( rInStm, "unknown super class" );
} }
if( rInStm.ReadIf( '{' ) ) if( rInStm.ReadIf( '{' ) )
{ {
@@ -309,19 +307,15 @@ void SvIdlParser::ReadInterfaceOrShellEntry(SvMetaClass& rClass)
if( rTok.Is( SvHash_import() ) ) if( rTok.Is( SvHash_import() ) )
{ {
SvMetaClass * pClass = rBase.ReadKnownClass( rInStm ); SvMetaClass * pClass = ReadKnownClass();
if( !pClass ) SvClassElement xEle(pClass);
throw SvParseException( rInStm, "unknown imported interface" );
SvClassElement xEle;
xEle.SetClass( pClass );
rClass.aClassElementList.push_back( xEle );
rTok = rInStm.GetToken(); rTok = rInStm.GetToken();
if( rTok.IsString() ) if( rTok.IsString() )
{ {
xEle.SetPrefix( rTok.GetString() ); xEle.SetPrefix( rTok.GetString() );
rInStm.GetToken_Next(); rInStm.GetToken_Next();
} }
rClass.aClassElementList.push_back( xEle );
return; return;
} }
else else
@@ -368,7 +362,17 @@ bool SvIdlParser::ReadInterfaceOrShellSlot(SvMetaSlot& rSlot)
throw SvParseException( rInStm, "attribute " + pAttr->GetName() + " is method or variable but not a slot" ); throw SvParseException( rInStm, "attribute " + pAttr->GetName() + " is method or variable but not a slot" );
rSlot.SetRef( pKnownSlot ); rSlot.SetRef( pKnownSlot );
rSlot.SetName( pKnownSlot->GetName() ); 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 else
{ {
@@ -435,6 +439,14 @@ bool SvIdlParser::ReadInterfaceOrShellMethodOrAttribute( SvMetaAttribute& rAttr
return bOk; return bOk;
} }
SvMetaClass * SvIdlParser::ReadKnownClass()
{
SvMetaClass* pClass = rBase.ReadKnownClass( rInStm );
if( !pClass )
throw SvParseException( rInStm, "unknown class" );
return pClass;
}
SvMetaType * SvIdlParser::ReadKnownType() SvMetaType * SvIdlParser::ReadKnownType()
{ {
OString aName = ReadIdentifier(); OString aName = ReadIdentifier();