summaryrefslogtreecommitdiff
path: root/idl
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-02-15 14:22:36 +0200
committerNoel Grandin <noel@peralex.com>2016-02-15 15:47:30 +0200
commitf7520bbc80b571a15adca5279cc7fc5e8965e53c (patch)
treeab18692f88820aa9d69b2543c9f9656dcc32c236 /idl
parentac432839329866659e339b582d31a1980c035c2e (diff)
move interface/shell parsing to SvIdlParser
Change-Id: I95cce21c6c9beb5637dd4f4a769f455eaacbec2b
Diffstat (limited to 'idl')
-rw-r--r--idl/inc/object.hxx10
-rw-r--r--idl/inc/parser.hxx2
-rw-r--r--idl/source/objects/object.cxx28
-rw-r--r--idl/source/prj/parser.cxx79
4 files changed, 60 insertions, 59 deletions
diff --git a/idl/inc/object.hxx b/idl/inc/object.hxx
index 3967fa9e2883..12f5af2b06ac 100644
--- a/idl/inc/object.hxx
+++ b/idl/inc/object.hxx
@@ -48,9 +48,11 @@ public:
class SvMetaClass : public SvMetaType
{
+public:
+ tools::SvRef<SvMetaClass> aSuperClass;
+private:
SvRefMemberList<SvMetaAttribute *> aAttrList;
std::vector<SvClassElement> aClassElementList;
- tools::SvRef<SvMetaClass> aSuperClass;
bool TestAttribute( SvIdlDataBase & rBase, SvTokenStream & rInStm,
SvMetaAttribute & rAttr ) const;
@@ -70,15 +72,13 @@ class SvMetaClass : public SvMetaType
SvMetaClassList & rClassList,
const OString& rPrefix, SvIdlDataBase& rBase );
-protected:
- virtual void ReadContextSvIdl( SvIdlDataBase &,
- SvTokenStream & rInStm ) override;
public:
SvMetaClass();
+ virtual void ReadContextSvIdl( SvIdlDataBase &,
+ SvTokenStream & rInStm ) override;
void FillClasses( SvMetaClassList & rList );
- virtual bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm ) override;
virtual void WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ) override;
};
diff --git a/idl/inc/parser.hxx b/idl/inc/parser.hxx
index 8418d0be77da..ccd2f64ae06d 100644
--- a/idl/inc/parser.hxx
+++ b/idl/inc/parser.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_IDL_INC_PARSER_HXX
#include <rtl/ustring.hxx>
+#include <types.hxx>
class SvTokenStream;
class SvIdlDataBase;
@@ -40,6 +41,7 @@ public:
bool ReadModuleBody(SvMetaModule& rModule);
void ReadModuleElement( SvMetaModule& rModule );
void ReadInclude( SvMetaModule& rModule );
+ void ReadInterfaceOrShell( SvMetaModule& rModule, MetaTypeType aMetaTypeType );
void ReadItem();
void ReadStruct();
void ReadEnum();
diff --git a/idl/source/objects/object.cxx b/idl/source/objects/object.cxx
index c5c3589acdea..711ca195f915 100644
--- a/idl/source/objects/object.cxx
+++ b/idl/source/objects/object.cxx
@@ -99,34 +99,6 @@ void SvMetaClass::ReadContextSvIdl( SvIdlDataBase & rBase,
rInStm.Seek( nTokPos );
}
-bool SvMetaClass::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm )
-{
- sal_uLong nTokPos = rInStm.Tell();
- if( SvMetaType::ReadHeaderSvIdl( rBase, rInStm ) &&
- (GetMetaTypeType() == MetaTypeType::Interface || GetMetaTypeType() == MetaTypeType::Shell) )
- {
- bool bOk = true;
- if( rInStm.ReadIf( ':' ) )
- {
- aSuperClass = rBase.ReadKnownClass( rInStm );
- bOk = aSuperClass.Is();
- if( !bOk )
- {
- throw SvParseException( rInStm, "unknown super class" );
- }
- }
- if( bOk )
- {
- rBase.Write(OString('.'));
- bOk = SvMetaObject::ReadSvIdl( rBase, rInStm );
- }
- if( bOk )
- return bOk;
- }
- rInStm.Seek( nTokPos );
- return false;
-}
-
bool SvMetaClass::TestAttribute( SvIdlDataBase & rBase, SvTokenStream & rInStm,
SvMetaAttribute & rAttr ) const
{
diff --git a/idl/source/prj/parser.cxx b/idl/source/prj/parser.cxx
index f2bc458e4b24..cdd80dfecbff 100644
--- a/idl/source/prj/parser.cxx
+++ b/idl/source/prj/parser.cxx
@@ -118,16 +118,13 @@ bool SvIdlParser::ReadModuleBody(SvMetaModule& rModule)
void SvIdlParser::ReadModuleElement( SvMetaModule& rModule )
{
- if( rInStm.GetToken().Is( SvHash_interface() )
- || rInStm.GetToken().Is( SvHash_shell() ) )
+ if( rInStm.GetToken().Is( SvHash_interface() ) )
{
- tools::SvRef<SvMetaClass> aClass( new SvMetaClass() );
- if( aClass->ReadSvIdl( rBase, rInStm ) )
- {
- rModule.aClassList.push_back( aClass );
- // announce globally
- rBase.GetClassList().push_back( aClass );
- }
+ ReadInterfaceOrShell(rModule, MetaTypeType::Interface);
+ }
+ else if( rInStm.GetToken().Is( SvHash_shell() ) )
+ {
+ ReadInterfaceOrShell(rModule, MetaTypeType::Shell);
}
else if( rInStm.GetToken().Is( SvHash_enum() ) )
{
@@ -254,20 +251,6 @@ void SvIdlParser::ReadItem()
rBase.GetTypeList().push_back( xItem );
}
-SvMetaType * SvIdlParser::ReadKnownType()
-{
- OString aName = ReadIdentifier();
- for( const auto& aType : rBase.GetTypeList() )
- {
- if( aType->GetName().equals(aName) )
- {
- return aType;
- }
- }
- throw SvParseException( rInStm, "wrong typedef: ");
-}
-
-
void SvIdlParser::ReadEnum()
{
rInStm.GetToken_Next();
@@ -316,14 +299,52 @@ void SvIdlParser::ReadEnumValue( SvMetaTypeEnum& rEnum )
rEnum.aEnumValueList.push_back( aEnumVal );
}
+void SvIdlParser::ReadInterfaceOrShell( SvMetaModule& rModule, MetaTypeType aMetaTypeType )
+{
+ tools::SvRef<SvMetaClass> aClass( new SvMetaClass() );
+ rInStm.GetToken_Next();
-void SvIdlParser::ReadChar(char cChar)
+ aClass->SetType( aMetaTypeType );
+
+ aClass->SetName( ReadIdentifier() );
+
+ if( rInStm.ReadIf( ':' ) )
+ {
+ aClass->aSuperClass = rBase.ReadKnownClass( rInStm );
+ if( !aClass->aSuperClass.Is() )
+ throw SvParseException( rInStm, "unknown super class" );
+ }
+ if( rInStm.ReadIf( '{' ) )
+ {
+ sal_uInt32 nBeginPos = 0; // can not happen with Tell
+ while( nBeginPos != rInStm.Tell() )
+ {
+ nBeginPos = rInStm.Tell();
+ aClass->ReadContextSvIdl( rBase, rInStm );
+ rInStm.ReadIfDelimiter();
+ }
+ ReadChar( '}' );
+ }
+ rModule.aClassList.push_back( aClass );
+ // announce globally
+ rBase.GetClassList().push_back( aClass );
+}
+
+SvMetaType * SvIdlParser::ReadKnownType()
{
- if( !rInStm.ReadIf( cChar ) )
- throw SvParseException(rInStm, "expected char '" + OString(cChar) + "'");
+ OString aName = ReadIdentifier();
+ for( const auto& aType : rBase.GetTypeList() )
+ {
+ if( aType->GetName().equals(aName) )
+ {
+ return aType;
+ }
+ }
+ throw SvParseException( rInStm, "wrong typedef: ");
}
+
void SvIdlParser::ReadDelimiter()
{
if( !rInStm.ReadIfDelimiter() )
@@ -346,6 +367,12 @@ OString SvIdlParser::ReadString()
return rTok.GetString();
}
+void SvIdlParser::ReadChar(char cChar)
+{
+ if( !rInStm.ReadIf( cChar ) )
+ throw SvParseException(rInStm, "expected char '" + OString(cChar) + "'");
+}
+
void SvIdlParser::ReadToken(SvStringHashEntry* entry)
{
if( !rInStm.GetToken().Is(entry) )