move the method param parsing code into SvParser
Change-Id: I5718c309acd213f94e96efc2e9a98ab0344fe341
diff --git a/idl/inc/parser.hxx b/idl/inc/parser.hxx
index 7f6186c..d4d6abb 100644
--- a/idl/inc/parser.hxx
+++ b/idl/inc/parser.hxx
@@ -45,11 +45,12 @@ public:
void ReadInterfaceOrShell( SvMetaModule& rModule, MetaTypeType aMetaTypeType );
void ReadInterfaceOrShellEntry( SvMetaClass& rClass );
bool ReadInterfaceOrShellSlot( SvMetaSlot& rSlot );
void ReadInterfaceOrShellMethodOrAttribute( SvMetaAttribute& rAttr );
void ReadInterfaceOrShellMethod( SvMetaAttribute& rAttr );
void ReadItem();
void ReadStruct();
void ReadEnum();
void ReadEnumValue( SvMetaTypeEnum& rEnum );
void ReadSlotId(SvIdentifier& rSlotId);
SvMetaClass* ReadKnownClass();
SvMetaType* ReadKnownType();
void Read(char cChar);
diff --git a/idl/source/prj/parser.cxx b/idl/source/prj/parser.cxx
index a71e367..1438bec 100644
--- a/idl/source/prj/parser.cxx
+++ b/idl/source/prj/parser.cxx
@@ -316,7 +316,7 @@ void SvIdlParser::ReadInterfaceOrShellEntry(SvMetaClass& rClass)
else
{
xAttr = new SvMetaAttribute( pType );
ReadInterfaceOrShellMethodOrAttribute(*xAttr);
ReadInterfaceOrShellMethod(*xAttr);
bOk = true;
}
if( bOk )
@@ -354,7 +354,7 @@ bool SvIdlParser::ReadInterfaceOrShellSlot(SvMetaSlot& rSlot)
rSlot.ReadAttributesSvIdl( rBase, rInStm );
ReadIfDelimiter();
}
bOk = ReadIf( ']' );
Read( ']' );
}
}
else
@@ -379,17 +379,13 @@ bool SvIdlParser::ReadInterfaceOrShellSlot(SvMetaSlot& rSlot)
return bOk;
}
void SvIdlParser::ReadInterfaceOrShellMethodOrAttribute( SvMetaAttribute& rAttr )
void SvIdlParser::ReadInterfaceOrShellMethod( SvMetaAttribute& rAttr )
{
rAttr.SetName( ReadIdentifier() );
rAttr.aSlotId.setString( ReadIdentifier() );
sal_uLong n;
if( !rBase.FindId( rAttr.aSlotId.getString(), &n ) )
throw SvParseException( rInStm, "no value for identifier <" + rAttr.aSlotId.getString() + "> " );
rAttr.aSlotId.SetValue(n);
ReadSlotId( rAttr.aSlotId );
Read( '(' );
// read method arguments
Read( '(' );
tools::SvRef<SvMetaType> xT(new SvMetaType() );
xT->SetRef(rAttr.GetType() );
rAttr.aType = xT;
@@ -398,12 +394,11 @@ void SvIdlParser::ReadInterfaceOrShellMethodOrAttribute( SvMetaAttribute& rAttr
{
while (true)
{
tools::SvRef<SvMetaAttribute> xAttr( new SvMetaAttribute() );
if( !xAttr->ReadSvIdl( rBase, rInStm ) )
throw SvParseException(rInStm, "ReadSvIdl in method argument parsing failed");
if( !xAttr->Test( rInStm ) )
throw SvParseException(rInStm, "test in method argument parsing failed");
rAttr.aType->GetAttrList().push_back( xAttr );
tools::SvRef<SvMetaAttribute> xParamAttr( new SvMetaAttribute() );
xParamAttr->aType = ReadKnownType();
xParamAttr->SetName( ReadIdentifier() );
ReadSlotId(xParamAttr->aSlotId);
rAttr.aType->GetAttrList().push_back( xParamAttr );
if (!ReadIfDelimiter())
break;
}
@@ -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()
{
OString aName(ReadIdentifier());
@@ -470,9 +474,8 @@ OString SvIdlParser::ReadString()
void SvIdlParser::Read(char cChar)
{
if( !(rInStm.GetToken().IsChar() && rInStm.GetToken().GetChar() == cChar ) )
if( !ReadIf(cChar) )
throw SvParseException(rInStm, "expected char '" + OString(cChar) + "'");
rInStm.GetToken_Next();
}
bool SvIdlParser::ReadIf(char cChar)