1*477794c1SAndrew Rist /**************************************************************
2*477794c1SAndrew Rist *
3*477794c1SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*477794c1SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*477794c1SAndrew Rist * distributed with this work for additional information
6*477794c1SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*477794c1SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*477794c1SAndrew Rist * "License"); you may not use this file except in compliance
9*477794c1SAndrew Rist * with the License. You may obtain a copy of the License at
10*477794c1SAndrew Rist *
11*477794c1SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13*477794c1SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*477794c1SAndrew Rist * software distributed under the License is distributed on an
15*477794c1SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*477794c1SAndrew Rist * KIND, either express or implied. See the License for the
17*477794c1SAndrew Rist * specific language governing permissions and limitations
18*477794c1SAndrew Rist * under the License.
19*477794c1SAndrew Rist *
20*477794c1SAndrew Rist *************************************************************/
21*477794c1SAndrew Rist
22*477794c1SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_rsc.hxx"
26cdf0e10cSrcweir /****************** I N C L U D E S **************************************/
27cdf0e10cSrcweir
28cdf0e10cSrcweir // Programmuebergreifende Includes.
29cdf0e10cSrcweir #include <rscdef.hxx>
30cdf0e10cSrcweir
31cdf0e10cSrcweir /****************** C o d e **********************************************/
32cdf0e10cSrcweir /****************** R s c I d ********************************************/
33cdf0e10cSrcweir sal_Bool RscId::bNames = sal_True;
34cdf0e10cSrcweir
35cdf0e10cSrcweir /*************************************************************************
36cdf0e10cSrcweir |*
37cdf0e10cSrcweir |* static RscId::SetNames
38cdf0e10cSrcweir |* static RscId::SetNoNames
39cdf0e10cSrcweir |*
40cdf0e10cSrcweir |* Beschreibung
41cdf0e10cSrcweir |* Ersterstellung MM 26.06.91
42cdf0e10cSrcweir |* Letzte Aenderung MM 26.06.91
43cdf0e10cSrcweir |*
44cdf0e10cSrcweir *************************************************************************/
SetNames(sal_Bool bSet)45cdf0e10cSrcweir void RscId::SetNames( sal_Bool bSet ) { bNames = bSet; }
IsSetNames()46cdf0e10cSrcweir sal_Bool RscId::IsSetNames() { return bNames; }
47cdf0e10cSrcweir
48cdf0e10cSrcweir /*************************************************************************
49cdf0e10cSrcweir |*
50cdf0e10cSrcweir |* RscId::GetNumber
51cdf0e10cSrcweir |*
52cdf0e10cSrcweir |* Beschreibung
53cdf0e10cSrcweir |* Ersterstellung MM 17.05.91
54cdf0e10cSrcweir |* Letzte Aenderung MM 17.05.91
55cdf0e10cSrcweir |*
56cdf0e10cSrcweir *************************************************************************/
GetNumber() const57cdf0e10cSrcweir sal_Int32 RscId::GetNumber() const{
58cdf0e10cSrcweir sal_Int32 lVal;
59cdf0e10cSrcweir aExp.Evaluate( &lVal );
60cdf0e10cSrcweir return lVal;
61cdf0e10cSrcweir }
62cdf0e10cSrcweir
63cdf0e10cSrcweir /*************************************************************************
64cdf0e10cSrcweir |*
65cdf0e10cSrcweir |* RscId::Create()
66cdf0e10cSrcweir |*
67cdf0e10cSrcweir |* Beschreibung
68cdf0e10cSrcweir |* Ersterstellung MM 01.11.91
69cdf0e10cSrcweir |* Letzte Aenderung MM 01.11.91
70cdf0e10cSrcweir |*
71cdf0e10cSrcweir *************************************************************************/
Create(const RscExpType & rExpType)72cdf0e10cSrcweir void RscId::Create( const RscExpType & rExpType )
73cdf0e10cSrcweir {
74cdf0e10cSrcweir aExp = rExpType;
75cdf0e10cSrcweir if( aExp.IsDefinition() )
76cdf0e10cSrcweir aExp.aExp.pDef->IncRef();
77cdf0e10cSrcweir else if( aExp.IsExpression() ){
78cdf0e10cSrcweir sal_Int32 lValue;
79cdf0e10cSrcweir
80cdf0e10cSrcweir aExp.Evaluate( &lValue );
81cdf0e10cSrcweir aExp.SetLong( lValue );
82cdf0e10cSrcweir }
83cdf0e10cSrcweir }
84cdf0e10cSrcweir
85cdf0e10cSrcweir /*************************************************************************
86cdf0e10cSrcweir |*
87cdf0e10cSrcweir |* RscId::Destroy()
88cdf0e10cSrcweir |*
89cdf0e10cSrcweir |* Beschreibung
90cdf0e10cSrcweir |* Ersterstellung MM 01.11.91
91cdf0e10cSrcweir |* Letzte Aenderung MM 01.11.91
92cdf0e10cSrcweir |*
93cdf0e10cSrcweir *************************************************************************/
Destroy()94cdf0e10cSrcweir void RscId::Destroy(){
95cdf0e10cSrcweir if( aExp.IsDefinition() )
96cdf0e10cSrcweir aExp.aExp.pDef->DecRef();
97cdf0e10cSrcweir aExp.cType = RSCEXP_NOTHING;
98cdf0e10cSrcweir }
99cdf0e10cSrcweir
100cdf0e10cSrcweir /*************************************************************************
101cdf0e10cSrcweir |*
102cdf0e10cSrcweir |* RscId::RscId()
103cdf0e10cSrcweir |*
104cdf0e10cSrcweir |* Beschreibung
105cdf0e10cSrcweir |* Ersterstellung MM 01.11.91
106cdf0e10cSrcweir |* Letzte Aenderung MM 01.11.91
107cdf0e10cSrcweir |*
108cdf0e10cSrcweir *************************************************************************/
RscId(const RscId & rRscId)109cdf0e10cSrcweir RscId::RscId( const RscId& rRscId ){
110cdf0e10cSrcweir aExp = rRscId.aExp;
111cdf0e10cSrcweir if( aExp.IsDefinition() )
112cdf0e10cSrcweir aExp.aExp.pDef->IncRef();
113cdf0e10cSrcweir }
114cdf0e10cSrcweir
115cdf0e10cSrcweir /*************************************************************************
116cdf0e10cSrcweir |*
117cdf0e10cSrcweir |* RscId::RscId()
118cdf0e10cSrcweir |*
119cdf0e10cSrcweir |* Beschreibung
120cdf0e10cSrcweir |* Ersterstellung MM 01.11.91
121cdf0e10cSrcweir |* Letzte Aenderung MM 25.11.91
122cdf0e10cSrcweir |*
123cdf0e10cSrcweir *************************************************************************/
RscId(RscDefine * pDef)124cdf0e10cSrcweir RscId::RscId( RscDefine * pDef ){
125cdf0e10cSrcweir RscExpType aExpType;
126cdf0e10cSrcweir
127cdf0e10cSrcweir aExpType.aExp.pDef = pDef;
128cdf0e10cSrcweir aExpType.cType = RSCEXP_DEF;
129cdf0e10cSrcweir Create( aExpType );
130cdf0e10cSrcweir }
131cdf0e10cSrcweir
132cdf0e10cSrcweir /*************************************************************************
133cdf0e10cSrcweir |*
134cdf0e10cSrcweir |* RscId:: =
135cdf0e10cSrcweir |*
136cdf0e10cSrcweir |* Beschreibung
137cdf0e10cSrcweir |* Ersterstellung MM 01.11.91
138cdf0e10cSrcweir |* Letzte Aenderung MM 01.11.91
139cdf0e10cSrcweir |*
140cdf0e10cSrcweir *************************************************************************/
operator =(const RscId & rRscId)141cdf0e10cSrcweir RscId& RscId::operator = ( const RscId& rRscId ){
142cdf0e10cSrcweir if( rRscId.aExp.IsDefinition() )
143cdf0e10cSrcweir rRscId.aExp.aExp.pDef->IncRef();
144cdf0e10cSrcweir Destroy();
145cdf0e10cSrcweir aExp = rRscId.aExp;
146cdf0e10cSrcweir return *this;
147cdf0e10cSrcweir }
148cdf0e10cSrcweir
149cdf0e10cSrcweir /*************************************************************************
150cdf0e10cSrcweir |*
151cdf0e10cSrcweir |* RscId::operator ==
152cdf0e10cSrcweir |*
153cdf0e10cSrcweir |* Beschreibung
154cdf0e10cSrcweir |* Ersterstellung MM 16.05.91
155cdf0e10cSrcweir |* Letzte Aenderung MM 16.05.91
156cdf0e10cSrcweir |*
157cdf0e10cSrcweir *************************************************************************/
operator ==(const RscId & rRscId) const158cdf0e10cSrcweir sal_Bool RscId::operator == ( const RscId& rRscId ) const
159cdf0e10cSrcweir {
160cdf0e10cSrcweir return( GetNumber() == rRscId.GetNumber() );
161cdf0e10cSrcweir }
162cdf0e10cSrcweir
163cdf0e10cSrcweir /*************************************************************************
164cdf0e10cSrcweir |*
165cdf0e10cSrcweir |* RscId::operator <
166cdf0e10cSrcweir |*
167cdf0e10cSrcweir |* Beschreibung
168cdf0e10cSrcweir |* Ersterstellung MM 16.05.91
169cdf0e10cSrcweir |* Letzte Aenderung MM 16.05.91
170cdf0e10cSrcweir |*
171cdf0e10cSrcweir *************************************************************************/
operator <(const RscId & rRscId) const172cdf0e10cSrcweir sal_Bool RscId::operator < ( const RscId& rRscId ) const
173cdf0e10cSrcweir {
174cdf0e10cSrcweir return( GetNumber() < rRscId.GetNumber() );
175cdf0e10cSrcweir }
176cdf0e10cSrcweir
177cdf0e10cSrcweir /*************************************************************************
178cdf0e10cSrcweir |*
179cdf0e10cSrcweir |* RscId::operator >
180cdf0e10cSrcweir |*
181cdf0e10cSrcweir |* Beschreibung
182cdf0e10cSrcweir |* Ersterstellung MM 16.05.91
183cdf0e10cSrcweir |* Letzte Aenderung MM 16.05.91
184cdf0e10cSrcweir |*
185cdf0e10cSrcweir *************************************************************************/
operator >(const RscId & rRscId) const186cdf0e10cSrcweir sal_Bool RscId::operator > ( const RscId& rRscId ) const
187cdf0e10cSrcweir {
188cdf0e10cSrcweir return( GetNumber() > rRscId.GetNumber() );
189cdf0e10cSrcweir }
190cdf0e10cSrcweir
191cdf0e10cSrcweir /*************************************************************************
192cdf0e10cSrcweir |*
193cdf0e10cSrcweir |* RscId::sal_Int32()
194cdf0e10cSrcweir |*
195cdf0e10cSrcweir |* Beschreibung
196cdf0e10cSrcweir |* Ersterstellung MM 16.05.91
197cdf0e10cSrcweir |* Letzte Aenderung MM 16.05.91
198cdf0e10cSrcweir |*
199cdf0e10cSrcweir *************************************************************************/
operator sal_Int32() const200cdf0e10cSrcweir RscId::operator sal_Int32() const
201cdf0e10cSrcweir {
202cdf0e10cSrcweir return( GetNumber() );
203cdf0e10cSrcweir }
204cdf0e10cSrcweir
205cdf0e10cSrcweir /*************************************************************************
206cdf0e10cSrcweir |*
207cdf0e10cSrcweir |* RscId::GetNames()
208cdf0e10cSrcweir |*
209cdf0e10cSrcweir |* Beschreibung
210cdf0e10cSrcweir |* Ersterstellung MM 16.05.91
211cdf0e10cSrcweir |* Letzte Aenderung MM 25.11.91
212cdf0e10cSrcweir |*
213cdf0e10cSrcweir *************************************************************************/
GetName() const214cdf0e10cSrcweir ByteString RscId::GetName() const
215cdf0e10cSrcweir {
216cdf0e10cSrcweir ByteString aStr;
217cdf0e10cSrcweir
218cdf0e10cSrcweir if ( !aExp.IsNothing() )
219cdf0e10cSrcweir {
220cdf0e10cSrcweir if( bNames )
221cdf0e10cSrcweir aExp.GetMacro( aStr );
222cdf0e10cSrcweir else
223cdf0e10cSrcweir aStr = ByteString::CreateFromInt32( GetNumber() );
224cdf0e10cSrcweir }
225cdf0e10cSrcweir
226cdf0e10cSrcweir return aStr;
227cdf0e10cSrcweir }
228cdf0e10cSrcweir
229cdf0e10cSrcweir /*************************************************************************
230cdf0e10cSrcweir |*
231cdf0e10cSrcweir |* RscId::GetMacro()
232cdf0e10cSrcweir |*
233cdf0e10cSrcweir |* Beschreibung
234cdf0e10cSrcweir |* Ersterstellung MM 01.11.91
235cdf0e10cSrcweir |* Letzte Aenderung MM 25.11.91
236cdf0e10cSrcweir |*
237cdf0e10cSrcweir *************************************************************************/
GetMacro() const238cdf0e10cSrcweir ByteString RscId::GetMacro() const
239cdf0e10cSrcweir {
240cdf0e10cSrcweir ByteString aStr;
241cdf0e10cSrcweir
242cdf0e10cSrcweir if ( aExp.IsDefinition() )
243cdf0e10cSrcweir aStr = aExp.aExp.pDef->GetMacro();
244cdf0e10cSrcweir else
245cdf0e10cSrcweir aExp.GetMacro( aStr );
246cdf0e10cSrcweir
247cdf0e10cSrcweir return aStr;
248cdf0e10cSrcweir }
249cdf0e10cSrcweir
250cdf0e10cSrcweir /****************** R s c D e f i n e ************************************/
251cdf0e10cSrcweir /*************************************************************************
252cdf0e10cSrcweir |*
253cdf0e10cSrcweir |* RscDefine::RscDefine()
254cdf0e10cSrcweir |*
255cdf0e10cSrcweir |* Beschreibung
256cdf0e10cSrcweir |* Ersterstellung MM 01.11.91
257cdf0e10cSrcweir |* Letzte Aenderung MM 01.11.91
258cdf0e10cSrcweir |*
259cdf0e10cSrcweir *************************************************************************/
RscDefine(sal_uLong lKey,const ByteString & rDefName,sal_Int32 lDefId)260cdf0e10cSrcweir RscDefine::RscDefine( sal_uLong lKey, const ByteString & rDefName, sal_Int32 lDefId )
261cdf0e10cSrcweir : StringNode( rDefName )
262cdf0e10cSrcweir {
263cdf0e10cSrcweir nRefCount = 0;
264cdf0e10cSrcweir lFileKey = lKey;
265cdf0e10cSrcweir lId = lDefId;
266cdf0e10cSrcweir pExp = NULL;
267cdf0e10cSrcweir }
268cdf0e10cSrcweir
RscDefine(sal_uLong lKey,const ByteString & rDefName,RscExpression * pExpression)269cdf0e10cSrcweir RscDefine::RscDefine( sal_uLong lKey, const ByteString & rDefName,
270cdf0e10cSrcweir RscExpression * pExpression )
271cdf0e10cSrcweir : StringNode( rDefName )
272cdf0e10cSrcweir {
273cdf0e10cSrcweir nRefCount = 0;
274cdf0e10cSrcweir lFileKey = lKey;
275cdf0e10cSrcweir pExpression->Evaluate( &lId );
276cdf0e10cSrcweir pExp = pExpression;
277cdf0e10cSrcweir }
278cdf0e10cSrcweir
279cdf0e10cSrcweir /*************************************************************************
280cdf0e10cSrcweir |*
281cdf0e10cSrcweir |* RscDefine::~RscDefine()
282cdf0e10cSrcweir |*
283cdf0e10cSrcweir |* Beschreibung
284cdf0e10cSrcweir |* Ersterstellung MM 01.11.91
285cdf0e10cSrcweir |* Letzte Aenderung MM 01.11.91
286cdf0e10cSrcweir |*
287cdf0e10cSrcweir *************************************************************************/
~RscDefine()288cdf0e10cSrcweir RscDefine::~RscDefine(){
289cdf0e10cSrcweir if( pExp )
290cdf0e10cSrcweir delete pExp;
291cdf0e10cSrcweir if( nRefCount )
292cdf0e10cSrcweir RscExit( 14 );
293cdf0e10cSrcweir }
294cdf0e10cSrcweir
295cdf0e10cSrcweir /*************************************************************************
296cdf0e10cSrcweir |*
297cdf0e10cSrcweir |* RscDefine::DecRef()
298cdf0e10cSrcweir |*
299cdf0e10cSrcweir |* Beschreibung
300cdf0e10cSrcweir |* Ersterstellung MM 01.11.91
301cdf0e10cSrcweir |* Letzte Aenderung MM 01.11.91
302cdf0e10cSrcweir |*
303cdf0e10cSrcweir *************************************************************************/
DecRef()304cdf0e10cSrcweir void RscDefine::DecRef(){
305cdf0e10cSrcweir nRefCount--;
306cdf0e10cSrcweir if( 0 == nRefCount ){
307cdf0e10cSrcweir delete this;
308cdf0e10cSrcweir }
309cdf0e10cSrcweir }
310cdf0e10cSrcweir
311cdf0e10cSrcweir /*************************************************************************
312cdf0e10cSrcweir |*
313cdf0e10cSrcweir |* RscDefine::DefineToNumber()
314cdf0e10cSrcweir |*
315cdf0e10cSrcweir |* Beschreibung
316cdf0e10cSrcweir |* Ersterstellung MM 07.11.91
317cdf0e10cSrcweir |* Letzte Aenderung MM 07.11.91
318cdf0e10cSrcweir |*
319cdf0e10cSrcweir *************************************************************************/
DefineToNumber()320cdf0e10cSrcweir void RscDefine::DefineToNumber()
321cdf0e10cSrcweir {
322cdf0e10cSrcweir if( pExp )
323cdf0e10cSrcweir delete pExp;
324cdf0e10cSrcweir pExp = NULL;
325cdf0e10cSrcweir SetName( ByteString::CreateFromInt32( lId ) );
326cdf0e10cSrcweir }
327cdf0e10cSrcweir
328cdf0e10cSrcweir /*************************************************************************
329cdf0e10cSrcweir |*
330cdf0e10cSrcweir |* RscDefine::ChangeMacro()
331cdf0e10cSrcweir |*
332cdf0e10cSrcweir |* Beschreibung
333cdf0e10cSrcweir |* Ersterstellung MM 04.11.91
334cdf0e10cSrcweir |* Letzte Aenderung MM 04.11.91
335cdf0e10cSrcweir |*
336cdf0e10cSrcweir *************************************************************************/
ChangeMacro(RscExpression * pExpression)337cdf0e10cSrcweir void RscDefine::ChangeMacro( RscExpression * pExpression ){
338cdf0e10cSrcweir if( pExp )
339cdf0e10cSrcweir delete pExp;
340cdf0e10cSrcweir pExp = pExpression;
341cdf0e10cSrcweir pExp->Evaluate( &lId );
342cdf0e10cSrcweir }
343cdf0e10cSrcweir
ChangeMacro(sal_Int32 lIdentifier)344cdf0e10cSrcweir void RscDefine::ChangeMacro( sal_Int32 lIdentifier ){
345cdf0e10cSrcweir if( pExp ){
346cdf0e10cSrcweir delete pExp;
347cdf0e10cSrcweir pExp = NULL;
348cdf0e10cSrcweir }
349cdf0e10cSrcweir lId = lIdentifier;
350cdf0e10cSrcweir }
351cdf0e10cSrcweir
352cdf0e10cSrcweir /*************************************************************************
353cdf0e10cSrcweir |*
354cdf0e10cSrcweir |* RscDefine::Evaluate()
355cdf0e10cSrcweir |*
356cdf0e10cSrcweir |* Beschreibung
357cdf0e10cSrcweir |* Ersterstellung MM 01.11.91
358cdf0e10cSrcweir |* Letzte Aenderung MM 01.11.91
359cdf0e10cSrcweir |*
360cdf0e10cSrcweir *************************************************************************/
Evaluate()361cdf0e10cSrcweir sal_Bool RscDefine::Evaluate(){
362cdf0e10cSrcweir sal_Bool bRet = sal_True;
363cdf0e10cSrcweir
364cdf0e10cSrcweir if( pExp )
365cdf0e10cSrcweir bRet = !pExp->Evaluate( &lId );
366cdf0e10cSrcweir
367cdf0e10cSrcweir return bRet;
368cdf0e10cSrcweir }
369cdf0e10cSrcweir
370cdf0e10cSrcweir /*************************************************************************
371cdf0e10cSrcweir |*
372cdf0e10cSrcweir |* RscDefine::Search()
373cdf0e10cSrcweir |*
374cdf0e10cSrcweir |* Beschreibung
375cdf0e10cSrcweir |* Ersterstellung MM 11.11.91
376cdf0e10cSrcweir |* Letzte Aenderung MM 11.11.91
377cdf0e10cSrcweir |*
378cdf0e10cSrcweir *************************************************************************/
Search(const char * pStr)379cdf0e10cSrcweir RscDefine * RscDefine::Search( const char * pStr ){
380cdf0e10cSrcweir return (RscDefine *)StringNode::Search( pStr );
381cdf0e10cSrcweir }
382cdf0e10cSrcweir
383cdf0e10cSrcweir /*************************************************************************
384cdf0e10cSrcweir |*
385cdf0e10cSrcweir |* RscDefine::GetMacro()
386cdf0e10cSrcweir |*
387cdf0e10cSrcweir |* Beschreibung
388cdf0e10cSrcweir |* Ersterstellung MM 01.11.91
389cdf0e10cSrcweir |* Letzte Aenderung MM 01.11.91
390cdf0e10cSrcweir |*
391cdf0e10cSrcweir *************************************************************************/
GetMacro()392cdf0e10cSrcweir ByteString RscDefine::GetMacro()
393cdf0e10cSrcweir {
394cdf0e10cSrcweir if( pExp )
395cdf0e10cSrcweir return pExp->GetMacro();
396cdf0e10cSrcweir return ByteString::CreateFromInt32( lId );
397cdf0e10cSrcweir }
398cdf0e10cSrcweir
399cdf0e10cSrcweir /****************** R s c D e f i n e L i s t ****************************/
400cdf0e10cSrcweir /*************************************************************************
401cdf0e10cSrcweir |*
402cdf0e10cSrcweir |* RscDefineList::New()
403cdf0e10cSrcweir |*
404cdf0e10cSrcweir |* Beschreibung
405cdf0e10cSrcweir |* Ersterstellung MM 04.11.91
406cdf0e10cSrcweir |* Letzte Aenderung MM 04.11.91
407cdf0e10cSrcweir |*
408cdf0e10cSrcweir *************************************************************************/
New(sal_uLong lFileKey,const ByteString & rDefName,sal_Int32 lDefId,sal_uLong lPos)409cdf0e10cSrcweir RscDefine * RscDefineList::New( sal_uLong lFileKey, const ByteString & rDefName,
410cdf0e10cSrcweir sal_Int32 lDefId, sal_uLong lPos )
411cdf0e10cSrcweir {
412cdf0e10cSrcweir RscDefine * pDef;
413cdf0e10cSrcweir
414cdf0e10cSrcweir pDef = new RscDefine( lFileKey, rDefName, lDefId );
415cdf0e10cSrcweir pDef->IncRef();
416cdf0e10cSrcweir Insert( pDef, lPos );
417cdf0e10cSrcweir return pDef;
418cdf0e10cSrcweir }
419cdf0e10cSrcweir
New(sal_uLong lFileKey,const ByteString & rDefName,RscExpression * pExpression,sal_uLong lPos)420cdf0e10cSrcweir RscDefine * RscDefineList::New( sal_uLong lFileKey, const ByteString & rDefName,
421cdf0e10cSrcweir RscExpression * pExpression, sal_uLong lPos )
422cdf0e10cSrcweir {
423cdf0e10cSrcweir RscDefine * pDef;
424cdf0e10cSrcweir
425cdf0e10cSrcweir pDef = new RscDefine( lFileKey, rDefName, pExpression );
426cdf0e10cSrcweir pDef->IncRef();
427cdf0e10cSrcweir Insert( pDef, lPos );
428cdf0e10cSrcweir
429cdf0e10cSrcweir return pDef;
430cdf0e10cSrcweir }
431cdf0e10cSrcweir
432cdf0e10cSrcweir /*************************************************************************
433cdf0e10cSrcweir |*
434cdf0e10cSrcweir |* RscDefineList::Remove()
435cdf0e10cSrcweir |*
436cdf0e10cSrcweir |* Beschreibung
437cdf0e10cSrcweir |* Ersterstellung MM 04.11.91
438cdf0e10cSrcweir |* Letzte Aenderung MM 04.11.91
439cdf0e10cSrcweir |*
440cdf0e10cSrcweir *************************************************************************/
Remove(RscDefine * pDef)441cdf0e10cSrcweir sal_Bool RscDefineList::Remove( RscDefine * pDef ){
442cdf0e10cSrcweir pDef = RscSubDefList::Remove( pDef );
443cdf0e10cSrcweir if( pDef ){
444cdf0e10cSrcweir pDef->DefineToNumber();
445cdf0e10cSrcweir pDef->DecRef();
446cdf0e10cSrcweir }
447cdf0e10cSrcweir
448cdf0e10cSrcweir return( NULL != pDef );
449cdf0e10cSrcweir }
450cdf0e10cSrcweir
Remove(sal_uLong lIndex)451cdf0e10cSrcweir sal_Bool RscDefineList::Remove( sal_uLong lIndex ){
452cdf0e10cSrcweir RscDefine * pDef = RscSubDefList::Remove( lIndex );
453cdf0e10cSrcweir if( pDef ){
454cdf0e10cSrcweir pDef->DefineToNumber();
455cdf0e10cSrcweir pDef->DecRef();
456cdf0e10cSrcweir }
457cdf0e10cSrcweir
458cdf0e10cSrcweir return( NULL != pDef );
459cdf0e10cSrcweir }
460cdf0e10cSrcweir
Remove()461cdf0e10cSrcweir sal_Bool RscDefineList::Remove(){
462cdf0e10cSrcweir RscDefine * pDef;
463cdf0e10cSrcweir
464cdf0e10cSrcweir pDef = RscSubDefList::Remove( (sal_uLong)0 );
465cdf0e10cSrcweir
466cdf0e10cSrcweir if( pDef ){
467cdf0e10cSrcweir pDef->DefineToNumber();
468cdf0e10cSrcweir pDef->DecRef();
469cdf0e10cSrcweir }
470cdf0e10cSrcweir return( NULL != pDef );
471cdf0e10cSrcweir }
472cdf0e10cSrcweir
473cdf0e10cSrcweir /*************************************************************************
474cdf0e10cSrcweir |*
475cdf0e10cSrcweir |* RscDefineList::Befor()
476cdf0e10cSrcweir |*
477cdf0e10cSrcweir |* Beschreibung
478cdf0e10cSrcweir |* Ersterstellung MM 12.11.91
479cdf0e10cSrcweir |* Letzte Aenderung MM 12.11.91
480cdf0e10cSrcweir |*
481cdf0e10cSrcweir *************************************************************************/
Befor(const RscDefine * pFree,const RscDefine * pDepend)482cdf0e10cSrcweir sal_Bool RscDefineList::Befor( const RscDefine * pFree,
483cdf0e10cSrcweir const RscDefine * pDepend )
484cdf0e10cSrcweir {
485cdf0e10cSrcweir RscDefine * pDef;
486cdf0e10cSrcweir
487cdf0e10cSrcweir pDef = First();
488cdf0e10cSrcweir while( pDef ){
489cdf0e10cSrcweir if( pDef == pFree ){
490cdf0e10cSrcweir pDef = Next();
491cdf0e10cSrcweir while( pDef ){
492cdf0e10cSrcweir if( pDef == pDepend )
493cdf0e10cSrcweir return sal_True;
494cdf0e10cSrcweir pDef = Next();
495cdf0e10cSrcweir }
496cdf0e10cSrcweir }
497cdf0e10cSrcweir pDef = Next();
498cdf0e10cSrcweir };
499cdf0e10cSrcweir return sal_False;
500cdf0e10cSrcweir }
501cdf0e10cSrcweir
502cdf0e10cSrcweir /*************************************************************************
503cdf0e10cSrcweir |*
504cdf0e10cSrcweir |* RscDefineList::WriteAll()
505cdf0e10cSrcweir |*
506cdf0e10cSrcweir |* Beschreibung
507cdf0e10cSrcweir |* Ersterstellung MM 28.10.91
508cdf0e10cSrcweir |* Letzte Aenderung MM 28.10.91
509cdf0e10cSrcweir |*
510cdf0e10cSrcweir *************************************************************************/
WriteAll(FILE * fOutput)511cdf0e10cSrcweir void RscDefineList::WriteAll( FILE * fOutput )
512cdf0e10cSrcweir {
513cdf0e10cSrcweir RscDefine * pDefEle = First();
514cdf0e10cSrcweir
515cdf0e10cSrcweir while( pDefEle )
516cdf0e10cSrcweir {
517cdf0e10cSrcweir fprintf( fOutput, "#define %s %s\n",
518cdf0e10cSrcweir pDefEle->GetName().GetBuffer(),
519cdf0e10cSrcweir pDefEle->GetMacro().GetBuffer() );
520cdf0e10cSrcweir pDefEle = Next();
521cdf0e10cSrcweir };
522cdf0e10cSrcweir }
523cdf0e10cSrcweir
524cdf0e10cSrcweir /****************** R s c E x p T y p e **********************************/
525cdf0e10cSrcweir /*************************************************************************
526cdf0e10cSrcweir |*
527cdf0e10cSrcweir |* RscExpType::Evaluate()
528cdf0e10cSrcweir |*
529cdf0e10cSrcweir |* Beschreibung
530cdf0e10cSrcweir |* Ersterstellung MM 01.11.91
531cdf0e10cSrcweir |* Letzte Aenderung MM 01.11.91
532cdf0e10cSrcweir |*
533cdf0e10cSrcweir *************************************************************************/
Evaluate(sal_Int32 * plValue) const534cdf0e10cSrcweir sal_Bool RscExpType::Evaluate( sal_Int32 * plValue ) const{
535cdf0e10cSrcweir if( IsDefinition() ){
536cdf0e10cSrcweir aExp.pDef->Evaluate();
537cdf0e10cSrcweir // Eventuellen Fehler ignorieren
538cdf0e10cSrcweir *plValue = aExp.pDef->GetNumber();
539cdf0e10cSrcweir }
540cdf0e10cSrcweir else if( IsExpression() )
541cdf0e10cSrcweir return( aExp.pExp->Evaluate( plValue ) );
542cdf0e10cSrcweir else if( IsNothing() )
543cdf0e10cSrcweir *plValue = 0;
544cdf0e10cSrcweir else
545cdf0e10cSrcweir *plValue = GetLong();
546cdf0e10cSrcweir
547cdf0e10cSrcweir return sal_True;
548cdf0e10cSrcweir }
549cdf0e10cSrcweir
550cdf0e10cSrcweir /*************************************************************************
551cdf0e10cSrcweir |*
552cdf0e10cSrcweir |* RscExpType::GetMacro()
553cdf0e10cSrcweir |*
554cdf0e10cSrcweir |* Beschreibung
555cdf0e10cSrcweir |* Ersterstellung MM 01.11.91
556cdf0e10cSrcweir |* Letzte Aenderung MM 01.11.91
557cdf0e10cSrcweir |*
558cdf0e10cSrcweir *************************************************************************/
GetMacro(ByteString & rStr) const559cdf0e10cSrcweir void RscExpType::GetMacro( ByteString & rStr ) const
560cdf0e10cSrcweir {
561cdf0e10cSrcweir ByteString aStr;
562cdf0e10cSrcweir
563cdf0e10cSrcweir if( IsDefinition() )
564cdf0e10cSrcweir {
565cdf0e10cSrcweir rStr += aExp.pDef->GetName();
566cdf0e10cSrcweir }
567cdf0e10cSrcweir else if( IsExpression() )
568cdf0e10cSrcweir rStr += aExp.pExp->GetMacro();
569cdf0e10cSrcweir else if( IsNumber() )
570cdf0e10cSrcweir rStr += ByteString::CreateFromInt32( GetLong() );
571cdf0e10cSrcweir }
572cdf0e10cSrcweir
573cdf0e10cSrcweir
574cdf0e10cSrcweir /****************** R s c E x p r e s s i o n ****************************/
575cdf0e10cSrcweir /*************************************************************************
576cdf0e10cSrcweir |*
577cdf0e10cSrcweir |* RscExpression::RscExpression()
578cdf0e10cSrcweir |*
579cdf0e10cSrcweir |* Beschreibung
580cdf0e10cSrcweir |* Ersterstellung MM 01.11.91
581cdf0e10cSrcweir |* Letzte Aenderung MM 01.11.91
582cdf0e10cSrcweir |*
583cdf0e10cSrcweir *************************************************************************/
RscExpression(RscExpType aLE,char cOp,RscExpType aRE)584cdf0e10cSrcweir RscExpression::RscExpression( RscExpType aLE, char cOp, RscExpType aRE )
585cdf0e10cSrcweir {
586cdf0e10cSrcweir aLeftExp = aLE;
587cdf0e10cSrcweir cOperation = cOp;
588cdf0e10cSrcweir aRightExp = aRE;
589cdf0e10cSrcweir if( aLeftExp.IsDefinition() )
590cdf0e10cSrcweir aLeftExp.aExp.pDef->IncRef();
591cdf0e10cSrcweir if( aRightExp.IsDefinition() )
592cdf0e10cSrcweir aRightExp.aExp.pDef->IncRef();
593cdf0e10cSrcweir }
594cdf0e10cSrcweir
595cdf0e10cSrcweir /*************************************************************************
596cdf0e10cSrcweir |*
597cdf0e10cSrcweir |* RscExpression::~RscExpression()
598cdf0e10cSrcweir |*
599cdf0e10cSrcweir |* Beschreibung
600cdf0e10cSrcweir |* Ersterstellung MM 01.11.91
601cdf0e10cSrcweir |* Letzte Aenderung MM 01.11.91
602cdf0e10cSrcweir |*
603cdf0e10cSrcweir *************************************************************************/
~RscExpression()604cdf0e10cSrcweir RscExpression::~RscExpression(){
605cdf0e10cSrcweir if( aLeftExp.IsDefinition() )
606cdf0e10cSrcweir aLeftExp.aExp.pDef->DecRef();
607cdf0e10cSrcweir else if( aLeftExp.IsExpression() )
608cdf0e10cSrcweir delete aLeftExp.aExp.pExp;
609cdf0e10cSrcweir
610cdf0e10cSrcweir if( aRightExp.IsDefinition() )
611cdf0e10cSrcweir aRightExp.aExp.pDef->DecRef();
612cdf0e10cSrcweir else if( aRightExp.IsExpression() )
613cdf0e10cSrcweir delete aRightExp.aExp.pExp;
614cdf0e10cSrcweir }
615cdf0e10cSrcweir
616cdf0e10cSrcweir /*************************************************************************
617cdf0e10cSrcweir |*
618cdf0e10cSrcweir |* RscExpression::Evaluate()
619cdf0e10cSrcweir |*
620cdf0e10cSrcweir |* Beschreibung
621cdf0e10cSrcweir |* Ersterstellung MM 01.11.91
622cdf0e10cSrcweir |* Letzte Aenderung MM 01.11.91
623cdf0e10cSrcweir |*
624cdf0e10cSrcweir *************************************************************************/
Evaluate(sal_Int32 * plValue)625cdf0e10cSrcweir sal_Bool RscExpression::Evaluate( sal_Int32 * plValue ){
626cdf0e10cSrcweir sal_Int32 lLeft;
627cdf0e10cSrcweir sal_Int32 lRight;
628cdf0e10cSrcweir
629cdf0e10cSrcweir // linken und rechten Zweig auswerten
630cdf0e10cSrcweir if( aLeftExp.Evaluate( &lLeft ) && aRightExp.Evaluate( &lRight ) ){
631cdf0e10cSrcweir if( cOperation == '&' )
632cdf0e10cSrcweir *plValue = lLeft & lRight;
633cdf0e10cSrcweir else if( cOperation == '|' )
634cdf0e10cSrcweir *plValue = lLeft | lRight;
635cdf0e10cSrcweir else if( cOperation == '+' )
636cdf0e10cSrcweir *plValue = lLeft + lRight;
637cdf0e10cSrcweir else if( cOperation == '-' )
638cdf0e10cSrcweir *plValue = lLeft - lRight;
639cdf0e10cSrcweir else if( cOperation == '*' )
640cdf0e10cSrcweir *plValue = lLeft * lRight;
641cdf0e10cSrcweir else if( cOperation == 'r' )
642cdf0e10cSrcweir *plValue = lLeft >> lRight;
643cdf0e10cSrcweir else if( cOperation == 'l' )
644cdf0e10cSrcweir *plValue = lLeft << lRight;
645cdf0e10cSrcweir else{
646cdf0e10cSrcweir if( 0L == lRight )
647cdf0e10cSrcweir return sal_False;
648cdf0e10cSrcweir *plValue = lLeft / lRight;
649cdf0e10cSrcweir };
650cdf0e10cSrcweir return sal_True;
651cdf0e10cSrcweir }
652cdf0e10cSrcweir return sal_False;
653cdf0e10cSrcweir }
654cdf0e10cSrcweir
655cdf0e10cSrcweir /*************************************************************************
656cdf0e10cSrcweir |*
657cdf0e10cSrcweir |* RscExpression::GetMacro()
658cdf0e10cSrcweir |*
659cdf0e10cSrcweir |* Beschreibung
660cdf0e10cSrcweir |* Ersterstellung MM 01.11.91
661cdf0e10cSrcweir |* Letzte Aenderung MM 01.11.91
662cdf0e10cSrcweir |*
663cdf0e10cSrcweir *************************************************************************/
GetMacro()664cdf0e10cSrcweir ByteString RscExpression::GetMacro()
665cdf0e10cSrcweir {
666cdf0e10cSrcweir ByteString aLeft;
667cdf0e10cSrcweir
668cdf0e10cSrcweir // Ausgabeoptimierung
669cdf0e10cSrcweir if( aLeftExp.IsNothing() )
670cdf0e10cSrcweir {
671cdf0e10cSrcweir if ( '-' == cOperation )
672cdf0e10cSrcweir {
673cdf0e10cSrcweir aLeft += '(';
674cdf0e10cSrcweir aLeft += '-';
675cdf0e10cSrcweir }
676cdf0e10cSrcweir aRightExp.GetMacro( aLeft );
677cdf0e10cSrcweir if( '-' == cOperation )
678cdf0e10cSrcweir aLeft += ')';
679cdf0e10cSrcweir }
680cdf0e10cSrcweir else if( aRightExp.IsNothing() )
681cdf0e10cSrcweir aLeftExp.GetMacro( aLeft );
682cdf0e10cSrcweir else{
683cdf0e10cSrcweir aLeft += '(';
684cdf0e10cSrcweir // linken Zweig auswerten
685cdf0e10cSrcweir aLeftExp.GetMacro( aLeft );
686cdf0e10cSrcweir
687cdf0e10cSrcweir aLeft += cOperation;
688cdf0e10cSrcweir
689cdf0e10cSrcweir aLeft += '(';
690cdf0e10cSrcweir // rechten Zweig auswerten
691cdf0e10cSrcweir aRightExp.GetMacro( aLeft );
692cdf0e10cSrcweir aLeft += ')';
693cdf0e10cSrcweir
694cdf0e10cSrcweir aLeft += ')';
695cdf0e10cSrcweir }
696cdf0e10cSrcweir
697cdf0e10cSrcweir return aLeft;
698cdf0e10cSrcweir }
699cdf0e10cSrcweir
700cdf0e10cSrcweir /****************** R s c F i l e ****************************************/
701cdf0e10cSrcweir /*************************************************************************
702cdf0e10cSrcweir |*
703cdf0e10cSrcweir |* RscFile::RscFile()
704cdf0e10cSrcweir |*
705cdf0e10cSrcweir |* Beschreibung
706cdf0e10cSrcweir |* Ersterstellung MM 04.11.91
707cdf0e10cSrcweir |* Letzte Aenderung MM 04.11.91
708cdf0e10cSrcweir |*
709cdf0e10cSrcweir *************************************************************************/
RscFile()710cdf0e10cSrcweir RscFile :: RscFile(){
711cdf0e10cSrcweir bLoaded = sal_False;
712cdf0e10cSrcweir bIncFile = sal_False;
713cdf0e10cSrcweir bDirty = sal_False;
714cdf0e10cSrcweir bScanned = sal_False;
715cdf0e10cSrcweir }
716cdf0e10cSrcweir
717cdf0e10cSrcweir /*************************************************************************
718cdf0e10cSrcweir |*
719cdf0e10cSrcweir |* RscFile::~RscFile()
720cdf0e10cSrcweir |*
721cdf0e10cSrcweir |* Beschreibung
722cdf0e10cSrcweir |* Ersterstellung MM 04.11.91
723cdf0e10cSrcweir |* Letzte Aenderung MM 04.11.91
724cdf0e10cSrcweir |*
725cdf0e10cSrcweir *************************************************************************/
~RscFile()726cdf0e10cSrcweir RscFile :: ~RscFile(){
727cdf0e10cSrcweir RscDepend * pDep = Remove( (sal_uLong)0 );
728cdf0e10cSrcweir
729cdf0e10cSrcweir while( pDep ){
730cdf0e10cSrcweir delete pDep;
731cdf0e10cSrcweir pDep = Remove( (sal_uLong)0 );
732cdf0e10cSrcweir }
733cdf0e10cSrcweir
734cdf0e10cSrcweir //von hinten nach vorne ist besser wegen der Abhaengigkeiten
735cdf0e10cSrcweir //Objekte zerstoeren sich, wenn Referenzzaehler NULL
736cdf0e10cSrcweir aDefLst.Last();
737cdf0e10cSrcweir while( aDefLst.Remove() ) ;
738cdf0e10cSrcweir }
739cdf0e10cSrcweir
740cdf0e10cSrcweir /*************************************************************************
741cdf0e10cSrcweir |*
742cdf0e10cSrcweir |* RscFile::Depend()
743cdf0e10cSrcweir |*
744cdf0e10cSrcweir |* Beschreibung Diese Methode gibt sal_True zurueck, wenn lDepend
745cdf0e10cSrcweir |* existiert und hinter lFree steht, oder wenn
746cdf0e10cSrcweir |* lDepend nicht existiert.
747cdf0e10cSrcweir |* Ersterstellung MM 12.11.91
748cdf0e10cSrcweir |* Letzte Aenderung MM 12.11.91
749cdf0e10cSrcweir |*
750cdf0e10cSrcweir *************************************************************************/
Depend(sal_uLong lDepend,sal_uLong lFree)751cdf0e10cSrcweir sal_Bool RscFile::Depend( sal_uLong lDepend, sal_uLong lFree ){
752cdf0e10cSrcweir RscDepend * pDep;
753cdf0e10cSrcweir
754cdf0e10cSrcweir pDep = Last();
755cdf0e10cSrcweir while( pDep ){
756cdf0e10cSrcweir if( pDep->GetFileKey() == lDepend ){
757cdf0e10cSrcweir while( pDep ){
758cdf0e10cSrcweir if( pDep->GetFileKey() == lFree )
759cdf0e10cSrcweir return sal_True;
760cdf0e10cSrcweir pDep = Prev();
761cdf0e10cSrcweir }
762cdf0e10cSrcweir return sal_False;
763cdf0e10cSrcweir }
764cdf0e10cSrcweir pDep = Prev();
765cdf0e10cSrcweir };
766cdf0e10cSrcweir
767cdf0e10cSrcweir return sal_True;
768cdf0e10cSrcweir }
769cdf0e10cSrcweir
770cdf0e10cSrcweir /*************************************************************************
771cdf0e10cSrcweir |*
772cdf0e10cSrcweir |* RscFile::InsertDependFile()
773cdf0e10cSrcweir |*
774cdf0e10cSrcweir |* Beschreibung
775cdf0e10cSrcweir |* Ersterstellung MM 06.01.92
776cdf0e10cSrcweir |* Letzte Aenderung MM 06.01.92
777cdf0e10cSrcweir |*
778cdf0e10cSrcweir *************************************************************************/
InsertDependFile(sal_uLong lIncFile,sal_uLong lPos)779cdf0e10cSrcweir sal_Bool RscFile :: InsertDependFile( sal_uLong lIncFile, sal_uLong lPos )
780cdf0e10cSrcweir {
781cdf0e10cSrcweir RscDepend * pDep;
782cdf0e10cSrcweir
783cdf0e10cSrcweir pDep = First();
784cdf0e10cSrcweir while( pDep ){
785cdf0e10cSrcweir if( pDep->GetFileKey() == lIncFile )
786cdf0e10cSrcweir return sal_True;
787cdf0e10cSrcweir pDep = Next();
788cdf0e10cSrcweir }
789cdf0e10cSrcweir
790cdf0e10cSrcweir // Current-Zeiger steht auf letztem Element
791cdf0e10cSrcweir if( lPos >= Count() ){ //letztes Element muss immer letztes bleiben
792cdf0e10cSrcweir // Abhaengigkeit vor der letzten Position eintragen
793cdf0e10cSrcweir Insert( new RscDepend( lIncFile ) );
794cdf0e10cSrcweir }
795cdf0e10cSrcweir else
796cdf0e10cSrcweir Insert( new RscDepend( lIncFile ), lPos );
797cdf0e10cSrcweir
798cdf0e10cSrcweir return sal_True;
799cdf0e10cSrcweir }
800cdf0e10cSrcweir
801cdf0e10cSrcweir /*************************************************************************
802cdf0e10cSrcweir |*
803cdf0e10cSrcweir |* RscFile::RemoveDependFile()
804cdf0e10cSrcweir |*
805cdf0e10cSrcweir |* Beschreibung
806cdf0e10cSrcweir |* Ersterstellung MM 18.11.91
807cdf0e10cSrcweir |* Letzte Aenderung MM 18.11.91
808cdf0e10cSrcweir |*
809cdf0e10cSrcweir *************************************************************************/
RemoveDependFile(sal_uLong lDepFile)810cdf0e10cSrcweir void RscFile :: RemoveDependFile( sal_uLong lDepFile )
811cdf0e10cSrcweir {
812cdf0e10cSrcweir
813cdf0e10cSrcweir RscDepend * pDep = Last();
814cdf0e10cSrcweir
815cdf0e10cSrcweir while( pDep ){
816cdf0e10cSrcweir if( pDep->GetFileKey() == lDepFile ){
817cdf0e10cSrcweir Remove( pDep );
818cdf0e10cSrcweir delete pDep;
819cdf0e10cSrcweir }
820cdf0e10cSrcweir pDep = Prev();
821cdf0e10cSrcweir }
822cdf0e10cSrcweir }
823cdf0e10cSrcweir
824cdf0e10cSrcweir /****************** R s c D e f T r e e **********************************/
825cdf0e10cSrcweir /*************************************************************************
826cdf0e10cSrcweir |*
827cdf0e10cSrcweir |* RscDefTree::~RscDefTree()
828cdf0e10cSrcweir |*
829cdf0e10cSrcweir |* Beschreibung
830cdf0e10cSrcweir |* Ersterstellung MM 12.11.91
831cdf0e10cSrcweir |* Letzte Aenderung MM 12.11.91
832cdf0e10cSrcweir |*
833cdf0e10cSrcweir *************************************************************************/
~RscDefTree()834cdf0e10cSrcweir RscDefTree::~RscDefTree(){
835cdf0e10cSrcweir Remove();
836cdf0e10cSrcweir }
837cdf0e10cSrcweir
838cdf0e10cSrcweir /*************************************************************************
839cdf0e10cSrcweir |*
840cdf0e10cSrcweir |* RscDefTree::Remove()
841cdf0e10cSrcweir |*
842cdf0e10cSrcweir |* Beschreibung
843cdf0e10cSrcweir |* Ersterstellung MM 12.11.91
844cdf0e10cSrcweir |* Letzte Aenderung MM 12.11.91
845cdf0e10cSrcweir |*
846cdf0e10cSrcweir *************************************************************************/
Remove()847cdf0e10cSrcweir void RscDefTree::Remove(){
848cdf0e10cSrcweir RscDefine * pDef;
849cdf0e10cSrcweir while( pDefRoot ){
850cdf0e10cSrcweir pDef = pDefRoot;
851cdf0e10cSrcweir pDefRoot = (RscDefine *)pDefRoot->Remove( pDefRoot );
852cdf0e10cSrcweir pDef->DecRef();
853cdf0e10cSrcweir }
854cdf0e10cSrcweir }
855cdf0e10cSrcweir
856cdf0e10cSrcweir /*************************************************************************
857cdf0e10cSrcweir |*
858cdf0e10cSrcweir |* RscDefTree::~Search()
859cdf0e10cSrcweir |*
860cdf0e10cSrcweir |* Beschreibung
861cdf0e10cSrcweir |* Ersterstellung MM 12.11.91
862cdf0e10cSrcweir |* Letzte Aenderung MM 12.11.91
863cdf0e10cSrcweir |*
864cdf0e10cSrcweir *************************************************************************/
Search(const char * pName)865cdf0e10cSrcweir RscDefine * RscDefTree::Search( const char * pName ){
866cdf0e10cSrcweir if( pDefRoot )
867cdf0e10cSrcweir return pDefRoot->Search( pName );
868cdf0e10cSrcweir return NULL;
869cdf0e10cSrcweir }
870cdf0e10cSrcweir
871cdf0e10cSrcweir /*************************************************************************
872cdf0e10cSrcweir |*
873cdf0e10cSrcweir |* RscDefTree::Insert()
874cdf0e10cSrcweir |*
875cdf0e10cSrcweir |* Beschreibung
876cdf0e10cSrcweir |* Ersterstellung MM 12.11.91
877cdf0e10cSrcweir |* Letzte Aenderung MM 12.11.91
878cdf0e10cSrcweir |*
879cdf0e10cSrcweir *************************************************************************/
Insert(RscDefine * pDef)880cdf0e10cSrcweir void RscDefTree::Insert( RscDefine * pDef ){
881cdf0e10cSrcweir if( pDefRoot )
882cdf0e10cSrcweir pDefRoot->Insert( pDef );
883cdf0e10cSrcweir else
884cdf0e10cSrcweir pDefRoot = pDef;
885cdf0e10cSrcweir pDef->IncRef();
886cdf0e10cSrcweir }
887cdf0e10cSrcweir
888cdf0e10cSrcweir /*************************************************************************
889cdf0e10cSrcweir |*
890cdf0e10cSrcweir |* RscDefTree::Remove()
891cdf0e10cSrcweir |*
892cdf0e10cSrcweir |* Beschreibung
893cdf0e10cSrcweir |* Ersterstellung MM 12.11.91
894cdf0e10cSrcweir |* Letzte Aenderung MM 12.11.91
895cdf0e10cSrcweir |*
896cdf0e10cSrcweir *************************************************************************/
Remove(RscDefine * pDef)897cdf0e10cSrcweir void RscDefTree::Remove( RscDefine * pDef ){
898cdf0e10cSrcweir if( pDefRoot ){
899cdf0e10cSrcweir //falls pDef == pDefRoot
900cdf0e10cSrcweir pDefRoot = (RscDefine *)pDefRoot->Remove( pDef );
901cdf0e10cSrcweir }
902cdf0e10cSrcweir pDef->DecRef();
903cdf0e10cSrcweir }
904cdf0e10cSrcweir
905cdf0e10cSrcweir /*************************************************************************
906cdf0e10cSrcweir |*
907cdf0e10cSrcweir |* RscDefTree::Evaluate()
908cdf0e10cSrcweir |*
909cdf0e10cSrcweir |* Beschreibung
910cdf0e10cSrcweir |* Ersterstellung MM 12.11.91
911cdf0e10cSrcweir |* Letzte Aenderung MM 12.11.91
912cdf0e10cSrcweir |*
913cdf0e10cSrcweir *************************************************************************/
Evaluate(RscDefine * pDef)914cdf0e10cSrcweir sal_Bool RscDefTree::Evaluate( RscDefine * pDef ){
915cdf0e10cSrcweir if( pDef ){
916cdf0e10cSrcweir if( !Evaluate( (RscDefine *)pDef->Left() ) )
917cdf0e10cSrcweir return sal_False;
918cdf0e10cSrcweir if( !Evaluate( (RscDefine *)pDef->Right() ) )
919cdf0e10cSrcweir return sal_False;
920cdf0e10cSrcweir };
921cdf0e10cSrcweir return sal_True;
922cdf0e10cSrcweir }
923cdf0e10cSrcweir
Evaluate()924cdf0e10cSrcweir sal_Bool RscDefTree::Evaluate(){
925cdf0e10cSrcweir return Evaluate( pDefRoot );
926cdf0e10cSrcweir }
927cdf0e10cSrcweir
928cdf0e10cSrcweir /****************** R s c F i l e T a b **********************************/
929cdf0e10cSrcweir /*************************************************************************
930cdf0e10cSrcweir |*
931cdf0e10cSrcweir |* RscFileTab::RscFileTab()
932cdf0e10cSrcweir |*
933cdf0e10cSrcweir |* Beschreibung
934cdf0e10cSrcweir |* Ersterstellung MM 07.11.91
935cdf0e10cSrcweir |* Letzte Aenderung MM 07.11.91
936cdf0e10cSrcweir |*
937cdf0e10cSrcweir *************************************************************************/
RscFileTab()938cdf0e10cSrcweir RscFileTab::RscFileTab(){
939cdf0e10cSrcweir }
940cdf0e10cSrcweir
941cdf0e10cSrcweir /*************************************************************************
942cdf0e10cSrcweir |*
943cdf0e10cSrcweir |* RscFileTab::~RscFileTab()
944cdf0e10cSrcweir |*
945cdf0e10cSrcweir |* Beschreibung
946cdf0e10cSrcweir |* Ersterstellung MM 04.11.91
947cdf0e10cSrcweir |* Letzte Aenderung MM 04.11.91
948cdf0e10cSrcweir |*
949cdf0e10cSrcweir *************************************************************************/
~RscFileTab()950cdf0e10cSrcweir RscFileTab :: ~RscFileTab(){
951cdf0e10cSrcweir RscFile * pFile;
952cdf0e10cSrcweir
953cdf0e10cSrcweir aDefTree.Remove();
954cdf0e10cSrcweir
955cdf0e10cSrcweir pFile = Last();
956cdf0e10cSrcweir while( pFile ){
957cdf0e10cSrcweir Remove( GetIndex( pFile ) );
958cdf0e10cSrcweir delete pFile;
959cdf0e10cSrcweir pFile = Prev();
960cdf0e10cSrcweir };
961cdf0e10cSrcweir }
962cdf0e10cSrcweir
963cdf0e10cSrcweir /*************************************************************************
964cdf0e10cSrcweir |*
965cdf0e10cSrcweir |* RscFileTab::Find()
966cdf0e10cSrcweir |*
967cdf0e10cSrcweir |* Beschreibung
968cdf0e10cSrcweir |* Ersterstellung MM 16.05.91
969cdf0e10cSrcweir |* Letzte Aenderung MM 16.05.91
970cdf0e10cSrcweir |*
971cdf0e10cSrcweir *************************************************************************/
Find(const ByteString & rName)972cdf0e10cSrcweir sal_uLong RscFileTab :: Find( const ByteString & rName )
973cdf0e10cSrcweir {
974cdf0e10cSrcweir RscFile * pFName;
975cdf0e10cSrcweir
976cdf0e10cSrcweir pFName = First();
977cdf0e10cSrcweir while( pFName && (pFName->aFileName != rName) )
978cdf0e10cSrcweir pFName = Next();
979cdf0e10cSrcweir
980cdf0e10cSrcweir if( pFName )
981cdf0e10cSrcweir return( GetIndex( pFName ) );
982cdf0e10cSrcweir else
983cdf0e10cSrcweir return( NOFILE_INDEX );
984cdf0e10cSrcweir }
985cdf0e10cSrcweir
986cdf0e10cSrcweir /*************************************************************************
987cdf0e10cSrcweir |*
988cdf0e10cSrcweir |* RscFileTab::FindDef()
989cdf0e10cSrcweir |*
990cdf0e10cSrcweir |* Beschreibung
991cdf0e10cSrcweir |* Ersterstellung MM 30.10.91
992cdf0e10cSrcweir |* Letzte Aenderung MM 01.11.91
993cdf0e10cSrcweir |*
994cdf0e10cSrcweir *************************************************************************/
FindDef(const char * pName)995cdf0e10cSrcweir RscDefine * RscFileTab::FindDef( const char * pName ){
996cdf0e10cSrcweir return aDefTree.Search( pName );
997cdf0e10cSrcweir }
998cdf0e10cSrcweir
999cdf0e10cSrcweir /*************************************************************************
1000cdf0e10cSrcweir |*
1001cdf0e10cSrcweir |* RscFileTab::FindDef()
1002cdf0e10cSrcweir |*
1003cdf0e10cSrcweir |* Beschreibung
1004cdf0e10cSrcweir |* Ersterstellung MM 30.10.91
1005cdf0e10cSrcweir |* Letzte Aenderung MM 01.11.91
1006cdf0e10cSrcweir |*
1007cdf0e10cSrcweir *************************************************************************/
FindDef(sal_uLong lFileKey,const ByteString & rName)1008cdf0e10cSrcweir RscDefine * RscFileTab::FindDef( sal_uLong lFileKey, const ByteString & rName )
1009cdf0e10cSrcweir {
1010cdf0e10cSrcweir RscDefine * pDef = FindDef( rName );
1011cdf0e10cSrcweir
1012cdf0e10cSrcweir if( pDef )
1013cdf0e10cSrcweir //befindet sich das DEFINE in einer Include-Datei in der
1014cdf0e10cSrcweir //Datei lFileKey
1015cdf0e10cSrcweir if( Depend( lFileKey, pDef->GetFileKey() ) )
1016cdf0e10cSrcweir return pDef;
1017cdf0e10cSrcweir return NULL;
1018cdf0e10cSrcweir }
1019cdf0e10cSrcweir
1020cdf0e10cSrcweir /*************************************************************************
1021cdf0e10cSrcweir |*
1022cdf0e10cSrcweir |* RscFileTab::Depend()
1023cdf0e10cSrcweir |*
1024cdf0e10cSrcweir |* Beschreibung
1025cdf0e10cSrcweir |* Ersterstellung MM 08.11.91
1026cdf0e10cSrcweir |* Letzte Aenderung MM 08.11.91
1027cdf0e10cSrcweir |*
1028cdf0e10cSrcweir *************************************************************************/
Depend(sal_uLong lDepend,sal_uLong lFree)1029cdf0e10cSrcweir sal_Bool RscFileTab::Depend( sal_uLong lDepend, sal_uLong lFree ){
1030cdf0e10cSrcweir if( lDepend == lFree )
1031cdf0e10cSrcweir return sal_True;
1032cdf0e10cSrcweir
1033cdf0e10cSrcweir RscFile * pFile = First();
1034cdf0e10cSrcweir while( pFile ){
1035cdf0e10cSrcweir if( !pFile->IsIncFile() ){
1036cdf0e10cSrcweir if( !pFile->Depend( lDepend, lFree ) )
1037cdf0e10cSrcweir return sal_False;
1038cdf0e10cSrcweir };
1039cdf0e10cSrcweir pFile = Next();
1040cdf0e10cSrcweir };
1041cdf0e10cSrcweir
1042cdf0e10cSrcweir return sal_True;
1043cdf0e10cSrcweir }
1044cdf0e10cSrcweir
1045cdf0e10cSrcweir /*************************************************************************
1046cdf0e10cSrcweir |*
1047cdf0e10cSrcweir |* RscFileTab::TestDef()
1048cdf0e10cSrcweir |*
1049cdf0e10cSrcweir |* Beschreibung
1050cdf0e10cSrcweir |* Ersterstellung MM 14.01.92
1051cdf0e10cSrcweir |* Letzte Aenderung MM 14.01.92
1052cdf0e10cSrcweir |*
1053cdf0e10cSrcweir *************************************************************************/
TestDef(sal_uLong lFileKey,sal_uLong lPos,const RscDefine * pDefDec)1054cdf0e10cSrcweir sal_Bool RscFileTab::TestDef( sal_uLong lFileKey, sal_uLong lPos,
1055cdf0e10cSrcweir const RscDefine * pDefDec )
1056cdf0e10cSrcweir {
1057cdf0e10cSrcweir if( lFileKey == pDefDec->GetFileKey() ){
1058cdf0e10cSrcweir RscFile * pFile = GetFile( pDefDec->GetFileKey() );
1059cdf0e10cSrcweir if( pFile && (lPos <= pFile->aDefLst.GetPos( (RscDefine *)pDefDec ))
1060cdf0e10cSrcweir && (lPos != LIST_APPEND) )
1061cdf0e10cSrcweir return sal_False;
1062cdf0e10cSrcweir }
1063cdf0e10cSrcweir else if( !Depend( lFileKey, pDefDec->GetFileKey() ) )
1064cdf0e10cSrcweir return sal_False;
1065cdf0e10cSrcweir
1066cdf0e10cSrcweir return TestDef( lFileKey, lPos, pDefDec->pExp );
1067cdf0e10cSrcweir }
1068cdf0e10cSrcweir
1069cdf0e10cSrcweir /*************************************************************************
1070cdf0e10cSrcweir |*
1071cdf0e10cSrcweir |* RscFileTab::TestDef()
1072cdf0e10cSrcweir |*
1073cdf0e10cSrcweir |* Beschreibung
1074cdf0e10cSrcweir |* Ersterstellung MM 14.01.92
1075cdf0e10cSrcweir |* Letzte Aenderung MM 14.01.92
1076cdf0e10cSrcweir |*
1077cdf0e10cSrcweir *************************************************************************/
TestDef(sal_uLong lFileKey,sal_uLong lPos,const RscExpression * pExpDec)1078cdf0e10cSrcweir sal_Bool RscFileTab::TestDef( sal_uLong lFileKey, sal_uLong lPos,
1079cdf0e10cSrcweir const RscExpression * pExpDec )
1080cdf0e10cSrcweir {
1081cdf0e10cSrcweir if( !pExpDec )
1082cdf0e10cSrcweir return sal_True;
1083cdf0e10cSrcweir
1084cdf0e10cSrcweir if( pExpDec->aLeftExp.IsExpression() )
1085cdf0e10cSrcweir if( !TestDef( lFileKey, lPos, pExpDec->aLeftExp.aExp.pExp ) )
1086cdf0e10cSrcweir return sal_False;
1087cdf0e10cSrcweir
1088cdf0e10cSrcweir if( pExpDec->aLeftExp.IsDefinition() )
1089cdf0e10cSrcweir if( !TestDef( lFileKey, lPos, pExpDec->aLeftExp.aExp.pDef ) )
1090cdf0e10cSrcweir return sal_False;
1091cdf0e10cSrcweir
1092cdf0e10cSrcweir if( pExpDec->aRightExp.IsExpression() )
1093cdf0e10cSrcweir if( !TestDef( lFileKey, lPos, pExpDec->aRightExp.aExp.pExp ) )
1094cdf0e10cSrcweir return sal_False;
1095cdf0e10cSrcweir
1096cdf0e10cSrcweir if( pExpDec->aRightExp.IsDefinition() )
1097cdf0e10cSrcweir if( !TestDef( lFileKey, lPos, pExpDec->aRightExp.aExp.pDef ) )
1098cdf0e10cSrcweir return sal_False;
1099cdf0e10cSrcweir
1100cdf0e10cSrcweir return sal_True;
1101cdf0e10cSrcweir }
1102cdf0e10cSrcweir
1103cdf0e10cSrcweir /*************************************************************************
1104cdf0e10cSrcweir |*
1105cdf0e10cSrcweir |* RscFileTab::NewDef()
1106cdf0e10cSrcweir |*
1107cdf0e10cSrcweir |* Beschreibung
1108cdf0e10cSrcweir |* Ersterstellung MM 04.11.91
1109cdf0e10cSrcweir |* Letzte Aenderung MM 04.11.91
1110cdf0e10cSrcweir |*
1111cdf0e10cSrcweir *************************************************************************/
NewDef(sal_uLong lFileKey,const ByteString & rDefName,sal_Int32 lId,sal_uLong lPos)1112cdf0e10cSrcweir RscDefine * RscFileTab::NewDef( sal_uLong lFileKey, const ByteString & rDefName,
1113cdf0e10cSrcweir sal_Int32 lId, sal_uLong lPos )
1114cdf0e10cSrcweir {
1115cdf0e10cSrcweir RscDefine * pDef = FindDef( rDefName );
1116cdf0e10cSrcweir
1117cdf0e10cSrcweir if( !pDef ){
1118cdf0e10cSrcweir RscFile * pFile = GetFile( lFileKey );
1119cdf0e10cSrcweir
1120cdf0e10cSrcweir if( pFile ){
1121cdf0e10cSrcweir pDef = pFile->aDefLst.New( lFileKey, rDefName, lId, lPos );
1122cdf0e10cSrcweir aDefTree.Insert( pDef );
1123cdf0e10cSrcweir }
1124cdf0e10cSrcweir }
1125cdf0e10cSrcweir else
1126cdf0e10cSrcweir pDef = NULL;
1127cdf0e10cSrcweir
1128cdf0e10cSrcweir return( pDef );
1129cdf0e10cSrcweir }
1130cdf0e10cSrcweir
1131cdf0e10cSrcweir /*************************************************************************
1132cdf0e10cSrcweir |*
1133cdf0e10cSrcweir |* RscFileTab::NewDef()
1134cdf0e10cSrcweir |*
1135cdf0e10cSrcweir |* Beschreibung
1136cdf0e10cSrcweir |* Ersterstellung MM 04.11.91
1137cdf0e10cSrcweir |* Letzte Aenderung MM 04.11.91
1138cdf0e10cSrcweir |*
1139cdf0e10cSrcweir *************************************************************************/
NewDef(sal_uLong lFileKey,const ByteString & rDefName,RscExpression * pExp,sal_uLong lPos)1140cdf0e10cSrcweir RscDefine * RscFileTab::NewDef( sal_uLong lFileKey, const ByteString & rDefName,
1141cdf0e10cSrcweir RscExpression * pExp, sal_uLong lPos )
1142cdf0e10cSrcweir {
1143cdf0e10cSrcweir RscDefine * pDef = FindDef( rDefName );
1144cdf0e10cSrcweir
1145cdf0e10cSrcweir if( !pDef ){
1146cdf0e10cSrcweir //Macros in den Expressions sind definiert ?
1147cdf0e10cSrcweir if( TestDef( lFileKey, lPos, pExp ) ){
1148cdf0e10cSrcweir RscFile * pFile = GetFile( lFileKey );
1149cdf0e10cSrcweir
1150cdf0e10cSrcweir if( pFile ){
1151cdf0e10cSrcweir pDef = pFile->aDefLst.New( lFileKey, rDefName, pExp, lPos );
1152cdf0e10cSrcweir aDefTree.Insert( pDef );
1153cdf0e10cSrcweir }
1154cdf0e10cSrcweir }
1155cdf0e10cSrcweir }
1156cdf0e10cSrcweir else
1157cdf0e10cSrcweir pDef = NULL;
1158cdf0e10cSrcweir
1159cdf0e10cSrcweir if( !pDef ){
1160cdf0e10cSrcweir // pExp wird immer Eigentum und muss, wenn es nicht benoetigt wird
1161cdf0e10cSrcweir // geloescht werden
1162cdf0e10cSrcweir delete pExp;
1163cdf0e10cSrcweir }
1164cdf0e10cSrcweir return( pDef );
1165cdf0e10cSrcweir }
1166cdf0e10cSrcweir
1167cdf0e10cSrcweir /*************************************************************************
1168cdf0e10cSrcweir |*
1169cdf0e10cSrcweir |* RscFileTab::IsDefUsed()
1170cdf0e10cSrcweir |*
1171cdf0e10cSrcweir |* Beschreibung
1172cdf0e10cSrcweir |* Ersterstellung MM 22.11.91
1173cdf0e10cSrcweir |* Letzte Aenderung MM 22.11.91
1174cdf0e10cSrcweir |*
1175cdf0e10cSrcweir *************************************************************************/
IsDefUsed(const ByteString & rDefName)1176cdf0e10cSrcweir sal_Bool RscFileTab::IsDefUsed( const ByteString & rDefName )
1177cdf0e10cSrcweir {
1178cdf0e10cSrcweir RscDefine * pDef = FindDef( rDefName );
1179cdf0e10cSrcweir
1180cdf0e10cSrcweir if( pDef )
1181cdf0e10cSrcweir return( pDef->GetRefCount() != 2 );
1182cdf0e10cSrcweir
1183cdf0e10cSrcweir return sal_False;
1184cdf0e10cSrcweir }
1185cdf0e10cSrcweir
1186cdf0e10cSrcweir /*************************************************************************
1187cdf0e10cSrcweir |*
1188cdf0e10cSrcweir |* RscFileTab::DeleteDef()
1189cdf0e10cSrcweir |*
1190cdf0e10cSrcweir |* Beschreibung
1191cdf0e10cSrcweir |* Ersterstellung MM 11.11.91
1192cdf0e10cSrcweir |* Letzte Aenderung MM 11.11.91
1193cdf0e10cSrcweir |*
1194cdf0e10cSrcweir *************************************************************************/
DeleteDef(const ByteString & rDefName)1195cdf0e10cSrcweir void RscFileTab::DeleteDef( const ByteString & rDefName )
1196cdf0e10cSrcweir {
1197cdf0e10cSrcweir RscDefine * pDef = FindDef( rDefName );
1198cdf0e10cSrcweir RscFile * pFile;
1199cdf0e10cSrcweir
1200cdf0e10cSrcweir if( pDef ){
1201cdf0e10cSrcweir pFile = GetFile( pDef->GetFileKey() );
1202cdf0e10cSrcweir if( pFile ){
1203cdf0e10cSrcweir aDefTree.Remove( pDef );
1204cdf0e10cSrcweir pFile->aDefLst.Remove( pDef );
1205cdf0e10cSrcweir }
1206cdf0e10cSrcweir };
1207cdf0e10cSrcweir }
1208cdf0e10cSrcweir
1209cdf0e10cSrcweir /*************************************************************************
1210cdf0e10cSrcweir |*
1211cdf0e10cSrcweir |* RscFileTab::ChangeDef()
1212cdf0e10cSrcweir |*
1213cdf0e10cSrcweir |* Beschreibung
1214cdf0e10cSrcweir |* Ersterstellung MM 04.11.91
1215cdf0e10cSrcweir |* Letzte Aenderung MM 11.11.91
1216cdf0e10cSrcweir |*
1217cdf0e10cSrcweir *************************************************************************/
ChangeDef(const ByteString & rDefName,sal_Int32 lId)1218cdf0e10cSrcweir sal_Bool RscFileTab::ChangeDef( const ByteString & rDefName, sal_Int32 lId )
1219cdf0e10cSrcweir {
1220cdf0e10cSrcweir RscDefine * pDef = FindDef( rDefName );
1221cdf0e10cSrcweir
1222cdf0e10cSrcweir if( pDef ){
1223cdf0e10cSrcweir pDef->ChangeMacro( lId );
1224cdf0e10cSrcweir //alle Macros neu bewerten
1225cdf0e10cSrcweir return aDefTree.Evaluate();
1226cdf0e10cSrcweir };
1227cdf0e10cSrcweir return( sal_False );
1228cdf0e10cSrcweir }
1229cdf0e10cSrcweir
1230cdf0e10cSrcweir /*************************************************************************
1231cdf0e10cSrcweir |*
1232cdf0e10cSrcweir |* RscFileTab::ChangeDef()
1233cdf0e10cSrcweir |*
1234cdf0e10cSrcweir |* Beschreibung
1235cdf0e10cSrcweir |* Ersterstellung MM 04.11.91
1236cdf0e10cSrcweir |* Letzte Aenderung MM 11.11.91
1237cdf0e10cSrcweir |*
1238cdf0e10cSrcweir *************************************************************************/
ChangeDef(const ByteString & rDefName,RscExpression * pExp)1239cdf0e10cSrcweir sal_Bool RscFileTab::ChangeDef( const ByteString & rDefName,
1240cdf0e10cSrcweir RscExpression * pExp )
1241cdf0e10cSrcweir {
1242cdf0e10cSrcweir RscDefine * pDef = FindDef( rDefName );
1243cdf0e10cSrcweir RscFile * pFile;
1244cdf0e10cSrcweir sal_uLong lPos = 0;
1245cdf0e10cSrcweir
1246cdf0e10cSrcweir if( pDef ){
1247cdf0e10cSrcweir pFile = GetFile( pDef->GetFileKey() );
1248cdf0e10cSrcweir if( pFile )
1249cdf0e10cSrcweir lPos = pFile->aDefLst.GetPos( pDef );
1250cdf0e10cSrcweir //Macros in den Expressions sind definiert ?
1251cdf0e10cSrcweir if( TestDef( pDef->GetFileKey(), lPos, pExp ) ){
1252cdf0e10cSrcweir pDef->ChangeMacro( pExp );
1253cdf0e10cSrcweir //alle Macros neu bewerten
1254cdf0e10cSrcweir return aDefTree.Evaluate();
1255cdf0e10cSrcweir }
1256cdf0e10cSrcweir };
1257cdf0e10cSrcweir
1258cdf0e10cSrcweir // pExp wird immer Eigentum und muss, wenn es nicht benoetigt wird
1259cdf0e10cSrcweir // geloescht werden
1260cdf0e10cSrcweir delete pExp;
1261cdf0e10cSrcweir
1262cdf0e10cSrcweir return( sal_False );
1263cdf0e10cSrcweir }
1264cdf0e10cSrcweir
1265cdf0e10cSrcweir /*************************************************************************
1266cdf0e10cSrcweir |*
1267cdf0e10cSrcweir |* RscFileTab::ChangeDefName()
1268cdf0e10cSrcweir |*
1269cdf0e10cSrcweir |* Beschreibung
1270cdf0e10cSrcweir |* Ersterstellung MM 04.11.91
1271cdf0e10cSrcweir |* Letzte Aenderung MM 04.11.91
1272cdf0e10cSrcweir |*
1273cdf0e10cSrcweir *************************************************************************/
ChangeDefName(const ByteString & rDefName,const ByteString & rNewName)1274cdf0e10cSrcweir sal_Bool RscFileTab::ChangeDefName( const ByteString & rDefName,
1275cdf0e10cSrcweir const ByteString & rNewName )
1276cdf0e10cSrcweir {
1277cdf0e10cSrcweir RscDefine * pDef = FindDef( rDefName );
1278cdf0e10cSrcweir
1279cdf0e10cSrcweir //Name gefunden ?
1280cdf0e10cSrcweir if( pDef ){
1281cdf0e10cSrcweir // und neuer Name noch nicht bekannt ?
1282cdf0e10cSrcweir if( !FindDef( pDef->GetFileKey(), rNewName ) ){
1283cdf0e10cSrcweir aDefTree.Remove( pDef );
1284cdf0e10cSrcweir pDef->SetName( rNewName );
1285cdf0e10cSrcweir aDefTree.Insert( pDef );
1286cdf0e10cSrcweir return( sal_True );
1287cdf0e10cSrcweir }
1288cdf0e10cSrcweir };
1289cdf0e10cSrcweir
1290cdf0e10cSrcweir return( sal_False );
1291cdf0e10cSrcweir }
1292cdf0e10cSrcweir
1293cdf0e10cSrcweir /*************************************************************************
1294cdf0e10cSrcweir |*
1295cdf0e10cSrcweir |* RscFileTab::DeleteFileContext()
1296cdf0e10cSrcweir |*
1297cdf0e10cSrcweir |* Beschreibung
1298cdf0e10cSrcweir |* Ersterstellung MM 09.12.91
1299cdf0e10cSrcweir |* Letzte Aenderung MM 09.12.91
1300cdf0e10cSrcweir |*
1301cdf0e10cSrcweir *************************************************************************/
DeleteFileContext(sal_uLong lFileKey)1302cdf0e10cSrcweir void RscFileTab :: DeleteFileContext( sal_uLong lFileKey ){
1303cdf0e10cSrcweir RscFile * pFName;
1304cdf0e10cSrcweir
1305cdf0e10cSrcweir pFName = GetFile( lFileKey );
1306cdf0e10cSrcweir if( pFName ){
1307cdf0e10cSrcweir RscDefine * pDef;
1308cdf0e10cSrcweir
1309cdf0e10cSrcweir pDef = pFName->aDefLst.First();
1310cdf0e10cSrcweir while( pDef ){
1311cdf0e10cSrcweir aDefTree.Remove( pDef );
1312cdf0e10cSrcweir pDef = pFName->aDefLst.Next();
1313cdf0e10cSrcweir };
1314cdf0e10cSrcweir while( pFName->aDefLst.Remove( (sal_uLong)0 ) ) ;
1315cdf0e10cSrcweir }
1316cdf0e10cSrcweir }
1317cdf0e10cSrcweir
1318cdf0e10cSrcweir /*************************************************************************
1319cdf0e10cSrcweir |*
1320cdf0e10cSrcweir |* RscFileTab::DeleteFile()
1321cdf0e10cSrcweir |*
1322cdf0e10cSrcweir |* Beschreibung
1323cdf0e10cSrcweir |* Ersterstellung MM 16.05.91
1324cdf0e10cSrcweir |* Letzte Aenderung MM 16.05.91
1325cdf0e10cSrcweir |*
1326cdf0e10cSrcweir *************************************************************************/
DeleteFile(sal_uLong lFileKey)1327cdf0e10cSrcweir void RscFileTab :: DeleteFile( sal_uLong lFileKey ){
1328cdf0e10cSrcweir RscFile * pFName;
1329cdf0e10cSrcweir
1330cdf0e10cSrcweir //Defines freigeben
1331cdf0e10cSrcweir DeleteFileContext( lFileKey );
1332cdf0e10cSrcweir
1333cdf0e10cSrcweir //Schleife ueber alle Abhaengigkeiten
1334cdf0e10cSrcweir pFName = First();
1335cdf0e10cSrcweir while( pFName ){
1336cdf0e10cSrcweir pFName->RemoveDependFile( lFileKey );
1337cdf0e10cSrcweir pFName = Next();
1338cdf0e10cSrcweir };
1339cdf0e10cSrcweir
1340cdf0e10cSrcweir pFName = Remove( lFileKey );
1341cdf0e10cSrcweir if( pFName )
1342cdf0e10cSrcweir delete pFName;
1343cdf0e10cSrcweir }
1344cdf0e10cSrcweir
1345cdf0e10cSrcweir /*************************************************************************
1346cdf0e10cSrcweir |*
1347cdf0e10cSrcweir |* RscFileTab::NewCodeFile()
1348cdf0e10cSrcweir |*
1349cdf0e10cSrcweir |* Beschreibung
1350cdf0e10cSrcweir |* Ersterstellung MM 16.05.91
1351cdf0e10cSrcweir |* Letzte Aenderung MM 16.05.91
1352cdf0e10cSrcweir |*
1353cdf0e10cSrcweir *************************************************************************/
NewCodeFile(const ByteString & rName)1354cdf0e10cSrcweir sal_uLong RscFileTab :: NewCodeFile( const ByteString & rName )
1355cdf0e10cSrcweir {
1356cdf0e10cSrcweir sal_uLong lKey;
1357cdf0e10cSrcweir RscFile * pFName;
1358cdf0e10cSrcweir
1359cdf0e10cSrcweir lKey = Find( rName );
1360cdf0e10cSrcweir if( UNIQUEINDEX_ENTRY_NOTFOUND == lKey )
1361cdf0e10cSrcweir {
1362cdf0e10cSrcweir pFName = new RscFile();
1363cdf0e10cSrcweir pFName->aFileName = rName;
1364cdf0e10cSrcweir pFName->aPathName = rName;
1365cdf0e10cSrcweir lKey = Insert( pFName );
1366cdf0e10cSrcweir pFName->InsertDependFile( lKey, LIST_APPEND );
1367cdf0e10cSrcweir }
1368cdf0e10cSrcweir return lKey;
1369cdf0e10cSrcweir }
1370cdf0e10cSrcweir
1371cdf0e10cSrcweir /*************************************************************************
1372cdf0e10cSrcweir |*
1373cdf0e10cSrcweir |* RscFileTab::NewIncFile()
1374cdf0e10cSrcweir |*
1375cdf0e10cSrcweir |* Beschreibung
1376cdf0e10cSrcweir |* Ersterstellung MM 16.05.91
1377cdf0e10cSrcweir |* Letzte Aenderung MM 16.05.91
1378cdf0e10cSrcweir |*
1379cdf0e10cSrcweir *************************************************************************/
NewIncFile(const ByteString & rName,const ByteString & rPath)1380cdf0e10cSrcweir sal_uLong RscFileTab :: NewIncFile( const ByteString & rName,
1381cdf0e10cSrcweir const ByteString & rPath )
1382cdf0e10cSrcweir {
1383cdf0e10cSrcweir sal_uLong lKey;
1384cdf0e10cSrcweir RscFile * pFName;
1385cdf0e10cSrcweir
1386cdf0e10cSrcweir lKey = Find( rName );
1387cdf0e10cSrcweir if( UNIQUEINDEX_ENTRY_NOTFOUND == lKey )
1388cdf0e10cSrcweir {
1389cdf0e10cSrcweir pFName = new RscFile();
1390cdf0e10cSrcweir pFName->aFileName = rName;
1391cdf0e10cSrcweir pFName->aPathName = rPath;
1392cdf0e10cSrcweir pFName->SetIncFlag();
1393cdf0e10cSrcweir lKey = Insert( pFName );
1394cdf0e10cSrcweir pFName->InsertDependFile( lKey, LIST_APPEND );
1395cdf0e10cSrcweir }
1396cdf0e10cSrcweir return lKey;
1397cdf0e10cSrcweir }
1398