1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
35 #include <rtl/string.hxx>
36 #include <tools/pstm.hxx>
38 #include <rtl/ustring.hxx>
47 sal_uInt32 nLine
, nColumn
;
49 SvIdlError() : nLine(0), nColumn(0) {}
50 SvIdlError( sal_uInt32 nL
, sal_uInt32 nC
)
51 : nLine(nL
), nColumn(nC
) {}
53 const rtl::OString
& GetText() const { return aText
; }
54 void SetText( const rtl::OString
& rT
) { aText
= rT
; }
55 sal_Bool
IsError() const { return nLine
!= 0; }
56 void Clear() { nLine
= nColumn
= 0; }
57 SvIdlError
& operator = ( const SvIdlError
& rRef
)
60 nColumn
= rRef
.nColumn
;
70 sal_uInt32 nVerbosity
;
74 SvPersistStream aPersStream
;
75 StringList aIdFileList
;
76 SvStringHashTable
* pIdTable
;
78 SvMetaTypeMemberList aTypeList
;
79 SvMetaClassMemberList aClassList
;
80 SvMetaModuleMemberList aModuleList
;
81 SvMetaAttributeMemberList aAttrList
;
82 SvMetaTypeMemberList aTmpTypeList
; // not persistent
85 ::std::set
< ::rtl::OUString
> m_DepFiles
;
86 SvMetaObjectMemberStack aContextStack
;
92 aIFaceName
= rtl::OString();
95 explicit SvIdlDataBase( const SvCommand
& rCmd
);
97 static sal_Bool
IsBinaryFormat( SvStream
& rInStm
);
99 void Load( SvStream
& rInStm
);
100 void Save( SvStream
& rInStm
, sal_uInt32 nContextFlags
);
102 SvMetaAttributeMemberList
& GetAttrList() { return aAttrList
; }
103 SvStringHashTable
* GetIdTable() { return pIdTable
; }
104 SvMetaTypeMemberList
& GetTypeList();
105 SvMetaClassMemberList
& GetClassList() { return aClassList
; }
106 SvMetaModuleMemberList
& GetModuleList() { return aModuleList
; }
107 SvMetaModule
* GetModule( const rtl::OString
& rName
);
109 // list of used types while writing
110 SvMetaTypeMemberList aUsedTypes
;
111 rtl::OString aIFaceName
;
112 SvNumberIdentifier aStructSlotId
;
114 void StartNewFile( const String
& rName
);
115 void SetExportFile( const String
& rName
)
116 { aExportFile
= rName
; }
117 void AppendAttr( SvMetaAttribute
*pSlot
);
118 const SvIdlError
& GetError() const { return aError
; }
119 void SetError( const SvIdlError
& r
)
122 const String
& GetPath() const { return aPath
; }
123 SvMetaObjectMemberStack
& GetStack() { return aContextStack
; }
125 void Write(const rtl::OString
& rText
);
126 void WriteError(const rtl::OString
& rErrWrn
,
127 const rtl::OString
& rFileName
,
128 const rtl::OString
& rErrorText
,
129 sal_uLong nRow
= 0, sal_uLong nColumn
= 0 ) const;
130 void WriteError( SvTokenStream
& rInStm
);
131 void SetError( const rtl::OString
& rError
, SvToken
* pTok
);
132 void Push( SvMetaObject
* pObj
);
133 sal_Bool
Pop( sal_Bool bOk
, SvTokenStream
& rInStm
, sal_uInt32 nTokPos
)
139 rInStm
.Seek( nTokPos
);
142 sal_uInt32
GetUniqueId() { return ++nUniqueId
; }
143 sal_Bool
FindId( const rtl::OString
& rIdName
, sal_uLong
* pVal
);
144 sal_Bool
InsertId( const rtl::OString
& rIdName
, sal_uLong nVal
);
145 sal_Bool
ReadIdFile( const String
& rFileName
);
147 SvMetaType
* FindType( const rtl::OString
& rName
);
148 static SvMetaType
* FindType( const SvMetaType
*, SvMetaTypeMemberList
& );
150 SvMetaType
* ReadKnownType( SvTokenStream
& rInStm
);
151 SvMetaAttribute
* ReadKnownAttr( SvTokenStream
& rInStm
,
152 SvMetaType
* pType
= NULL
);
153 SvMetaAttribute
* SearchKnownAttr( const SvNumberIdentifier
& );
154 SvMetaClass
* ReadKnownClass( SvTokenStream
& rInStm
);
155 void AddDepFile(String
const& rFileName
);
156 bool WriteDepFile(SvFileStream
& rStream
, ::rtl::OUString
const& rTarget
);
159 class SvIdlWorkingBase
: public SvIdlDataBase
162 explicit SvIdlWorkingBase( const SvCommand
& rCmd
);
164 sal_Bool
ReadSvIdl( SvTokenStream
&, sal_Bool bImported
, const String
& rPath
);
165 sal_Bool
WriteSvIdl( SvStream
& );
167 sal_Bool
WriteSfx( SvStream
& );
168 sal_Bool
WriteHelpIds( SvStream
& );
169 sal_Bool
WriteSfxItem( SvStream
& );
170 sal_Bool
WriteCSV( SvStream
& );
171 sal_Bool
WriteDocumentation( SvStream
& );
174 #endif // _DATABASE_HXX
176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */