1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: database.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_idl.hxx"
37 #include <tools/fsys.hxx>
38 #include <tools/debug.hxx>
39 #include <database.hxx>
40 #include <globals.hxx>
42 /****************** SvIdlDataBase ****************************************/
43 /*************************************************************************
44 |* SvIdlDataBase::SvIdlDataBase()
47 *************************************************************************/
51 for( i = 5001; i < 5500; i += 2 ){
52 for( n = 2; n < i && ((i % n) != 0); n++ );
54 printf( "\nPrimzahl: %d\n", i );
61 SvIdlDataBase::SvIdlDataBase()
64 , bIsModified( FALSE
)
65 , aPersStream( *IDLAPP
->pClassMgr
, NULL
)
71 /*************************************************************************
72 |* SvIdlDataBase::~SvIdlDataBase()
75 *************************************************************************/
76 SvIdlDataBase::~SvIdlDataBase()
78 String
* pStr
= aIdFileList
.First();
82 pStr
= aIdFileList
.Next();
87 /*************************************************************************
88 |* SvIdlDataBase::GetTypeList()
91 *************************************************************************/
92 #define ADD_TYPE( Name, OdlName, ParserChar, CName, BasName, BasPost ) \
93 aTypeList.Append( new SvMetaType( SvHash_##Name()->GetName(), \
94 BasName, OdlName, ParserChar, CName, BasName, BasPost ) );
96 SvMetaTypeMemberList
& SvIdlDataBase::GetTypeList()
98 if( aTypeList
.Count() == 0 )
100 aTypeList
.Append( new SvMetaTypeString() );
101 aTypeList
.Append( new SvMetaTypevoid() );
103 // MI: IDispatch::Invoke kann keine unsigned
104 ADD_TYPE( UINT16
, "long", 'h', "unsigned short", "Long", "&" );
105 ADD_TYPE( INT16
, "short", 'h', "short", "Integer", "%" );
106 ADD_TYPE( UINT32
, "long", 'l', "unsigned long", "Long", "&" );
107 ADD_TYPE( INT32
, "long", 'l', "long", "Long", "&" );
108 ADD_TYPE( int, "int", 'i', "int", "Integer", "%" );
109 ADD_TYPE( BOOL
, "boolean", 'b', "unsigned char", "Boolean", "" );
110 ADD_TYPE( char, "char", 'c', "char", "Integer", "%" );
111 ADD_TYPE( BYTE
, "char", 'c', "unsigned char", "Integer", "%" );
112 ADD_TYPE( float, "float", 'f', "float", "Single", "!" );
113 ADD_TYPE( double, "double", 'F', "double", "Double", "#" );
114 ADD_TYPE( SbxObject
, "VARIANT", 'o', "C_Object", "Object", "" );
116 // A c h t u n g !!!, bei hinzufuegen von Typen werden alle
117 // bin„ren Datenbasen inkompatibel
120 // So tun als ob die Init-Daten auf einem Stream gelesen wurden
122 aPersStream.SetStream( &aStm );
123 // Alle Init-Daten Streamen
124 aPersStream << aTypeList;
125 // Nur die Id-Zuordnung merken
126 aPersStream.SetStream( NULL );
132 /*************************************************************************
134 |* SvIdlDataBase::GetModuleInfo()
137 |* Ersterstellung MM 13.12.94
138 |* Letzte Aenderung MM 13.12.94
140 *************************************************************************/
141 SvMetaModule
* SvIdlDataBase::GetModule( const ByteString
& rName
)
143 for( ULONG n
= 0; n
< aModuleList
.Count(); n
++ )
144 if( aModuleList
.GetObject( n
)->GetName() == rName
)
145 return aModuleList
.GetObject( n
);
149 /*************************************************************************
151 |* SvIdlDataBase::IsBinaryFormat()
155 *************************************************************************/
156 #define DATABASE_SIGNATURE (UINT32)0x13B799F2
157 #define DATABASE_VER 0x0006
158 BOOL
SvIdlDataBase::IsBinaryFormat( SvStream
& rStm
)
161 ULONG nPos
= rStm
.Tell();
165 return nSig
== DATABASE_SIGNATURE
;
168 /*************************************************************************
170 |* SvIdlDataBase::Load()
174 *************************************************************************/
175 void SvIdlDataBase::Load( SvStream
& rStm
)
177 DBG_ASSERT( aTypeList
.Count() == 0, "type list already initialized" );
178 SvPersistStream
aPStm( *IDLAPP
->pClassMgr
, &rStm
);
185 if( nSig
!= DATABASE_SIGNATURE
)
187 aPStm
.SetError( SVSTREAM_FILEFORMAT_ERROR
);
190 if( nVersion
!= DATABASE_VER
)
192 aPStm
.SetError( SVSTREAM_WRONGVERSION
);
198 aPStm
>> aModuleList
;
202 aPStm
.SetError( SVSTREAM_GENERALERROR
);
205 /*************************************************************************
206 |* SvIdlDataBase::Save()
209 *************************************************************************/
210 void SvIdlDataBase::Save( SvStream
& rStm
, UINT32 nFlags
)
212 SvPersistStream
aPStm( *IDLAPP
->pClassMgr
, &rStm
);
213 aPStm
.SetContextFlags( nFlags
);
215 aPStm
<< (UINT32
)DATABASE_SIGNATURE
;
216 aPStm
<< (USHORT
)DATABASE_VER
;
218 BOOL bOnlyStreamedObjs
= FALSE
;
219 if( nFlags
& IDL_WRITE_CALLING
)
220 bOnlyStreamedObjs
= TRUE
;
222 if( bOnlyStreamedObjs
)
224 SvMetaClassMemberList aList
;
225 for( ULONG n
= 0; n
< GetModuleList().Count(); n
++ )
227 SvMetaModule
* pModule
= GetModuleList().GetObject( n
);
228 if( !pModule
->IsImported() )
229 aList
.Append( pModule
->GetClassList() );
236 //aClassList.WriteObjects( aPStm, bOnlyStreamedObjs );
237 aTypeList
.WriteObjects( aPStm
, bOnlyStreamedObjs
);
238 aAttrList
.WriteObjects( aPStm
, bOnlyStreamedObjs
);
239 aModuleList
.WriteObjects( aPStm
, bOnlyStreamedObjs
);
243 /*************************************************************************
244 |* SvIdlDataBase::SetError()
247 *************************************************************************/
248 void SvIdlDataBase::SetError( const ByteString
& rError
, SvToken
* pTok
)
250 if( pTok
->GetLine() > 10000 )
251 aError
.SetText( "hgchcg" );
253 if( aError
.nLine
< pTok
->GetLine()
254 || (aError
.nLine
== pTok
->GetLine() && aError
.nColumn
< pTok
->GetColumn()) )
256 aError
= SvIdlError( pTok
->GetLine(), pTok
->GetColumn() );
257 aError
.SetText( rError
);
261 /*************************************************************************
262 |* SvIdlDataBase::Push()
265 *************************************************************************/
266 void SvIdlDataBase::Push( SvMetaObject
* pObj
)
268 GetStack().Push( pObj
);
272 /*************************************************************************
274 |* SvIdlDataBase::FindId()
278 *************************************************************************/
279 BOOL
SvIdlDataBase::FindId( const ByteString
& rIdName
, ULONG
* pVal
)
284 if( pIdTable
->Test( rIdName
, &nHash
) )
286 *pVal
= pIdTable
->Get( nHash
)->GetValue();
293 /*************************************************************************
295 |* SvIdlDataBase::InsertId()
299 *************************************************************************/
300 BOOL
SvIdlDataBase::InsertId( const ByteString
& rIdName
, ULONG nVal
)
303 pIdTable
= new SvStringHashTable( 20003 );
306 if( pIdTable
->Insert( rIdName
, &nHash
) )
308 pIdTable
->Get( nHash
)->SetValue( nVal
);
314 /*************************************************************************
315 |* SvIdlDataBase::ReadIdFile()
318 *************************************************************************/
319 BOOL
SvIdlDataBase::ReadIdFile( const String
& rFileName
)
321 DirEntry
aFullName( rFileName
);
322 aFullName
.Find( GetPath() );
324 String
* pIdFile
= aIdFileList
.First();
327 if( *pIdFile
== rFileName
)
328 return TRUE
; // schon eingelesen
329 pIdFile
= aIdFileList
.Next();
332 aIdFileList
.Insert( new String( rFileName
), LIST_APPEND
);
334 SvTokenStream
aTokStm( aFullName
.GetFull() );
335 if( aTokStm
.GetStream().GetError() == SVSTREAM_OK
)
337 SvToken
* pTok
= aTokStm
.GetToken_Next();
339 while( !pTok
->IsEof() )
341 if( pTok
->IsChar() && pTok
->GetChar() == '#' )
343 pTok
= aTokStm
.GetToken_Next();
344 if( pTok
->Is( SvHash_define() ) )
346 pTok
= aTokStm
.GetToken_Next();
348 if( pTok
->IsIdentifier() )
349 aDefName
= pTok
->GetString();
352 ByteString
aStr( "unexpected token after define" );
354 SetError( aStr
, pTok
);
355 WriteError( aTokStm
);
363 pTok
= aTokStm
.GetToken_Next();
364 if( pTok
->IsIdentifier() )
367 if( FindId( pTok
->GetString(), &n
) )
372 else if( pTok
->IsChar() )
374 if( pTok
->GetChar() == '-'
375 || pTok
->GetChar() == '/'
376 || pTok
->GetChar() == '*'
377 || pTok
->GetChar() == '&'
378 || pTok
->GetChar() == '|'
379 || pTok
->GetChar() == '^'
380 || pTok
->GetChar() == '~' )
382 ByteString
aStr( "unknown operator '" );
383 aStr
+= pTok
->GetChar();
384 aStr
+= "'in define";
386 SetError( aStr
, pTok
);
387 WriteError( aTokStm
);
390 if( pTok
->GetChar() != '+'
391 && pTok
->GetChar() != '('
392 && pTok
->GetChar() != ')' )
393 // nur + erlaubt, Klammern spielen kein Rolle,
394 // da + komutativ ist
397 else if( pTok
->IsInteger() )
399 nVal
+= pTok
->GetNumber();
406 if( !InsertId( aDefName
, nVal
) )
408 ByteString aStr
= "hash table overflow: ";
409 SetError( aStr
, pTok
);
410 WriteError( aTokStm
);
415 else if( pTok
->Is( SvHash_include() ) )
417 pTok
= aTokStm
.GetToken_Next();
419 if( pTok
->IsString() )
420 aName
= pTok
->GetString();
421 else if( pTok
->IsChar() && pTok
->GetChar() == '<' )
423 pTok
= aTokStm
.GetToken_Next();
424 while( !pTok
->IsEof()
425 && !(pTok
->IsChar() && pTok
->GetChar() == '>') )
427 aName
+= pTok
->GetTokenAsString();
428 pTok
= aTokStm
.GetToken_Next();
432 ByteString
aStr( "unexpected eof in #include" );
434 SetError( aStr
, pTok
);
435 WriteError( aTokStm
);
439 if( !ReadIdFile( String::CreateFromAscii(aName
.GetBuffer()) ) )
441 ByteString aStr
= "cannot read file: ";
443 SetError( aStr
, pTok
);
444 WriteError( aTokStm
);
450 pTok
= aTokStm
.GetToken_Next();
458 /*************************************************************************
459 |* SvIdlDataBase::FindType()
462 *************************************************************************/
463 SvMetaType
* SvIdlDataBase::FindType( const SvMetaType
* pPType
,
464 SvMetaTypeMemberList
& rList
)
466 SvMetaType
* pType
= rList
.First();
467 while( pType
&& pPType
!= pType
)
468 pType
= rList
.Next();
472 SvMetaType
* SvIdlDataBase::FindType( const ByteString
& rName
)
474 SvMetaType
* pType
= aTypeList
.First();
475 while( pType
&& rName
!= pType
->GetName() )
476 pType
= aTypeList
.Next();
480 /*************************************************************************
481 |* SvIdlDataBase::ReadKnownType()
484 *************************************************************************/
485 SvMetaType
* SvIdlDataBase::ReadKnownType( SvTokenStream
& rInStm
)
489 int nCall0
= CALL_VALUE
;
490 int nCall1
= CALL_VALUE
;
491 BOOL bSet
= FALSE
; //irgent ein Attribut gesetzt
493 UINT32 nTokPos
= rInStm
.Tell();
494 SvToken
* pTok
= rInStm
.GetToken_Next();
496 if( pTok
->HasHash() )
498 UINT32 nBeginPos
= 0; // kann mit Tell nicht vorkommen
499 while( nBeginPos
!= rInStm
.Tell() )
501 nBeginPos
= rInStm
.Tell();
502 if( pTok
->Is( SvHash_in() ) )
505 pTok
= rInStm
.GetToken_Next();
508 if( pTok
->Is( SvHash_out() ) )
511 pTok
= rInStm
.GetToken_Next();
514 if( pTok
->Is( SvHash_inout() ) )
518 pTok
= rInStm
.GetToken_Next();
524 SvMetaTypeList aTmpTypeList;
525 if( FillTypeList( aTmpTypeList, pTok ) )
527 if( pTok
->IsIdentifier() )
529 ByteString aName
= pTok
->GetString();
530 SvMetaTypeMemberList
& rList
= GetTypeList();
531 SvMetaType
* pType
= rList
.First();
534 if( pType
->GetName() == aName
)
536 pType
= rList
.Next();
540 pTok
= rInStm
.GetToken();
543 if( pTok
->GetChar() == '&' || pTok
->GetChar() == '*' )
545 nCall0
= (pTok
->GetChar() == '&') ? CALL_REFERENCE
:
547 rInStm
.GetToken_Next();
548 pTok
= rInStm
.GetToken();
549 if( pTok
->GetChar() == '&' || pTok
->GetChar() == '*' )
551 nCall1
= (pTok
->GetChar() == '&') ? CALL_REFERENCE
:
553 rInStm
.GetToken_Next();
559 SvMetaType * pMetaType = aTmpTypeList.First();
562 if( pMetaType->GetIn() == bIn
563 && pMetaType->GetOut() == bOut
564 && pMetaType->GetCall0() == nCall0
565 && pMetaType->GetCall1() == nCall1 )
569 pMetaType = aTmpTypeList.Next();
572 //SvMetaType * pType = aTmpTypeList.First();
574 // Ist genau dieser Typ
577 DBG_ASSERT( aTmpTypeList
.First(), "mindestens ein Element" );
578 SvMetaTypeRef xType
= new SvMetaType( pType
->GetName(), 'h', "dummy" );
579 xType
->SetRef( pType
);
581 xType
->SetOut( bOut
);
582 xType
->SetCall0( nCall0
);
583 xType
->SetCall1( nCall1
);
585 aTmpTypeList
.Append( xType
);
589 rInStm
.Seek( nTokPos
);
593 /*************************************************************************
595 |* SvIdlDataBase::ReadKnownAttr()
599 *************************************************************************/
600 SvMetaAttribute
* SvIdlDataBase::ReadKnownAttr
602 SvTokenStream
& rInStm
,
603 SvMetaType
* pType
/* Wenn der pType == NULL, dann muss der Typ
604 noch gelesen werden. */
607 UINT32 nTokPos
= rInStm
.Tell();
610 pType
= ReadKnownType( rInStm
);
614 // Wenn wir Slots auf die Wiese stellen, d"urfen wir nicht voraussetzen,
615 // da\s jeder Slot einen anderen Namen hat!
617 SvToken * pTok = rInStm.GetToken_Next();
618 if( pTok->IsIdentifier() )
619 for( ULONG n = 0; n < aAttrList.Count(); n++ )
621 SvMetaAttribute * pAttr = aAttrList.GetObject( n );
622 if( pAttr->GetName() == pTok->GetString() )
630 SvToken
* pTok
= rInStm
.GetToken_Next();
631 if( pTok
->IsIdentifier() )
634 if( FindId( pTok
->GetString(), &n
) )
636 for( ULONG i
= 0; i
< aAttrList
.Count(); i
++ )
638 SvMetaAttribute
* pAttr
= aAttrList
.GetObject( i
);
639 if( pAttr
->GetSlotId() == pTok
->GetString() )
644 ByteString
aStr( "Nicht gefunden : " );
645 aStr
+= pTok
->GetString();
646 DBG_ERROR( aStr
.GetBuffer() );
650 rInStm
.Seek( nTokPos
);
654 SvMetaAttribute
* SvIdlDataBase::SearchKnownAttr
656 const SvNumberIdentifier
& rId
660 if( FindId( rId
, &n
) )
662 for( ULONG i
= 0; i
< aAttrList
.Count(); i
++ )
664 SvMetaAttribute
* pAttr
= aAttrList
.GetObject( i
);
665 if( pAttr
->GetSlotId() == rId
)
673 /*************************************************************************
674 |* SvIdlDataBase::ReadKnownClass()
677 *************************************************************************/
678 SvMetaClass
* SvIdlDataBase::ReadKnownClass( SvTokenStream
& rInStm
)
680 UINT32 nTokPos
= rInStm
.Tell();
681 SvToken
* pTok
= rInStm
.GetToken_Next();
683 if( pTok
->IsIdentifier() )
684 for( ULONG n
= 0; n
< aClassList
.Count(); n
++ )
686 SvMetaClass
* pClass
= aClassList
.GetObject( n
);
687 if( pClass
->GetName() == pTok
->GetString() )
691 rInStm
.Seek( nTokPos
);
695 /*************************************************************************
696 |* SvIdlDataBase::Write()
699 *************************************************************************/
700 void SvIdlDataBase::Write( const ByteString
& rText
)
703 fprintf( stdout
, "%s", rText
.GetBuffer() );
707 /*************************************************************************
708 |* SvIdlDataBase::WriteError()
711 *************************************************************************/
712 void SvIdlDataBase::WriteError( const ByteString
& rErrWrn
,
713 const ByteString
& rFileName
,
714 const ByteString
& rErrorText
,
715 ULONG nRow
, ULONG nColumn
) const
719 fprintf( stderr
, "\n%s --- %s: ( %ld, %ld )\n",
720 rFileName
.GetBuffer(), rErrWrn
.GetBuffer(), nRow
, nColumn
);
722 if( rErrorText
.Len() )
724 fprintf( stderr
, "\t%s\n", rErrorText
.GetBuffer() );
729 /*************************************************************************
730 |* SvIdlDataBase::WriteError()
733 *************************************************************************/
734 void SvIdlDataBase::WriteError( SvTokenStream
& rInStm
)
738 String
aFileName( rInStm
.GetFileName() );
739 ByteString aErrorText
;
740 ULONG nRow
= 0, nColumn
= 0;
743 SvToken
*pTok
= rInStm
.GetToken();
746 nRow
= pTok
->GetLine();
747 nColumn
= pTok
->GetColumn();
749 if( aError
.IsError() )
751 // Fehler Token suchen
753 if( aError
.GetText().Len() )
755 aErrorText
= "may be <";
756 aErrorText
+= aError
.GetText();
758 SvToken
* pPrevTok
= NULL
;
759 while( pTok
!= pPrevTok
)
762 if( pTok
->GetLine() == aError
.nLine
763 && pTok
->GetColumn() == aError
.nColumn
)
765 pTok
= rInStm
.GetToken_PrevAll();
769 aErrorText
+= "> at ( ";
770 aErrorText
+= ByteString::CreateFromInt64(aError
.nLine
);
772 aErrorText
+= ByteString::CreateFromInt64(aError
.nColumn
);
775 // Fehler zuruecksetzen
776 aError
= SvIdlError();
779 WriteError( "error", ByteString( aFileName
, RTL_TEXTENCODING_UTF8
), aErrorText
, nRow
, nColumn
);
781 DBG_ASSERT( pTok
, "token must be found" );
785 // Identifier in der Naehe suchen
786 if( !pTok
->IsIdentifier() )
788 rInStm
.GetToken_PrevAll();
789 pTok
= rInStm
.GetToken();
791 if( pTok
&& pTok
->IsIdentifier() )
793 ByteString aN
= IDLAPP
->pHashTable
->GetNearString( pTok
->GetString() );
795 fprintf( stderr
, "%s versus %s\n", pTok
->GetString().GetBuffer(), aN
.GetBuffer() );
800 /****************** SvIdlWorkingBase ****************************************/
801 /*************************************************************************
802 |* SvIdlWorkingBase::SvIdlWorkingBase()
805 *************************************************************************/
806 SvIdlWorkingBase::SvIdlWorkingBase()
810 /*************************************************************************
811 |* SvIdlWorkingBase::ReadSvIdl()
814 *************************************************************************/
815 BOOL
SvIdlWorkingBase::ReadSvIdl( SvTokenStream
& rInStm
, BOOL bImported
, const String
& rPath
)
817 aPath
= rPath
; // nur fuer den durchlauf gueltig
820 pTok
= rInStm
.GetToken();
821 // nur ein import ganz am Anfang
822 if( pTok
->Is( SvHash_import() ) )
824 rInStm
.GetToken_Next();
825 rInStm
.Read( '(' ); // optional
826 pTok
= rInStm
.GetToken_Next();
827 if( pTok
->IsString() )
829 DirEntry
aFullName( String::CreateFromAscii( pTok
->GetString().GetBuffer() ) );
830 if( aFullName
.Find( rPath
) )
832 SvFileStream
aStm( aFullName
.GetFull(),
833 STREAM_STD_READ
| STREAM_NOCREATE
);
835 if( aStm
.GetError() != SVSTREAM_OK
)
837 if( aStm
.GetError() == SVSTREAM_WRONGVERSION
)
839 ByteString
aStr( "wrong version, file " );
840 aStr
+= ByteString( aFullName
.GetFull(), RTL_TEXTENCODING_UTF8
);
841 SetError( aStr
, pTok
);
842 WriteError( rInStm
);
849 SvTokenStream
aTokStm( aStm
, aFullName
.GetFull() );
850 bOk
= ReadSvIdl( aTokStm
, TRUE
, rPath
);
861 UINT32 nBeginPos
= 0xFFFFFFFF; // kann mit Tell nicht vorkommen
863 while( bOk
&& nBeginPos
!= rInStm
.Tell() )
865 nBeginPos
= rInStm
.Tell();
866 pTok
= rInStm
.GetToken();
869 if( pTok
->IsEmpty() )
872 // nur ein import ganz am Anfang
873 /*else */if( pTok
->Is( SvHash_module() ) )
875 SvMetaModuleRef aModule
= new SvMetaModule( rInStm
.GetFileName(), bImported
);
876 if( aModule
->ReadSvIdl( *this, rInStm
) )
877 GetModuleList().Append( aModule
);
884 if( !bOk
|| !pTok
->IsEof() )
887 WriteError( rInStm
);
893 /*************************************************************************
894 |* SvIdlWorkingBase::WriteSvIdl()
897 *************************************************************************/
898 BOOL
SvIdlWorkingBase::WriteSvIdl( SvStream
& rOutStm
)
900 if( rOutStm
.GetError() != SVSTREAM_OK
)
903 SvStringHashList aList
;
906 GetIdTable()->FillHashList( &aList
);
907 SvStringHashEntry
* pEntry
= aList
.First();
910 rOutStm
<< "#define " << pEntry
->GetName().GetBuffer()
912 << ByteString::CreateFromInt64(
913 pEntry
->GetValue() ).GetBuffer()
915 pEntry
= aList
.Next();
919 for( ULONG n
= 0; n
< GetModuleList().Count(); n
++ )
921 SvMetaModule
* pModule
= GetModuleList().GetObject( n
);
922 //if( !pModule->IsImported() )
923 pModule
->WriteSvIdl( *this, rOutStm
, 0 );
928 /*************************************************************************
929 |* SvIdlWorkingBase::WriteSfx()
932 *************************************************************************/
933 BOOL
SvIdlWorkingBase::WriteSfx( SvStream
& rOutStm
)
935 if( rOutStm
.GetError() != SVSTREAM_OK
)
938 // alle Tmp-Variablen fuer das Schreiben zuruecksetzen
940 SvMemoryStream
aTmpStm( 256000, 256000 );
942 for( n
= 0; n
< GetModuleList().Count(); n
++ )
944 SvMetaModule
* pModule
= GetModuleList().GetObject( n
);
945 if( !pModule
->IsImported() )
946 pModule
->WriteSfx( *this, aTmpStm
);
949 for( n
= 0; n
< aUsedTypes
.Count(); n
++ )
951 SvMetaType
* pType
= aUsedTypes
.GetObject( n
);
952 pType
->WriteSfx( *this, rOutStm
);
959 BOOL
SvIdlWorkingBase::WriteHelpIds( SvStream
& rOutStm
)
961 if( rOutStm
.GetError() != SVSTREAM_OK
)
966 for( n
= 0; n
< GetModuleList().Count(); n
++ )
968 SvMetaModule
* pModule
= GetModuleList().GetObject( n
);
969 //if( !pModule->IsImported() )
970 pModule
->WriteHelpIds( *this, rOutStm
, &aIdTable
);
973 const SvMetaAttributeMemberList
& rAttrList
= GetAttrList();
974 for( n
= 0; n
< rAttrList
.Count(); n
++ )
976 SvMetaAttribute
* pAttr
= rAttrList
.GetObject( n
);
977 pAttr
->WriteHelpId( *this, rOutStm
, &aIdTable
);
983 /*************************************************************************
984 |* SvIdlWorkingBase::WriteSfxItem()
987 *************************************************************************/
988 BOOL
SvIdlWorkingBase::WriteSfxItem( SvStream
& )
993 void SvIdlDataBase::StartNewFile( const String
& rName
)
995 bExport
= ( aExportFile
.EqualsIgnoreCaseAscii( rName
) );
998 void SvIdlDataBase::AppendAttr( SvMetaAttribute
*pAttr
)
1000 aAttrList
.Append( pAttr
);
1002 pAttr
->SetNewAttribute( TRUE
);
1005 BOOL
SvIdlWorkingBase::WriteCSV( SvStream
& rStrm
)
1007 SvMetaAttributeMemberList
&rList
= GetAttrList();
1008 ULONG nCount
= rList
.Count();
1009 for ( ULONG n
=0; n
<nCount
; n
++ )
1011 if ( rList
.GetObject(n
)->IsNewAttribute() )
1013 rList
.GetObject(n
)->WriteCSV( *this, rStrm
);
1017 if ( rStrm
.GetError() != SVSTREAM_OK
)
1023 /*************************************************************************
1024 |* SvIdlWorkingBase::WriteDocumentation()
1027 *************************************************************************/
1028 BOOL
SvIdlWorkingBase::WriteDocumentation( SvStream
& rOutStm
)
1030 if( rOutStm
.GetError() != SVSTREAM_OK
)
1033 for( ULONG n
= 0; n
< GetModuleList().Count(); n
++ )
1035 SvMetaModule
* pModule
= GetModuleList().GetObject( n
);
1036 if( !pModule
->IsImported() )
1037 pModule
->Write( *this, rOutStm
, 0, WRITE_DOCU
);
1044 #endif // IDL_COMPILER