summaryrefslogtreecommitdiff
path: root/idl
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2016-03-11 10:38:44 +0200
committerNoel Grandin <noel@peralex.com>2016-06-22 09:27:15 +0200
commit5a39ad3b259a20fa1c78e34ca9146dcec7fe90b0 (patch)
treeecfaefe9b63554e32fecc03632acb4505ef743c3 /idl
parentdc1df1b8f92b873b0776bff4ca3da79af05392ba (diff)
move the method param parsing code into SvParser
Change-Id: I5718c309acd213f94e96efc2e9a98ab0344fe341
Diffstat (limited to 'idl')
-rw-r--r--idl/inc/parser.hxx3
-rw-r--r--idl/source/prj/parser.cxx37
2 files changed, 22 insertions, 18 deletions
diff --git a/idl/inc/parser.hxx b/idl/inc/parser.hxx
index 7f6186c0af13..d4d6abb440a3 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 a71e36745cbb..1438becbfe1a 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)