xref: /aoo42x/main/rsc/inc/rscclass.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 _RSCCLASS_HXX
24 #define _RSCCLASS_HXX
25 
26 #include <rscall.h>
27 #include <rscerror.h>
28 #include <rschash.hxx>
29 #include <rsctop.hxx>
30 
31 /******************* R s c C l a s s *************************************/
32 class RscClass : public RscTop
33 {
34 protected:
35     struct RscClassInst{
36         sal_uLong   nVarDflt;
37     };
38     struct VARTYPE_STRUCT {
39         Atom            nVarName;   // Variablenname
40         RSCVAR          nVarType;   // Variablentyp
41         sal_uInt32      nMask;      // Maskierungsbit
42         sal_uInt32      nOffset;    // Beginn der Instanzdaten
43         RscTop *        pClass;     // Klasse
44         CLASS_DATA      pDefault;   // Zeiger auf DefaultDaten
45         Atom            nDataBaseName;//Name fuer Fremddatenbereich
46     };
47     sal_uInt32              nSuperSize; // Groesse der Instanzdaten der SuperKl.
48     sal_uInt32              nSize;      // Groesse der Instanzdaten dieser Klasse
49                                     // mit Superklassen
50     sal_uInt32              nEntries;   // Eintraege in pVarTypeList
51     VARTYPE_STRUCT *    pVarTypeList;   // Variablenliste
52     RSCINST             GetInstData( CLASS_DATA pData, sal_uInt32 nEle,
53                                      sal_Bool bGetCopy = sal_False );
54     CLASS_DATA          GetDfltData( sal_uInt32 nEle );
55     sal_Bool                IsDflt( CLASS_DATA pData, sal_uInt32 nEle );
56     sal_Bool                IsValueDflt( CLASS_DATA pData, sal_uInt32 nEle );
57     void                SetVarDflt( CLASS_DATA pData, sal_uInt32 nEle,
58                                     sal_Bool bSet );
59     sal_Int32               GetCorrectValues( const RSCINST & rInst, sal_uInt32 nVarPos,
60                                         sal_uInt32 nTupelIdx, RscTypCont * pTC );
61 public:
62                     RscClass( Atom nId, sal_uInt32 nTypId, RscTop * pSuperCl );
63                     ~RscClass();
64 
65     virtual RSCCLASS_TYPE   GetClassType() const;
66 
67     void            Pre_dtor();
68     ERRTYPE         SetVariable( Atom nVarName, RscTop * pClass,
69                                  RSCINST * pDflt,
70                                  RSCVAR nVarType, sal_uInt32 nMask,
71                                  Atom nDataBaseName );
72     virtual void    EnumVariables( void * pData, VarEnumCallbackProc );
73     RSCINST         GetVariable( const RSCINST & rInst, Atom nVarName,
74                                  const RSCINST & rInitInst,
75                                  sal_Bool nInitDflt = sal_False,
76 								 RscTop * pCreateClass = NULL );
77     RSCINST         GetCopyVar( const RSCINST & rInst, Atom nVarName );
78 
79                     // Gibt die Groesse der Klasse in Bytes
Size()80     sal_uInt32          Size(){ return( nSize ); };
81 
82     sal_Bool            IsConsistent( const RSCINST & rInst, RscInconsList * pList );
83     void            SetToDefault( const RSCINST & rInst );
84     sal_Bool            IsDefault( const RSCINST & rInst );
85     sal_Bool            IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
86     void            SetDefault( const RSCINST & rData, Atom nVarId );
87     using RscTop::GetDefault;
88     RSCINST         GetDefault( Atom nVarId );
89 
90     RSCINST         Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool );
91     void            Destroy( const RSCINST & rInst );
92     void            WriteSrc( const RSCINST & rInst, FILE * fOutput,
93                               RscTypCont * pTC, sal_uInt32 nTab, const char * );
94     ERRTYPE         WriteInstRc( const RSCINST & rInst, RscWriteRc & aMem,
95                                  RscTypCont * pTC, sal_uInt32, sal_Bool bExtra );
96     ERRTYPE         WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
97                              RscTypCont * pTC, sal_uInt32, sal_Bool bExtra );
98     void            WriteSyntax( FILE * fOutput, RscTypCont * pTC );
99 
100 	void			WriteRcAccess( FILE * fOutput, RscTypCont * pTC,
101 								const char * );
102 	void			WriteRcCtor( FILE * fOutput, RscTypCont * pTC );
103 };
104 
105 class RscSysDepend : public RscClass
106 {
107 public:
108                     RscSysDepend( Atom nId, sal_uInt32 nTypId, RscTop * pSuper );
109     ERRTYPE         WriteSysDependRc( const RSCINST &, RscWriteRc & aMem,
110                                     RscTypCont * pTC, sal_uInt32, sal_Bool bExtra,
111                                     sal_Bool bFirst = sal_False );
112     ERRTYPE         WriteRc( const RSCINST &, RscWriteRc & aMem,
113                              RscTypCont * pTC, sal_uInt32, sal_Bool bExtra );
114 };
115 
116 class RscFirstSysDepend : public RscSysDepend
117 {
118 public:
119                     RscFirstSysDepend( Atom nId, sal_uInt32 nTypId,
120                                         RscTop * pSuper );
121     ERRTYPE         WriteRc( const RSCINST &, RscWriteRc & aMem,
122                              RscTypCont * pTC, sal_uInt32, sal_Bool bExtra );
123 };
124 
125 class RscTupel : public RscClass
126 {
127 public:
128     RscTupel( Atom nId, sal_uInt32 nTypId, RscTop * pSuper );
129     RSCINST         GetTupelVar( const RSCINST & rInst, sal_uInt32 nPos,
130                                 const RSCINST & rInitInst );
131     void            WriteSrc( const RSCINST & rInst, FILE * fOutput,
132                               RscTypCont * pTC, sal_uInt32 nTab, const char * );
133 };
134 
135 #endif //_RSCCLASS_HXX
136