xref: /aoo42x/main/rsc/inc/rscarray.hxx (revision f7c60c9c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _RSCARRAY_HXX
24 #define _RSCARRAY_HXX
25 
26 #include <rscall.h>
27 #include <rscerror.h>
28 #include <rsctop.hxx>
29 
30 class RscEnum;
31 
32 /******************* R s c A r r a y ************************************/
33 class RscInstNode : public IdNode
34 {
35 	sal_uInt32	nTypeId;
36 protected:
37     using NameNode::Search;
38 public:
39 	RSCINST	aInst;
40 	RscInstNode( sal_uInt32 nId );
41 	~RscInstNode();
42 	virtual sal_uInt32	GetId() const;
Left() const43 	RscInstNode *   Left() const { return (RscInstNode *)pLeft  ; };
Right() const44 	RscInstNode *   Right() const{ return (RscInstNode *)pRight ; };
Search(sal_uInt32 nId) const45 	RscInstNode *	Search( sal_uInt32 nId ) const
46 					{
47 						return (RscInstNode *)IdNode::Search( nId );
48 					}
49 };
50 
51 struct RscArrayInst
52 {
53 	RscInstNode *	pNode;
54 };
55 
56 /* Der Baum wird ueber die Werte des Enums sortiert, nicht ueber
57 	seine HashId.
58 */
59 class RscArray : public RscTop
60 {
61 protected:
62     RscEnum *       pTypeClass; // Typ der Eintraege
63     sal_uInt32          nSize;      // Groesse der Instanzdaten dieser Klasse
64                                 // mit Superklassen
65     sal_uInt32          nOffInstData;// Offset auf eigen Instanzdaten
66     void            WriteSrcArray( const RSCINST & rInst, FILE * fOutput,
67                               	RscTypCont * pTC, sal_uInt32 nTab, const char * );
68 public:
69                     RscArray( Atom nId, sal_uInt32 nTypId,
70                                 RscTop * pSuper, RscEnum * pTypeClass );
71                     ~RscArray();
72 	virtual RSCCLASS_TYPE	GetClassType() const;
73 
SetTypeClass(RscEnum * pClass)74     void            SetTypeClass( RscEnum * pClass )
75 					{
76                         pTypeClass = pClass;
77                     }
78     virtual RscTop *    GetTypeClass() const;
79     RSCINST         Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool );
80     void            Destroy( const RSCINST & rInst );
81     virtual ERRTYPE GetValueEle( const RSCINST & rInst, sal_Int32 lValue,
82 								RscTop * pCreateClass,
83                                 RSCINST * pGetInst );
84     virtual ERRTYPE GetArrayEle( const RSCINST & rInst, Atom nId,
85 								RscTop * pCreateClass,
86                                 RSCINST * pGetInst );
87 
88                     // Gibt die Groesse der Klasse in Bytes
Size()89     sal_uInt32          Size(){ return( nSize ); };
90 
91     sal_Bool            IsConsistent( const RSCINST & rInst, RscInconsList * pList );
92 	virtual void	SetToDefault( const RSCINST & rInst );
93     sal_Bool            IsDefault( const RSCINST & rInst );
94     sal_Bool            IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
95 
96     virtual void    WriteSrcHeader( const RSCINST & rInst, FILE * fOutput,
97                                     RscTypCont * pTC, sal_uInt32 nTab,
98                                     const RscId & aId, const char * );
99     void            WriteSrc( const RSCINST & rInst, FILE * fOutput,
100                               RscTypCont * pTC, sal_uInt32 nTab, const char * );
101     ERRTYPE         WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
102                              RscTypCont * pTC, sal_uInt32, sal_Bool bExtra );
103 	virtual void	WriteRcAccess( FILE * fOutput, RscTypCont * pTC,
104 									const char * );
105 };
106 
107 class RscClassArray : public RscArray
108 {
109 public:
110                     RscClassArray( Atom nId, sal_uInt32 nTypId,
111                                 RscTop * pSuper, RscEnum * pTypeClass );
112                     ~RscClassArray();
113     virtual void    WriteSrcHeader( const RSCINST & rInst, FILE * fOutput,
114                                     RscTypCont * pTC, sal_uInt32 nTab,
115                                     const RscId & aId, const char * );
116     void            WriteSrc( const RSCINST & rInst, FILE * fOutput,
117                               RscTypCont * pTC, sal_uInt32 nTab, const char * );
118     virtual ERRTYPE WriteRcHeader( const RSCINST & rInst, RscWriteRc & aMem,
119                                    RscTypCont * pTC, const RscId & aId,
120                     				sal_uInt32 nDeep, sal_Bool bExtra );
121 };
122 
123 
124 class RscLangArray : public RscArray
125 {
126 public:
127                     RscLangArray( Atom nId, sal_uInt32 nTypId,
128                                 RscTop * pSuper, RscEnum * pTypeClass );
129 	virtual RSCCLASS_TYPE	GetClassType() const;
130 };
131 
132 #endif //_RSCARRAY
133