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( const SvCommand
& rCmd
)
64 , nVerbosity( rCmd
.nVerbosity
)
65 , bIsModified( FALSE
)
66 , aPersStream( *IDLAPP
->pClassMgr
, NULL
)
72 /*************************************************************************
73 |* SvIdlDataBase::~SvIdlDataBase()
76 *************************************************************************/
77 SvIdlDataBase::~SvIdlDataBase()
79 String
* pStr
= aIdFileList
.First();
83 pStr
= aIdFileList
.Next();
88 /*************************************************************************
89 |* SvIdlDataBase::GetTypeList()
92 *************************************************************************/
93 #define ADD_TYPE( Name, OdlName, ParserChar, CName, BasName, BasPost ) \
94 aTypeList.Append( new SvMetaType( SvHash_##Name()->GetName(), \
95 BasName, OdlName, ParserChar, CName, BasName, BasPost ) );
97 SvMetaTypeMemberList
& SvIdlDataBase::GetTypeList()
99 if( aTypeList
.Count() == 0 )
101 aTypeList
.Append( new SvMetaTypeString() );
102 aTypeList
.Append( new SvMetaTypevoid() );
104 // MI: IDispatch::Invoke kann keine unsigned
105 ADD_TYPE( UINT16
, "long", 'h', "unsigned short", "Long", "&" );
106 ADD_TYPE( INT16
, "short", 'h', "short", "Integer", "%" );
107 ADD_TYPE( UINT32
, "long", 'l', "unsigned long", "Long", "&" );
108 ADD_TYPE( INT32
, "long", 'l', "long", "Long", "&" );
109 ADD_TYPE( int, "int", 'i', "int", "Integer", "%" );
110 ADD_TYPE( BOOL
, "boolean", 'b', "unsigned char", "Boolean", "" );
111 ADD_TYPE( char, "char", 'c', "char", "Integer", "%" );
112 ADD_TYPE( BYTE
, "char", 'c', "unsigned char", "Integer", "%" );
113 ADD_TYPE( float, "float", 'f', "float", "Single", "!" );
114 ADD_TYPE( double, "double", 'F', "double", "Double", "#" );
115 ADD_TYPE( SbxObject
, "VARIANT", 'o', "C_Object", "Object", "" );
117 // A c h t u n g !!!, bei hinzufuegen von Typen werden alle
118 // bin„ren Datenbasen inkompatibel
121 // So tun als ob die Init-Daten auf einem Stream gelesen wurden
123 aPersStream.SetStream( &aStm );
124 // Alle Init-Daten Streamen
125 aPersStream << aTypeList;
126 // Nur die Id-Zuordnung merken
127 aPersStream.SetStream( NULL );
133 /*************************************************************************
135 |* SvIdlDataBase::GetModuleInfo()
138 |* Ersterstellung MM 13.12.94
139 |* Letzte Aenderung MM 13.12.94
141 *************************************************************************/
142 SvMetaModule
* SvIdlDataBase::GetModule( const ByteString
& rName
)
144 for( ULONG n
= 0; n
< aModuleList
.Count(); n
++ )
145 if( aModuleList
.GetObject( n
)->GetName() == rName
)
146 return aModuleList
.GetObject( n
);
150 /*************************************************************************
152 |* SvIdlDataBase::IsBinaryFormat()
156 *************************************************************************/
157 #define DATABASE_SIGNATURE (UINT32)0x13B799F2
158 #define DATABASE_VER 0x0006
159 BOOL
SvIdlDataBase::IsBinaryFormat( SvStream
& rStm
)
162 ULONG nPos
= rStm
.Tell();
166 return nSig
== DATABASE_SIGNATURE
;
169 /*************************************************************************
171 |* SvIdlDataBase::Load()
175 *************************************************************************/
176 void SvIdlDataBase::Load( SvStream
& rStm
)
178 DBG_ASSERT( aTypeList
.Count() == 0, "type list already initialized" );
179 SvPersistStream
aPStm( *IDLAPP
->pClassMgr
, &rStm
);
186 if( nSig
!= DATABASE_SIGNATURE
)
188 aPStm
.SetError( SVSTREAM_FILEFORMAT_ERROR
);
191 if( nVersion
!= DATABASE_VER
)
193 aPStm
.SetError( SVSTREAM_WRONGVERSION
);
199 aPStm
>> aModuleList
;
203 aPStm
.SetError( SVSTREAM_GENERALERROR
);
206 /*************************************************************************
207 |* SvIdlDataBase::Save()
210 *************************************************************************/
211 void SvIdlDataBase::Save( SvStream
& rStm
, UINT32 nFlags
)
213 SvPersistStream
aPStm( *IDLAPP
->pClassMgr
, &rStm
);
214 aPStm
.SetContextFlags( nFlags
);
216 aPStm
<< (UINT32
)DATABASE_SIGNATURE
;
217 aPStm
<< (USHORT
)DATABASE_VER
;
219 BOOL bOnlyStreamedObjs
= FALSE
;
220 if( nFlags
& IDL_WRITE_CALLING
)
221 bOnlyStreamedObjs
= TRUE
;
223 if( bOnlyStreamedObjs
)
225 SvMetaClassMemberList aList
;
226 for( ULONG n
= 0; n
< GetModuleList().Count(); n
++ )
228 SvMetaModule
* pModule
= GetModuleList().GetObject( n
);
229 if( !pModule
->IsImported() )
230 aList
.Append( pModule
->GetClassList() );
237 //aClassList.WriteObjects( aPStm, bOnlyStreamedObjs );
238 aTypeList
.WriteObjects( aPStm
, bOnlyStreamedObjs
);
239 aAttrList
.WriteObjects( aPStm
, bOnlyStreamedObjs
);
240 aModuleList
.WriteObjects( aPStm
, bOnlyStreamedObjs
);
244 /*************************************************************************
245 |* SvIdlDataBase::SetError()
248 *************************************************************************/
249 void SvIdlDataBase::SetError( const ByteString
& rError
, SvToken
* pTok
)
251 if( pTok
->GetLine() > 10000 )
252 aError
.SetText( "hgchcg" );
254 if( aError
.nLine
< pTok
->GetLine()
255 || (aError
.nLine
== pTok
->GetLine() && aError
.nColumn
< pTok
->GetColumn()) )
257 aError
= SvIdlError( pTok
->GetLine(), pTok
->GetColumn() );
258 aError
.SetText( rError
);
262 /*************************************************************************
263 |* SvIdlDataBase::Push()
266 *************************************************************************/
267 void SvIdlDataBase::Push( SvMetaObject
* pObj
)
269 GetStack().Push( pObj
);
273 /*************************************************************************
275 |* SvIdlDataBase::FindId()
279 *************************************************************************/
280 BOOL
SvIdlDataBase::FindId( const ByteString
& rIdName
, ULONG
* pVal
)
285 if( pIdTable
->Test( rIdName
, &nHash
) )
287 *pVal
= pIdTable
->Get( nHash
)->GetValue();
294 /*************************************************************************
296 |* SvIdlDataBase::InsertId()
300 *************************************************************************/
301 BOOL
SvIdlDataBase::InsertId( const ByteString
& rIdName
, ULONG nVal
)
304 pIdTable
= new SvStringHashTable( 20003 );
307 if( pIdTable
->Insert( rIdName
, &nHash
) )
309 pIdTable
->Get( nHash
)->SetValue( nVal
);
315 /*************************************************************************
316 |* SvIdlDataBase::ReadIdFile()
319 *************************************************************************/
320 BOOL
SvIdlDataBase::ReadIdFile( const String
& rFileName
)
322 DirEntry
aFullName( rFileName
);
323 aFullName
.Find( GetPath() );
325 String
* pIdFile
= aIdFileList
.First();
328 if( *pIdFile
== rFileName
)
329 return TRUE
; // schon eingelesen
330 pIdFile
= aIdFileList
.Next();
333 aIdFileList
.Insert( new String( rFileName
), LIST_APPEND
);
335 SvTokenStream
aTokStm( aFullName
.GetFull() );
336 if( aTokStm
.GetStream().GetError() == SVSTREAM_OK
)
338 SvToken
* pTok
= aTokStm
.GetToken_Next();
340 while( !pTok
->IsEof() )
342 if( pTok
->IsChar() && pTok
->GetChar() == '#' )
344 pTok
= aTokStm
.GetToken_Next();
345 if( pTok
->Is( SvHash_define() ) )
347 pTok
= aTokStm
.GetToken_Next();
349 if( pTok
->IsIdentifier() )
350 aDefName
= pTok
->GetString();
353 ByteString
aStr( "unexpected token after define" );
355 SetError( aStr
, pTok
);
356 WriteError( aTokStm
);
364 pTok
= aTokStm
.GetToken_Next();
365 if( pTok
->IsIdentifier() )
368 if( FindId( pTok
->GetString(), &n
) )
373 else if( pTok
->IsChar() )
375 if( pTok
->GetChar() == '-'
376 || pTok
->GetChar() == '/'
377 || pTok
->GetChar() == '*'
378 || pTok
->GetChar() == '&'
379 || pTok
->GetChar() == '|'
380 || pTok
->GetChar() == '^'
381 || pTok
->GetChar() == '~' )
383 ByteString
aStr( "unknown operator '" );
384 aStr
+= pTok
->GetChar();
385 aStr
+= "'in define";
387 SetError( aStr
, pTok
);
388 WriteError( aTokStm
);
391 if( pTok
->GetChar() != '+'
392 && pTok
->GetChar() != '('
393 && pTok
->GetChar() != ')' )
394 // nur + erlaubt, Klammern spielen kein Rolle,
395 // da + komutativ ist
398 else if( pTok
->IsInteger() )
400 nVal
+= pTok
->GetNumber();
407 if( !InsertId( aDefName
, nVal
) )
409 ByteString aStr
= "hash table overflow: ";
410 SetError( aStr
, pTok
);
411 WriteError( aTokStm
);
416 else if( pTok
->Is( SvHash_include() ) )
418 pTok
= aTokStm
.GetToken_Next();
420 if( pTok
->IsString() )
421 aName
= pTok
->GetString();
422 else if( pTok
->IsChar() && pTok
->GetChar() == '<' )
424 pTok
= aTokStm
.GetToken_Next();
425 while( !pTok
->IsEof()
426 && !(pTok
->IsChar() && pTok
->GetChar() == '>') )
428 aName
+= pTok
->GetTokenAsString();
429 pTok
= aTokStm
.GetToken_Next();
433 ByteString
aStr( "unexpected eof in #include" );
435 SetError( aStr
, pTok
);
436 WriteError( aTokStm
);
440 if( !ReadIdFile( String::CreateFromAscii(aName
.GetBuffer()) ) )
442 ByteString aStr
= "cannot read file: ";
444 SetError( aStr
, pTok
);
445 WriteError( aTokStm
);
451 pTok
= aTokStm
.GetToken_Next();
459 /*************************************************************************
460 |* SvIdlDataBase::FindType()
463 *************************************************************************/
464 SvMetaType
* SvIdlDataBase::FindType( const SvMetaType
* pPType
,
465 SvMetaTypeMemberList
& rList
)
467 SvMetaType
* pType
= rList
.First();
468 while( pType
&& pPType
!= pType
)
469 pType
= rList
.Next();
473 SvMetaType
* SvIdlDataBase::FindType( const ByteString
& rName
)
475 SvMetaType
* pType
= aTypeList
.First();
476 while( pType
&& rName
!= pType
->GetName() )
477 pType
= aTypeList
.Next();
481 /*************************************************************************
482 |* SvIdlDataBase::ReadKnownType()
485 *************************************************************************/
486 SvMetaType
* SvIdlDataBase::ReadKnownType( SvTokenStream
& rInStm
)
490 int nCall0
= CALL_VALUE
;
491 int nCall1
= CALL_VALUE
;
492 BOOL bSet
= FALSE
; //irgent ein Attribut gesetzt
494 UINT32 nTokPos
= rInStm
.Tell();
495 SvToken
* pTok
= rInStm
.GetToken_Next();
497 if( pTok
->HasHash() )
499 UINT32 nBeginPos
= 0; // kann mit Tell nicht vorkommen
500 while( nBeginPos
!= rInStm
.Tell() )
502 nBeginPos
= rInStm
.Tell();
503 if( pTok
->Is( SvHash_in() ) )
506 pTok
= rInStm
.GetToken_Next();
509 if( pTok
->Is( SvHash_out() ) )
512 pTok
= rInStm
.GetToken_Next();
515 if( pTok
->Is( SvHash_inout() ) )
519 pTok
= rInStm
.GetToken_Next();
525 SvMetaTypeList aTmpTypeList;
526 if( FillTypeList( aTmpTypeList, pTok ) )
528 if( pTok
->IsIdentifier() )
530 ByteString aName
= pTok
->GetString();
531 SvMetaTypeMemberList
& rList
= GetTypeList();
532 SvMetaType
* pType
= rList
.First();
535 if( pType
->GetName() == aName
)
537 pType
= rList
.Next();
541 pTok
= rInStm
.GetToken();
544 if( pTok
->GetChar() == '&' || pTok
->GetChar() == '*' )
546 nCall0
= (pTok
->GetChar() == '&') ? CALL_REFERENCE
:
548 rInStm
.GetToken_Next();
549 pTok
= rInStm
.GetToken();
550 if( pTok
->GetChar() == '&' || pTok
->GetChar() == '*' )
552 nCall1
= (pTok
->GetChar() == '&') ? CALL_REFERENCE
:
554 rInStm
.GetToken_Next();
560 SvMetaType * pMetaType = aTmpTypeList.First();
563 if( pMetaType->GetIn() == bIn
564 && pMetaType->GetOut() == bOut
565 && pMetaType->GetCall0() == nCall0
566 && pMetaType->GetCall1() == nCall1 )
570 pMetaType = aTmpTypeList.Next();
573 //SvMetaType * pType = aTmpTypeList.First();
575 // Ist genau dieser Typ
578 DBG_ASSERT( aTmpTypeList
.First(), "mindestens ein Element" );
579 SvMetaTypeRef xType
= new SvMetaType( pType
->GetName(), 'h', "dummy" );
580 xType
->SetRef( pType
);
582 xType
->SetOut( bOut
);
583 xType
->SetCall0( nCall0
);
584 xType
->SetCall1( nCall1
);
586 aTmpTypeList
.Append( xType
);
590 rInStm
.Seek( nTokPos
);
594 /*************************************************************************
596 |* SvIdlDataBase::ReadKnownAttr()
600 *************************************************************************/
601 SvMetaAttribute
* SvIdlDataBase::ReadKnownAttr
603 SvTokenStream
& rInStm
,
604 SvMetaType
* pType
/* Wenn der pType == NULL, dann muss der Typ
605 noch gelesen werden. */
608 UINT32 nTokPos
= rInStm
.Tell();
611 pType
= ReadKnownType( rInStm
);
615 // Wenn wir Slots auf die Wiese stellen, d"urfen wir nicht voraussetzen,
616 // da\s jeder Slot einen anderen Namen hat!
618 SvToken * pTok = rInStm.GetToken_Next();
619 if( pTok->IsIdentifier() )
620 for( ULONG n = 0; n < aAttrList.Count(); n++ )
622 SvMetaAttribute * pAttr = aAttrList.GetObject( n );
623 if( pAttr->GetName() == pTok->GetString() )
631 SvToken
* pTok
= rInStm
.GetToken_Next();
632 if( pTok
->IsIdentifier() )
635 if( FindId( pTok
->GetString(), &n
) )
637 for( ULONG i
= 0; i
< aAttrList
.Count(); i
++ )
639 SvMetaAttribute
* pAttr
= aAttrList
.GetObject( i
);
640 if( pAttr
->GetSlotId() == pTok
->GetString() )
645 ByteString
aStr( "Nicht gefunden : " );
646 aStr
+= pTok
->GetString();
647 DBG_ERROR( aStr
.GetBuffer() );
651 rInStm
.Seek( nTokPos
);
655 SvMetaAttribute
* SvIdlDataBase::SearchKnownAttr
657 const SvNumberIdentifier
& rId
661 if( FindId( rId
, &n
) )
663 for( ULONG i
= 0; i
< aAttrList
.Count(); i
++ )
665 SvMetaAttribute
* pAttr
= aAttrList
.GetObject( i
);
666 if( pAttr
->GetSlotId() == rId
)
674 /*************************************************************************
675 |* SvIdlDataBase::ReadKnownClass()
678 *************************************************************************/
679 SvMetaClass
* SvIdlDataBase::ReadKnownClass( SvTokenStream
& rInStm
)
681 UINT32 nTokPos
= rInStm
.Tell();
682 SvToken
* pTok
= rInStm
.GetToken_Next();
684 if( pTok
->IsIdentifier() )
685 for( ULONG n
= 0; n
< aClassList
.Count(); n
++ )
687 SvMetaClass
* pClass
= aClassList
.GetObject( n
);
688 if( pClass
->GetName() == pTok
->GetString() )
692 rInStm
.Seek( nTokPos
);
696 /*************************************************************************
697 |* SvIdlDataBase::Write()
700 *************************************************************************/
701 void SvIdlDataBase::Write( const ByteString
& rText
)
704 if( nVerbosity
!= 0 )
705 fprintf( stdout
, "%s", rText
.GetBuffer() );
709 /*************************************************************************
710 |* SvIdlDataBase::WriteError()
713 *************************************************************************/
714 void SvIdlDataBase::WriteError( const ByteString
& rErrWrn
,
715 const ByteString
& rFileName
,
716 const ByteString
& rErrorText
,
717 ULONG nRow
, ULONG nColumn
) const
721 fprintf( stderr
, "\n%s --- %s: ( %ld, %ld )\n",
722 rFileName
.GetBuffer(), rErrWrn
.GetBuffer(), nRow
, nColumn
);
724 if( rErrorText
.Len() )
726 fprintf( stderr
, "\t%s\n", rErrorText
.GetBuffer() );
731 /*************************************************************************
732 |* SvIdlDataBase::WriteError()
735 *************************************************************************/
736 void SvIdlDataBase::WriteError( SvTokenStream
& rInStm
)
740 String
aFileName( rInStm
.GetFileName() );
741 ByteString aErrorText
;
742 ULONG nRow
= 0, nColumn
= 0;
745 SvToken
*pTok
= rInStm
.GetToken();
748 nRow
= pTok
->GetLine();
749 nColumn
= pTok
->GetColumn();
751 if( aError
.IsError() )
753 // Fehler Token suchen
755 if( aError
.GetText().Len() )
757 aErrorText
= "may be <";
758 aErrorText
+= aError
.GetText();
760 SvToken
* pPrevTok
= NULL
;
761 while( pTok
!= pPrevTok
)
764 if( pTok
->GetLine() == aError
.nLine
765 && pTok
->GetColumn() == aError
.nColumn
)
767 pTok
= rInStm
.GetToken_PrevAll();
771 aErrorText
+= "> at ( ";
772 aErrorText
+= ByteString::CreateFromInt64(aError
.nLine
);
774 aErrorText
+= ByteString::CreateFromInt64(aError
.nColumn
);
777 // Fehler zuruecksetzen
778 aError
= SvIdlError();
781 WriteError( "error", ByteString( aFileName
, RTL_TEXTENCODING_UTF8
), aErrorText
, nRow
, nColumn
);
783 DBG_ASSERT( pTok
, "token must be found" );
787 // Identifier in der Naehe suchen
788 if( !pTok
->IsIdentifier() )
790 rInStm
.GetToken_PrevAll();
791 pTok
= rInStm
.GetToken();
793 if( pTok
&& pTok
->IsIdentifier() )
795 ByteString aN
= IDLAPP
->pHashTable
->GetNearString( pTok
->GetString() );
797 fprintf( stderr
, "%s versus %s\n", pTok
->GetString().GetBuffer(), aN
.GetBuffer() );
802 /****************** SvIdlWorkingBase ****************************************/
803 /*************************************************************************
804 |* SvIdlWorkingBase::SvIdlWorkingBase()
807 *************************************************************************/
808 SvIdlWorkingBase::SvIdlWorkingBase(const SvCommand
& rCmd
) : SvIdlDataBase(rCmd
)
812 /*************************************************************************
813 |* SvIdlWorkingBase::ReadSvIdl()
816 *************************************************************************/
817 BOOL
SvIdlWorkingBase::ReadSvIdl( SvTokenStream
& rInStm
, BOOL bImported
, const String
& rPath
)
819 aPath
= rPath
; // nur fuer den durchlauf gueltig
822 pTok
= rInStm
.GetToken();
823 // nur ein import ganz am Anfang
824 if( pTok
->Is( SvHash_import() ) )
826 rInStm
.GetToken_Next();
827 rInStm
.Read( '(' ); // optional
828 pTok
= rInStm
.GetToken_Next();
829 if( pTok
->IsString() )
831 DirEntry
aFullName( String::CreateFromAscii( pTok
->GetString().GetBuffer() ) );
832 if( aFullName
.Find( rPath
) )
834 SvFileStream
aStm( aFullName
.GetFull(),
835 STREAM_STD_READ
| STREAM_NOCREATE
);
837 if( aStm
.GetError() != SVSTREAM_OK
)
839 if( aStm
.GetError() == SVSTREAM_WRONGVERSION
)
841 ByteString
aStr( "wrong version, file " );
842 aStr
+= ByteString( aFullName
.GetFull(), RTL_TEXTENCODING_UTF8
);
843 SetError( aStr
, pTok
);
844 WriteError( rInStm
);
851 SvTokenStream
aTokStm( aStm
, aFullName
.GetFull() );
852 bOk
= ReadSvIdl( aTokStm
, TRUE
, rPath
);
863 UINT32 nBeginPos
= 0xFFFFFFFF; // kann mit Tell nicht vorkommen
865 while( bOk
&& nBeginPos
!= rInStm
.Tell() )
867 nBeginPos
= rInStm
.Tell();
868 pTok
= rInStm
.GetToken();
871 if( pTok
->IsEmpty() )
874 // nur ein import ganz am Anfang
875 /*else */if( pTok
->Is( SvHash_module() ) )
877 SvMetaModuleRef aModule
= new SvMetaModule( rInStm
.GetFileName(), bImported
);
878 if( aModule
->ReadSvIdl( *this, rInStm
) )
879 GetModuleList().Append( aModule
);
886 if( !bOk
|| !pTok
->IsEof() )
889 WriteError( rInStm
);
895 /*************************************************************************
896 |* SvIdlWorkingBase::WriteSvIdl()
899 *************************************************************************/
900 BOOL
SvIdlWorkingBase::WriteSvIdl( SvStream
& rOutStm
)
902 if( rOutStm
.GetError() != SVSTREAM_OK
)
905 SvStringHashList aList
;
908 GetIdTable()->FillHashList( &aList
);
909 SvStringHashEntry
* pEntry
= aList
.First();
912 rOutStm
<< "#define " << pEntry
->GetName().GetBuffer()
914 << ByteString::CreateFromInt64(
915 pEntry
->GetValue() ).GetBuffer()
917 pEntry
= aList
.Next();
921 for( ULONG n
= 0; n
< GetModuleList().Count(); n
++ )
923 SvMetaModule
* pModule
= GetModuleList().GetObject( n
);
924 //if( !pModule->IsImported() )
925 pModule
->WriteSvIdl( *this, rOutStm
, 0 );
930 /*************************************************************************
931 |* SvIdlWorkingBase::WriteSfx()
934 *************************************************************************/
935 BOOL
SvIdlWorkingBase::WriteSfx( SvStream
& rOutStm
)
937 if( rOutStm
.GetError() != SVSTREAM_OK
)
940 // alle Tmp-Variablen fuer das Schreiben zuruecksetzen
942 SvMemoryStream
aTmpStm( 256000, 256000 );
944 for( n
= 0; n
< GetModuleList().Count(); n
++ )
946 SvMetaModule
* pModule
= GetModuleList().GetObject( n
);
947 if( !pModule
->IsImported() )
948 pModule
->WriteSfx( *this, aTmpStm
);
951 for( n
= 0; n
< aUsedTypes
.Count(); n
++ )
953 SvMetaType
* pType
= aUsedTypes
.GetObject( n
);
954 pType
->WriteSfx( *this, rOutStm
);
961 BOOL
SvIdlWorkingBase::WriteHelpIds( SvStream
& rOutStm
)
963 if( rOutStm
.GetError() != SVSTREAM_OK
)
968 for( n
= 0; n
< GetModuleList().Count(); n
++ )
970 SvMetaModule
* pModule
= GetModuleList().GetObject( n
);
971 //if( !pModule->IsImported() )
972 pModule
->WriteHelpIds( *this, rOutStm
, &aIdTable
);
975 const SvMetaAttributeMemberList
& rAttrList
= GetAttrList();
976 for( n
= 0; n
< rAttrList
.Count(); n
++ )
978 SvMetaAttribute
* pAttr
= rAttrList
.GetObject( n
);
979 pAttr
->WriteHelpId( *this, rOutStm
, &aIdTable
);
985 /*************************************************************************
986 |* SvIdlWorkingBase::WriteSfxItem()
989 *************************************************************************/
990 BOOL
SvIdlWorkingBase::WriteSfxItem( SvStream
& )
995 void SvIdlDataBase::StartNewFile( const String
& rName
)
997 bExport
= ( aExportFile
.EqualsIgnoreCaseAscii( rName
) );
1000 void SvIdlDataBase::AppendAttr( SvMetaAttribute
*pAttr
)
1002 aAttrList
.Append( pAttr
);
1004 pAttr
->SetNewAttribute( TRUE
);
1007 BOOL
SvIdlWorkingBase::WriteCSV( SvStream
& rStrm
)
1009 SvMetaAttributeMemberList
&rList
= GetAttrList();
1010 ULONG nCount
= rList
.Count();
1011 for ( ULONG n
=0; n
<nCount
; n
++ )
1013 if ( rList
.GetObject(n
)->IsNewAttribute() )
1015 rList
.GetObject(n
)->WriteCSV( *this, rStrm
);
1019 if ( rStrm
.GetError() != SVSTREAM_OK
)
1025 /*************************************************************************
1026 |* SvIdlWorkingBase::WriteDocumentation()
1029 *************************************************************************/
1030 BOOL
SvIdlWorkingBase::WriteDocumentation( SvStream
& rOutStm
)
1032 if( rOutStm
.GetError() != SVSTREAM_OK
)
1035 for( ULONG n
= 0; n
< GetModuleList().Count(); n
++ )
1037 SvMetaModule
* pModule
= GetModuleList().GetObject( n
);
1038 if( !pModule
->IsImported() )
1039 pModule
->Write( *this, rOutStm
, 0, WRITE_DOCU
);
1046 #endif // IDL_COMPILER