summaryrefslogtreecommitdiff
path: root/idl/source/objects/types.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'idl/source/objects/types.cxx')
-rw-r--r--idl/source/objects/types.cxx506
1 files changed, 0 insertions, 506 deletions
diff --git a/idl/source/objects/types.cxx b/idl/source/objects/types.cxx
index af230a24912a..3f8ab37b28a2 100644
--- a/idl/source/objects/types.cxx
+++ b/idl/source/objects/types.cxx
@@ -204,45 +204,6 @@ void SvMetaAttribute::ReadAttributesSvIdl( SvIdlDataBase & rBase,
}
}
-void SvMetaAttribute::WriteParam( SvIdlDataBase & rBase,
- SvStream & rOutStm,
- sal_uInt16 nTab,
- WriteType nT )
-{
- SvMetaType * pType = GetType();
- DBG_ASSERT( pType, "no type for attribute" );
- SvMetaType * pBaseType = pType->GetBaseType();
- DBG_ASSERT( pBaseType, "no base type for attribute" );
-
- if( nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE )
- {
- if( pBaseType->GetType() == TYPE_STRUCT )
- {
- const SvMetaAttributeMemberList & rList = pBaseType->GetAttrList();
- sal_uLong nCount = rList.size();
- for( sal_uLong i = 0; i < nCount; i++ )
- {
- rList[i]->WriteParam( rBase, rOutStm, nTab, nT );
- if( i+1<nCount )
- {
- rOutStm.WriteChar( ',' );
- }
- }
- }
- else
- {
- WriteTab( rOutStm, nTab );
- pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT );
-
- if( !GetName().getString().isEmpty() )
- {
- rOutStm.WriteChar( ' ' );
- rOutStm.WriteCharPtr( GetName().getString().getStr() );
- }
- }
- }
-}
-
sal_uLong SvMetaAttribute::MakeSlotValue( SvIdlDataBase & rBase, bool bVar ) const
{
const SvNumberIdentifier & rId = GetSlotId();
@@ -261,195 +222,6 @@ sal_uLong SvMetaAttribute::MakeSlotValue( SvIdlDataBase & rBase, bool bVar ) con
return n;
}
-void SvMetaAttribute::WriteAttributes( SvIdlDataBase &, SvStream &,
- sal_uInt16,
- WriteType, WriteAttribute )
-{
-}
-
-void SvMetaAttribute::WriteCSource( SvIdlDataBase & rBase, SvStream & rOutStm,
- bool bSet )
-{
- rOutStm << endl;
- SvMetaType * pType = GetType();
- SvMetaType * pBaseType = pType->GetBaseType();
-
- // for Set the return is always void
- bool bVoid = bSet;
- if( pBaseType->GetType() == TYPE_METHOD )
- bVoid = pBaseType->GetReturnType()->GetBaseType()->GetName().getString() == "void";
-
- // emit methods/functions body
- rOutStm.WriteChar( '{' ) << endl;
- WriteTab( rOutStm, 1 );
-
- if( !bVoid )
- {
- if ( pBaseType->GetCName() == "double" )
- {
- rOutStm.WriteCharPtr( "return *(double*)" );
- }
- else
- {
- rOutStm.WriteCharPtr( "return (" );
- pType->WriteTypePrefix( rBase, rOutStm, 2, WRITE_C_SOURCE );
- rOutStm.WriteCharPtr( ") " );
- }
- }
- rOutStm.WriteCharPtr( "pODKCallFunction( " )
- .WriteCharPtr( OString::number(MakeSlotValue(rBase, IsVariable())).getStr() );
- rOutStm.WriteChar( ',' ) << endl;
- WriteTab( rOutStm, 3 );
- rOutStm.WriteCharPtr( " h" ).WriteCharPtr( rBase.aIFaceName.getStr() ).WriteCharPtr( " , " );
-
- OString aParserStr;
- if( pBaseType->GetType() == TYPE_METHOD || bSet )
- aParserStr = pBaseType->GetParserString();
- if( !aParserStr.isEmpty() )
- {
- rOutStm.WriteChar( '\"' );
- rOutStm.WriteCharPtr( aParserStr.getStr() );
- rOutStm.WriteCharPtr( "\", " );
- }
- else
- rOutStm.WriteCharPtr( "NULL, " );
-
- if( pBaseType->GetType() == TYPE_METHOD && !bVoid )
- {
- rOutStm.WriteCharPtr( "'" );
- rOutStm.WriteChar( pBaseType->GetReturnType()->GetBaseType()->GetParserChar() );
- rOutStm.WriteCharPtr( "'" );
- }
- else if ( !bSet )
- {
- rOutStm.WriteCharPtr( "'" );
- rOutStm.WriteChar( pBaseType->GetParserChar() );
- rOutStm.WriteCharPtr( "'" );
- }
- else
- rOutStm.WriteChar( '0' );
-
- if( !aParserStr.isEmpty() )
- {
- rOutStm.WriteCharPtr( ", " );
- if( IsMethod() )
- pBaseType->WriteParamNames( rBase, rOutStm, OString() );
- else if( bSet )
- pBaseType->WriteParamNames( rBase, rOutStm, GetName().getString() );
- }
-
- rOutStm.WriteCharPtr( " );" ) << endl;
- rOutStm.WriteChar( '}' ) << endl;
-}
-
-void SvMetaAttribute::WriteRecursiv_Impl( SvIdlDataBase & rBase,
- SvStream & rOutStm, sal_uInt16 nTab,
- WriteType nT, WriteAttribute nA )
-{
- const SvMetaAttributeMemberList & rList = GetType()->GetBaseType()->GetAttrList();
- sal_uLong nCount = rList.size();
-
- SvNumberIdentifier slotId = rBase.aStructSlotId;
- if ( !GetSlotId().getString().isEmpty() )
- rBase.aStructSlotId = GetSlotId();
-
- // offial hack interface by MM: special controls get passed with the WriteAttribute
- if ( GetReadonly() )
- nA |= WA_READONLY;
-
- for( sal_uLong i = 0; i < nCount; i++ )
- {
- SvMetaAttribute *pAttr = rList[i];
- pAttr->Write( rBase, rOutStm, nTab, nT, nA );
- }
-
- rBase.aStructSlotId = slotId;
-}
-
-void SvMetaAttribute::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
- sal_uInt16 nTab,
- WriteType nT, WriteAttribute nA )
-{
- // no attributes for automation
- if ( !GetAutomation() || !GetExport() )
- return;
-
- bool bVariable;
- if( nA & WA_VARIABLE )
- bVariable = true;
- else if( nA & WA_METHOD )
- bVariable = false;
- else
- bVariable = IsVariable();
-
- SvMetaType * pType = GetType();
- DBG_ASSERT( pType, "no type for attribute" );
- SvMetaType * pBaseType = pType->GetBaseType();
- DBG_ASSERT( pBaseType, "no base type for attribute" );
- int nBType = pBaseType->GetType();
-
- if( nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE )
- {
- if( !bVariable && IsMethod() )
- {
- OString name = rBase.aIFaceName + GetName().getString();
- const char * pName = name.getStr();
- WriteTab( rOutStm, nTab );
- pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT );
- rOutStm.WriteChar( ' ' ).WriteCharPtr( pName );
- pType->WriteMethodArgs( rBase, rOutStm, nTab, nT );
- if( nT == WRITE_C_HEADER )
- rOutStm.WriteChar( ';' ) << endl << endl;
- else
- WriteCSource( rBase, rOutStm, false );
- }
- else if ( bVariable && IsVariable() )
- {
- if( nBType == TYPE_STRUCT )
- {
- // for assistance emit the name of the property as acomment
- rOutStm.WriteCharPtr( "/* " ).WriteCharPtr( GetName().getString().getStr() ).WriteCharPtr( " */" ) << endl;
-
- WriteRecursiv_Impl( rBase, rOutStm, nTab, nT, nA );
- }
- else
- {
- OString name = GetName().getString();
-
- bool bReadonly = GetReadonly() || ( nA & WA_READONLY );
- if ( !bReadonly && !IsMethod() )
- {
- // allocation
- WriteTab( rOutStm, nTab );
- rOutStm.WriteCharPtr( "void " );
- rOutStm.WriteCharPtr( rBase.aIFaceName.getStr() )
- .WriteCharPtr( "Set" ).WriteCharPtr( name.getStr() ).WriteCharPtr( "( " ).WriteCharPtr( C_PREF )
- .WriteCharPtr( "Object h" ).WriteCharPtr( rBase.aIFaceName.getStr() ).WriteCharPtr( ", " ) << endl;
- WriteTab( rOutStm, nTab+1 );
- pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT );
- rOutStm.WriteChar( ' ' ).WriteCharPtr( name.getStr() ).WriteCharPtr( " )" );
- if( nT == WRITE_C_HEADER )
- rOutStm.WriteChar( ';' ) << endl << endl;
- else
- WriteCSource( rBase, rOutStm, true );
- }
-
- // access
- WriteTab( rOutStm, nTab );
- pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT );
- rOutStm.WriteChar( ' ' );
- rOutStm.WriteCharPtr( rBase.aIFaceName.getStr() )
- .WriteCharPtr( "Get" ).WriteCharPtr( name.getStr() ).WriteCharPtr( "( " ).WriteCharPtr( C_PREF )
- .WriteCharPtr( "Object h" ).WriteCharPtr( rBase.aIFaceName.getStr() ).WriteCharPtr( " )" );
- if( nT == WRITE_C_HEADER )
- rOutStm.WriteChar( ';' ) << endl << endl;
- else
- WriteCSource( rBase, rOutStm, false );
- }
- }
- }
-}
-
sal_uLong SvMetaAttribute::MakeSfx( OStringBuffer& rAttrArray )
{
SvMetaType * pType = GetType();
@@ -776,103 +548,6 @@ bool SvMetaType::ReadSvIdl( SvIdlDataBase & rBase,
return false;
}
-void SvMetaType::WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm,
- sal_uInt16 nTab,
- WriteType nT, WriteAttribute nA )
-{
- if( GetAttrCount() )
- {
- SvMetaAttributeMemberList::const_iterator it = pAttrList->begin();
- while( it != pAttrList->end() )
- {
- SvMetaAttribute * pAttr = *it;
- pAttr->Write( rBase, rOutStm, nTab, nT, nA );
- if( GetType() == TYPE_METHOD )
- rOutStm.WriteChar( ',' ) << endl;
- else
- rOutStm.WriteChar( ';' ) << endl;
- ++it;
- }
- }
-}
-
-void SvMetaType::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
- sal_uInt16 nTab,
- WriteType nT, WriteAttribute nA )
-{
- if( nT == WRITE_C_HEADER && nType != TYPE_ENUM )
- // write only enum
- return;
-
- OString name = GetName().getString();
- if( nT == WRITE_C_HEADER )
- {
- switch( nType )
- {
- case TYPE_CLASS:
- {
- }
- break;
- case TYPE_STRUCT:
- case TYPE_UNION:
- case TYPE_ENUM:
- {
- WriteStars( rOutStm );
- if( nType == TYPE_STRUCT || nType == TYPE_UNION )
- nA = WA_STRUCT;
-
- if( nT == WRITE_C_HEADER)
- {
- if ( nT == WRITE_C_HEADER )
- {
- OString aStr = name.toAsciiUpperCase();
- rOutStm.WriteCharPtr( "#ifndef " ).WriteCharPtr( C_PREF ).WriteCharPtr( aStr.getStr() ).WriteCharPtr( "_DEF " ) << endl;
- rOutStm.WriteCharPtr( "#define " ).WriteCharPtr( C_PREF ).WriteCharPtr( aStr.getStr() ).WriteCharPtr( "_DEF " ) << endl;
- }
-
- WriteTab( rOutStm, nTab );
- rOutStm.WriteCharPtr( "typedef" ) << endl;
- }
- WriteTab( rOutStm, nTab );
- if( nType == TYPE_STRUCT )
- rOutStm.WriteCharPtr( "struct" );
- else if( nType == TYPE_UNION )
- rOutStm.WriteCharPtr( "union" );
- else
- rOutStm.WriteCharPtr( "enum" );
- if( nT != WRITE_C_HEADER)
- rOutStm.WriteChar( ' ' ).WriteCharPtr( name.getStr() );
-
- rOutStm << endl;
- WriteTab( rOutStm, nTab );
- rOutStm.WriteChar( '{' ) << endl;
- WriteContext( rBase, rOutStm, nTab +1, nT, nA );
- WriteTab( rOutStm, nTab );
- rOutStm.WriteChar( '}' );
- if( nT == WRITE_C_HEADER )
- {
- rOutStm.WriteChar( ' ' ).WriteCharPtr( C_PREF ).WriteCharPtr( name.getStr() );
- }
- rOutStm.WriteChar( ';' ) << endl;
-
- if ( nT == WRITE_C_HEADER )
- rOutStm.WriteCharPtr( "#endif" );
- rOutStm << endl;
- }
- break;
- case TYPE_POINTER:
- case TYPE_BASE:
- {
- }
- break;
- case TYPE_METHOD:
- {
- }
- break;
- }
- }
-}
-
bool SvMetaType::ReadNamesSvIdl( SvIdlDataBase & rBase,
SvTokenStream & rInStm )
{
@@ -901,13 +576,6 @@ void SvMetaType::ReadContextSvIdl( SvIdlDataBase & rBase,
}
}
-void SvMetaType::WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm,
- sal_uInt16 nTab,
- WriteType nT, WriteAttribute nA )
-{
- SvMetaExtern::WriteAttributes( rBase, rOutStm, nTab, nT, nA );
-}
-
sal_uLong SvMetaType::MakeSfx( OStringBuffer& rAttrArray )
{
sal_uLong nC = 0;
@@ -1013,110 +681,6 @@ bool SvMetaType::ReadMethodArgs( SvIdlDataBase & rBase,
return false;
}
-void SvMetaType::WriteMethodArgs
-(
- SvIdlDataBase & rBase,
- SvStream & rOutStm,
- sal_uInt16 nTab, WriteType nT
-)
-{
- rOutStm.WriteChar( '(' );
- if( nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE )
- {
- rOutStm.WriteChar( ' ' ).WriteCharPtr( C_PREF ).WriteCharPtr( "Object h" ).WriteCharPtr( rBase.aIFaceName.getStr() );
- if( GetAttrCount() )
- rOutStm.WriteChar( ',' );
- else
- rOutStm.WriteChar( ' ' );
- }
-
- if( GetAttrCount() )
- {
- rOutStm << endl;
- SvMetaAttributeMemberList::const_iterator it = pAttrList->begin();
- while( it != pAttrList->end() )
- {
- SvMetaAttribute* pAttr = *it;
- switch( nT )
- {
- case WRITE_C_HEADER:
- case WRITE_C_SOURCE:
- {
- pAttr->WriteParam( rBase, rOutStm, nTab +1, nT );
- }
- break;
-
- default:
- {
- DBG_ASSERT( false, "WriteType not implemented" );
- }
- }
- ++it;
- if( it != pAttrList->end() )
- rOutStm.WriteChar( ',' ) << endl;
- }
- if( nT != WRITE_C_HEADER && nT != WRITE_C_SOURCE )
- {
- rOutStm << endl;
- WriteTab( rOutStm, nTab +1 );
- }
- rOutStm.WriteChar( ' ' );
- }
- rOutStm.WriteChar( ')' );
-}
-
-void SvMetaType::WriteTypePrefix( SvIdlDataBase & rBase, SvStream & rOutStm,
- sal_uInt16 nTab, WriteType nT )
-{
- switch( nT )
- {
- case WRITE_C_HEADER:
- case WRITE_C_SOURCE:
- {
-
- SvMetaType * pBaseType = GetBaseType();
- DBG_ASSERT( pBaseType, "no base type for attribute" );
-
- if( pBaseType->GetType() == TYPE_METHOD )
- pBaseType->GetReturnType()->WriteTypePrefix(
- rBase, rOutStm, nTab, nT );
- else if( nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE )
- {
- if( TYPE_STRUCT == pBaseType->GetType() )
- rOutStm.WriteCharPtr( C_PREF ).WriteCharPtr( pBaseType->GetName().getString().getStr() )
- .WriteCharPtr( " *" );
- else
- {
- if ( pBaseType->GetType() == TYPE_ENUM )
- rOutStm.WriteCharPtr( C_PREF );
- rOutStm.WriteCharPtr( pBaseType->GetCName().getStr() );
- }
- }
- else
- {
- if( TYPE_STRUCT == pBaseType->GetType() )
- rOutStm.WriteCharPtr( pBaseType->GetName().getString().getStr() ).WriteCharPtr( " *" );
- else
- rOutStm.WriteCharPtr( pBaseType->GetName().getString().getStr() );
- }
- }
- break;
-
- default:
- {
- DBG_ASSERT( false, "WriteType not implemented" );
- }
- }
-}
-
-void SvMetaType::WriteTheType( SvIdlDataBase & rBase, SvStream & rOutStm,
- sal_uInt16 nTab, WriteType nT )
-{
- WriteTypePrefix( rBase, rOutStm, nTab, nT );
- if( GetType() == TYPE_METHOD )
- WriteMethodArgs( rBase, rOutStm, nTab +2, nT );
-}
-
OString SvMetaType::GetParserString() const
{
SvMetaType * pBT = GetBaseType();
@@ -1141,35 +705,6 @@ OString SvMetaType::GetParserString() const
return aPStr;
}
-void SvMetaType::WriteParamNames( SvIdlDataBase & rBase,
- SvStream & rOutStm,
- const OString& rChief )
-{
- SvMetaType * pBT = GetBaseType();
- if( pBT != this )
- pBT->WriteParamNames( rBase, rOutStm, rChief );
- else
- {
- int type = GetType();
-
- if( TYPE_METHOD == type || TYPE_STRUCT == type )
- {
- sal_uLong nAttrCount = GetAttrCount();
- // write the single attributes
- for( sal_uLong n = 0; n < nAttrCount; n++ )
- {
- SvMetaAttribute * pA = (*pAttrList)[n];
- OString aStr = pA->GetName().getString();
- pA->GetType()->WriteParamNames( rBase, rOutStm, aStr );
- if( n +1 < nAttrCount )
- rOutStm.WriteCharPtr( ", " );
- }
- }
- else
- rOutStm.WriteCharPtr( rChief.getStr() );
- }
-}
-
TYPEINIT1( SvMetaTypeString, SvMetaType );
SvMetaTypeString::SvMetaTypeString()
: SvMetaType( "String", "SbxSTRING", "BSTR", 's', "char *", "String", "$" )
@@ -1189,15 +724,6 @@ bool SvMetaEnumValue::ReadSvIdl( SvIdlDataBase & rBase,
return true;
}
-void SvMetaEnumValue::Write( SvIdlDataBase &, SvStream & rOutStm, sal_uInt16,
- WriteType nT, WriteAttribute )
-{
- if ( nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE )
- rOutStm.WriteCharPtr( C_PREF ).WriteCharPtr( GetName().getString().getStr() );
- else
- rOutStm.WriteCharPtr( GetName().getString().getStr() );
-}
-
TYPEINIT1( SvMetaTypeEnum, SvMetaType );
SvMetaTypeEnum::SvMetaTypeEnum()
{
@@ -1258,38 +784,6 @@ bool SvMetaTypeEnum::ReadSvIdl( SvIdlDataBase & rBase,
return false;
}
-void SvMetaTypeEnum::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
- sal_uInt16 nTab,
- WriteType nT, WriteAttribute nA )
-{
- SvMetaType::Write( rBase, rOutStm, nTab, nT, nA );
-}
-
-void SvMetaTypeEnum::WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm,
- sal_uInt16 nTab,
- WriteType nT, WriteAttribute nA )
-{
- WriteTab( rOutStm, nTab +1 );
- for( sal_uLong n = 0; n < aEnumValueList.size(); n++ )
- {
- aEnumValueList[n]->Write( rBase, rOutStm, nTab +1, nT, nA );
-
- if( n + 1 != aEnumValueList.size() )
- {
- if( 2 == n % 3 )
- {
- rOutStm.WriteChar( ',' ) << endl;
- WriteTab( rOutStm, nTab +1 );
- }
- else
- rOutStm.WriteCharPtr( ",\t" );
- }
- else
- rOutStm << endl;
- }
- rOutStm << endl;
-}
-
TYPEINIT1( SvMetaTypevoid, SvMetaType );
SvMetaTypevoid::SvMetaTypevoid()
: SvMetaType( "void", "SbxVOID", "void", 'v', "void", "", "" )