Kaydet (Commit) 5a39ad3b authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Noel Grandin

move the method param parsing code into SvParser

Change-Id: I5718c309acd213f94e96efc2e9a98ab0344fe341
üst dc1df1b8
...@@ -45,11 +45,12 @@ public: ...@@ -45,11 +45,12 @@ public:
void ReadInterfaceOrShell( SvMetaModule& rModule, MetaTypeType aMetaTypeType ); void ReadInterfaceOrShell( SvMetaModule& rModule, MetaTypeType aMetaTypeType );
void ReadInterfaceOrShellEntry( SvMetaClass& rClass ); void ReadInterfaceOrShellEntry( SvMetaClass& rClass );
bool ReadInterfaceOrShellSlot( SvMetaSlot& rSlot ); bool ReadInterfaceOrShellSlot( SvMetaSlot& rSlot );
void ReadInterfaceOrShellMethodOrAttribute( SvMetaAttribute& rAttr ); void ReadInterfaceOrShellMethod( SvMetaAttribute& rAttr );
void ReadItem(); void ReadItem();
void ReadStruct(); void ReadStruct();
void ReadEnum(); void ReadEnum();
void ReadEnumValue( SvMetaTypeEnum& rEnum ); void ReadEnumValue( SvMetaTypeEnum& rEnum );
void ReadSlotId(SvIdentifier& rSlotId);
SvMetaClass* ReadKnownClass(); SvMetaClass* ReadKnownClass();
SvMetaType* ReadKnownType(); SvMetaType* ReadKnownType();
void Read(char cChar); void Read(char cChar);
......
...@@ -316,7 +316,7 @@ void SvIdlParser::ReadInterfaceOrShellEntry(SvMetaClass& rClass) ...@@ -316,7 +316,7 @@ void SvIdlParser::ReadInterfaceOrShellEntry(SvMetaClass& rClass)
else else
{ {
xAttr = new SvMetaAttribute( pType ); xAttr = new SvMetaAttribute( pType );
ReadInterfaceOrShellMethodOrAttribute(*xAttr); ReadInterfaceOrShellMethod(*xAttr);
bOk = true; bOk = true;
} }
if( bOk ) if( bOk )
...@@ -354,7 +354,7 @@ bool SvIdlParser::ReadInterfaceOrShellSlot(SvMetaSlot& rSlot) ...@@ -354,7 +354,7 @@ bool SvIdlParser::ReadInterfaceOrShellSlot(SvMetaSlot& rSlot)
rSlot.ReadAttributesSvIdl( rBase, rInStm ); rSlot.ReadAttributesSvIdl( rBase, rInStm );
ReadIfDelimiter(); ReadIfDelimiter();
} }
bOk = ReadIf( ']' ); Read( ']' );
} }
} }
else else
...@@ -379,17 +379,13 @@ bool SvIdlParser::ReadInterfaceOrShellSlot(SvMetaSlot& rSlot) ...@@ -379,17 +379,13 @@ bool SvIdlParser::ReadInterfaceOrShellSlot(SvMetaSlot& rSlot)
return bOk; return bOk;
} }
void SvIdlParser::ReadInterfaceOrShellMethodOrAttribute( SvMetaAttribute& rAttr ) void SvIdlParser::ReadInterfaceOrShellMethod( SvMetaAttribute& rAttr )
{ {
rAttr.SetName( ReadIdentifier() ); rAttr.SetName( ReadIdentifier() );
rAttr.aSlotId.setString( ReadIdentifier() ); ReadSlotId( rAttr.aSlotId );
sal_uLong n;
if( !rBase.FindId( rAttr.aSlotId.getString(), &n ) )
throw SvParseException( rInStm, "no value for identifier <" + rAttr.aSlotId.getString() + "> " );
rAttr.aSlotId.SetValue(n);
Read( '(' );
// read method arguments // read method arguments
Read( '(' );
tools::SvRef<SvMetaType> xT(new SvMetaType() ); tools::SvRef<SvMetaType> xT(new SvMetaType() );
xT->SetRef(rAttr.GetType() ); xT->SetRef(rAttr.GetType() );
rAttr.aType = xT; rAttr.aType = xT;
...@@ -398,12 +394,11 @@ void SvIdlParser::ReadInterfaceOrShellMethodOrAttribute( SvMetaAttribute& rAttr ...@@ -398,12 +394,11 @@ void SvIdlParser::ReadInterfaceOrShellMethodOrAttribute( SvMetaAttribute& rAttr
{ {
while (true) while (true)
{ {
tools::SvRef<SvMetaAttribute> xAttr( new SvMetaAttribute() ); tools::SvRef<SvMetaAttribute> xParamAttr( new SvMetaAttribute() );
if( !xAttr->ReadSvIdl( rBase, rInStm ) ) xParamAttr->aType = ReadKnownType();
throw SvParseException(rInStm, "ReadSvIdl in method argument parsing failed"); xParamAttr->SetName( ReadIdentifier() );
if( !xAttr->Test( rInStm ) ) ReadSlotId(xParamAttr->aSlotId);
throw SvParseException(rInStm, "test in method argument parsing failed"); rAttr.aType->GetAttrList().push_back( xParamAttr );
rAttr.aType->GetAttrList().push_back( xAttr );
if (!ReadIfDelimiter()) if (!ReadIfDelimiter())
break; break;
} }
...@@ -411,6 +406,15 @@ void SvIdlParser::ReadInterfaceOrShellMethodOrAttribute( SvMetaAttribute& rAttr ...@@ -411,6 +406,15 @@ void SvIdlParser::ReadInterfaceOrShellMethodOrAttribute( SvMetaAttribute& rAttr
} }
} }
void SvIdlParser::ReadSlotId(SvIdentifier& rSlotId)
{
rSlotId.setString( ReadIdentifier() );
sal_uLong n;
if( !rBase.FindId( rSlotId.getString(), &n ) )
throw SvParseException( rInStm, "no value for identifier <" + rSlotId.getString() + "> " );
rSlotId.SetValue(n);
}
SvMetaClass * SvIdlParser::ReadKnownClass() SvMetaClass * SvIdlParser::ReadKnownClass()
{ {
OString aName(ReadIdentifier()); OString aName(ReadIdentifier());
...@@ -470,9 +474,8 @@ OString SvIdlParser::ReadString() ...@@ -470,9 +474,8 @@ OString SvIdlParser::ReadString()
void SvIdlParser::Read(char cChar) void SvIdlParser::Read(char cChar)
{ {
if( !(rInStm.GetToken().IsChar() && rInStm.GetToken().GetChar() == cChar ) ) if( !ReadIf(cChar) )
throw SvParseException(rInStm, "expected char '" + OString(cChar) + "'"); throw SvParseException(rInStm, "expected char '" + OString(cChar) + "'");
rInStm.GetToken_Next();
} }
bool SvIdlParser::ReadIf(char cChar) bool SvIdlParser::ReadIf(char cChar)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment