diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2013-07-03 02:35:31 -0500 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2013-07-03 20:53:12 +0000 |
commit | bb45bdf359c65c174fd557d615f77ceb46fa685c (patch) | |
tree | 1f87575ee1d0471b14f5078a99d3a589d955d56d /rsc | |
parent | 27a4d5597c0757611d0e2e682d0c05441859cc4e (diff) |
module rsc: String, bool and other clean-up.
Change-Id: I2dcde42e6068631a5a643961a764df86dc63dca2
Reviewed-on: https://gerrit.libreoffice.org/4690
Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
Diffstat (limited to 'rsc')
42 files changed, 2883 insertions, 2466 deletions
diff --git a/rsc/inc/rscall.h b/rsc/inc/rscall.h index 96b3954174d3..b1b919205304 100644 --- a/rsc/inc/rscall.h +++ b/rsc/inc/rscall.h @@ -70,25 +70,28 @@ extern AtomContainer* pHS; /******************* T y p e s *******************************************/ enum RSCCLASS_TYPE { RSCCLASS_BOOL, RSCCLASS_STRING, RSCCLASS_NUMBER, - RSCCLASS_CONST, RSCCLASS_COMPLEX, RSCCLASS_ENUMARRAY }; + RSCCLASS_CONST, RSCCLASS_COMPLEX, RSCCLASS_ENUMARRAY }; typedef void (* VarEnumCallbackProc)( void * pData, RSCCLASS_TYPE, Atom ); /******************* S t r u c t s ***************************************/ -struct RSCINST { +struct RSCINST +{ RscTop * pClass; CLASS_DATA pData; RSCINST(){ pClass = NULL; pData = NULL; } - RSCINST( RscTop * pCl, CLASS_DATA pClassData ){ - pClass = pCl; - pData = pClassData; - } - sal_Bool IsInst() const { return( pData != NULL ); } + RSCINST( RscTop * pCl, CLASS_DATA pClassData ) + { + pClass = pCl; + pData = pClassData; + } + bool IsInst() const { return( pData != NULL ); } }; /********************** S U B I N F O S T R U C T ************************/ -struct SUBINFO_STRUCT { +struct SUBINFO_STRUCT +{ SUBINFO_STRUCT(){ nPos = 0; pClass = NULL; }; RscId aId; // Identifier der Resource sal_uInt32 nPos; // Position der Resource diff --git a/rsc/inc/rscarray.hxx b/rsc/inc/rscarray.hxx index 9d036a5fc4fe..a3ec217ba73a 100644 --- a/rsc/inc/rscarray.hxx +++ b/rsc/inc/rscarray.hxx @@ -38,9 +38,9 @@ public: RscInstNode * Left() const { return (RscInstNode *)pLeft ; }; RscInstNode * Right() const{ return (RscInstNode *)pRight ; }; RscInstNode * Search( sal_uInt32 nId ) const - { - return (RscInstNode *)IdNode::Search( nId ); - } + { + return (RscInstNode *)IdNode::Search( nId ); + } }; struct RscArrayInst @@ -55,38 +55,35 @@ class RscArray : public RscTop { protected: RscEnum * pTypeClass; // Typ der Eintraege - sal_uInt32 nSize; // Groesse der Instanzdaten dieser Klasse + sal_uInt32 nSize; // Groesse der Instanzdaten dieser Klasse // mit Superklassen - sal_uInt32 nOffInstData;// Offset auf eigen Instanzdaten + sal_uInt32 nOffInstData;// Offset auf eigen Instanzdaten void WriteSrcArray( const RSCINST & rInst, FILE * fOutput, - RscTypCont * pTC, sal_uInt32 nTab, const char * ); + RscTypCont * pTC, sal_uInt32 nTab, const char * ); public: RscArray( Atom nId, sal_uInt32 nTypId, - RscTop * pSuper, RscEnum * pTypeClass ); + RscTop * pSuper, RscEnum * pTypeClass ); ~RscArray(); virtual RSCCLASS_TYPE GetClassType() const; - void SetTypeClass( RscEnum * pClass ) - { - pTypeClass = pClass; - } + void SetTypeClass( RscEnum * pClass ) { pTypeClass = pClass; } virtual RscTop * GetTypeClass() const; - RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool ); + RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, bool ); void Destroy( const RSCINST & rInst ); virtual ERRTYPE GetValueEle( const RSCINST & rInst, sal_Int32 lValue, - RscTop * pCreateClass, - RSCINST * pGetInst ); + RscTop * pCreateClass, + RSCINST * pGetInst ); virtual ERRTYPE GetArrayEle( const RSCINST & rInst, Atom nId, - RscTop * pCreateClass, - RSCINST * pGetInst ); + RscTop * pCreateClass, + RSCINST * pGetInst ); // Gibt die Groesse der Klasse in Bytes - sal_uInt32 Size(){ return( nSize ); }; + sal_uInt32 Size(){ return nSize; } - sal_Bool IsConsistent( const RSCINST & rInst ); + bool IsConsistent( const RSCINST & rInst ); virtual void SetToDefault( const RSCINST & rInst ); - sal_Bool IsDefault( const RSCINST & rInst ); - sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + bool IsDefault( const RSCINST & rInst ); + bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); virtual void WriteSrcHeader( const RSCINST & rInst, FILE * fOutput, RscTypCont * pTC, sal_uInt32 nTab, @@ -94,14 +91,14 @@ public: void WriteSrc( const RSCINST & rInst, FILE * fOutput, RscTypCont * pTC, sal_uInt32 nTab, const char * ); ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, - RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); + RscTypCont * pTC, sal_uInt32, bool bExtra ); }; class RscClassArray : public RscArray { public: RscClassArray( Atom nId, sal_uInt32 nTypId, - RscTop * pSuper, RscEnum * pTypeClass ); + RscTop * pSuper, RscEnum * pTypeClass ); ~RscClassArray(); virtual void WriteSrcHeader( const RSCINST & rInst, FILE * fOutput, RscTypCont * pTC, sal_uInt32 nTab, @@ -110,7 +107,7 @@ public: RscTypCont * pTC, sal_uInt32 nTab, const char * ); virtual ERRTYPE WriteRcHeader( const RSCINST & rInst, RscWriteRc & aMem, RscTypCont * pTC, const RscId & aId, - sal_uInt32 nDeep, sal_Bool bExtra ); + sal_uInt32 nDeep, bool bExtra ); }; @@ -118,7 +115,7 @@ class RscLangArray : public RscArray { public: RscLangArray( Atom nId, sal_uInt32 nTypId, - RscTop * pSuper, RscEnum * pTypeClass ); + RscTop * pSuper, RscEnum * pTypeClass ); virtual RSCCLASS_TYPE GetClassType() const; }; diff --git a/rsc/inc/rscclass.hxx b/rsc/inc/rscclass.hxx index 609d288f8a68..f32ab9d1aaca 100644 --- a/rsc/inc/rscclass.hxx +++ b/rsc/inc/rscclass.hxx @@ -27,10 +27,12 @@ class RscClass : public RscTop { protected: - struct RscClassInst{ - sal_uLong nVarDflt; + struct RscClassInst + { + sal_uLong nVarDflt; }; - struct VARTYPE_STRUCT { + struct VARTYPE_STRUCT + { Atom nVarName; // Variablenname RSCVAR nVarType; // Variablentyp sal_uInt32 nMask; // Maskierungsbit @@ -39,20 +41,20 @@ protected: CLASS_DATA pDefault; // Zeiger auf DefaultDaten Atom nDataBaseName;//Name fuer Fremddatenbereich }; - sal_uInt32 nSuperSize; // Groesse der Instanzdaten der SuperKl. - sal_uInt32 nSize; // Groesse der Instanzdaten dieser Klasse + sal_uInt32 nSuperSize; // Groesse der Instanzdaten der SuperKl. + sal_uInt32 nSize; // Groesse der Instanzdaten dieser Klasse // mit Superklassen - sal_uInt32 nEntries; // Eintraege in pVarTypeList + sal_uInt32 nEntries; // Eintraege in pVarTypeList VARTYPE_STRUCT * pVarTypeList; // Variablenliste RSCINST GetInstData( CLASS_DATA pData, sal_uInt32 nEle, - sal_Bool bGetCopy = sal_False ); + bool bGetCopy = false ); CLASS_DATA GetDfltData( sal_uInt32 nEle ); - sal_Bool IsDflt( CLASS_DATA pData, sal_uInt32 nEle ); - sal_Bool IsValueDflt( CLASS_DATA pData, sal_uInt32 nEle ); + bool IsDflt( CLASS_DATA pData, sal_uInt32 nEle ); + bool IsValueDflt( CLASS_DATA pData, sal_uInt32 nEle ); void SetVarDflt( CLASS_DATA pData, sal_uInt32 nEle, - sal_Bool bSet ); - sal_Int32 GetCorrectValues( const RSCINST & rInst, sal_uInt32 nVarPos, - sal_uInt32 nTupelIdx, RscTypCont * pTC ); + bool bSet ); + sal_Int32 GetCorrectValues( const RSCINST & rInst, sal_uInt32 nVarPos, + sal_uInt32 nTupelIdx, RscTypCont * pTC ); public: RscClass( Atom nId, sal_uInt32 nTypId, RscTop * pSuperCl ); ~RscClass(); @@ -67,29 +69,29 @@ public: virtual void EnumVariables( void * pData, VarEnumCallbackProc ); RSCINST GetVariable( const RSCINST & rInst, Atom nVarName, const RSCINST & rInitInst, - sal_Bool nInitDflt = sal_False, + bool nInitDflt = false, RscTop * pCreateClass = NULL ); RSCINST GetCopyVar( const RSCINST & rInst, Atom nVarName ); // Gibt die Groesse der Klasse in Bytes - sal_uInt32 Size(){ return( nSize ); }; + sal_uInt32 Size(){ return nSize; } - sal_Bool IsConsistent( const RSCINST & rInst ); + bool IsConsistent( const RSCINST & rInst ); void SetToDefault( const RSCINST & rInst ); - sal_Bool IsDefault( const RSCINST & rInst ); - sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + bool IsDefault( const RSCINST & rInst ); + bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); void SetDefault( const RSCINST & rData, Atom nVarId ); using RscTop::GetDefault; RSCINST GetDefault( Atom nVarId ); - RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool ); + RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, bool ); void Destroy( const RSCINST & rInst ); void WriteSrc( const RSCINST & rInst, FILE * fOutput, RscTypCont * pTC, sal_uInt32 nTab, const char * ); ERRTYPE WriteInstRc( const RSCINST & rInst, RscWriteRc & aMem, - RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); + RscTypCont * pTC, sal_uInt32, bool bExtra ); ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, - RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); + RscTypCont * pTC, sal_uInt32, bool bExtra ); }; class RscSysDepend : public RscClass @@ -97,10 +99,10 @@ class RscSysDepend : public RscClass public: RscSysDepend( Atom nId, sal_uInt32 nTypId, RscTop * pSuper ); ERRTYPE WriteSysDependRc( const RSCINST &, RscWriteRc & aMem, - RscTypCont * pTC, sal_uInt32, sal_Bool bExtra, - sal_Bool bFirst = sal_False ); + RscTypCont * pTC, sal_uInt32, bool bExtra, + bool bFirst = false ); ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, - RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); + RscTypCont * pTC, sal_uInt32, bool bExtra ); }; class RscTupel : public RscClass @@ -108,7 +110,7 @@ class RscTupel : public RscClass public: RscTupel( Atom nId, sal_uInt32 nTypId, RscTop * pSuper ); RSCINST GetTupelVar( const RSCINST & rInst, sal_uInt32 nPos, - const RSCINST & rInitInst ); + const RSCINST & rInitInst ); void WriteSrc( const RSCINST & rInst, FILE * fOutput, RscTypCont * pTC, sal_uInt32 nTab, const char * ); }; diff --git a/rsc/inc/rscclobj.hxx b/rsc/inc/rscclobj.hxx index 8eba2316da4c..463f119778d4 100644 --- a/rsc/inc/rscclobj.hxx +++ b/rsc/inc/rscclobj.hxx @@ -24,10 +24,11 @@ #include <rscall.h> /******************* O b j N o d e ***************************************/ -class ObjNode : public IdNode{ +class ObjNode : public IdNode +{ RscId aRscId; // Id der Resource CLASS_DATA pRscObj;// pointer to a resourceobject - sal_uLong lFileKey;// Dateischluessel + sal_uLong lFileKey;// Dateischluessel protected: using NameNode::Search; @@ -36,26 +37,29 @@ public: ObjNode( const RscId & rId, CLASS_DATA pData, sal_uLong lKey ); ObjNode * DelObjNode( RscTop * pClass, sal_uLong lFileKey ); - sal_uInt32 GetId() const; + sal_uInt32 GetId() const; RscId GetRscId(){ return( aRscId ); } - sal_uLong GetFileKey(){ return lFileKey; }; - ObjNode* Search( const RscId &rName ) const{ - // search the index in the b-tree - return( (ObjNode *)IdNode::Search( rName ) ); - } - sal_Bool Insert( ObjNode* pTN ){ - // insert a new node in the b-tree - return( IdNode::Insert( (IdNode *)pTN ) ); - } - CLASS_DATA GetRscObj(){ - // get the Object from this Node - return( pRscObj ); - } - sal_Bool IsConsistent(); + sal_uLong GetFileKey(){ return lFileKey; }; + ObjNode* Search( const RscId &rName ) const //< search the index in the b-tree + { + return( (ObjNode *)IdNode::Search( rName ) ); + } + bool Insert( ObjNode* pTN ) //< insert a new node in the b-tree + + { + return( IdNode::Insert( (IdNode *)pTN ) ); + } + CLASS_DATA GetRscObj() //< get the Object from this Node + + { + return( pRscObj ); + } + bool IsConsistent(); }; /******************* R e f N o d e ***************************************/ -class RefNode : public IdNode{ +class RefNode : public IdNode +{ Atom nTypNameId; // index of a Name in a hashtabel protected: using NameNode::Search; @@ -65,24 +69,25 @@ public: ObjNode* pObjBiTree; // Zeiger auf Objektbaum RefNode( Atom nTyp ); - sal_uInt32 GetId() const; - RefNode* Search( Atom typ ) const{ - // search the index in the b-tree - return( (RefNode *)IdNode::Search( typ ) ); - }; - sal_Bool Insert( RefNode* pTN ){ - // insert a new node in the b-tree - return( IdNode::Insert( (IdNode *)pTN ) ); - }; - sal_Bool PutObjNode( ObjNode * pPutObject ); + sal_uInt32 GetId() const; + RefNode* Search( Atom typ ) const //< search the index in the b-tree + { + return( (RefNode *)IdNode::Search( typ ) ); + } + bool Insert( RefNode* pTN ) //< insert a new node in the b-tree + { + return( IdNode::Insert( (IdNode *)pTN ) ); + } + bool PutObjNode( ObjNode * pPutObject ); // insert new node in b-tree pObjBiTree ObjNode * GetObjNode( const RscId &rRscId ); - ObjNode * GetObjNode(){ - // hole pObjBiTree - return( pObjBiTree ); - }; + ObjNode * GetObjNode() + { + // hole pObjBiTree + return( pObjBiTree ); + } }; #endif // _RSCCLOBJ_HXX diff --git a/rsc/inc/rscconst.hxx b/rsc/inc/rscconst.hxx index 3cba043db1fc..1e48f27bfcce 100644 --- a/rsc/inc/rscconst.hxx +++ b/rsc/inc/rscconst.hxx @@ -27,46 +27,49 @@ class RscConst : public RscTop { protected: - struct VarEle { + struct VarEle + { Atom nId; // Name der Konstante sal_Int32 lValue; // Wert der Konstante }; - VarEle * pVarArray; // Zeiger auf das Feld mit Konstanten + VarEle * pVarArray; // Zeiger auf das Feld mit Konstanten sal_uInt32 nEntries; // Anzahle der Eintraege im Feld public: RscConst( Atom nId, sal_uInt32 nTypId ); ~RscConst(); virtual RSCCLASS_TYPE GetClassType() const; - sal_uInt32 GetEntryCount() const { return nEntries; } + sal_uInt32 GetEntryCount() const { return nEntries; } // Die erlaubten Werte werden gesetzt ERRTYPE SetConstant( Atom nVarName, sal_Int32 lValue ); Atom GetConstant( sal_uInt32 nPos ); - sal_Bool GetConstValue( Atom nConstId, sal_Int32 * pVal ) const; - sal_Bool GetValueConst( sal_Int32 nValue, Atom * pConstId ) const; + bool GetConstValue( Atom nConstId, sal_Int32 * pVal ) const; + bool GetValueConst( sal_Int32 nValue, Atom * pConstId ) const; sal_uInt32 GetConstPos( Atom nConstId ); }; -class RscEnum : public RscConst { - struct RscEnumInst { +class RscEnum : public RscConst +{ + struct RscEnumInst + { sal_uInt32 nValue; // Position der Konstanten im Array - sal_Bool bDflt; // Ist Default + bool bDflt; // Ist Default }; - sal_uInt32 nSize; + sal_uInt32 nSize; public: RscEnum( Atom nId, sal_uInt32 nTypId ); - RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, sal_Bool ); - sal_uInt32 Size(){ return nSize; } + RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, bool ); + sal_uInt32 Size(){ return nSize; } virtual void SetToDefault( const RSCINST & rInst ) { - ((RscEnumInst*)rInst.pData)->bDflt = sal_True; + ((RscEnumInst*)rInst.pData)->bDflt = true; } - sal_Bool IsDefault( const RSCINST & rInst ) + bool IsDefault( const RSCINST & rInst ) { return( ((RscEnumInst*)rInst.pData)->bDflt ); }; // Als Default setzen - sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId, sal_Int32 nValue ); @@ -76,7 +79,7 @@ public: void WriteSrc( const RSCINST &rInst, FILE * fOutput, RscTypCont * pTC, sal_uInt32 nTab, const char * ); ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, - RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); + RscTypCont * pTC, sal_uInt32, bool bExtra ); }; class RscNameTable; diff --git a/rsc/inc/rsccont.hxx b/rsc/inc/rsccont.hxx index fe7ad8704765..e23f1455b5d7 100644 --- a/rsc/inc/rsccont.hxx +++ b/rsc/inc/rsccont.hxx @@ -23,16 +23,18 @@ #include <rscerror.h> #include <rsctop.hxx> -struct ENTRY_STRUCT { +struct ENTRY_STRUCT +{ RscId aName; RSCINST aInst; void Create(){ aName.Create(); aInst = RSCINST(); } void Destroy(); }; -struct RscBaseContInst { +struct RscBaseContInst +{ sal_uInt32 nEntries; ENTRY_STRUCT * pEntries; - sal_Bool bDflt; + bool bDflt; }; class RscBaseCont : public RscTop @@ -40,10 +42,10 @@ class RscBaseCont : public RscTop protected: RscTop * pTypeClass; // Typ der Eintraege RscTop * pTypeClass1;// Zwei verschiedene Typen moeglich - sal_Bool bNoId; // Keine Identifier - sal_uInt32 nSize; // Groesse der Instanzdaten dieser Klasse + bool bNoId; // Keine Identifier + sal_uInt32 nSize; // Groesse der Instanzdaten dieser Klasse // mit Superklassen - sal_uInt32 nOffInstData;// Offset auf eigen Instanzdaten + sal_uInt32 nOffInstData;// Offset auf eigen Instanzdaten void DestroyElements( RscBaseContInst * pClassData ); RSCINST SearchElePos( const RSCINST & rInst, const RscId & rEleName, RscTop * pClass, sal_uInt32 nPos ); @@ -51,19 +53,19 @@ protected: void ContWriteSrc( const RSCINST & rInst, FILE * fOutput, RscTypCont * pTC, sal_uInt32 nTab, const char * ); ERRTYPE ContWriteRc( const RSCINST & rInst, RscWriteRc & aMem, - RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); + RscTypCont * pTC, sal_uInt32, bool bExtra ); public: RscBaseCont( Atom nId, sal_uInt32 nTypId, RscTop * pSuper = NULL, - sal_Bool bNoId = sal_True ); + bool bNoId = true ); ~RscBaseCont(); virtual RSCCLASS_TYPE GetClassType() const; void SetTypeClass( RscTop * pClass, RscTop * pClass1 = NULL ) - { - pTypeClass = pClass; - pTypeClass1 = pClass1; - }; - RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool ); + { + pTypeClass = pClass; + pTypeClass1 = pClass1; + } + RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, bool ); void Destroy( const RSCINST & rInst ); ERRTYPE GetElement( const RSCINST & rInst, const RscId & rEleName, RscTop * pCreateClass, const RSCINST & rCreateInst, @@ -79,18 +81,18 @@ public: SUBINFO_STRUCT GetInfoEle( const RSCINST & rInst, sal_uInt32 nPos ); ERRTYPE SetString( const RSCINST &, const char * pStr ); ERRTYPE SetNumber( const RSCINST &, sal_Int32 lValue ); - ERRTYPE SetBool( const RSCINST & rInst, sal_Bool bValue ); + ERRTYPE SetBool( const RSCINST & rInst, bool bValue ); ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId, sal_Int32 nValue ); ERRTYPE SetRef( const RSCINST & rInst, const RscId & rRefId ); // Gibt die Groesse der Klasse in Bytes - sal_uInt32 Size(){ return( nSize ); }; + sal_uInt32 Size(){ return nSize; } - sal_Bool IsConsistent( const RSCINST & rInst ); + bool IsConsistent( const RSCINST & rInst ); void SetToDefault( const RSCINST & rInst ); - sal_Bool IsDefault( const RSCINST & rInst ); - sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + bool IsDefault( const RSCINST & rInst ); + bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); void Delete( const RSCINST & rInst, RscTop * pClass, const RscId & rId ); @@ -99,7 +101,7 @@ public: void WriteSrc( const RSCINST & rInst, FILE * fOutput, RscTypCont * pTC, sal_uInt32 nTab, const char * ); ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, - RscTypCont * pTC, sal_uInt32 , sal_Bool bExtra); + RscTypCont * pTC, sal_uInt32 , bool bExtra); }; class RscContWriteSrc : public RscBaseCont @@ -107,27 +109,29 @@ class RscContWriteSrc : public RscBaseCont public: RscContWriteSrc( Atom nId, sal_uInt32 nTypId, RscTop * pSuper = NULL, - sal_Bool bNoId = sal_True ); + bool bNoId = true ); void WriteSrc( const RSCINST & rInst, FILE * fOutput, RscTypCont * pTC, sal_uInt32 nTab, const char * ); }; -class RscCont : public RscContWriteSrc { +class RscCont : public RscContWriteSrc +{ public: RscCont( Atom nId, sal_uInt32 nTypId, RscTop * pSuper = NULL, - sal_Bool bNoId = sal_True ); + bool bNoId = true ); ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, - RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); + RscTypCont * pTC, sal_uInt32, bool bExtra ); }; -class RscContExtraData : public RscContWriteSrc { +class RscContExtraData : public RscContWriteSrc +{ public: RscContExtraData( Atom nId, sal_uInt32 nTypId, - RscTop * pSuper = NULL, - sal_Bool bNoId = sal_True ); + RscTop * pSuper = NULL, + bool bNoId = true ); ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, - RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); + RscTypCont * pTC, sal_uInt32, bool bExtra ); }; #endif //_RSCCONT_HXX diff --git a/rsc/inc/rscdb.hxx b/rsc/inc/rscdb.hxx index c0a416575ddd..b8bc6b571bcd 100644 --- a/rsc/inc/rscdb.hxx +++ b/rsc/inc/rscdb.hxx @@ -28,7 +28,6 @@ #include <rscstr.hxx> #include <rscarray.hxx> #include <rscdef.hxx> -#include <tools/string.hxx> #include <vector> #include <map> @@ -63,13 +62,13 @@ typedef ::std::vector< RscSysEntry* > RscSysList; class RscTypCont { - CharSet nSourceCharSet; + rtl_TextEncoding nSourceCharSet; sal_uInt32 nMachineId; // Globaler Maschinentyp RSCBYTEORDER_TYPE nByteOrder; // Intel oder - OString aLanguage; // output language + OString aLanguage; // output language std::vector< sal_uInt32 > aLangFallbacks; // language fallback list (entry 0 is language itself) - OString aSearchPath; // Suchen der Bitmap, Icon, Pointer - OString aSysSearchPath; // aSearchPath plus language specific paths + OString aSearchPath; // Suchen der Bitmap, Icon, Pointer + OString aSysSearchPath; // aSearchPath plus language specific paths sal_uInt32 nUniqueId; // eindeutiger Id fuer Systemresourcen sal_uLong nFilePos; // Position in der Datei ( MTF ) sal_uInt32 nPMId; // eindeutiger Id fuer PM-Rseourcefile @@ -286,7 +285,7 @@ public: RscError* pEH; // Fehlerhandler RscNameTable aNmTb; // Tabelle fuer Namen RscFileTab aFileTab; // Tabelle der Dateinamen - sal_uInt32 nFlags; + sal_uInt32 nFlags; std::map<sal_uInt64, sal_uLong> aIdTranslator; //Ordnet Resourcetypen und Id's einen Id zu //(unter PM), oder eine Dateiposition (MTF) @@ -295,43 +294,43 @@ public: Atom AddLanguage( const char* ); - sal_Bool IsPreload() const - { return (nFlags & PRELOAD_FLAG) ? sal_True : sal_False; } - sal_Bool IsSysResTest() const - { return (nFlags & NOSYSRESTEST_FLAG) ? sal_False : sal_True; } - sal_Bool IsSrsDefault() const - { return (nFlags & SRSDEFAULT_FLAG) ? sal_True : sal_False; } - OString ChangeLanguage(const OString & rNewLang); + bool IsPreload() const + { return (nFlags & PRELOAD_FLAG) ? true : false; } + bool IsSysResTest() const + { return (nFlags & NOSYSRESTEST_FLAG) ? false : true; } + bool IsSrsDefault() const + { return (nFlags & SRSDEFAULT_FLAG) ? true : false; } + OString ChangeLanguage(const OString & rNewLang); const std::vector< sal_uInt32 >& GetFallbacks() const - { return aLangFallbacks; } + { return aLangFallbacks; } RSCBYTEORDER_TYPE GetByteOrder() const { return nByteOrder; } - CharSet GetSourceCharSet() const { return nSourceCharSet; } - CharSet SetSourceCharSet( CharSet aCharSet ) - { - CharSet aOld = nSourceCharSet; - nSourceCharSet = aCharSet; - return aOld; - } - void SetSearchPath( const OString& rStr) { aSearchPath = rStr; } - OString GetSearchPath() const { return aSearchPath; } - void SetSysSearchPath( const OString& rStr ) { aSysSearchPath = rStr; } - void InsertType( RscTop * pType ) - { - aBaseLst.push_back( pType ); - } - RscTop * SearchType( Atom nTypId ); - // loescht alle Resourceobjekte diese Datei - void Delete( sal_uLong lFileKey ); - RscTop * GetRoot() { return( pRoot ); }; - sal_uInt32 PutSysName( sal_uInt32 nRscTyp, char * pName, sal_uInt32 nConst, - sal_uInt32 nId, sal_Bool bFirst ); - void ClearSysNames(); - ERRTYPE WriteRc( WriteRcContext& rContext ); - void WriteSrc( FILE * fOutput, sal_uLong nFileIndex, - sal_Bool bName = sal_True ); - sal_uInt32 PutTranslatorKey( sal_uInt64 nKey ); - void IncFilePos( sal_uLong nOffset ){ nFilePos += nOffset; } + rtl_TextEncoding GetSourceCharSet() const { return nSourceCharSet; } + rtl_TextEncoding SetSourceCharSet( rtl_TextEncoding aCharSet ) + { + rtl_TextEncoding aOld = nSourceCharSet; + nSourceCharSet = aCharSet; + return aOld; + } + void SetSearchPath( const OString& rStr) { aSearchPath = rStr; } + OString GetSearchPath() const { return aSearchPath; } + void SetSysSearchPath( const OString& rStr ) { aSysSearchPath = rStr; } + void InsertType( RscTop * pType ) + { + aBaseLst.push_back( pType ); + } + RscTop * SearchType( Atom nTypId ); + // loescht alle Resourceobjekte diese Datei + void Delete( sal_uLong lFileKey ); + RscTop * GetRoot() { return pRoot; } + sal_uInt32 PutSysName( sal_uInt32 nRscTyp, char * pName, sal_uInt32 nConst, + sal_uInt32 nId, bool bFirst ); + void ClearSysNames(); + ERRTYPE WriteRc( WriteRcContext& rContext ); + void WriteSrc( FILE * fOutput, sal_uLong nFileIndex, + bool bName = true ); + sal_uInt32 PutTranslatorKey( sal_uInt64 nKey ); + void IncFilePos( sal_uLong nOffset ){ nFilePos += nOffset; } }; #endif diff --git a/rsc/inc/rscdef.hxx b/rsc/inc/rscdef.hxx index 0ca4ec6b5ff5..f279ddb2f18f 100644 --- a/rsc/inc/rscdef.hxx +++ b/rsc/inc/rscdef.hxx @@ -38,37 +38,41 @@ class RscDefine; class RscExpType { public: - union { + union + { RscExpression * pExp; RscDefine * pDef; - struct { + struct + { short nHi; unsigned short nLo; } aLong; } aExp; char cType; char cUnused; - sal_Bool IsNumber() const { return( RSCEXP_LONG == cType ); } - sal_Bool IsExpression()const { return( RSCEXP_EXP == cType ); } - sal_Bool IsDefinition()const { return( RSCEXP_DEF == cType ); } - sal_Bool IsNothing() const { return( RSCEXP_NOTHING == cType ); } - void SetLong( sal_Int32 lValue ){ - aExp.aLong.nHi = (short)(lValue >> 16); - aExp.aLong.nLo = (unsigned short)lValue; - cType = RSCEXP_LONG; - } - sal_Int32 GetLong() const{ - return aExp.aLong.nLo | - ((sal_Int32)aExp.aLong.nHi << 16); - } - sal_Bool Evaluate( sal_Int32 * pValue ) const; + bool IsNumber() const { return( RSCEXP_LONG == cType ); } + bool IsExpression()const { return( RSCEXP_EXP == cType ); } + bool IsDefinition()const { return( RSCEXP_DEF == cType ); } + bool IsNothing() const { return( RSCEXP_NOTHING == cType ); } + void SetLong( sal_Int32 lValue ) + { + aExp.aLong.nHi = (short)(lValue >> 16); + aExp.aLong.nLo = (unsigned short)lValue; + cType = RSCEXP_LONG; + } + sal_Int32 GetLong() const + { + return aExp.aLong.nLo | + ((sal_Int32)aExp.aLong.nHi << 16); + } + bool Evaluate( sal_Int32 * pValue ) const; void AppendMacro( OStringBuffer & ) const; }; /*********** R s c I d ***************************************************/ class RscId { - static sal_Bool bNames;// sal_False, bei den Namenoperation nur Zahlen + static bool bNames;// false, bei den Namenoperation nur Zahlen public: RscExpType aExp; // Zahl, Define oder Ausdruck sal_Int32 GetNumber() const; @@ -86,25 +90,23 @@ public: void Destroy(); - ~RscId(){ - Destroy(); - } + ~RscId() { Destroy(); } RscId( const RscId& rRscId ); RscId& operator = ( const RscId& rRscId ); - static void SetNames( sal_Bool bSet = sal_True ); - operator sal_Int32() const; // Gibt Nummer zurueck + static void SetNames( bool bSet = true ); + operator sal_Int32() const; // Gibt Nummer zurueck OString GetName() const; // Gibt den Namen des Defines zurueck - sal_Bool operator < ( const RscId& rRscId ) const; - sal_Bool operator > ( const RscId& rRscId ) const; - sal_Bool operator == ( const RscId& rRscId ) const; - sal_Bool operator <= ( const RscId& rRscId ) const - { return !(operator > ( rRscId )); } - sal_Bool operator >= ( const RscId& rRscId ) const - { return !(operator < ( rRscId )); } - sal_Bool IsId() const { return !aExp.IsNothing(); } + bool operator < ( const RscId& rRscId ) const; + bool operator > ( const RscId& rRscId ) const; + bool operator == ( const RscId& rRscId ) const; + bool operator <= ( const RscId& rRscId ) const + { return !(operator > ( rRscId )); } + bool operator >= ( const RscId& rRscId ) const + { return !(operator < ( rRscId )); } + bool IsId() const { return !aExp.IsNothing(); } }; /*********** R s c D e f i n e *******************************************/ @@ -115,35 +117,36 @@ friend class RscDefineList; friend class RscDefTree; friend class RscExpression; friend class RscId; - sal_uLong lFileKey; // zu welcher Datei gehoert das Define - sal_uInt32 nRefCount; // Wieviele Referenzen auf dieses Objekt - sal_Int32 lId; // Identifier + sal_uLong lFileKey; // zu welcher Datei gehoert das Define + sal_uInt32 nRefCount; // Wieviele Referenzen auf dieses Objekt + sal_Int32 lId; // Identifier RscExpression * pExp; // Ausdruck protected: - RscDefine( sal_uLong lFileKey, const OString& rDefName, - sal_Int32 lDefId ); - RscDefine( sal_uLong lFileKey, const OString& rDefName, - RscExpression * pExpression ); - ~RscDefine(); - void IncRef(){ nRefCount++; } + RscDefine( sal_uLong lFileKey, const OString& rDefName, + sal_Int32 lDefId ); + RscDefine( sal_uLong lFileKey, const OString& rDefName, + RscExpression * pExpression ); + ~RscDefine(); + void IncRef(){ nRefCount++; } sal_uInt32 GetRefCount() const { return nRefCount; } - void DecRef(); - void DefineToNumber(); - void SetName(const OString& rNewName) { m_aName = rNewName; } + void DecRef(); + void DefineToNumber(); + void SetName(const OString& rNewName) { m_aName = rNewName; } using StringNode::Search; public: RscDefine * Search( const char * ); - sal_uLong GetFileKey() const { return lFileKey; } - sal_Bool Evaluate(); - sal_Int32 GetNumber() const { return lId; } - OString GetMacro(); + sal_uLong GetFileKey() const { return lFileKey; } + bool Evaluate(); + sal_Int32 GetNumber() const { return lId; } + OString GetMacro(); }; typedef ::std::vector< RscDefine* > RscSubDefList; -class RscDefineList { +class RscDefineList +{ friend class RscFile; friend class RscFileTab; private: @@ -153,19 +156,21 @@ private: sal_Int32 lDefId, size_t lPos ); RscDefine * New( sal_uLong lFileKey, const OString& rDefName, RscExpression * pExpression, size_t lPos ); - sal_Bool Remove(); - size_t GetPos( RscDefine* item ) { - for ( size_t i = 0, n = maList.size(); i < n; ++i ) - if ( maList[ i ] == item ) - return i; - return size_t(-1); - } + bool Remove(); + size_t GetPos( RscDefine* item ) + { + for ( size_t i = 0, n = maList.size(); i < n; ++i ) + if ( maList[ i ] == item ) + return i; + return size_t(-1); + } public: void WriteAll( FILE * fOutput ); }; /*********** R s c E x p r e s s i o n ***********************************/ -class RscExpression { +class RscExpression +{ friend class RscFileTab; char cOperation; RscExpType aLeftExp; @@ -174,15 +179,16 @@ public: RscExpression( RscExpType aLE, char cOp, RscExpType aRE ); ~RscExpression(); - sal_Bool Evaluate( sal_Int32 * pValue ); - OString GetMacro(); + bool Evaluate( sal_Int32 * pValue ); + OString GetMacro(); }; /********************** R S C F I L E ************************************/ -class RscDepend { - sal_uLong lKey; +class RscDepend +{ + sal_uLong lKey; public: - RscDepend( sal_uLong lIncKey ){ lKey = lIncKey; }; + RscDepend( sal_uLong lIncKey ){ lKey = lIncKey; }; sal_uLong GetFileKey(){ return lKey; } }; @@ -192,31 +198,32 @@ typedef ::std::vector< RscDepend* > RscDependList; class RscFile { friend class RscFileTab; - sal_Bool bIncFile; // Ist es eine Include-Datei + bool bIncFile; // Ist es eine Include-Datei public: - sal_Bool bLoaded; // Ist die Datei geladen - sal_Bool bScanned; // Wurde Datei nach Inclide abgesucht - sal_Bool bDirty; // Dirty-Flag - OString aFileName; // Name der Datei - OString aPathName; // Pfad und Name der Datei + bool bLoaded; // Ist die Datei geladen + bool bScanned; // Wurde Datei nach Inclide abgesucht + bool bDirty; // Dirty-Flag + OString aFileName; // Name der Datei + OString aPathName; // Pfad und Name der Datei RscDefineList aDefLst; // Liste der Defines RscDependList aDepLst; // List of Depend RscFile(); ~RscFile(); - sal_Bool InsertDependFile( sal_uLong lDepFile, size_t lPos ); - sal_Bool Depend( sal_uLong lDepend, sal_uLong lFree ); - void SetIncFlag(){ bIncFile = sal_True; }; - sal_Bool IsIncFile(){ return bIncFile; }; + bool InsertDependFile( sal_uLong lDepFile, size_t lPos ); + bool Depend( sal_uLong lDepend, sal_uLong lFree ); + void SetIncFlag(){ bIncFile = true; }; + bool IsIncFile(){ return bIncFile; }; }; typedef UniqueIndex<RscFile> RscSubFileTab; #define NOFILE_INDEX UNIQUEINDEX_ENTRY_NOTFOUND -class RscDefTree { +class RscDefTree +{ RscDefine * pDefRoot; public: - static sal_Bool Evaluate( RscDefine * pDef ); + static bool Evaluate( RscDefine * pDef ); RscDefTree(){ pDefRoot = NULL; } ~RscDefTree(); void Remove(); @@ -235,14 +242,14 @@ public: RscDefine * FindDef( const char * ); RscDefine * FindDef(const OString& rStr) - { - return FindDef(rStr.getStr()); - } + { + return FindDef(rStr.getStr()); + } - sal_Bool Depend( sal_uLong lDepend, sal_uLong lFree ); - sal_Bool TestDef( sal_uLong lFileKey, size_t lPos, + bool Depend( sal_uLong lDepend, sal_uLong lFree ); + bool TestDef( sal_uLong lFileKey, size_t lPos, const RscDefine * pDefDec ); - sal_Bool TestDef( sal_uLong lFileKey, size_t lPos, + bool TestDef( sal_uLong lFileKey, size_t lPos, const RscExpression * pExpDec ); RscDefine * NewDef( sal_uLong lKey, const OString& rDefName, @@ -251,10 +258,10 @@ public: RscExpression *, sal_uLong lPos ); // Alle Defines die in dieser Datei Definiert sind loeschen - void DeleteFileContext( sal_uLong lKey ); - sal_uLong NewCodeFile(const OString& rName); - sal_uLong NewIncFile(const OString& rName, const OString& rPath); - RscFile * GetFile( sal_uLong lFileKey ){ return Get( lFileKey ); } + void DeleteFileContext( sal_uLong lKey ); + sal_uLong NewCodeFile(const OString& rName); + sal_uLong NewIncFile(const OString& rName, const OString& rPath); + RscFile * GetFile( sal_uLong lFileKey ){ return Get( lFileKey ); } }; #endif // _RSCDEF_HXX diff --git a/rsc/inc/rscerror.h b/rsc/inc/rscerror.h index 6b8a579594e4..6c7fd6ef1926 100644 --- a/rsc/inc/rscerror.h +++ b/rsc/inc/rscerror.h @@ -85,20 +85,19 @@ #define ERR_WARNINGEND 0x2000 -class ERRTYPE { +class ERRTYPE +{ sal_uInt32 nError; public: ERRTYPE() { nError = ERR_OK; } ERRTYPE( sal_uInt32 nErr ) { nError = nErr; } - ERRTYPE( const ERRTYPE & rErr ) { nError = rErr.nError; }; + ERRTYPE( const ERRTYPE & rErr ) { nError = rErr.nError; } ERRTYPE& operator = ( const ERRTYPE & rError ); - operator sal_uInt32() const { return( nError ); } - sal_Bool IsError() const { return( nError <= ERR_ERROREND ); } - sal_Bool IsOk() const { return( !IsError() ); } - sal_Bool IsWarning() const { - return( nError >= ERR_WARNINGSTART && nError <= ERR_WARNINGEND ); - }; - void Clear(){ nError = ERR_OK; } + operator sal_uInt32() const { return( nError ); } + bool IsError() const { return nError <= ERR_ERROREND; } + bool IsOk() const { return !IsError(); } + bool IsWarning() const { return nError >= ERR_WARNINGSTART && nError <= ERR_WARNINGEND;} + void Clear(){ nError = ERR_OK; } }; /****************** R s c E r r o r **************************************/ @@ -126,17 +125,14 @@ public: virtual ~RscError() {} sal_uInt32 nErrors;// Anzahl der Fehler - RscError( RscVerbosity _verbosity ) { - fListing = NULL; - nErrors = 0; - m_verbosity = _verbosity; - }; - void SetListFile( FILE * fList ){ - fListing = fList; - }; - FILE * GetListFile(){ - return fListing; - }; + RscError( RscVerbosity _verbosity ) + { + fListing = NULL; + nErrors = 0; + m_verbosity = _verbosity; + } + void SetListFile( FILE * fList ){ fListing = fList; } + FILE * GetListFile(){ return fListing; } RscVerbosity GetVerbosity() const { return m_verbosity; } virtual void StdOut( const char *, const RscVerbosity _verbosityLevel = RscVerbosityNormal ); virtual void StdErr( const char * ); diff --git a/rsc/inc/rscflag.hxx b/rsc/inc/rscflag.hxx index 981272a9422f..aefbf0de135a 100644 --- a/rsc/inc/rscflag.hxx +++ b/rsc/inc/rscflag.hxx @@ -25,29 +25,31 @@ #include <rscconst.hxx> /******************* R s c F l a g ***************************************/ -class RscFlag : public RscConst { - struct RscFlagInst{ +class RscFlag : public RscConst +{ + struct RscFlagInst + { sal_uInt32 nFlags; sal_uInt32 nDfltFlags; }; RSCINST CreateBasic( RSCINST * pInst ); public: RscFlag( Atom nId, sal_uInt32 nTypId ); - RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool ); + RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, bool ); RSCINST CreateClient( RSCINST * pInst, const RSCINST & rDflt, - sal_Bool bOwnClass, Atom nConsId ); - sal_uInt32 Size(); + bool bOwnClass, Atom nConsId ); + sal_uInt32 Size(); virtual void SetToDefault( const RSCINST & rInst ); - sal_Bool IsDefault( const RSCINST & rInst ); - sal_Bool IsDefault( const RSCINST & rInst, Atom nConstId ); + bool IsDefault( const RSCINST & rInst ); + bool IsDefault( const RSCINST & rInst, Atom nConstId ); // Ist das Flag gesetzt - sal_Bool IsSet( const RSCINST & rInst, Atom nConstId ); + bool IsSet( const RSCINST & rInst, Atom nConstId ); // Als Default setzen - sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); - sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef, + bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef, Atom nConstId ); ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId, @@ -56,41 +58,44 @@ public: void WriteSrc( const RSCINST & rInst, FILE * fOutput, RscTypCont * pTC, sal_uInt32 nTab, const char * ); ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, - RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); + RscTypCont * pTC, sal_uInt32, bool bExtra ); }; /******************* R s c C l i e n t ***********************************/ class RscClient : public RscTop { - RscFlag * pRefClass; //Klasse die als Server benutzt wird - Atom nConstId; //Id des zu setzenden Wertes + RscFlag * pRefClass; //Klasse die als Server benutzt wird + Atom nConstId; //Id des zu setzenden Wertes public: RscClient( Atom nId, sal_uInt32 nTypId, RscFlag * pClass, Atom nConstantId ); virtual RSCCLASS_TYPE GetClassType() const; - RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool ); - sal_uInt32 Size(){ return( pRefClass->Size() ); }; + RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, bool ); + sal_uInt32 Size(){ return( pRefClass->Size() ); }; // Eine Zuweisung an eine Variable - sal_Bool IsDefault( const RSCINST & rInst ){ + bool IsDefault( const RSCINST & rInst ){ return( pRefClass->IsDefault( rInst, nConstId ) ); }; // Als Default setzen - sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ){ - return pRefClass->IsValueDefault( rInst, - pDef, nConstId ); - } - ERRTYPE SetBool( const RSCINST & rInst, sal_Bool bValue ){ - if( bValue ) - return( pRefClass->SetConst( rInst, nConstId, bValue ) ); - else - return( pRefClass-> - SetNotConst( rInst, nConstId ) ); - }; - ERRTYPE GetBool( const RSCINST & rInst, sal_Bool * pB ){ - *pB = pRefClass->IsSet( rInst, nConstId ); - return( ERR_OK ); - }; + bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) + { + return pRefClass->IsValueDefault( rInst, + pDef, nConstId ); + } + ERRTYPE SetBool( const RSCINST & rInst, bool bValue ) + { + if( bValue ) + return( pRefClass->SetConst( rInst, nConstId, bValue ) ); + else + return( pRefClass-> + SetNotConst( rInst, nConstId ) ); + } + ERRTYPE GetBool( const RSCINST & rInst, bool * pB ) + { + *pB = pRefClass->IsSet( rInst, nConstId ); + return( ERR_OK ); + } void WriteSrc( const RSCINST & rInst, FILE * fOutput, RscTypCont * pTC, sal_uInt32 nTab, const char * ); }; diff --git a/rsc/inc/rsckey.hxx b/rsc/inc/rsckey.hxx index d04c4047439f..7ec4141ec325 100644 --- a/rsc/inc/rsckey.hxx +++ b/rsc/inc/rsckey.hxx @@ -24,27 +24,29 @@ class RscTop; #include <rscall.h> -typedef struct { - Atom nName; - sal_uInt32 nTyp; +typedef struct +{ + Atom nName; + sal_uInt32 nTyp; long yylval; } KEY_STRUCT; -class RscNameTable { - sal_Bool bSort; //soll bei jedem einfuegen sortiert werden? - sal_uInt32 nEntries; //Anzahl der Eintr�ge +class RscNameTable +{ + bool bSort; //soll bei jedem einfuegen sortiert werden? + sal_uInt32 nEntries; //Anzahl der Eintr�ge KEY_STRUCT * pTable; public: RscNameTable(); ~RscNameTable(); - void SetSort( sal_Bool bSorted = sal_True ); - Atom Put( Atom nName, sal_uInt32 nTyp, long nValue ); - Atom Put( const char * pName, sal_uInt32 nTyp, long nValue ); - Atom Put( const char * pName, sal_uInt32 nTyp ); - Atom Put( Atom nName, sal_uInt32 nTyp, RscTop * pClass ); - - // sal_True, wurde gefunden - sal_Bool Get( Atom nName, KEY_STRUCT * pEle ); + void SetSort( bool bSorted = true ); + Atom Put( Atom nName, sal_uInt32 nTyp, long nValue ); + Atom Put( const char * pName, sal_uInt32 nTyp, long nValue ); + Atom Put( const char * pName, sal_uInt32 nTyp ); + Atom Put( Atom nName, sal_uInt32 nTyp, RscTop * pClass ); + + // true, wurde gefunden + bool Get( Atom nName, KEY_STRUCT * pEle ); }; diff --git a/rsc/inc/rsclex.hxx b/rsc/inc/rsclex.hxx index 2b6605f3604a..31069240468b 100644 --- a/rsc/inc/rsclex.hxx +++ b/rsc/inc/rsclex.hxx @@ -52,14 +52,16 @@ struct RSCHEADER { }; /************** O b j e c t s t a c k ************************************/ -struct Node { +struct Node +{ Node* pPrev; RSCINST aInst; sal_uInt32 nTupelRec; // Rekursionstiefe fuer Tupel - Node() { pPrev = NULL; nTupelRec = 0; }; + Node() { pPrev = NULL; nTupelRec = 0; } }; -class ObjectStack { +class ObjectStack +{ private : Node* pRoot; public : @@ -67,7 +69,7 @@ class ObjectStack { ObjectStack () { pRoot = NULL; } const RSCINST & Top () { return pRoot->aInst; } - sal_Bool IsEmpty() { return( pRoot == NULL ); } + bool IsEmpty() { return( pRoot == NULL ); } void IncTupelRec() { pRoot->nTupelRec++; } void DecTupelRec() { pRoot->nTupelRec--; } sal_uInt32 TupelRecCount() const { return pRoot->nTupelRec; } diff --git a/rsc/inc/rscmgr.hxx b/rsc/inc/rscmgr.hxx index 838533bb6488..95301d28a7aa 100644 --- a/rsc/inc/rscmgr.hxx +++ b/rsc/inc/rscmgr.hxx @@ -26,11 +26,13 @@ #include <rscclass.hxx> /******************* R s c M g r *****************************************/ -class RscMgr : public RscClass { - struct RscMgrInst { +class RscMgr : public RscClass +{ + struct RscMgrInst + { RscId aRefId; // nRefId = Referenz Identifier - sal_Bool bDflt; // Ist Default - void Create(){ aRefId.Create(); bDflt = sal_True; } + bool bDflt; // Ist Default + void Create(){ aRefId.Create(); bDflt = true; } void Destroy(){ aRefId.Destroy(); } }; ERRTYPE IsToDeep( const RSCINST & rInst, sal_uInt32 nDeep = 0 ); @@ -38,24 +40,24 @@ public: RscMgr( Atom nId, sal_uInt32 nTypId, RscTop * pSuperCl ); void SetToDefault( const RSCINST & rInst ); - sal_Bool IsDefault( const RSCINST & rInst ); - sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + bool IsDefault( const RSCINST & rInst ); + bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); - RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool ); + RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, bool ); void Destroy( const RSCINST & rInst ); - sal_uInt32 Size(); + sal_uInt32 Size(); void WriteSrcHeader( const RSCINST & aInst, FILE * fOutput, - RscTypCont * pTC, sal_uInt32 nTab, - const RscId & rId, const char * ); + RscTypCont * pTC, sal_uInt32 nTab, + const RscId & rId, const char * ); void WriteSrc( const RSCINST & rInst, FILE * fOutput, RscTypCont * pTC, sal_uInt32 nTab, const char * ); ERRTYPE WriteRcHeader( const RSCINST & rInst, RscWriteRc & aMem, RscTypCont * pTC, const RscId & rId, - sal_uInt32, sal_Bool bExtra ); + sal_uInt32, bool bExtra ); ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, - RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); - sal_Bool IsConsistent( const RSCINST & rInst ); + RscTypCont * pTC, sal_uInt32, bool bExtra ); + bool IsConsistent( const RSCINST & rInst ); ERRTYPE GetRef( const RSCINST & rInst, RscId * ); ERRTYPE SetRef( const RSCINST & rInst, const RscId & rRefId ); }; diff --git a/rsc/inc/rscpar.hxx b/rsc/inc/rscpar.hxx index 0833e224fb6f..98a3944ae360 100644 --- a/rsc/inc/rscpar.hxx +++ b/rsc/inc/rscpar.hxx @@ -30,44 +30,46 @@ class RscTypCont; class RscFileInst { ERRTYPE aFirstError;// Erster Fehler - sal_uInt32 nErrorLine; // Zeile des ersten Fehlers - sal_uInt32 nErrorPos; // Position des ersten Fehlers - sal_uInt32 nLineNo; // Zeile in der Eingabedatei - sal_uLong lFileIndex; // Index auf Eingabedatei - sal_uLong lSrcIndex; // Index auf Basisdatei + sal_uInt32 nErrorLine; // Zeile des ersten Fehlers + sal_uInt32 nErrorPos; // Position des ersten Fehlers + sal_uInt32 nLineNo; // Zeile in der Eingabedatei + sal_uLong lFileIndex; // Index auf Eingabedatei + sal_uLong lSrcIndex; // Index auf Basisdatei FILE * fInputFile; // Eingabedatei char * pInput; // Lesepuffer - sal_uInt32 nInputBufLen; // Laenge des Lesepuffers - sal_uInt32 nInputPos; // Position im Lesepuffer - sal_uInt32 nInputEndPos;// Ende im Lesepuffer + sal_uInt32 nInputBufLen; // Laenge des Lesepuffers + sal_uInt32 nInputPos; // Position im Lesepuffer + sal_uInt32 nInputEndPos;// Ende im Lesepuffer char * pLine; // Zeile - sal_uInt32 nLineBufLen;//Lange des Zeilenpuffres - sal_uInt32 nScanPos; // Position in der Zeile + sal_uInt32 nLineBufLen;//Lange des Zeilenpuffres + sal_uInt32 nScanPos; // Position in der Zeile int cLastChar; - sal_Bool bEof; + bool bEof; public: RscTypCont * pTypCont; - void Init(); // ctor initialisieren - RscFileInst( RscTypCont * pTC, sal_uLong lIndexSrc, + void Init(); // ctor initialisieren + RscFileInst( RscTypCont * pTC, sal_uLong lIndexSrc, sal_uLong lFileIndex, FILE * fFile ); - ~RscFileInst(); - sal_Bool IsEof() const { return bEof; } - void SetFileIndex( sal_uLong lFIndex ) { lFileIndex = lFIndex; } + ~RscFileInst(); + bool IsEof() const { return bEof; } + void SetFileIndex( sal_uLong lFIndex ) { lFileIndex = lFIndex; } sal_uLong GetFileIndex() { return( lFileIndex ); } sal_uLong GetSrcIndex() { return( lSrcIndex ); } - void SetLineNo( sal_uInt32 nLine ) { nLineNo = nLine; } + void SetLineNo( sal_uInt32 nLine ) { nLineNo = nLine; } sal_uInt32 GetLineNo() { return( nLineNo ); } sal_uInt32 GetScanPos() { return( nScanPos ); } - char * GetLine() { return( pLine ); } - int GetChar(); - int GetFastChar() { return pLine[ nScanPos ] ? - pLine[ nScanPos++ ] : GetChar(); - } - void GetNewLine(); - // Fehlerbehandlung - void SetError( ERRTYPE aError ); - ERRTYPE GetError() { return aFirstError; } + char * GetLine() { return( pLine ); } + int GetChar(); + int GetFastChar() + { + return pLine[ nScanPos ] ? + pLine[ nScanPos++ ] : GetChar(); + } + void GetNewLine(); + // Fehlerbehandlung + void SetError( ERRTYPE aError ); + ERRTYPE GetError() { return aFirstError; } sal_uInt32 GetErrorLine() { return nErrorLine; } sal_uInt32 GetErrorPos() { return nErrorPos; } }; diff --git a/rsc/inc/rscrange.hxx b/rsc/inc/rscrange.hxx index e9adb1ce82a6..00dbf283a77d 100644 --- a/rsc/inc/rscrange.hxx +++ b/rsc/inc/rscrange.hxx @@ -27,38 +27,39 @@ class RscRange : public RscTop { protected: - struct RscRangeInst { + struct RscRangeInst + { sal_uInt16 nValue; // nValue = Ausgangswert - nMin - sal_Bool bDflt; // Ist Default + bool bDflt; // Ist Default }; - sal_Int32 nMin; // Minimum des Bereiches - sal_Int32 nMax; // Maximum des Bereiches - sal_uInt32 nSize; + sal_Int32 nMin; // Minimum des Bereiches + sal_Int32 nMax; // Maximum des Bereiches + sal_uInt32 nSize; public: RscRange( Atom nId, sal_uInt32 nTypId ); virtual RSCCLASS_TYPE GetClassType() const; - RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, sal_Bool ); + RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, bool ); // Der zulaessige Bereich wird gesetzt ERRTYPE SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum ); // Gibt die Groesse der Klasse in Bytes - sal_uInt32 Size(){ return nSize; } + sal_uInt32 Size(){ return nSize; } // Eine Zuweisung an eine Variable virtual void SetToDefault( const RSCINST & rInst ) - { - ((RscRangeInst*)rInst.pData)->bDflt = sal_True; - } - sal_Bool IsDefault( const RSCINST & rInst) - { - return( ((RscRangeInst*)rInst.pData)->bDflt ); - }; + { + ((RscRangeInst*)rInst.pData)->bDflt = true; + } + bool IsDefault( const RSCINST & rInst) + { + return( ((RscRangeInst*)rInst.pData)->bDflt ); + }; // Als Default setzen - sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); ERRTYPE SetNumber( const RSCINST &, sal_Int32 ); ERRTYPE GetNumber( const RSCINST &, sal_Int32 * ); void WriteSrc( const RSCINST &, FILE * fOutput, RscTypCont * pTC, sal_uInt32 nTab, const char * ); ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, - RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); + RscTypCont * pTC, sal_uInt32, bool bExtra ); }; class RscLongRange : public RscTop @@ -67,7 +68,7 @@ protected: struct RscLongRangeInst { sal_Int32 nValue; // nValue = Ausgangswert - nMin - sal_Bool bDflt; // Ist Default + bool bDflt; // Ist Default }; sal_Int32 nMin; // Minimum des Bereiches sal_Int32 nMax; // Maximum des Bereiches @@ -75,28 +76,28 @@ protected: public: RscLongRange( Atom nId, sal_uInt32 nTypId ); virtual RSCCLASS_TYPE GetClassType() const; - RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, sal_Bool ); + RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, bool ); // Der zulaessige Bereich wird gesetzt ERRTYPE SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum ); // Gibt die Groesse der Klasse in Bytes - sal_uInt32 Size(){ return nSize; } + sal_uInt32 Size(){ return nSize; } // Eine Zuweisung an eine Variable virtual void SetToDefault( const RSCINST & rInst ) - { - ((RscLongRangeInst*)rInst.pData)->bDflt = sal_True; - } - sal_Bool IsDefault( const RSCINST & rInst) - { - return( ((RscLongRangeInst*)rInst.pData)->bDflt ); - }; + { + ((RscLongRangeInst*)rInst.pData)->bDflt = true; + } + bool IsDefault( const RSCINST & rInst) + { + return( ((RscLongRangeInst*)rInst.pData)->bDflt ); + }; // Als Default setzen - sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); ERRTYPE SetNumber( const RSCINST &, sal_Int32 ); ERRTYPE GetNumber( const RSCINST &, sal_Int32 * ); void WriteSrc( const RSCINST &, FILE * fOutput, RscTypCont * pTC, sal_uInt32 nTab, const char * ); ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, - RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); + RscTypCont * pTC, sal_uInt32, bool bExtra ); }; @@ -119,26 +120,27 @@ public: RscIdRange( Atom nId, sal_uInt32 nTypId ); virtual RSCCLASS_TYPE GetClassType() const; // Der zulaessige Bereich wird gesetzt - ERRTYPE SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum ){ - nMin = nMinimum; - nMax = nMaximum; - return ERR_OK; - } - RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, sal_Bool ); + ERRTYPE SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum ) + { + nMin = nMinimum; + nMax = nMaximum; + return ERR_OK; + } + RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, bool ); void Destroy( const RSCINST & rInst ); sal_uInt32 Size(){ return nSize; } virtual void SetToDefault( const RSCINST & rInst ) - { - ((RscId*)rInst.pData)->aExp.cUnused = sal_True; - } - sal_Bool IsDefault( const RSCINST & rInst) - { - //cUnused wird fuer Defaultkennung verwendet - return ((RscId*)rInst.pData)->aExp.cUnused - ? sal_True : sal_False; - } + { + ((RscId*)rInst.pData)->aExp.cUnused = true; + } + bool IsDefault( const RSCINST & rInst) + { + //cUnused wird fuer Defaultkennung verwendet + return ((RscId*)rInst.pData)->aExp.cUnused + ? true : false; + } // Als Default setzen - sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); ERRTYPE SetNumber( const RSCINST &, sal_Int32 ); ERRTYPE GetNumber( const RSCINST &, sal_Int32 * ); ERRTYPE SetRef( const RSCINST &, const RscId & rRscId ); @@ -146,8 +148,8 @@ public: void WriteSrc( const RSCINST &, FILE * fOutput, RscTypCont * pTC, sal_uInt32 nTab, const char * ); ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, - RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); - sal_Bool IsConsistent( const RSCINST & rInst ); + RscTypCont * pTC, sal_uInt32, bool bExtra ); + bool IsConsistent( const RSCINST & rInst ); }; class RscBool : public RscRange @@ -156,30 +158,29 @@ public: RscBool( Atom nId, sal_uInt32 nTypId ); virtual RSCCLASS_TYPE GetClassType() const; // Der zulaessige Bereich wird gesetzt - ERRTYPE SetRange( sal_Int32, sal_Int32 ){ - return( ERR_UNKNOWN_METHOD ); - }; - ERRTYPE SetBool( const RSCINST & rInst, sal_Bool b ){ - return( SetNumber( rInst, (sal_Int32)b ) ); - }; - ERRTYPE GetBool( const RSCINST & rInst, sal_Bool * pB){ - sal_Int32 l; - GetNumber( rInst, &l ); - *pB = (0 != l); - return( ERR_OK ); - }; + ERRTYPE SetRange( sal_Int32, sal_Int32 ){ return ERR_UNKNOWN_METHOD; } + ERRTYPE SetBool( const RSCINST & rInst, bool b ) + { + return SetNumber( rInst, (sal_Int32)b ); + }; + ERRTYPE GetBool( const RSCINST & rInst, bool * pB) + { + sal_Int32 l; + GetNumber( rInst, &l ); + *pB = (0 != l); + return ERR_OK; + }; void WriteSrc( const RSCINST &, FILE * fOutput, RscTypCont * pTC, sal_uInt32 nTab, const char * ); }; -class RscBreakRange : public RscRange { - sal_Int32 nOutRange; +class RscBreakRange : public RscRange +{ + sal_Int32 nOutRange; public: RscBreakRange( Atom nId, sal_uInt32 nTypId ); - void SetOutRange( sal_Int32 nNumber ){ - nOutRange = nNumber; - } - RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, sal_Bool ); + void SetOutRange( sal_Int32 nNumber ) { nOutRange = nNumber; } + RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, bool ); ERRTYPE SetNumber( const RSCINST &, sal_Int32 ); }; diff --git a/rsc/inc/rscstr.hxx b/rsc/inc/rscstr.hxx index 87da46f7fae2..fffbe5c26783 100644 --- a/rsc/inc/rscstr.hxx +++ b/rsc/inc/rscstr.hxx @@ -27,9 +27,10 @@ class RscString : public RscTop { RscTop * pRefClass; - struct RscStringInst { + struct RscStringInst + { char * pStr; // Zeiger auf String - sal_Bool bDflt; // Ist Default + bool bDflt; // Ist Default RscId aRefId; // ReferenzName }; sal_uInt32 nSize; @@ -37,24 +38,21 @@ public: RscString( Atom nId, sal_uInt32 nTypId ); virtual RSCCLASS_TYPE GetClassType() const; - void SetRefClass( RscTop * pClass ) - { - pRefClass = pClass; - }; - RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, sal_Bool ); + void SetRefClass( RscTop * pClass ) { pRefClass = pClass; } + RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, bool ); // Der zulaessige Bereich wird gesetzt void Destroy( const RSCINST & rInst ); - sal_uInt32 Size(){ return nSize; } + sal_uInt32 Size(){ return nSize; } void SetToDefault( const RSCINST & rInst ) - { - ((RscStringInst*)rInst.pData)->bDflt = sal_True; - } - sal_Bool IsDefault( const RSCINST & rInst) - { - return( ((RscStringInst*)rInst.pData)->bDflt ); - }; + { + ((RscStringInst*)rInst.pData)->bDflt = true; + } + bool IsDefault( const RSCINST & rInst) + { + return ((RscStringInst*)rInst.pData)->bDflt; + } // Als Default setzen - sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); ERRTYPE SetString( const RSCINST &, const char * pStr ); ERRTYPE GetString( const RSCINST &, char ** ppStr ); ERRTYPE GetRef( const RSCINST & rInst, RscId * ); @@ -62,7 +60,7 @@ public: void WriteSrc( const RSCINST &, FILE * fOutput, RscTypCont * pTC, sal_uInt32 nTab, const char * ); ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem, - RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); + RscTypCont * pTC, sal_uInt32, bool bExtra ); }; #endif // _RSCSTR_HXX diff --git a/rsc/inc/rsctools.hxx b/rsc/inc/rsctools.hxx index e26efcd60807..296ca4f09848 100644 --- a/rsc/inc/rsctools.hxx +++ b/rsc/inc/rsctools.hxx @@ -41,8 +41,8 @@ enum RSCBYTEORDER_TYPE { RSC_BIGENDIAN, RSC_LITTLEENDIAN, RSC_SYSTEMENDIAN }; (nSize + sizeof( void * ) -1) / sizeof( void * ) * sizeof( void * ) /******************* F u n c t i o n F o r w a r d s *******************/ OString GetTmpFileName(); -sal_Bool Append(const OString &rDestFile, const OString &rSourceFile); -sal_Bool Append(FILE * fDest, OString &raSourceFile); +bool Append(const OString &rDestFile, const OString &rSourceFile); +bool Append(FILE * fDest, OString &raSourceFile); OString OutputFile(const OString &rInput, const char * ext); char * ResponseFile( RscPtrPtr * ppCmd, char ** ppArgv, sal_uInt32 nArgc ); @@ -85,8 +85,8 @@ public: /****************** R s c W r i t e R c **********************************/ class RscWriteRc { - sal_uInt32 nLen; - sal_Bool bSwap; + sal_uInt32 nLen; + bool bSwap; RSCBYTEORDER_TYPE nByteOrder; char * pMem; char * GetPointer( sal_uInt32 nSize ); diff --git a/rsc/inc/rsctop.hxx b/rsc/inc/rsctop.hxx index 34723c618f1e..0929db770d4c 100644 --- a/rsc/inc/rsctop.hxx +++ b/rsc/inc/rsctop.hxx @@ -45,9 +45,9 @@ protected: RscTop * pSuperCl = NULL ); public: - OString aCallPar1; // Klassenaufruf ohne Typen bis ResId - OString aCallPar2; // Klassenaufruf ohne Typen ab ResId - OString aCallParType; // Klassenaufruf mit Typen + OString aCallPar1; // Klassenaufruf ohne Typen bis ResId + OString aCallPar2; // Klassenaufruf ohne Typen ab ResId + OString aCallParType; // Klassenaufruf mit Typen void SetSuperClass( RscTop * pClass ) { @@ -59,8 +59,8 @@ public: sal_uInt32 GetTypId() const { return nTypId; }; // Gibt die Oberklasse zurueck - sal_Bool InHierarchy( RscTop * pClass ); - sal_Bool IsCodeWriteable() const + bool InHierarchy( RscTop * pClass ); + bool IsCodeWriteable() const { return( 0 != aCallParType.getLength() ); } @@ -79,7 +79,7 @@ public: virtual Atom GetConstant( sal_uInt32 ); - virtual RscTop * GetTypeClass() const; + virtual RscTop* GetTypeClass() const; // Gibt die Groesse der Klasse in Bytes virtual sal_uInt32 Size(); @@ -103,7 +103,7 @@ public: // pData, pClass im return koennen NULL sein virtual RSCINST GetVariable( const RSCINST & rInst, Atom nVarName, const RSCINST & rInitInst, - sal_Bool nInitDflt = sal_False, + bool nInitDflt = false, RscTop * pCreateClass = NULL ); virtual RSCINST GetCopyVar( const RSCINST & rInst, Atom nVarName ); @@ -153,7 +153,7 @@ public: virtual ERRTYPE SetNumber( const RSCINST & rInst, sal_Int32 lValue ); // Eine Zuweisung an eine Variable - virtual ERRTYPE SetBool( const RSCINST & rInst, sal_Bool bValue ); + virtual ERRTYPE SetBool( const RSCINST & rInst, bool bValue ); // Eine Zuweisung an eine Variable virtual ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId, @@ -166,29 +166,29 @@ public: virtual ERRTYPE GetNumber( const RSCINST & rInst, sal_Int32 * pN ); - virtual ERRTYPE GetBool( const RSCINST & rInst, sal_Bool * pB ); + virtual ERRTYPE GetBool( const RSCINST & rInst, bool * pB ); virtual ERRTYPE GetConst( const RSCINST & rInst, Atom * pH ); virtual ERRTYPE GetString( const RSCINST & rInst, char ** ppStr ); virtual RSCINST Create( RSCINST * pInst, - const RSCINST & rDefInst, sal_Bool bOwnClass = sal_False ); + const RSCINST & rDefInst, bool bOwnClass = false ); // Instanz zerstoeren virtual void Destroy( const RSCINST & rInst ); // prueft auf konsistenz - virtual sal_Bool IsConsistent( const RSCINST & rInst ); + virtual bool IsConsistent( const RSCINST & rInst ); // Alles auf Default setzen virtual void SetToDefault( const RSCINST & rInst ); // Ist Eingabe = Default - virtual sal_Bool IsDefault( const RSCINST & rInst ); + virtual bool IsDefault( const RSCINST & rInst ); // Gleiche Werte auf Default setzen - virtual sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); + virtual bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); // Instanz auf Default setzen virtual void SetDefault( const RSCINST & rInst, Atom nVarId ); @@ -210,9 +210,9 @@ public: RscTypCont * pTC, sal_uInt32 nTab,const char * ); virtual ERRTYPE WriteRcHeader( const RSCINST & rInst, RscWriteRc & aMem, RscTypCont * pTC, const RscId & aId, - sal_uInt32 nDeep, sal_Bool bExtra ); + sal_uInt32 nDeep, bool bExtra ); virtual ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, - RscTypCont * pTC, sal_uInt32 nDeep, sal_Bool bExtra ); + RscTypCont * pTC, sal_uInt32 nDeep, bool bExtra ); }; #endif //_RSCTOP_HXX diff --git a/rsc/inc/rsctree.hxx b/rsc/inc/rsctree.hxx index ed3bb3ee2cb8..ee674d4b947b 100644 --- a/rsc/inc/rsctree.hxx +++ b/rsc/inc/rsctree.hxx @@ -60,8 +60,8 @@ public: NameNode* Right() const{ return (NameNode *)pRight ; }; NameNode* Search( const NameNode * pName ) const; // insert a new node in the b-tree - sal_Bool Insert( NameNode * pTN, sal_uInt32 * nDepth ); - sal_Bool Insert( NameNode* pTN ); + bool Insert( NameNode * pTN, sal_uInt32 * nDepth ); + bool Insert( NameNode* pTN ); virtual COMPARE Compare( const NameNode * ) const; virtual COMPARE Compare( const void * ) const; NameNode* SearchParent( const NameNode * ) const; diff --git a/rsc/source/parser/rscdb.cxx b/rsc/source/parser/rscdb.cxx index 7c975e09e281..c1f69a57deb0 100644 --- a/rsc/source/parser/rscdb.cxx +++ b/rsc/source/parser/rscdb.cxx @@ -39,33 +39,32 @@ RscTypCont :: RscTypCont( RscError * pErrHdl, RSCBYTEORDER_TYPE nOrder, const OString& rSearchPath, sal_uInt32 nFlagsP ) - : - nSourceCharSet( RTL_TEXTENCODING_UTF8 ), - nByteOrder( nOrder ), - aSearchPath( rSearchPath ), - aBool( pHS->getID( "sal_Bool" ), RSC_NOTYPE ), - aShort( pHS->getID( "short" ), RSC_NOTYPE ), - aUShort( pHS->getID( "sal_uInt16" ), RSC_NOTYPE ), - aLong( pHS->getID( "long" ), RSC_NOTYPE ), - aEnumLong( pHS->getID( "enum_long" ), RSC_NOTYPE ), - aIdUShort( pHS->getID( "IDUSHORT" ), RSC_NOTYPE ), - aIdNoZeroUShort( pHS->getID( "IDUSHORT" ), RSC_NOTYPE ), - aNoZeroShort( pHS->getID( "NoZeroShort" ), RSC_NOTYPE ), - a1to12Short( pHS->getID( "MonthShort" ), RSC_NOTYPE ), - a0to23Short( pHS->getID( "HourShort" ), RSC_NOTYPE ), - a1to31Short( pHS->getID( "DayShort" ), RSC_NOTYPE ), - a0to59Short( pHS->getID( "MinuteShort" ), RSC_NOTYPE ), - a0to99Short( pHS->getID( "_0to59Short" ), RSC_NOTYPE ), - a0to9999Short( pHS->getID( "YearShort" ), RSC_NOTYPE ), - aIdLong( pHS->getID( "IDLONG" ), RSC_NOTYPE ), - aString( pHS->getID( "Chars" ), RSC_NOTYPE ), - aStringLiteral( pHS->getID( "Chars" ), RSC_NOTYPE ), - aWinBits( pHS->getID( "WinBits" ), RSC_NOTYPE ), - aLangType(), - aLangString( pHS->getID( "Lang_Chars" ), RSC_NOTYPE, &aString, &aLangType ), - aLangShort( pHS->getID( "Lang_short" ), RSC_NOTYPE, &aShort, &aLangType ), - nAcceleratorType( 0 ), - nFlags( nFlagsP ) + : nSourceCharSet( RTL_TEXTENCODING_UTF8 ) + , nByteOrder( nOrder ) + , aSearchPath( rSearchPath ) + , aBool( pHS->getID( "sal_Bool" ), RSC_NOTYPE ) + , aShort( pHS->getID( "short" ), RSC_NOTYPE ) + , aUShort( pHS->getID( "sal_uInt16" ), RSC_NOTYPE ) + , aLong( pHS->getID( "long" ), RSC_NOTYPE ) + , aEnumLong( pHS->getID( "enum_long" ), RSC_NOTYPE ) + , aIdUShort( pHS->getID( "IDUSHORT" ), RSC_NOTYPE ) + , aIdNoZeroUShort( pHS->getID( "IDUSHORT" ), RSC_NOTYPE ) + , aNoZeroShort( pHS->getID( "NoZeroShort" ), RSC_NOTYPE ) + , a1to12Short( pHS->getID( "MonthShort" ), RSC_NOTYPE ) + , a0to23Short( pHS->getID( "HourShort" ), RSC_NOTYPE ) + , a1to31Short( pHS->getID( "DayShort" ), RSC_NOTYPE ) + , a0to59Short( pHS->getID( "MinuteShort" ), RSC_NOTYPE ) + , a0to99Short( pHS->getID( "_0to59Short" ), RSC_NOTYPE ) + , a0to9999Short( pHS->getID( "YearShort" ), RSC_NOTYPE ) + , aIdLong( pHS->getID( "IDLONG" ), RSC_NOTYPE ) + , aString( pHS->getID( "Chars" ), RSC_NOTYPE ) + , aStringLiteral( pHS->getID( "Chars" ), RSC_NOTYPE ) + , aWinBits( pHS->getID( "WinBits" ), RSC_NOTYPE ) + , aLangType() + , aLangString( pHS->getID( "Lang_Chars" ), RSC_NOTYPE, &aString, &aLangType ) + , aLangShort( pHS->getID( "Lang_short" ), RSC_NOTYPE, &aShort, &aLangType ) + , nAcceleratorType( 0 ) + , nFlags( nFlagsP ) { nUniqueId = 256; nPMId = RSC_VERSIONCONTROL +1; //mindestens einen groesser @@ -79,13 +78,14 @@ OString RscTypCont::ChangeLanguage(const OString& rNewLang) aLanguage = rNewLang; ::std::vector< OUString > aFallbacks; + if (rNewLang.isEmpty()) aFallbacks.push_back( "" ); // do not resolve to SYSTEM (en-US) else aFallbacks = LanguageTag( OStringToOUString( rNewLang, RTL_TEXTENCODING_ASCII_US)).getFallbackStrings(); - bool bAppendEnUsFallback = - ! (rNewLang.equalsIgnoreAsciiCase( "en-US" ) || - rNewLang.equalsIgnoreAsciiCase( "x-no-translate" ) ); + + bool bAppendEnUsFallback = ! (rNewLang.equalsIgnoreAsciiCase( "en-US" ) || + rNewLang.equalsIgnoreAsciiCase( "x-no-translate" ) ); if (bAppendEnUsFallback) aFallbacks.push_back( "en-US"); @@ -124,12 +124,15 @@ Atom RscTypCont::AddLanguage( const char* pLang ) } -void DestroyNode( RscTop * pRscTop, ObjNode * pObjNode ){ - if( pObjNode ){ +void DestroyNode( RscTop * pRscTop, ObjNode * pObjNode ) +{ + if( pObjNode ) + { DestroyNode( pRscTop, (ObjNode*)pObjNode->Left() ); DestroyNode( pRscTop, (ObjNode*)pObjNode->Right() ); - if( pObjNode->GetRscObj() ){ + if( pObjNode->GetRscObj() ) + { pRscTop->Destroy( RSCINST( pRscTop, pObjNode->GetRscObj() ) ); rtl_freeMemory( pObjNode->GetRscObj() ); } @@ -137,18 +140,20 @@ void DestroyNode( RscTop * pRscTop, ObjNode * pObjNode ){ }; } -void DestroySubTrees( RscTop * pRscTop ){ - if( pRscTop ){ +void DestroySubTrees( RscTop * pRscTop ) +{ + if( pRscTop ) + { DestroySubTrees( (RscTop*)pRscTop->Left() ); - DestroyNode( pRscTop, pRscTop->GetObjNode() ); - DestroySubTrees( (RscTop*)pRscTop->Right() ); }; } -void DestroyTree( RscTop * pRscTop ){ - if( pRscTop ){ +void DestroyTree( RscTop * pRscTop ) +{ + if( pRscTop ) + { DestroyTree( (RscTop*)pRscTop->Left() ); DestroyTree( (RscTop*)pRscTop->Right() ); @@ -156,8 +161,10 @@ void DestroyTree( RscTop * pRscTop ){ }; } -void Pre_dtorTree( RscTop * pRscTop ){ - if( pRscTop ){ +void Pre_dtorTree( RscTop * pRscTop ) +{ + if( pRscTop ) + { Pre_dtorTree( (RscTop*)pRscTop->Left() ); Pre_dtorTree( (RscTop*)pRscTop->Right() ); @@ -165,7 +172,8 @@ void Pre_dtorTree( RscTop * pRscTop ){ }; } -RscTypCont :: ~RscTypCont(){ +RscTypCont :: ~RscTypCont() +{ // Alle Unterbaeume loeschen aVersion.pClass->Destroy( aVersion ); rtl_freeMemory( aVersion.pData ); @@ -175,6 +183,7 @@ RscTypCont :: ~RscTypCont(){ // BasisTypen for ( size_t i = 0, n = aBaseLst.size(); i < n; ++i ) aBaseLst[ i ]->Pre_dtor(); + aBool.Pre_dtor(); aShort.Pre_dtor(); aUShort.Pre_dtor(); @@ -194,10 +203,12 @@ RscTypCont :: ~RscTypCont(){ for ( size_t i = 0, n = aBaseLst.size(); i < n; ++i ) delete aBaseLst[ i ]; + aBaseLst.clear(); for ( size_t i = 0, n = aSysLst.size(); i < n; ++i ) delete aSysLst[ i ]; + aSysLst.clear(); } @@ -205,15 +216,16 @@ void RscTypCont::ClearSysNames() { for ( size_t i = 0, n = aSysLst.size(); i < n; ++i ) delete aSysLst[ i ]; + aSysLst.clear(); } RscTop * RscTypCont::SearchType( Atom nId ) -/* [Beschreibung] - - Sucht eine Basistyp nId; -*/ { + /* [Beschreibung] + + Sucht eine Basistyp nId; + */ if( nId == InvalidAtom ) return NULL; @@ -242,6 +254,8 @@ RscTop * RscTypCont::SearchType( Atom nId ) ELSE_IF( aLangType ) ELSE_IF( aLangString ) ELSE_IF( aLangShort ) +// al least to not pollute +#undef ELSE_IF for ( size_t i = 0, n = aBaseLst.size(); i < n; ++i ) { @@ -253,22 +267,22 @@ RscTop * RscTypCont::SearchType( Atom nId ) } sal_uInt32 RscTypCont :: PutSysName( sal_uInt32 nRscTyp, char * pFileName, - sal_uInt32 nConst, sal_uInt32 nId, sal_Bool bFirst ) + sal_uInt32 nConst, sal_uInt32 nId, bool bFirst ) { RscSysEntry *pSysEntry; RscSysEntry *pFoundEntry = NULL; - sal_Bool bId1 = sal_False; + bool bId1 = false; for ( size_t i = 0, n = aSysLst.size(); i < n; ++i ) { pSysEntry = aSysLst[ i ]; if( pSysEntry->nKey == 1 ) - bId1 = sal_True; + bId1 = true; if( !strcmp( pSysEntry->aFileName.getStr(), pFileName ) ) - if( pSysEntry->nRscTyp == nRscTyp - && pSysEntry->nTyp == nConst - && pSysEntry->nRefId == nId - ) { + if( pSysEntry->nRscTyp == nRscTyp && + pSysEntry->nTyp == nConst && + pSysEntry->nRefId == nId) + { pFoundEntry = pSysEntry; break; } @@ -334,9 +348,9 @@ void RscTypCont :: WriteInc( FILE * fOutput, sal_uLong lFileKey ) pFile->aFileName.getStr() ); } } - }; - }; - }; + } + } + } } @@ -347,7 +361,7 @@ private: ERRTYPE aError; // Enthaelt den ersten Fehler RscTypCont* pTypCont; FILE * fOutput; // AusgabeDatei - sal_uLong lFileKey; // Welche src-Datei + sal_uLong lFileKey; // Welche src-Datei RscTop * pClass; DECL_LINK( CallBackWriteRc, ObjNode * ); @@ -376,7 +390,7 @@ IMPL_LINK( RscEnumerateObj, CallBackWriteRc, ObjNode *, pObjNode ) aError = pClass->WriteRcHeader( RSCINST( pClass, pObjNode->GetRscObj() ), aMem, pTypCont, - pObjNode->GetRscId(), 0, sal_True ); + pObjNode->GetRscId(), 0, true ); if( aError.IsError() || aError.IsWarning() ) pTypCont->pEH->Error( aError, pClass, pObjNode->GetRscId() ); @@ -386,7 +400,8 @@ IMPL_LINK( RscEnumerateObj, CallBackWriteRc, ObjNode *, pObjNode ) IMPL_LINK_INLINE_START( RscEnumerateObj, CallBackWriteSrc, ObjNode *, pObjNode ) { - if( pObjNode->GetFileKey() == lFileKey ){ + if( pObjNode->GetFileKey() == lFileKey ) + { pClass->WriteSrcHeader( RSCINST( pClass, pObjNode->GetRscObj() ), fOutput, pTypCont, 0, pObjNode->GetRscId(), "" ); @@ -451,28 +466,27 @@ private: public: RscEnumerateObj aEnumObj; - RscEnumerateRef( RscTypCont * pTC, RscTop * pR, - FILE * fOutput ) - { - aEnumObj.pTypCont = pTC; - aEnumObj.fOutput = fOutput; - pRoot = pR; - } + RscEnumerateRef( RscTypCont * pTC, RscTop * pR, + FILE * fOutput ) + { + aEnumObj.pTypCont = pTC; + aEnumObj.fOutput = fOutput; + pRoot = pR; + } ERRTYPE WriteRc() - { - aEnumObj.aError.Clear(); - pRoot->EnumNodes( LINK( this, RscEnumerateRef, CallBackWriteRc ) ); - return aEnumObj.aError; - }; - + { + aEnumObj.aError.Clear(); + pRoot->EnumNodes( LINK( this, RscEnumerateRef, CallBackWriteRc ) ); + return aEnumObj.aError; + } ERRTYPE WriteSrc( sal_uLong lFileKey ) - { - aEnumObj.lFileKey = lFileKey; + { + aEnumObj.lFileKey = lFileKey; - aEnumObj.aError.Clear(); - pRoot->EnumNodes( LINK( this, RscEnumerateRef, CallBackWriteSrc ) ); - return aEnumObj.aError; - } + aEnumObj.aError.Clear(); + pRoot->EnumNodes( LINK( this, RscEnumerateRef, CallBackWriteSrc ) ); + return aEnumObj.aError; + } }; IMPL_LINK_INLINE_START( RscEnumerateRef, CallBackWriteRc, RscTop *, pRef ) @@ -502,14 +516,14 @@ ERRTYPE RscTypCont::WriteRc( WriteRcContext& rContext ) // version control RscWriteRc aMem( nByteOrder ); - aVersion.pClass->WriteRcHeader( aVersion, aMem, this, RscId( RSCVERSION_ID ), 0, sal_True ); + aVersion.pClass->WriteRcHeader( aVersion, aMem, this, RscId( RSCVERSION_ID ), 0, true ); aEnumRef.aEnumObj.WriteRcFile( aMem, rContext.fOutput ); return aError; } void RscTypCont :: WriteSrc( FILE * fOutput, sal_uLong nFileKey, - sal_Bool bName ) + bool bName ) { RscFile * pFName; RscEnumerateRef aEnumRef( this, pRoot, fOutput ); @@ -525,7 +539,8 @@ void RscTypCont :: WriteSrc( FILE * fOutput, sal_uLong nFileKey, if( NOFILE_INDEX == nFileKey ) { sal_uIntPtr aIndex = aFileTab.FirstIndex(); - while( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND ) { + while( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND ) + { pFName = aFileTab.Get( aIndex ); if( !pFName->IsIncFile() ) pFName->aDefLst.WriteAll( fOutput ); @@ -536,7 +551,8 @@ void RscTypCont :: WriteSrc( FILE * fOutput, sal_uLong nFileKey, else { pFName = aFileTab.Get( nFileKey ); - if( pFName ){ + if( pFName ) + { pFName->aDefLst.WriteAll( fOutput ); aEnumRef.WriteSrc( nFileKey ); } @@ -544,7 +560,7 @@ void RscTypCont :: WriteSrc( FILE * fOutput, sal_uLong nFileKey, } else { - RscId::SetNames( sal_False ); + RscId::SetNames( false ); if( NOFILE_INDEX == nFileKey ) { sal_uIntPtr aIndex = aFileTab.FirstIndex(); @@ -583,55 +599,60 @@ IMPL_LINK_INLINE_START( RscDel, Delete, RscTop *, pNode ) } IMPL_LINK_INLINE_END( RscDel, Delete, RscTop *, pNode ) -void RscTypCont :: Delete( sal_uLong lFileKey ){ +void RscTypCont :: Delete( sal_uLong lFileKey ) +{ // Resourceinstanzen loeschen RscDel aDel( pRoot, lFileKey ); // Defines loeschen aFileTab.DeleteFileContext( lFileKey ); } -sal_Bool IsInstConsistent( ObjNode * pObjNode, RscTop * pRscTop ) +bool IsInstConsistent( ObjNode * pObjNode, RscTop * pRscTop ) { - sal_Bool bRet = sal_True; + bool bRet = true; - if( pObjNode ){ + if( pObjNode ) + { RSCINST aTmpI; if( ! IsInstConsistent( (ObjNode*)pObjNode->Left(), pRscTop ) ) - bRet = sal_False; + bRet = false; aTmpI.pClass = pRscTop; aTmpI.pData = pObjNode->GetRscObj(); if( ! aTmpI.pClass->IsConsistent( aTmpI ) ) - bRet = sal_False; + bRet = false; if( ! IsInstConsistent( (ObjNode*)pObjNode->Right(), pRscTop ) ) - bRet = sal_False; + bRet = false; }; - return( bRet ); + return bRet; } -sal_Bool MakeConsistent( RscTop * pRscTop ) +bool MakeConsistent( RscTop * pRscTop ) { - sal_Bool bRet = sal_True; + bool bRet = true; - if( pRscTop ){ + if( pRscTop ) + { if( ! ::MakeConsistent( (RscTop*)pRscTop->Left() ) ) - bRet = sal_False; + bRet = false; - if( pRscTop->GetObjNode() ){ - if( ! pRscTop->GetObjNode()->IsConsistent() ){ + if( pRscTop->GetObjNode() ) + { + if( ! pRscTop->GetObjNode()->IsConsistent() ) + { pRscTop->GetObjNode()->OrderTree(); if( ! pRscTop->GetObjNode()->IsConsistent() ) - bRet = sal_False; + bRet = false; } if( ! IsInstConsistent( pRscTop->GetObjNode(), pRscTop ) ) - bRet = sal_False; + bRet = false; } if( ! ::MakeConsistent( (RscTop*)pRscTop->Right() ) ) - bRet = sal_False; + bRet = false; }; return bRet; diff --git a/rsc/source/parser/rscibas.cxx b/rsc/source/parser/rscibas.cxx index a78072e86c75..54afe1ca5347 100644 --- a/rsc/source/parser/rscibas.cxx +++ b/rsc/source/parser/rscibas.cxx @@ -122,7 +122,7 @@ void RscLangEnum::Init( RscNameTable& rNames ) { OString aIsoToken; sal_uInt16 nTokenCounter = 0; - sal_Bool bOneMore = 1; + bool bOneMore = 1; while ( bOneMore ) { aIsoToken = comphelper::string::getToken(aEnvIsoTokens, nTokenCounter, ' '); @@ -140,6 +140,7 @@ void RscLangEnum::Init( RscNameTable& rNames ) } else bOneMore = 0; + nTokenCounter++; } } @@ -170,7 +171,7 @@ Atom RscLangEnum::AddLanguage( const char* pLang, RscNameTable& rNames ) RscEnum * RscTypCont::InitLangType() { aLangType.Init( aNmTb ); - return( &aLangType ); + return &aLangType; } RscEnum * RscTypCont::InitFieldUnitsType() @@ -210,7 +211,8 @@ RscEnum * RscTypCont::InitTimeFieldFormat() return pTimeFieldFormat; } -RscEnum * RscTypCont::InitColor(){ +RscEnum * RscTypCont::InitColor() +{ RscEnum * pColor; pColor = new RscEnum( pHS->getID( "EnumColor" ), RSC_NOTYPE ); @@ -231,10 +233,11 @@ RscEnum * RscTypCont::InitColor(){ SETCONST( pColor, "COL_YELLOW", COL_YELLOW ); SETCONST( pColor, "COL_WHITE", COL_WHITE ); - return( pColor ); + return pColor; } -RscEnum * RscTypCont::InitMapUnit(){ +RscEnum * RscTypCont::InitMapUnit() +{ RscEnum * pMapUnit; pMapUnit = new RscEnum( pHS->getID( "EnumMapUnit" ), RSC_NOTYPE ); @@ -252,10 +255,11 @@ RscEnum * RscTypCont::InitMapUnit(){ SETCONST( pMapUnit, "MAP_TWIP", MAP_TWIP ); SETCONST( pMapUnit, "MAP_APPFONT", MAP_APPFONT ); SETCONST( pMapUnit, "MAP_SV", RSC_EXTRAMAPUNIT ); - return( pMapUnit ); + return pMapUnit; } -RscEnum * RscTypCont::InitKey(){ +RscEnum * RscTypCont::InitKey() +{ RscEnum * pKey; pKey = new RscEnum( pHS->getID( "EnumKey" ), RSC_NOTYPE ); @@ -367,10 +371,11 @@ RscEnum * RscTypCont::InitKey(){ SETCONST( pKey, "KEY_TILDE", com::sun::star::awt::Key::TILDE ); SETCONST( pKey, "KEY_QUOTELEFT", com::sun::star::awt::Key::QUOTELEFT ); - return( pKey ); + return pKey; } -RscEnum * RscTypCont::InitTriState(){ +RscEnum * RscTypCont::InitTriState() +{ RscEnum * pTriState; pTriState = new RscEnum( pHS->getID( "EnumTriState" ), RSC_NOTYPE ); @@ -378,7 +383,7 @@ RscEnum * RscTypCont::InitTriState(){ SETCONST( pTriState, "STATE_CHECK", STATE_CHECK ); SETCONST( pTriState, "STATE_DONTKNOW", STATE_DONTKNOW ); - return( pTriState ); + return pTriState; } RscEnum * RscTypCont::InitMessButtons() @@ -391,10 +396,11 @@ RscEnum * RscTypCont::InitMessButtons() SETCONST( pMessButtons, "WB_YES_NO_CANCEL", sal::static_int_cast<sal_uInt32>(WB_YES_NO_CANCEL) ); SETCONST( pMessButtons, "WB_RETRY_CANCEL", sal::static_int_cast<sal_uInt32>(WB_RETRY_CANCEL) ); SETCONST( pMessButtons, "WB_ABORT_RETRY_IGNORE", sal::static_int_cast<sal_uInt32>(WB_ABORT_RETRY_IGNORE) ); - return( pMessButtons ); + return pMessButtons; } -RscEnum * RscTypCont::InitMessDefButton(){ +RscEnum * RscTypCont::InitMessDefButton() +{ RscEnum * pMessDefButton; pMessDefButton = new RscEnum( pHS->getID( "EnumMessDefButton" ), RSC_NOTYPE ); @@ -405,7 +411,7 @@ RscEnum * RscTypCont::InitMessDefButton(){ SETCONST( pMessDefButton, "WB_DEF_YES", sal::static_int_cast<sal_uInt32>(WB_DEF_YES) ); SETCONST( pMessDefButton, "WB_DEF_NO", sal::static_int_cast<sal_uInt32>(WB_DEF_NO) ); SETCONST( pMessDefButton, "WB_DEF_IGNORE", sal::static_int_cast<sal_uInt32>(WB_DEF_IGNORE) ); - return( pMessDefButton ); + return pMessDefButton; } RscTupel * RscTypCont::InitGeometry() @@ -502,7 +508,7 @@ RscCont * RscTypCont::InitStringLongTupelList( RscTupel * pStringLong ) RscArray * RscTypCont::InitLangStringTupelList( RscCont * pStrTupelLst ) { return new RscArray( pHS->getID( "Lang_CharsCharsTupel" ), - RSC_NOTYPE, pStrTupelLst, &aLangType ); + RSC_NOTYPE, pStrTupelLst, &aLangType ); } RscArray * RscTypCont::InitLangStringLongTupelList( RscCont * pStrLongTupelLst ) diff --git a/rsc/source/parser/rscicpx.cxx b/rsc/source/parser/rscicpx.cxx index 8df19d3f498f..9a54719667aa 100644 --- a/rsc/source/parser/rscicpx.cxx +++ b/rsc/source/parser/rscicpx.cxx @@ -56,7 +56,7 @@ RscTop * RscTypCont::InitClassMgr() RscBaseCont * pClass; Atom nId; - aBaseLst.push_back( pClass = new RscBaseCont( InvalidAtom, RSC_NOTYPE, NULL, sal_False ) ); + aBaseLst.push_back( pClass = new RscBaseCont( InvalidAtom, RSC_NOTYPE, NULL, false ) ); nId = pHS->getID( "Resource" ); pClassMgr = new RscMgr( nId, RSC_RESOURCE, pClass ); @@ -81,7 +81,8 @@ RscTop * RscTypCont::InitClassMgr() return pClassMgr; } -RscTop * RscTypCont::InitClassString( RscTop * pSuper ){ +RscTop * RscTypCont::InitClassString( RscTop * pSuper ) +{ Atom nId; RscTop * pClassString; @@ -93,10 +94,11 @@ RscTop * RscTypCont::InitClassString( RscTop * pSuper ){ // Variablen anlegen nId = aNmTb.Put( "Text", VARNAME ); pClassString->SetVariable( nId, &aLangString ); - return( pClassString ); + return pClassString; } -RscTop * RscTypCont::InitClassBitmap( RscTop * pSuper ){ +RscTop * RscTypCont::InitClassBitmap( RscTop * pSuper ) +{ Atom nId; RscTop * pClassBitmap; @@ -110,10 +112,11 @@ RscTop * RscTypCont::InitClassBitmap( RscTop * pSuper ){ nId = aNmTb.Put( "File", VARNAME ); pClassBitmap->SetVariable( nId, &aLangString, NULL, VAR_NORC ); - return( pClassBitmap ); + return pClassBitmap; } -RscTop * RscTypCont::InitClassColor( RscTop * pSuper, RscEnum * pColor ){ +RscTop * RscTypCont::InitClassColor( RscTop * pSuper, RscEnum * pColor ) +{ Atom nId; RscTop * pClassColor; @@ -133,7 +136,7 @@ RscTop * RscTypCont::InitClassColor( RscTop * pSuper, RscEnum * pColor ){ nId = aNmTb.Put( "Predefine", VARNAME ); pClassColor->SetVariable( nId, pColor ); - return( pClassColor ); + return pClassColor; } RscTop * RscTypCont::InitClassImage( RscTop * pSuper, RscTop * pClassBitmap, @@ -157,7 +160,7 @@ RscTop * RscTypCont::InitClassImage( RscTop * pSuper, RscTop * pClassBitmap, pClassImage->SetVariable( nId, pClassColor, NULL, VAR_SVDYNAMIC, RSC_IMAGE_MASKCOLOR ); - return( pClassImage ); + return pClassImage; } RscTop * RscTypCont::InitClassImageList( RscTop * pSuper, @@ -192,11 +195,11 @@ RscTop * RscTypCont::InitClassImageList( RscTop * pSuper, nId = aNmTb.Put( "IdCount", VARNAME ); pClassImageList->SetVariable( nId, &aUShort, NULL, 0, RSC_IMAGELIST_IDCOUNT ); - return( pClassImageList ); + return pClassImageList; } RscTop * RscTypCont::InitClassWindow( RscTop * pSuper, RscEnum * pMapUnit, - RscArray * pLangGeo ) + RscArray * pLangGeo ) { Atom nId; RscTop * pClassWindow; @@ -297,7 +300,7 @@ RscTop * RscTypCont::InitClassWindow( RscTop * pSuper, RscEnum * pMapUnit, 0, WINDOW_BORDER_STYLE ); - return( pClassWindow ); + return pClassWindow; } RscTop * RscTypCont::InitClassSystemWindow( RscTop * pSuper ) @@ -460,11 +463,11 @@ RscTop * RscTypCont::InitClassTriStateBox( RscTop * pSuper, nId = aNmTb.Put( "TriStateDisable", VARNAME ); pClassTriStateBox->SetVariable( nId, &aBool ); - return( pClassTriStateBox ); + return pClassTriStateBox; } RscTop * RscTypCont::InitClassMenuButton( RscTop * pSuper, - RscTop * pClassMenu ) + RscTop * pClassMenu ) { Atom nId; RscTop * pClassMenuButton; @@ -479,7 +482,7 @@ RscTop * RscTypCont::InitClassMenuButton( RscTop * pSuper, pClassMenuButton->SetVariable( nId, pClassMenu, NULL, 0, RSCMENUBUTTON_MENU ); - return( pClassMenuButton ); + return pClassMenuButton; } @@ -610,7 +613,7 @@ RscTop * RscTypCont::InitClassScrollBar( RscTop * pSuper ) { RSCINST aDfltI; - aDfltI = aShort.Create( NULL, RSCINST(), sal_False ); + aDfltI = aShort.Create( NULL, RSCINST(), false ); aDfltI.pClass->SetNumber( aDfltI, 100 ); // aDfltI.pClass->MakeDefault( aDfltI ); @@ -622,7 +625,7 @@ RscTop * RscTypCont::InitClassScrollBar( RscTop * pSuper ) { RSCINST aDfltI; - aDfltI = aShort.Create( NULL, RSCINST(), sal_False ); + aDfltI = aShort.Create( NULL, RSCINST(), false ); aDfltI.pClass->SetNumber( aDfltI, 1 ); // aDfltI.pClass->MakeDefault( aDfltI ); @@ -632,7 +635,7 @@ RscTop * RscTypCont::InitClassScrollBar( RscTop * pSuper ) { RSCINST aDfltI; - aDfltI = aShort.Create( NULL, RSCINST(), sal_False ); + aDfltI = aShort.Create( NULL, RSCINST(), false ); aDfltI.pClass->SetNumber( aDfltI, 1 ); // aDfltI.pClass->MakeDefault( aDfltI ); nId = aNmTb.Put( "LineSize", VARNAME ); @@ -669,7 +672,7 @@ RscTop * RscTypCont::InitClassListBox( RscTop * pSuper, RscArray * pStrLst ) INS_WINBIT(pClassListBox,DDExtraWidth) { - RSCINST aDflt = aUShort.Create( NULL, RSCINST(), sal_False ); + RSCINST aDflt = aUShort.Create( NULL, RSCINST(), false ); aDflt.pClass->SetNumber( aDflt, (sal_uInt16)0xFFFF ); nId = aNmTb.Put( "CurPos", VARNAME ); pClassListBox->SetVariable( nId, &aUShort, &aDflt ); @@ -918,7 +921,7 @@ RscTop * RscTypCont::InitClassKeyCode( RscTop * pSuper, RscEnum * pKey ) } RscTop * RscTypCont::InitClassAccelItem( RscTop * pSuper, - RscTop * pClassKeyCode ) + RscTop * pClassKeyCode ) { Atom nId; RscTop * pClassAccelItem; diff --git a/rsc/source/parser/rscinit.cxx b/rsc/source/parser/rscinit.cxx index 48710a693e31..80a95dbb0f9f 100644 --- a/rsc/source/parser/rscinit.cxx +++ b/rsc/source/parser/rscinit.cxx @@ -146,7 +146,7 @@ void RscTypCont::Init() Atom nId; - aNmTb.SetSort( sal_False ); + aNmTb.SetSort( false ); { aNmTb.Put( "LINE", LINE, (long)0 ); aNmTb.Put( "NOT", NOT, (long)0 ); diff --git a/rsc/source/parser/rsckey.cxx b/rsc/source/parser/rsckey.cxx index c9ed1c44dc32..432e1073e580 100644 --- a/rsc/source/parser/rsckey.cxx +++ b/rsc/source/parser/rsckey.cxx @@ -44,28 +44,33 @@ int SAL_CALL KeyCompare( const void * pFirst, const void * pSecond ) return( 0 ); } -RscNameTable::RscNameTable() { - bSort = sal_True; +RscNameTable::RscNameTable() +{ + bSort = true; nEntries = 0; pTable = NULL; }; -RscNameTable::~RscNameTable() { +RscNameTable::~RscNameTable() +{ if( pTable ) rtl_freeMemory( pTable ); }; -void RscNameTable::SetSort( sal_Bool bSorted ){ +void RscNameTable::SetSort( bool bSorted ) +{ bSort = bSorted; - if( bSort && pTable){ + if( bSort && pTable) + { // Schluesselwort Feld sortieren qsort( (void *)pTable, nEntries, sizeof( KEY_STRUCT ), KeyCompare ); }; }; -Atom RscNameTable::Put( Atom nName, sal_uInt32 nTyp, long nValue ){ +Atom RscNameTable::Put( Atom nName, sal_uInt32 nTyp, long nValue ) +{ if( pTable ) pTable = (KEY_STRUCT *) rtl_reallocateMemory( (void *)pTable, @@ -74,18 +79,20 @@ Atom RscNameTable::Put( Atom nName, sal_uInt32 nTyp, long nValue ){ pTable = (KEY_STRUCT *) rtl_allocateMemory( ((nEntries +1) * sizeof( KEY_STRUCT )) ); + pTable[ nEntries ].nName = nName; pTable[ nEntries ].nTyp = nTyp; pTable[ nEntries ].yylval = nValue; nEntries++; if( bSort ) SetSort(); - return( nName ); + + return nName; }; Atom RscNameTable::Put( const char * pName, sal_uInt32 nTyp, long nValue ) { - return( Put( pHS->getID( pName ), nTyp, nValue ) ); + return Put( pHS->getID( pName ), nTyp, nValue ); }; Atom RscNameTable::Put( const char * pName, sal_uInt32 nTyp ) @@ -93,44 +100,50 @@ Atom RscNameTable::Put( const char * pName, sal_uInt32 nTyp ) Atom nId; nId = pHS->getID( pName ); - return( Put( nId, nTyp, (long)nId ) ); + return Put( nId, nTyp, (long)nId ); }; Atom RscNameTable::Put( Atom nName, sal_uInt32 nTyp, RscTop * pClass ) { - return( Put( nName, nTyp, (long)pClass ) ); + return Put( nName, nTyp, (long)pClass ); }; -sal_Bool RscNameTable::Get( Atom nName, KEY_STRUCT * pEle ){ +bool RscNameTable::Get( Atom nName, KEY_STRUCT * pEle ) +{ KEY_STRUCT * pKey = NULL; KEY_STRUCT aSearchName; sal_uInt32 i; - if( bSort ){ + if( bSort ) + { // Suche nach dem Schluesselwort aSearchName.nName = nName; pKey = (KEY_STRUCT *)bsearch( #ifdef UNX - (const char *) &aSearchName, (char *)pTable, + (const char *) &aSearchName, (char *)pTable, #else - (const void *) &aSearchName, (const void *)pTable, + (const void *) &aSearchName, (const void *)pTable, #endif - nEntries, sizeof( KEY_STRUCT ), KeyCompare ); + nEntries, sizeof( KEY_STRUCT ), KeyCompare ); } - else{ + else + { i = 0; - while( i < nEntries && !pKey ){ + while( i < nEntries && !pKey ) + { if( pTable[ i ].nName == nName ) pKey = &pTable[ i ]; i++; }; }; - if( pKey ){ // Schluesselwort gefunden + if( pKey ) + { + // Schluesselwort gefunden *pEle = *pKey; - return( sal_True ); + return true; }; - return( sal_False ); + return false; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/parser/rsclex.cxx b/rsc/source/parser/rsclex.cxx index 3f795ea7eba7..0f24556dcd4a 100644 --- a/rsc/source/parser/rsclex.cxx +++ b/rsc/source/parser/rsclex.cxx @@ -52,42 +52,51 @@ const char* StringContainer::putString( const char* pString ) } int c; -sal_Bool bLastInclude;// War letztes Symbol INCLUDE +bool bLastInclude;// War letztes Symbol INCLUDE RscFileInst* pFI; RscTypCont* pTC; RscExpression * pExp; -struct KeyVal { +struct KeyVal +{ int nKeyWord; YYSTYPE aYYSType; } aKeyVal[ 1 ]; -sal_Bool bTargetDefined; +bool bTargetDefined; StringContainer* pStringContainer = NULL; -sal_uInt32 GetNumber(){ +sal_uInt32 GetNumber() +{ sal_uInt32 l = 0; sal_uInt32 nLog = 10; - if( '0' == c ){ + if( '0' == c ) + { c = pFI->GetFastChar(); - if( 'x' == c ){ + if( 'x' == c ) + { nLog = 16; c = pFI->GetFastChar(); } }; - if( nLog == 16 ){ - while( isxdigit( c ) ){ + if( nLog == 16 ) + { + while( isxdigit( c ) ) + { if( isdigit( c ) ) l = l * nLog + (c - '0'); else l = l * nLog + (toupper( c ) - 'A' + 10 ); + c = pFI->GetFastChar(); } } - else{ - while( isdigit( c ) || 'x' == c ){ + else + { + while( isdigit( c ) || 'x' == c ) + { l = l * nLog + (c - '0'); c = pFI->GetFastChar(); } @@ -99,30 +108,40 @@ sal_uInt32 GetNumber(){ if( l > 0x7fffffff ) //Oberstes bit gegebenenfalls abschneiden; l &= 0x7fffffff; - return( l ); + return l; } -int MakeToken( YYSTYPE * pTokenVal ){ +int MakeToken( YYSTYPE * pTokenVal ) +{ int c1; - while( true ){ // Kommentare und Leerzeichen ueberlesen + while( true ) // Kommentare und Leerzeichen ueberlesen + { while( isspace( c ) ) c = pFI->GetFastChar(); - if( '/' == c ){ + + if( '/' == c ) + { c1 = c; c = pFI->GetFastChar(); - if( '/' == c ){ + if( '/' == c ) + { while( '\n' != c && !pFI->IsEof() ) c = pFI->GetFastChar(); + c = pFI->GetFastChar(); } - else if( '*' == c ){ + else if( '*' == c ) + { c = pFI->GetFastChar(); - do { + do + { while( '*' != c && !pFI->IsEof() ) c = pFI->GetFastChar(); + c = pFI->GetFastChar(); - } while( '/' != c && !pFI->IsEof() ); + } + while( '/' != c && !pFI->IsEof() ); c = pFI->GetFastChar(); } else @@ -132,13 +151,16 @@ int MakeToken( YYSTYPE * pTokenVal ){ break; }; - if( c == pFI->IsEof() ){ + if( c == pFI->IsEof() ) + { return( 0 ); } - if( bLastInclude ){ - bLastInclude = sal_False; //Zuruecksetzten - if( '<' == c ){ + if( bLastInclude ) + { + bLastInclude = false; //Zuruecksetzten + if( '<' == c ) + { OStringBuffer aBuf( 256 ); c = pFI->GetFastChar(); while( '>' != c && !pFI->IsEof() ) @@ -155,7 +177,7 @@ int MakeToken( YYSTYPE * pTokenVal ){ if( c == '"' ) { OStringBuffer aBuf( 256 ); - sal_Bool bDone = sal_False; + bool bDone = false; while( !bDone && !pFI->IsEof() && c ) { c = pFI->GetFastChar(); @@ -166,6 +188,7 @@ int MakeToken( YYSTYPE * pTokenVal ){ c = pFI->GetFastChar(); } while( c == ' ' || c == '\t' ); + if( c == '"' ) { // this is a continued string @@ -173,7 +196,7 @@ int MakeToken( YYSTYPE * pTokenVal ){ // see rscyacc.y } else - bDone = sal_True; + bDone = true; } else if( c == '\\' ) { @@ -186,14 +209,16 @@ int MakeToken( YYSTYPE * pTokenVal ){ aBuf.append( sal_Char(c) ); } pTokenVal->string = const_cast<char*>(pStringContainer->putString( aBuf.getStr() )); - return( STRING ); + return STRING; } - if (isdigit (c)){ + if (isdigit (c)) + { pTokenVal->value = GetNumber(); return( NUMBER ); } - if( isalpha (c) || (c == '_') ){ + if( isalpha (c) || (c == '_') ) + { Atom nHashId; OStringBuffer aBuf( 256 ); @@ -215,45 +240,48 @@ int MakeToken( YYSTYPE * pTokenVal ){ // Schluesselwort gefunden switch( aKey.nTyp ) { - case CLASSNAME: - pTokenVal->pClass = (RscTop *)aKey.yylval; - break; - case VARNAME: - pTokenVal->varid = aKey.nName; - break; - case CONSTNAME: - pTokenVal->constname.hashid = aKey.nName; - pTokenVal->constname.nValue = aKey.yylval; - break; - case BOOLEAN: - pTokenVal->svbool = (sal_Bool)aKey.yylval; - break; - case INCLUDE: - bLastInclude = sal_True; - default: - pTokenVal->value = aKey.yylval; + case CLASSNAME: + pTokenVal->pClass = (RscTop *)aKey.yylval; + break; + case VARNAME: + pTokenVal->varid = aKey.nName; + break; + case CONSTNAME: + pTokenVal->constname.hashid = aKey.nName; + pTokenVal->constname.nValue = aKey.yylval; + break; + case BOOLEAN: + pTokenVal->svbool = (bool)aKey.yylval; + break; + case INCLUDE: + bLastInclude = true; + default: + pTokenVal->value = aKey.yylval; }; - return( aKey.nTyp ); + return aKey.nTyp; } else { pTokenVal->string = const_cast<char*>(pStringContainer->putString( aBuf.getStr() )); - return( SYMBOL ); + return SYMBOL; } } - else{ // Symbol + else + { + // Symbol RscDefine * pDef; pDef = pTC->aFileTab.FindDef( aBuf.getStr() ); - if( pDef ){ + if( pDef ) + { pTokenVal->defineele = pDef; - return( RSCDEFINE ); + return RSCDEFINE; } pTokenVal->string = const_cast<char*>(pStringContainer->putString( aBuf.getStr() )); - return( SYMBOL ); + return SYMBOL; } } @@ -283,7 +311,7 @@ int MakeToken( YYSTYPE * pTokenVal ){ c1 = c; c = pFI->GetFastChar(); - return( c1 ); + return c1; } #if defined( RS6000 ) @@ -293,13 +321,12 @@ int yylex() #endif { if( bTargetDefined ) - bTargetDefined = sal_False; + bTargetDefined = false; else - aKeyVal[ 0 ].nKeyWord = - MakeToken( &aKeyVal[ 0 ].aYYSType ); + aKeyVal[ 0 ].nKeyWord = MakeToken( &aKeyVal[ 0 ].aYYSType ); yylval = aKeyVal[ 0 ].aYYSType; - return( aKeyVal[ 0 ].nKeyWord ); + return aKeyVal[ 0 ].nKeyWord; } #ifdef RS6000 @@ -319,14 +346,15 @@ void InitParser( RscFileInst * pFileInst ) pFI = pFileInst; pStringContainer = new StringContainer(); pExp = NULL; //fuer MacroParser - bTargetDefined = sal_False; + bTargetDefined = false; // Anfangszeichen initialisieren - bLastInclude = sal_False; + bLastInclude = false; c = pFI->GetFastChar(); } -void EndParser(){ +void EndParser() +{ // Stack abraeumen while( ! S.IsEmpty() ) S.Pop(); @@ -355,15 +383,20 @@ void IncludeParser( RscFileInst * pFileInst ) InitParser( pFileInst ); nToken = MakeToken( &aYYSType ); - while( 0 != nToken && CLASSNAME != nToken ){ - if( '#' == nToken ){ - if( INCLUDE == (nToken = MakeToken( &aYYSType )) ){ - if( STRING == (nToken = MakeToken( &aYYSType )) ){ + while( 0 != nToken && CLASSNAME != nToken ) + { + if( '#' == nToken ) + { + if( INCLUDE == (nToken = MakeToken( &aYYSType )) ) + { + if( STRING == (nToken = MakeToken( &aYYSType )) ) + { lKey = pTypCon->aFileTab.NewIncFile( aYYSType.string, aYYSType.string ); pFName->InsertDependFile( lKey, ULONG_MAX ); } - else if( INCLUDE_STRING == nToken ){ + else if( INCLUDE_STRING == nToken ) + { lKey = pTypCon->aFileTab.NewIncFile( aYYSType.string, OString() ); pFName->InsertDependFile( lKey, ULONG_MAX ); diff --git a/rsc/source/parser/rscpar.cxx b/rsc/source/parser/rscpar.cxx index 3c000be49754..984d3655198d 100644 --- a/rsc/source/parser/rscpar.cxx +++ b/rsc/source/parser/rscpar.cxx @@ -29,8 +29,8 @@ void RscFileInst::Init() *pLine = '\0'; nScanPos = 0; cLastChar = '\0'; - bEof = sal_False; -}; + bEof = false; +} RscFileInst::RscFileInst( RscTypCont * pTC, sal_uLong lIndexSrc, sal_uLong lFIndex, FILE * fFile ) @@ -47,7 +47,8 @@ RscFileInst::RscFileInst( RscTypCont * pTC, sal_uLong lIndexSrc, pInput = (char *)rtl_allocateMemory( nInputBufLen ); } -RscFileInst::~RscFileInst(){ +RscFileInst::~RscFileInst() +{ if( pInput ) rtl_freeMemory( pInput ); if( pLine ) @@ -57,17 +58,17 @@ RscFileInst::~RscFileInst(){ int RscFileInst::GetChar() { if( pLine[ nScanPos ] ) - return( pLine[ nScanPos++ ] ); + return pLine[ nScanPos++ ]; else if( nInputPos >= nInputEndPos && nInputEndPos != nInputBufLen ) { // Dateiende - bEof = sal_True; + bEof = true; return 0; } else { GetNewLine(); - return( '\n' ); + return '\n'; } } @@ -97,17 +98,21 @@ void RscFileInst::GetNewLine() } // cr lf, lf cr, lf oder cr wird '\0' - if( pInput[ nInputPos ] == '\n' ){ + if( pInput[ nInputPos ] == '\n' ) + { nInputPos++; - if( cLastChar != '\r' ){ + if( cLastChar != '\r' ) + { cLastChar = '\n'; pLine[ nLen++ ] = '\0'; goto END; } } - else if( pInput[ nInputPos ] == '\r' ){ + else if( pInput[ nInputPos ] == '\r' ) + { nInputPos++; - if( cLastChar != '\n' ){ + if( cLastChar != '\n' ) + { cLastChar = '\r'; pLine[ nLen++ ] = '\0'; goto END; @@ -133,7 +138,8 @@ void RscFileInst::GetNewLine() pLine[ nLen ] = '\0'; END: - if( pTypCont->pEH->GetListFile() ){ + if( pTypCont->pEH->GetListFile() ) + { char buf[ 10 ]; sprintf( buf, "%5d ", (int)GetLineNo() ); diff --git a/rsc/source/parser/rscyacc.y b/rsc/source/parser/rscyacc.y index 8373ec602231..0c72461cfd67 100644 --- a/rsc/source/parser/rscyacc.y +++ b/rsc/source/parser/rscyacc.y @@ -52,7 +52,7 @@ RSCINST GetVarInst( const RSCINST & rInst, const char * pVarName ) if( !aInst.pData ) pTC->pEH->Error( ERR_NOVARIABLENAME, rInst.pClass, RscId() ); - return( aInst ); + return aInst; } void SetNumber( const RSCINST & rInst, const char * pVarName, sal_Int32 lValue ) @@ -61,7 +61,8 @@ void SetNumber( const RSCINST & rInst, const char * pVarName, sal_Int32 lValue ) aInst = GetVarInst( rInst, pVarName ); - if( aInst.pData ){ + if( aInst.pData ) + { ERRTYPE aError; aError = aInst.pClass->SetNumber( aInst, lValue ); @@ -122,7 +123,7 @@ RscId MakeRscId( RscExpType aExpType ) return RscId(); } -sal_Bool DoClassHeader( RSCHEADER * pHeader, sal_Bool bMember ) +bool DoClassHeader( RSCHEADER * pHeader, bool bMember ) { RSCINST aCopyInst; RscId aName1 = MakeRscId( pHeader->nName1 ); @@ -152,8 +153,8 @@ sal_Bool DoClassHeader( RSCHEADER * pHeader, sal_Bool bMember ) if( bMember ) { // Angabe von Superklassen oder abgeleiteten Klassen ist jetzt erlaubt - if( S.Top().pClass->InHierarchy( pHeader->pClass ) - || pHeader->pClass->InHierarchy( S.Top().pClass) ) + if( S.Top().pClass->InHierarchy( pHeader->pClass ) || + pHeader->pClass->InHierarchy( S.Top().pClass) ) { if( aCopyInst.IsInst() ) { @@ -197,11 +198,14 @@ sal_Bool DoClassHeader( RSCHEADER * pHeader, sal_Bool bMember ) if( (sal_Int32)aName1 >= 256 && aName1.IsId() ) pTC->pEH->Error( WRN_LOCALID, pHeader->pClass, aName1 ); + aError = S.Top().pClass->GetElement( S.Top(), aName1, pHeader->pClass, aCopyInst, &aTmpI ); if( aError.IsWarning() ) + { pTC->pEH->Error( aError, pHeader->pClass, aName1 ); + } else if( aError.IsError() ) { if( ERR_CONT_INVALIDTYPE == aError ) @@ -209,11 +213,12 @@ sal_Bool DoClassHeader( RSCHEADER * pHeader, sal_Bool bMember ) pHS->getString( pHeader->pClass->GetId() ).getStr() ); else pTC->pEH->Error( aError, S.Top().pClass, aName1 ); + S.Top().pClass->GetElement( S.Top(), RscId(), pHeader->pClass, RSCINST(), &aTmpI ); if( !aTmpI.IsInst() ) - return( sal_False ); + return false; } S.Push( aTmpI ); } @@ -226,7 +231,7 @@ sal_Bool DoClassHeader( RSCHEADER * pHeader, sal_Bool bMember ) pTC->pEH->Error( aError, S.Top().pClass, aName1 ); } - return( sal_True ); + return true ; } RSCINST GetFirstTupelEle( const RSCINST & rTop ) @@ -262,36 +267,36 @@ RSCINST GetFirstTupelEle( const RSCINST & rTop ) /* Compilerstack */ %union { - Atom varid; - struct { - Atom hashid; - sal_Int32 nValue; - } constname; - RscTop * pClass; - RSCHEADER header; - struct { - CLASS_DATA pData; - RscTop * pClass; - } instance; - sal_Int32 value; - sal_uInt16 ushort; - short exp_short; - char * string; - sal_Bool svbool; - REF_ENUM copyref; - RscDefine * defineele; - CharSet charset; - RscExpType macrostruct; + Atom varid; + struct { + Atom hashid; + sal_Int32 nValue; + } constname; + RscTop * pClass; + RSCHEADER header; + struct { + CLASS_DATA pData; + RscTop * pClass; + } instance; + sal_Int32 value; + sal_uInt16 ushort; + short exp_short; + char * string; + bool svbool; + REF_ENUM copyref; + RscDefine * defineele; + rtl_TextEncoding charset; + RscExpType macrostruct; } /* Token */ -%token <value> NUMBER -%token <string> SYMBOL -%token <defineele> RSCDEFINE -%token <string> STRING -%token <string> INCLUDE_STRING -%token <character> CHARACTER -%token <svbool> BOOLEAN +%token <value> NUMBER +%token <string> SYMBOL +%token <defineele> RSCDEFINE +%token <string> STRING +%token <string> INCLUDE_STRING +%token <character> CHARACTER +%token <svbool> BOOLEAN %token LINE %token AUTO_ID @@ -310,26 +315,26 @@ RSCINST GetFirstTupelEle( const RSCINST & rTop ) %token DEFAULT -%token <pClass> CLASSNAME -%token <varid> VARNAME -%token <constname> CONSTNAME +%token <pClass> CLASSNAME +%token <varid> VARNAME +%token <constname> CONSTNAME %token CLASS %token EXTENDABLE %token WRITEIFSET -%type <macrostruct> macro_expression -%type <macrostruct> id_expression -%type <value> long_expression -%type <string> string_multiline +%type <macrostruct> macro_expression +%type <macrostruct> id_expression +%type <value> long_expression +%type <string> string_multiline -%type <pClass> type -%type <pClass> type_base -%type <header> class_header_body -%type <header> class_header -%type <header> var_header_class -%type <copyref> copy_ref -%type <ushort> type_flags +%type <pClass> type +%type <pClass> type_base +%type <header> class_header_body +%type <header> class_header +%type <header> var_header_class +%type <copyref> copy_ref +%type <ushort> type_flags %left '|' @@ -343,7 +348,7 @@ RSCINST GetFirstTupelEle( const RSCINST & rTop ) %left '(' ')' -/* Grammatik */ +/* Grammatik */ %start resource_definitions @@ -353,95 +358,105 @@ resource_definitions : | resource_definitions resource_definition | MACROTARGET macro_expression - { - RscExpType aExpType; - sal_Int32 lValue; - - aExpType.cType = RSCEXP_NOTHING; - pExp = new RscExpression( aExpType, '+', $2 ); - if( !pExp->Evaluate( &lValue ) ) - pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() ); - } - ; + { + RscExpType aExpType; + sal_Int32 lValue; + + aExpType.cType = RSCEXP_NOTHING; + pExp = new RscExpression( aExpType, '+', $2 ); + if( !pExp->Evaluate( &lValue ) ) + { + pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() ); + } + } +; resource_definition : line_number | '#' DEFINE SYMBOL macro_expression - { - sal_Bool bError = sal_False; - - if( $4.IsNumber() ){ - if( !pTC->aFileTab.NewDef( pFI->GetFileIndex(), - rtl::OString( $3 ), - $4.GetLong(), ULONG_MAX ) ) - bError = sal_True; - } - else if( $4.IsDefinition() ){ - RscExpType aExpType; - RscExpression * pExpr; - - aExpType.cType = RSCEXP_NOTHING; - aExpType.SetLong( 0 ); - aExpType.cType = RSCEXP_LONG; - pExpr = new RscExpression( aExpType, '+', $4 ); - - if( !pTC->aFileTab.NewDef( pFI->GetFileIndex(), - rtl::OString( $3 ), pExpr, ULONG_MAX ) ) - bError = sal_True; - } - else if( $4.IsExpression() ){ - if( !pTC->aFileTab.NewDef( pFI->GetFileIndex(), - rtl::OString( $3 ), $4.aExp.pExp, - ULONG_MAX ) ) - bError = sal_True; - } - - if( bError ){ - pTC->pEH->Error( ERR_DECLAREDEFINE, NULL, RscId(), $3 ); - } - } + { + bool bError = false; + + if( $4.IsNumber() ) + { + if( !pTC->aFileTab.NewDef( pFI->GetFileIndex(), + rtl::OString( $3 ), + $4.GetLong(), ULONG_MAX ) ) + bError = true; + } + else if( $4.IsDefinition() ) + { + RscExpType aExpType; + RscExpression * pExpr; + + aExpType.cType = RSCEXP_NOTHING; + aExpType.SetLong( 0 ); + aExpType.cType = RSCEXP_LONG; + pExpr = new RscExpression( aExpType, '+', $4 ); + + if( !pTC->aFileTab.NewDef( pFI->GetFileIndex(), + rtl::OString( $3 ), pExpr, ULONG_MAX ) ) + { + bError =true; + } + } + else if( $4.IsExpression() ) + { + if( !pTC->aFileTab.NewDef( pFI->GetFileIndex(), + rtl::OString( $3 ), $4.aExp.pExp, + ULONG_MAX ) ) + { + bError = true; + } + } + + if( bError ) + { + pTC->pEH->Error( ERR_DECLAREDEFINE, NULL, RscId(), $3 ); + } + } | '#' DEFINE RSCDEFINE macro_expression - { - pTC->pEH->Error( ERR_DOUBLEDEFINE, NULL, RscId(), $3->GetName().getStr() ); - } + { + pTC->pEH->Error( ERR_DOUBLEDEFINE, NULL, RscId(), $3->GetName().getStr() ); + } | '#' INCLUDE STRING - { - } + { + } | '#' INCLUDE INCLUDE_STRING - { - } + { + } | class_definition ';' - { + { #ifdef D40 - void * pMem; - pMem = rtl_allocateMemory( 20000 ); - rtl_freeMemory( pMem ); + void * pMem; + pMem = rtl_allocateMemory( 20000 ); + rtl_freeMemory( pMem ); #endif - } + } | new_class_definition_header '{' new_class_definition_body '}' ';' | new_class_definition_header ';' ; new_class_definition_header : CLASS SYMBOL id_expression ':' CLASSNAME - { - sal_Int32 lType; - - $3.Evaluate( &lType ); - - // Klasse anlegen - Atom nId = pHS->getID( $2 ); - pCurClass = new RscClass( nId, lType, $5 ); - nCurMask = 1; - pTC->aNmTb.Put( nId, CLASSNAME, pCurClass ); - pTC->GetRoot()->Insert( pCurClass ); - } + { + sal_Int32 lType; + + $3.Evaluate( &lType ); + + // Klasse anlegen + Atom nId = pHS->getID( $2 ); + pCurClass = new RscClass( nId, lType, $5 ); + nCurMask = 1; + pTC->aNmTb.Put( nId, CLASSNAME, pCurClass ); + pTC->GetRoot()->Insert( pCurClass ); + } | CLASS CLASSNAME id_expression ':' CLASSNAME - { - pCurClass = $2; - nCurMask = 1; - } - ; + { + pCurClass = $2; + nCurMask = 1; + } +; new_class_definition_body : @@ -451,174 +466,178 @@ new_class_definition_body property_definition : type_flags type SYMBOL { - // Variable anlegen - Atom nId = pTC->aNmTb.Put( $3, VARNAME ); - pCurClass->SetVariable( nId, $2, NULL, $1, nCurMask ); - nCurMask <<= 1; + // Variable anlegen + Atom nId = pTC->aNmTb.Put( $3, VARNAME ); + pCurClass->SetVariable( nId, $2, NULL, $1, nCurMask ); + nCurMask <<= 1; } | type_flags type VARNAME { - pCurClass->SetVariable( $3, $2, NULL, $1, nCurMask ); - nCurMask <<= 1; + pCurClass->SetVariable( $3, $2, NULL, $1, nCurMask ); + nCurMask <<= 1; } ; type_flags : type_flags EXTENDABLE { - $$ = $1 | VAR_EXTENDABLE; + $$ = $1 | VAR_EXTENDABLE; } | type_flags WRITEIFSET { - $$ = $1 | VAR_SVDYNAMIC; + $$ = $1 | VAR_SVDYNAMIC; } | { - $$ = 0; + $$ = 0; } ; type : type_base { - $$ = $1; + $$ = $1; } | type_base '[' ']' { - if( $1 ) - { - rtl::OString aTypeName = rtl::OStringBuffer(pHS->getString($1->GetId())). - append("[]").makeStringAndClear(); - $$ = pTC->SearchType( pHS->getID( aTypeName.getStr(), true ) ); - if( !$$ ) - { - RscCont * pCont; - pCont = new RscCont( pHS->getID( aTypeName.getStr() ), RSC_NOTYPE ); - pCont->SetTypeClass( $1 ); - pTC->InsertType( pCont ); - $$ = pCont; - } - } - else - $$ = NULL; + if( $1 ) + { + rtl::OString aTypeName = rtl::OStringBuffer(pHS->getString($1->GetId())). + append("[]").makeStringAndClear(); + $$ = pTC->SearchType( pHS->getID( aTypeName.getStr(), true ) ); + if( !$$ ) + { + RscCont * pCont; + pCont = new RscCont( pHS->getID( aTypeName.getStr() ), RSC_NOTYPE ); + pCont->SetTypeClass( $1 ); + pTC->InsertType( pCont ); + $$ = pCont; + } + } + else + { + $$ = NULL; + } } ; type_base : CLASSNAME { - $$ = $1; + $$ = $1; } | SYMBOL { - RscTop * pType = pTC->SearchType( pHS->getID( $1, true ) ); - if( !pType ) - pTC->pEH->Error( ERR_NOTYPE, pCurClass, RscId() ); - $$ = pType; + RscTop * pType = pTC->SearchType( pHS->getID( $1, true ) ); + if( !pType ) + pTC->pEH->Error( ERR_NOTYPE, pCurClass, RscId() ); + $$ = pType; } ; class_definition : class_header class_body { - if( TYPE_REF == $1.nTyp ) - pTC->pEH->Error( ERR_REFNOTALLOWED, S.Top().pClass, - RscId( $1.nName1 ) ); - S.Pop(); + if( TYPE_REF == $1.nTyp ) + { + pTC->pEH->Error( ERR_REFNOTALLOWED, S.Top().pClass, + RscId( $1.nName1 ) ); + } + S.Pop(); } | class_header { - ERRTYPE aError; - RscId aRscId( $1.nName1 ); - - if( TYPE_NOTHING == $1.nTyp && aRscId.IsId() ) - aError = S.Top().pClass->SetRef( S.Top(), aRscId ); - else if( TYPE_COPY == $1.nTyp ) - aError = ERR_COPYNOTALLOWED; - if( aError.IsError() || aError.IsWarning() ) - pTC->pEH->Error( aError, S.Top().pClass, aRscId ); - S.Pop(); + ERRTYPE aError; + RscId aRscId( $1.nName1 ); + + if( TYPE_NOTHING == $1.nTyp && aRscId.IsId() ) + aError = S.Top().pClass->SetRef( S.Top(), aRscId ); + else if( TYPE_COPY == $1.nTyp ) + aError = ERR_COPYNOTALLOWED; + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, aRscId ); + S.Pop(); } ; class_header : class_header_body - { - if( !DoClassHeader( &$1, sal_False ) ) - return( ERR_ERROR ); - $$ = $1; - } + { + if( !DoClassHeader( &$1, false ) ) + return ERR_ERROR; + $$ = $1; + } ; copy_ref : '<' - { - $$ = TYPE_COPY; - } + { + $$ = TYPE_COPY; + } | ',' - { - $$ = TYPE_REF; - } - ; + { + $$ = TYPE_REF; + } +; class_header_body : CLASSNAME id_expression copy_ref CLASSNAME id_expression - { - $$.pClass = $1; - $$.nName1 = $2; - $$.nTyp = $3; - $$.pRefClass = $4; - $$.nName2 = $5; - } + { + $$.pClass = $1; + $$.nName1 = $2; + $$.nTyp = $3; + $$.pRefClass = $4; + $$.nName2 = $5; + } | CLASSNAME id_expression copy_ref id_expression - { - $$.pClass = $1; - $$.nName1 = $2; - $$.nTyp = $3; - $$.pRefClass = NULL; - $$.nName2 = $4; - } + { + $$.pClass = $1; + $$.nName1 = $2; + $$.nTyp = $3; + $$.pRefClass = NULL; + $$.nName2 = $4; + } | CLASSNAME id_expression - { - $$.pClass = $1; - $$.nName1 = $2; - $$.nTyp = TYPE_NOTHING; - $$.pRefClass = NULL; - $$.nName2.cType = RSCEXP_NOTHING; - } + { + $$.pClass = $1; + $$.nName1 = $2; + $$.nTyp = TYPE_NOTHING; + $$.pRefClass = NULL; + $$.nName2.cType = RSCEXP_NOTHING; + } | CLASSNAME copy_ref id_expression - { - $$.pClass = $1; - $$.nName1.cType = RSCEXP_NOTHING; - $$.nTyp = $2; - $$.pRefClass = NULL; - $$.nName2 = $3; - } + { + $$.pClass = $1; + $$.nName1.cType = RSCEXP_NOTHING; + $$.nTyp = $2; + $$.pRefClass = NULL; + $$.nName2 = $3; + } | CLASSNAME copy_ref CLASSNAME id_expression - { - $$.pClass = $1; - $$.nName1.cType = RSCEXP_NOTHING; - $$.nTyp = $2; - $$.pRefClass = $3; - $$.nName2 = $4; - } + { + $$.pClass = $1; + $$.nName1.cType = RSCEXP_NOTHING; + $$.nTyp = $2; + $$.pRefClass = $3; + $$.nName2 = $4; + } | CLASSNAME - { - $$.pClass = $1; - $$.nName1.cType = RSCEXP_NOTHING; - $$.nTyp = TYPE_NOTHING; - $$.nName2.cType = RSCEXP_NOTHING; - } - ; + { + $$.pClass = $1; + $$.nName1.cType = RSCEXP_NOTHING; + $$.nTyp = TYPE_NOTHING; + $$.nName2.cType = RSCEXP_NOTHING; + } +; class_body : '{' var_definitions '}' | '{' '}' | string_multiline - { - SetString( S.Top(), "TEXT", $1 ); - } - ; + { + SetString( S.Top(), "TEXT", $1 ); + } +; var_definitions : var_definition @@ -627,376 +646,380 @@ var_definitions xy_mapmode : CONSTNAME - { - SetConst( S.Top(), "_XYMAPMODE", $1.hashid, $1.nValue ); - } + { + SetConst( S.Top(), "_XYMAPMODE", $1.hashid, $1.nValue ); + } | ; wh_mapmode : CONSTNAME - { - SetConst( S.Top(), "_WHMAPMODE", $1.hashid, $1.nValue ); - } + { + SetConst( S.Top(), "_WHMAPMODE", $1.hashid, $1.nValue ); + } | ; xywh_mapmode : CONSTNAME - { - SetConst( S.Top(), "_XYMAPMODE", $1.hashid, $1.nValue ); - SetConst( S.Top(), "_WHMAPMODE", $1.hashid, $1.nValue ); - } + { + SetConst( S.Top(), "_XYMAPMODE", $1.hashid, $1.nValue ); + SetConst( S.Top(), "_WHMAPMODE", $1.hashid, $1.nValue ); + } | ; var_definition : line_number | var_header var_body ';' - { - S.Pop(); - } + { + S.Pop(); + } | class_definition ';' | var_header_class class_body ';' - { - if( TYPE_REF == $1.nTyp ) - pTC->pEH->Error( ERR_REFNOTALLOWED, S.Top().pClass, - RscId( $1.nName1 ) ); + { + if( TYPE_REF == $1.nTyp ) + pTC->pEH->Error( ERR_REFNOTALLOWED, S.Top().pClass, + RscId( $1.nName1 ) ); - if( S.Top().pClass->GetCount( S.Top() ) ) - pTC->pEH->Error( WRN_SUBINMEMBER, S.Top().pClass, - RscId( $1.nName1 ) ); + if( S.Top().pClass->GetCount( S.Top() ) ) + pTC->pEH->Error( WRN_SUBINMEMBER, S.Top().pClass, + RscId( $1.nName1 ) ); - S.Pop(); - } + S.Pop(); + } | var_header_class ';' - { - ERRTYPE aError; - RscId aRscId( $1.nName1 ); - - if( TYPE_NOTHING == $1.nTyp && aRscId.IsId() ) - aError = S.Top().pClass->SetRef( S.Top(), aRscId ); - else if( TYPE_COPY == $1.nTyp ) - aError = ERR_COPYNOTALLOWED; - if( S.Top().pClass->GetCount( S.Top() ) ) - aError = WRN_SUBINMEMBER; - if( aError.IsError() || aError.IsWarning() ) - pTC->pEH->Error( aError, S.Top().pClass, aRscId ); - - S.Pop(); - } + { + ERRTYPE aError; + RscId aRscId( $1.nName1 ); + + if( TYPE_NOTHING == $1.nTyp && aRscId.IsId() ) + aError = S.Top().pClass->SetRef( S.Top(), aRscId ); + else if( TYPE_COPY == $1.nTyp ) + aError = ERR_COPYNOTALLOWED; + if( S.Top().pClass->GetCount( S.Top() ) ) + aError = WRN_SUBINMEMBER; + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, aRscId ); + + S.Pop(); + } | XSCALE '=' '(' long_expression ',' long_expression ')' ';' - { - SetNumber( S.Top(), "_XNUMERATOR", $4 ); - SetNumber( S.Top(), "_XDENOMINATOR", $6 ); - } + { + SetNumber( S.Top(), "_XNUMERATOR", $4 ); + SetNumber( S.Top(), "_XDENOMINATOR", $6 ); + } | YSCALE '=' '(' long_expression ',' long_expression ')' ';' - { - SetNumber( S.Top(), "_YNUMERATOR", $4 ); - SetNumber( S.Top(), "_YDENOMINATOR", $6 ); - } + { + SetNumber( S.Top(), "_YNUMERATOR", $4 ); + SetNumber( S.Top(), "_YDENOMINATOR", $6 ); + } | RGB '=' '(' long_expression ',' long_expression - ',' long_expression ')' ';' - { - SetNumber( S.Top(), "RED", $4 ); - SetNumber( S.Top(), "GREEN", $6 ); - SetNumber( S.Top(), "BLUE", $8 ); - } + ',' long_expression ')' ';' + { + SetNumber( S.Top(), "RED", $4 ); + SetNumber( S.Top(), "GREEN", $6 ); + SetNumber( S.Top(), "BLUE", $8 ); + } | GEOMETRY '=' xywh_mapmode '(' long_expression ',' long_expression ',' - long_expression ',' long_expression ')' ';' - { - SetNumber( S.Top(), "_X", $5 ); - SetNumber( S.Top(), "_Y", $7 ); - SetNumber( S.Top(), "_WIDTH", $9 ); - SetNumber( S.Top(), "_HEIGHT", $11 ); - } + long_expression ',' long_expression ')' ';' + { + SetNumber( S.Top(), "_X", $5 ); + SetNumber( S.Top(), "_Y", $7 ); + SetNumber( S.Top(), "_WIDTH", $9 ); + SetNumber( S.Top(), "_HEIGHT", $11 ); + } | POSITION '=' xy_mapmode '(' long_expression ',' long_expression - ')' ';' - { - SetNumber( S.Top(), "_X", $5 ); - SetNumber( S.Top(), "_Y", $7 ); - } + ')' ';' + { + SetNumber( S.Top(), "_X", $5 ); + SetNumber( S.Top(), "_Y", $7 ); + } | DIMENSION '=' wh_mapmode '(' long_expression ',' long_expression - ')' ';' - { - SetNumber( S.Top(), "_WIDTH", $5 ); - SetNumber( S.Top(), "_HEIGHT", $7 ); - } + ')' ';' + { + SetNumber( S.Top(), "_WIDTH", $5 ); + SetNumber( S.Top(), "_HEIGHT", $7 ); + } | INZOOMOUTPUTSIZE '=' CONSTNAME '(' long_expression ',' long_expression - ')' ';' - { - SetConst( S.Top(), "_ZOOMINMAPMODE", $3.hashid, $3.nValue ); - SetNumber( S.Top(), "_ZOOMINWIDTH", $5 ); - SetNumber( S.Top(), "_ZOOMINHEIGHT", $7 ); - } + ')' ';' + { + SetConst( S.Top(), "_ZOOMINMAPMODE", $3.hashid, $3.nValue ); + SetNumber( S.Top(), "_ZOOMINWIDTH", $5 ); + SetNumber( S.Top(), "_ZOOMINHEIGHT", $7 ); + } | INZOOMOUTPUTSIZE '=' '(' long_expression ',' long_expression ')' ';' - { - SetNumber( S.Top(), "_ZOOMINWIDTH", $4 ); - SetNumber( S.Top(), "_ZOOMINHEIGHT", $6 ); - } + { + SetNumber( S.Top(), "_ZOOMINWIDTH", $4 ); + SetNumber( S.Top(), "_ZOOMINHEIGHT", $6 ); + } | FLOATINGPOS '=' CONSTNAME '(' long_expression ',' long_expression - ')' ';' - { - SetConst( S.Top(), "_FLOATINGPOSMAPMODE", $3.hashid, $3.nValue ); - SetNumber( S.Top(), "_FLOATINGPOSX", $5 ); - SetNumber( S.Top(), "_FLOATINGPOSY", $7 ); - } + ')' ';' + { + SetConst( S.Top(), "_FLOATINGPOSMAPMODE", $3.hashid, $3.nValue ); + SetNumber( S.Top(), "_FLOATINGPOSX", $5 ); + SetNumber( S.Top(), "_FLOATINGPOSY", $7 ); + } | FLOATINGPOS '=' '(' long_expression ',' long_expression ')' ';' - { - SetNumber( S.Top(), "_FLOATINGPOSX", $4 ); - SetNumber( S.Top(), "_FLOATINGPOSY", $6 ); - } - ; + { + SetNumber( S.Top(), "_FLOATINGPOSX", $4 ); + SetNumber( S.Top(), "_FLOATINGPOSY", $6 ); + } +; var_header_class : VARNAME '=' class_header_body - { - RSCINST aInst; - - aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST(), sal_False, $3.pClass ); - - if( aInst.pData ) - S.Push( aInst ); - else - { - pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(), - pHS->getString( $1 ).getStr() ); - return( ERR_ERROR ); - } - - if( !DoClassHeader( &$3, sal_True ) ) - return( ERR_ERROR ); - $$ = $3; - } + { + RSCINST aInst; + + aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST(), false, $3.pClass ); + + if( aInst.pData ) + S.Push( aInst ); + else + { + pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(), + pHS->getString( $1 ).getStr() ); + return ERR_ERROR; + } + + if( !DoClassHeader( &$3, true ) ) + return ERR_ERROR; + $$ = $3; + } | VARNAME '[' CONSTNAME ']' '=' class_header_body - { - RSCINST aInst; - - aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() ); - - if( aInst.pData ) - { - ERRTYPE aError; - RSCINST aIdxInst; - - aError = aInst.pClass->GetArrayEle( aInst, $3.hashid, NULL, &aIdxInst ); - if( aError.IsError() || aError.IsWarning() ) - pTC->pEH->Error( aError, S.Top().pClass, RscId() ); - if( aError.IsError() ) - return( ERR_ERROR ); - S.Push( aIdxInst ); - } - else - { - pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(), - pHS->getString( $1 ).getStr() ); - return( ERR_ERROR ); - } - if( !DoClassHeader( &$6, sal_True ) ) - return( ERR_ERROR ); - $$ = $6; - } + { + RSCINST aInst; + + aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() ); + + if( aInst.pData ) + { + ERRTYPE aError; + RSCINST aIdxInst; + + aError = aInst.pClass->GetArrayEle( aInst, $3.hashid, NULL, &aIdxInst ); + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + if( aError.IsError() ) + return ERR_ERROR; + S.Push( aIdxInst ); + } + else + { + pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(), + pHS->getString( $1 ).getStr() ); + return ERR_ERROR; + } + if( !DoClassHeader( &$6, true ) ) + return ERR_ERROR; + $$ = $6; + } | VARNAME '[' SYMBOL ']' '=' class_header_body - { - RSCINST aInst; - - aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() ); - - if( aInst.pData ) - { - long nNewLang = pTC->AddLanguage( $3 ); - ERRTYPE aError; - RSCINST aIdxInst; - - aError = aInst.pClass->GetArrayEle( aInst, nNewLang, NULL, &aIdxInst ); - if( aError.IsError() || aError.IsWarning() ) - pTC->pEH->Error( aError, S.Top().pClass, RscId() ); - if( aError.IsError() ) - return( ERR_ERROR ); - S.Push( aIdxInst ); - } - else - { - pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(), - pHS->getString( $1 ).getStr() ); - return( ERR_ERROR ); - } - if( !DoClassHeader( &$6, sal_True ) ) - return( ERR_ERROR ); - $$ = $6; - } - ; + { + RSCINST aInst; + + aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() ); + + if( aInst.pData ) + { + long nNewLang = pTC->AddLanguage( $3 ); + ERRTYPE aError; + RSCINST aIdxInst; + + aError = aInst.pClass->GetArrayEle( aInst, nNewLang, NULL, &aIdxInst ); + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + if( aError.IsError() ) + return ERR_ERROR; + S.Push( aIdxInst ); + } + else + { + pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(), + pHS->getString( $1 ).getStr() ); + return ERR_ERROR; + } + if( !DoClassHeader( &$6, true ) ) + return ERR_ERROR; + $$ = $6; + } +; var_header : VARNAME '=' - { - RSCINST aInst; - - aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() ); - - if( aInst.pData ) - S.Push( aInst ); - else{ - pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(), - pHS->getString( $1 ).getStr() ); - return( ERR_ERROR ); - } - } + { + RSCINST aInst; + + aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() ); + + if( aInst.pData ) + S.Push( aInst ); + else + { + pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(), + pHS->getString( $1 ).getStr() ); + return ERR_ERROR; + } + } | VARNAME '[' CONSTNAME ']' '=' - { - RSCINST aInst; - - aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() ); - - if( aInst.pData ) - { - ERRTYPE aError; - RSCINST aIdxInst; - - aError = aInst.pClass->GetArrayEle( aInst, $3.hashid, NULL, &aIdxInst ); - if( aError.IsError() || aError.IsWarning() ) - pTC->pEH->Error( aError, S.Top().pClass, RscId() ); - if( aError.IsError() ) - return( ERR_ERROR ); - S.Push( aIdxInst ); - } - else{ - pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(), - pHS->getString( $1 ).getStr() ); - return( ERR_ERROR ); - } - } + { + RSCINST aInst; + + aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() ); + + if( aInst.pData ) + { + ERRTYPE aError; + RSCINST aIdxInst; + + aError = aInst.pClass->GetArrayEle( aInst, $3.hashid, NULL, &aIdxInst ); + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + if( aError.IsError() ) + return ERR_ERROR; + S.Push( aIdxInst ); + } + else + { + pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(), + pHS->getString( $1 ).getStr() ); + return ERR_ERROR; + } + } | VARNAME '[' SYMBOL ']' '=' - { - RSCINST aInst; - - aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() ); - - if( aInst.pData ) - { - long nNewLang = pTC->AddLanguage( $3 ); - ERRTYPE aError; - RSCINST aIdxInst; - - aError = aInst.pClass->GetArrayEle( aInst, nNewLang, NULL, &aIdxInst ); - if( aError.IsError() || aError.IsWarning() ) - pTC->pEH->Error( aError, S.Top().pClass, RscId() ); - if( aError.IsError() ) - return( ERR_ERROR ); - S.Push( aIdxInst ); - } - else{ - pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(), - pHS->getString( $1 ).getStr() ); - return( ERR_ERROR ); - } - } - ; + { + RSCINST aInst; + + aInst = S.Top().pClass->GetVariable( S.Top(), $1, RSCINST() ); + + if( aInst.pData ) + { + long nNewLang = pTC->AddLanguage( $3 ); + ERRTYPE aError; + RSCINST aIdxInst; + + aError = aInst.pClass->GetArrayEle( aInst, nNewLang, NULL, &aIdxInst ); + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + if( aError.IsError() ) + return ERR_ERROR; + S.Push( aIdxInst ); + } + else + { + pTC->pEH->Error( ERR_NOVARIABLENAME, S.Top().pClass, RscId(), + pHS->getString( $1 ).getStr() ); + return ERR_ERROR; + } + } +; + tupel_header0 : - { - RSCINST aInst; - - aInst = S.Top().pClass->GetTupelVar( S.Top(), 0, RSCINST() ); - if( aInst.pData ) - S.Push( aInst ); - else - { - pTC->pEH->Error( ERR_NOTUPELNAME, S.Top().pClass, RscId() ); - return( ERR_ERROR ); - } - } - ; + { + RSCINST aInst; + + aInst = S.Top().pClass->GetTupelVar( S.Top(), 0, RSCINST() ); + if( aInst.pData ) + S.Push( aInst ); + else + { + pTC->pEH->Error( ERR_NOTUPELNAME, S.Top().pClass, RscId() ); + return ERR_ERROR; + } + } +; tupel_header1 : - { - RSCINST aInst; - - aInst = S.Top().pClass->GetTupelVar( S.Top(), 1, RSCINST() ); - if( aInst.pData ) - S.Push( aInst ); - else - { - pTC->pEH->Error( ERR_NOTUPELNAME, S.Top().pClass, RscId() ); - return( ERR_ERROR ); - } - } - ; + { + RSCINST aInst; + + aInst = S.Top().pClass->GetTupelVar( S.Top(), 1, RSCINST() ); + if( aInst.pData ) + S.Push( aInst ); + else + { + pTC->pEH->Error( ERR_NOTUPELNAME, S.Top().pClass, RscId() ); + return ERR_ERROR; + } + } +; tupel_header2 : - { - RSCINST aInst; - - aInst = S.Top().pClass->GetTupelVar( S.Top(), 2, RSCINST() ); - if( aInst.pData ) - S.Push( aInst ); - else - { - pTC->pEH->Error( ERR_NOTUPELNAME, S.Top().pClass, RscId() ); - return( ERR_ERROR ); - } - } - ; + { + RSCINST aInst; + + aInst = S.Top().pClass->GetTupelVar( S.Top(), 2, RSCINST() ); + if( aInst.pData ) + S.Push( aInst ); + else + { + pTC->pEH->Error( ERR_NOTUPELNAME, S.Top().pClass, RscId() ); + return ERR_ERROR; + } + } +; tupel_header3 : - { - RSCINST aInst; - - aInst = S.Top().pClass->GetTupelVar( S.Top(), 3, RSCINST() ); - if( !aInst.pData ) - { - pTC->pEH->Error( ERR_NOTUPELNAME, S.Top().pClass, RscId() ); - return( ERR_ERROR ); - } - S.Push( aInst ); - } - ; + { + RSCINST aInst; + + aInst = S.Top().pClass->GetTupelVar( S.Top(), 3, RSCINST() ); + if( !aInst.pData ) + { + pTC->pEH->Error( ERR_NOTUPELNAME, S.Top().pClass, RscId() ); + return ERR_ERROR; + } + S.Push( aInst ); + } +; tupel_body : var_body - { - S.Pop(); - } - ; + { + S.Pop(); + } +; var_list_header : - { - ERRTYPE aError; - RSCINST aInst; - - aError = S.Top().pClass->GetElement( S.Top(), RscId(), - NULL, RSCINST(), &aInst ); - if( aError.IsError() || aError.IsWarning() ) - pTC->pEH->Error( aError, S.Top().pClass, RscId() ); - if( aError.IsError() ) - { // unbedingt Instanz auf den Stack bringen - aInst = S.Top().pClass->Create( NULL, RSCINST() ); - } - S.Push( aInst ); - } - ; + { + ERRTYPE aError; + RSCINST aInst; + + aError = S.Top().pClass->GetElement( S.Top(), RscId(), + NULL, RSCINST(), &aInst ); + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + if( aError.IsError() ) + { // unbedingt Instanz auf den Stack bringen + aInst = S.Top().pClass->Create( NULL, RSCINST() ); + } + S.Push( aInst ); + } +; list_body : var_bodycomplex - { - S.Pop(); - } - ; + { + S.Pop(); + } +; list_header : - { - sal_uInt32 nCount = S.Top().pClass->GetCount( S.Top() ); - sal_uInt32 i; + { + sal_uInt32 nCount = S.Top().pClass->GetCount( S.Top() ); + sal_uInt32 i; - for( i = nCount; i > 0; i-- ) - S.Top().pClass->DeletePos( S.Top(), i -1 ); - } - ; + for( i = nCount; i > 0; i-- ) + S.Top().pClass->DeletePos( S.Top(), i -1 ); + } +; list : list var_list_header list_body ';' @@ -1008,110 +1031,110 @@ list var_bodysimple : macro_expression - { - sal_Int32 l; - ERRTYPE aError; - - if( !$1.Evaluate( &l ) ) - pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() ); - else - { - aError = S.Top().pClass->SetRef( S.Top(), RscId( $1 ) ); - if( aError.IsError() ) - { - aError.Clear(); - aError = S.Top().pClass->SetNumber( S.Top(), l ); - } - if( aError.IsError() ) - { // Aufwaertskompatible, Tupel probieren - RSCINST aInst = GetFirstTupelEle( S.Top() ); - if( aInst.pData ) - { - aError.Clear(); // Fehler zuruecksetzen - aError = aInst.pClass->SetRef( aInst, RscId( $1 ) ); - if( aError.IsError() ) - { - aError.Clear(); - aError = aInst.pClass->SetNumber( aInst, l ); - } - } - } - } - - if( $1.IsExpression() ) - delete $1.aExp.pExp; - - if( aError.IsError() || aError.IsWarning() ) - pTC->pEH->Error( aError, S.Top().pClass, RscId() ); - } + { + sal_Int32 l; + ERRTYPE aError; + + if( !$1.Evaluate( &l ) ) + pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() ); + else + { + aError = S.Top().pClass->SetRef( S.Top(), RscId( $1 ) ); + if( aError.IsError() ) + { + aError.Clear(); + aError = S.Top().pClass->SetNumber( S.Top(), l ); + } + if( aError.IsError() ) + { // Aufwaertskompatible, Tupel probieren + RSCINST aInst = GetFirstTupelEle( S.Top() ); + if( aInst.pData ) + { + aError.Clear(); // Fehler zuruecksetzen + aError = aInst.pClass->SetRef( aInst, RscId( $1 ) ); + if( aError.IsError() ) + { + aError.Clear(); + aError = aInst.pClass->SetNumber( aInst, l ); + } + } + } + } + + if( $1.IsExpression() ) + delete $1.aExp.pExp; + + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + } | CONSTNAME - { - ERRTYPE aError; - aError = S.Top().pClass->SetConst( S.Top(), $1.hashid, $1.nValue ); - if( aError.IsError() ) - { // Aufwaertskompatible, Tupel probieren - RSCINST aInst = GetFirstTupelEle( S.Top() ); - if( aInst.pData ) - { - aError.Clear(); // Fehler zuruecksetzen - aError = aInst.pClass->SetConst( aInst, $1.hashid, $1.nValue ); - } - } - - if( aError.IsError() || aError.IsWarning() ) - pTC->pEH->Error( aError, S.Top().pClass, RscId() ); - } + { + ERRTYPE aError; + aError = S.Top().pClass->SetConst( S.Top(), $1.hashid, $1.nValue ); + if( aError.IsError() ) + { // Aufwaertskompatible, Tupel probieren + RSCINST aInst = GetFirstTupelEle( S.Top() ); + if( aInst.pData ) + { + aError.Clear(); // Fehler zuruecksetzen + aError = aInst.pClass->SetConst( aInst, $1.hashid, $1.nValue ); + } + } + + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + } | NOT CONSTNAME - { - ERRTYPE aError; - aError = S.Top().pClass->SetNotConst( S.Top(), $2.hashid ); - if( aError.IsError() ) - { // Aufwaertskompatible, Tupel probieren - RSCINST aInst = GetFirstTupelEle( S.Top() ); - if( aInst.pData ) - { - aError.Clear(); // Fehler zuruecksetzen - aError = aInst.pClass->SetNotConst( aInst, $2.hashid ); - } - } - - if( aError.IsError() || aError.IsWarning() ) - pTC->pEH->Error( aError, S.Top().pClass, RscId() ); - } + { + ERRTYPE aError; + aError = S.Top().pClass->SetNotConst( S.Top(), $2.hashid ); + if( aError.IsError() ) + { // Aufwaertskompatible, Tupel probieren + RSCINST aInst = GetFirstTupelEle( S.Top() ); + if( aInst.pData ) + { + aError.Clear(); // Fehler zuruecksetzen + aError = aInst.pClass->SetNotConst( aInst, $2.hashid ); + } + } + + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + } | BOOLEAN - { - ERRTYPE aError; - aError = S.Top().pClass->SetBool( S.Top(), $1 ); - if( aError.IsError() ) - { // Aufwaertskompatible, Tupel probieren - RSCINST aInst = GetFirstTupelEle( S.Top() ); - if( aInst.pData ) - { - aError.Clear(); // Fehler zuruecksetzen - aError = aInst.pClass->SetBool( aInst, $1 ); - } - } - - if( aError.IsError() || aError.IsWarning() ) - pTC->pEH->Error( aError, S.Top().pClass, RscId() ); - } + { + ERRTYPE aError; + aError = S.Top().pClass->SetBool( S.Top(), $1 ); + if( aError.IsError() ) + { // Aufwaertskompatible, Tupel probieren + RSCINST aInst = GetFirstTupelEle( S.Top() ); + if( aInst.pData ) + { + aError.Clear(); // Fehler zuruecksetzen + aError = aInst.pClass->SetBool( aInst, $1 ); + } + } + + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + } | string_multiline - { - ERRTYPE aError; - aError = S.Top().pClass->SetString( S.Top(), $1 ); - if( aError.IsError() ) - { // Aufwaertskompatible, Tupel probieren - RSCINST aInst = GetFirstTupelEle( S.Top() ); - if( aInst.pData ) - { - aError.Clear(); // Fehler zuruecksetzen - aError = aInst.pClass->SetString( aInst, $1 ); - } - } - - if( aError.IsError() || aError.IsWarning() ) - pTC->pEH->Error( aError, S.Top().pClass, RscId() ); - } + { + ERRTYPE aError; + aError = S.Top().pClass->SetString( S.Top(), $1 ); + if( aError.IsError() ) + { // Aufwaertskompatible, Tupel probieren + RSCINST aInst = GetFirstTupelEle( S.Top() ); + if( aInst.pData ) + { + aError.Clear(); // Fehler zuruecksetzen + aError = aInst.pClass->SetString( aInst, $1 ); + } + } + + if( aError.IsError() || aError.IsWarning() ) + pTC->pEH->Error( aError, S.Top().pClass, RscId() ); + } | DEFAULT ; @@ -1120,9 +1143,9 @@ var_bodycomplex | '<' tupel_header0 tupel_body ';' '>' | '<' tupel_header0 tupel_body ';' tupel_header1 tupel_body ';' '>' | '<' tupel_header0 tupel_body ';' tupel_header1 tupel_body ';' - tupel_header2 tupel_body ';' '>' + tupel_header2 tupel_body ';' '>' | '<' tupel_header0 tupel_body ';' tupel_header1 tupel_body ';' - tupel_header2 tupel_body ';' tupel_header3 tupel_body ';' '>' + tupel_header2 tupel_body ';' tupel_header3 tupel_body ';' '>' ; var_body @@ -1132,210 +1155,232 @@ var_body string_multiline : STRING - { - $$ = $1; - } + { + $$ = $1; + } | string_multiline STRING - { - rtl::OStringBuffer aBuf( 256 ); - aBuf.append( $1 ); - aBuf.append( $2 ); - $$ = (char*)pStringContainer->putString( aBuf.getStr() ); - } - ; + { + rtl::OStringBuffer aBuf( 256 ); + aBuf.append( $1 ); + aBuf.append( $2 ); + $$ = (char*)pStringContainer->putString( aBuf.getStr() ); + } +; long_expression : macro_expression - { - if( !$1.Evaluate( &$$ ) ) - pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() ); - if( $1.IsExpression() ) - delete $1.aExp.pExp; - } - ; + { + if( !$1.Evaluate( &$$ ) ) + pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() ); + if( $1.IsExpression() ) + delete $1.aExp.pExp; + } +; macro_expression : RSCDEFINE - { - $$.cType = RSCEXP_DEF; - $$.aExp.pDef = $1; - } + { + $$.cType = RSCEXP_DEF; + $$.aExp.pDef = $1; + } | NUMBER - { - $$.cType = RSCEXP_LONG; - $$.SetLong( $1 ); - } + { + $$.cType = RSCEXP_LONG; + $$.SetLong( $1 ); + } | '-' macro_expression %prec UNARYMINUS - { - if( $2.IsNumber() ){ - $$.cType = $2.cType; - $$.SetLong( - $2.GetLong() ); - } - else{ - RscExpType aLeftExp; - - aLeftExp.cType = RSCEXP_NOTHING; - $$.cType = RSCEXP_EXP; - $$.aExp.pExp = new RscExpression( aLeftExp, '-', $2 ); - } - } + { + if( $2.IsNumber() ){ + $$.cType = $2.cType; + $$.SetLong( - $2.GetLong() ); + } + else + { + RscExpType aLeftExp; + + aLeftExp.cType = RSCEXP_NOTHING; + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( aLeftExp, '-', $2 ); + } + } | '+' macro_expression %prec UNARYPLUS - { - $$ = $2; - } + { + $$ = $2; + } | macro_expression '+' macro_expression - { - if( $1.IsNumber() && $3.IsNumber() ){ - $$.cType = RSCEXP_LONG; - $$.SetLong( $1.GetLong() + $3.GetLong() ); - } - else{ - $$.cType = RSCEXP_EXP; - $$.aExp.pExp = new RscExpression( $1, '+', $3 ); - } - } + { + if( $1.IsNumber() && $3.IsNumber() ) + { + $$.cType = RSCEXP_LONG; + $$.SetLong( $1.GetLong() + $3.GetLong() ); + } + else + { + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, '+', $3 ); + } + } | macro_expression '-' macro_expression - { - if( $1.IsNumber() && $3.IsNumber() ){ - $$.cType = RSCEXP_LONG; - $$.SetLong( $1.GetLong() - $3.GetLong() ); - } - else{ - $$.cType = RSCEXP_EXP; - $$.aExp.pExp = new RscExpression( $1, '-', $3 ); - } - } + { + if( $1.IsNumber() && $3.IsNumber() ) + { + $$.cType = RSCEXP_LONG; + $$.SetLong( $1.GetLong() - $3.GetLong() ); + } + else + { + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, '-', $3 ); + } + } | macro_expression '*' macro_expression - { - if( $1.IsNumber() && $3.IsNumber() ){ - $$.cType = RSCEXP_LONG; - $$.SetLong( $1.GetLong() * $3.GetLong() ); - } - else{ - $$.cType = RSCEXP_EXP; - $$.aExp.pExp = new RscExpression( $1, '*', $3 ); - } - } + { + if( $1.IsNumber() && $3.IsNumber() ) + { + $$.cType = RSCEXP_LONG; + $$.SetLong( $1.GetLong() * $3.GetLong() ); + } + else + { + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, '*', $3 ); + } + } | macro_expression '/' macro_expression - { - if( $1.IsNumber() && $3.IsNumber() ){ - if( 0 == $3.GetLong() ){ - $$.cType = RSCEXP_EXP; - $$.aExp.pExp = new RscExpression( $1, '/', $3 ); - } - else{ - $$.cType = RSCEXP_LONG; - $$.SetLong( $1.GetLong() / $3.GetLong() ); - } - } - else{ - $$.cType = RSCEXP_EXP; - $$.aExp.pExp = new RscExpression( $1, '/', $3 ); - } - } + { + if( $1.IsNumber() && $3.IsNumber() ) + { + if( 0 == $3.GetLong() ) + { + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, '/', $3 ); + } + else + { + $$.cType = RSCEXP_LONG; + $$.SetLong( $1.GetLong() / $3.GetLong() ); + } + } + else + { + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, '/', $3 ); + } + } | macro_expression '&' macro_expression - { - if( $1.IsNumber() && $3.IsNumber() ){ - $$.cType = RSCEXP_LONG; - $$.SetLong( $1.GetLong() & $3.GetLong() ); - } - else{ - $$.cType = RSCEXP_EXP; - $$.aExp.pExp = new RscExpression( $1, '&', $3 ); - } - } + { + if( $1.IsNumber() && $3.IsNumber() ) + { + $$.cType = RSCEXP_LONG; + $$.SetLong( $1.GetLong() & $3.GetLong() ); + } + else + { + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, '&', $3 ); + } + } | macro_expression '|' macro_expression - { - if( $1.IsNumber() && $3.IsNumber() ){ - $$.cType = RSCEXP_LONG; - $$.SetLong( $1.GetLong() | $3.GetLong() ); - } - else{ - $$.cType = RSCEXP_EXP; - $$.aExp.pExp = new RscExpression( $1, '|', $3 ); - } - } + { + if( $1.IsNumber() && $3.IsNumber() ) + { + $$.cType = RSCEXP_LONG; + $$.SetLong( $1.GetLong() | $3.GetLong() ); + } + else + { + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, '|', $3 ); + } + } | '(' macro_expression ')' - { - $$ = $2; - } + { + $$ = $2; + } | macro_expression LEFTSHIFT macro_expression - { - if( $1.IsNumber() && $3.IsNumber() ){ - $$.cType = RSCEXP_LONG; - $$.SetLong( $1.GetLong() << $3.GetLong() ); - } - else{ - $$.cType = RSCEXP_EXP; - $$.aExp.pExp = new RscExpression( $1, 'l', $3 ); - } - } + { + if( $1.IsNumber() && $3.IsNumber() ) + { + $$.cType = RSCEXP_LONG; + $$.SetLong( $1.GetLong() << $3.GetLong() ); + } + else + { + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, 'l', $3 ); + } + } | macro_expression RIGHTSHIFT macro_expression - { - if( $1.IsNumber() && $3.IsNumber() ){ - $$.cType = RSCEXP_LONG; - $$.SetLong( $1.GetLong() >> $3.GetLong() ); - } - else{ - $$.cType = RSCEXP_EXP; - $$.aExp.pExp = new RscExpression( $1, 'r', $3 ); - } - } - ; + { + if( $1.IsNumber() && $3.IsNumber() ) + { + $$.cType = RSCEXP_LONG; + $$.SetLong( $1.GetLong() >> $3.GetLong() ); + } + else + { + $$.cType = RSCEXP_EXP; + $$.aExp.pExp = new RscExpression( $1, 'r', $3 ); + } + } +; id_expression : id_expression line_number | macro_expression - { // pExpession auswerten und loeschen - if( RSCEXP_EXP == $1.cType ){ - sal_Int32 lValue; - - if( !$1.Evaluate( &lValue ) ) - pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() ); - delete $1.aExp.pExp; - $$.cType = RSCEXP_LONG; - $$.SetLong( lValue ); - } - else - $$ = $1; - } - ; + { // pExpession auswerten und loeschen + if( RSCEXP_EXP == $1.cType ) + { + sal_Int32 lValue; + + if( !$1.Evaluate( &lValue ) ) + pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() ); + delete $1.aExp.pExp; + $$.cType = RSCEXP_LONG; + $$.SetLong( lValue ); + } + else + { + $$ = $1; + } + } +; DUMMY_NUMBER : NUMBER - { - } + { + } | - { - } + { + } ; line_number : '#' LINE NUMBER STRING - { - RscFile * pFName; - - pFI->SetLineNo( $3 ); - pFI->SetFileIndex( pTC->aFileTab.NewCodeFile( rtl::OString( $4 ) ) ); - pFName = pTC->aFileTab.Get( pFI->GetFileIndex() ); - pFName->bLoaded = sal_True; - pFName->bScanned = sal_True; - } + { + RscFile * pFName; + + pFI->SetLineNo( $3 ); + pFI->SetFileIndex( pTC->aFileTab.NewCodeFile( rtl::OString( $4 ) ) ); + pFName = pTC->aFileTab.Get( pFI->GetFileIndex() ); + pFName->bLoaded = true; + pFName->bScanned = true; + } | '#' NUMBER STRING DUMMY_NUMBER - { - RscFile * pFName; - - pFI->SetLineNo( $2 ); - pFI->SetFileIndex( pTC->aFileTab.NewCodeFile( rtl::OString( $3 ) ) ); - pFName = pTC->aFileTab.Get( pFI->GetFileIndex() ); - pFName->bLoaded = sal_True; - pFName->bScanned = sal_True; - } + { + RscFile * pFName; + + pFI->SetLineNo( $2 ); + pFI->SetFileIndex( pTC->aFileTab.NewCodeFile( rtl::OString( $3 ) ) ); + pFName = pTC->aFileTab.Get( pFI->GetFileIndex() ); + pFName->bLoaded = true; + pFName->bScanned = true; + } | '#' NUMBER - { - pFI->SetLineNo( $2 ); - } - ; + { + pFI->SetLineNo( $2 ); + } +; %% #if defined _MSC_VER diff --git a/rsc/source/prj/start.cxx b/rsc/source/prj/start.cxx index f15472cff148..eda8ff5ec297 100644 --- a/rsc/source/prj/start.cxx +++ b/rsc/source/prj/start.cxx @@ -46,9 +46,9 @@ extern "C" } int rsc2_main(int, char**); -static sal_Bool CallPrePro( const OString& rInput, - const OString& rOutput, RscPtrPtr * pCmdLine, - sal_Bool bResponse ) +static bool CallPrePro( const OString& rInput, + const OString& rOutput, RscPtrPtr * pCmdLine, + bool bResponse ) { RscPtrPtr aNewCmdL; // Kommandozeile RscPtrPtr aRespCmdL; // Kommandozeile @@ -74,10 +74,9 @@ static sal_Bool CallPrePro( const OString& rInput, bVerbose = true; continue; } - if ( !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-u", 2 ) - || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-i", 2 ) - || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-d", 2 ) - ) + if ( !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-u", 2 ) || + !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-i", 2 ) || + !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-d", 2 )) { aNewCmdL.Append( rsc_strdup( (char *)pCmdLine->GetEntry( i ) ) ); } @@ -136,14 +135,14 @@ static sal_Bool CallPrePro( const OString& rInput, #endif } if ( nRet ) - return sal_False; + return false; - return sal_True; + return true; } -static sal_Bool CallRsc2( RscStrList * pInputList, - const OString &rSrsName, RscPtrPtr * pCmdLine ) +static bool CallRsc2( RscStrList * pInputList, + const OString &rSrsName, RscPtrPtr * pCmdLine ) { int nRet; OString* pString; @@ -164,19 +163,21 @@ static sal_Bool CallRsc2( RscStrList * pInputList, eVerbosity = RscVerbositySilent; continue; } - if( !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-fp=", 4 ) - || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-fo=", 4 ) - || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-presponse", 9 ) - || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-rc", 3 ) - || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-+" ) - || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-br" ) - || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-bz" ) - || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-r" ) - || ( '-' != *(char *)pCmdLine->GetEntry( i ) ) ) + if( !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-fp=", 4 ) || + !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-fo=", 4 ) || + !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-presponse", 9 ) || + !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-rc", 3 ) || + !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-+" ) || + !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-br" ) || + !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-bz" ) || + !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-r" ) || + ( '-' != *(char *)pCmdLine->GetEntry( i ) ) ) { } else + { aNewCmdL.Append( rsc_strdup( (char *)pCmdLine->GetEntry( i ) ) ); + } }; aNewCmdL.Append( rsc_strdup( rSrsName.getStr() ) ); @@ -200,25 +201,25 @@ static sal_Bool CallRsc2( RscStrList * pInputList, nRet = rsc2_main( aNewCmdL.GetCount(), (char**)aNewCmdL.GetBlock() ); if( nRet ) - return( sal_False ); - return( sal_True ); + return false; + return true; } SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { - sal_Bool bPrePro = sal_True; - sal_Bool bHelp = sal_False; - sal_Bool bError = sal_False; - sal_Bool bResponse = sal_False; - OString aSrsName; - OString aResName; - RscStrList aInputList; - RscStrList aTmpList; - char * pStr; - char ** ppStr; - RscPtrPtr aCmdLine; // Kommandozeile - sal_uInt32 i; - OString* pString; + bool bPrePro = true; + bool bHelp = false; + bool bError = false; + bool bResponse = false; + OString aSrsName; + OString aResName; + RscStrList aInputList; + RscStrList aTmpList; + char * pStr; + char ** ppStr; + RscPtrPtr aCmdLine; // Kommandozeile + sal_uInt32 i; + OString* pString; pStr = ::ResponseFile( &aCmdLine, argv, argc ); if( pStr ) @@ -230,7 +231,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) ppStr = (char **)aCmdLine.GetBlock(); ppStr++; i = 1; - sal_Bool bSetSrs = sal_False; + bool bSetSrs = false; while( ppStr && i < (aCmdLine.GetCount() -1) ) { if( '-' == **ppStr ) @@ -238,15 +239,15 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) if( !rsc_stricmp( (*ppStr) + 1, "p" ) || !rsc_stricmp( (*ppStr) + 1, "l" ) ) { // kein Preprozessor - bPrePro = sal_False; + bPrePro = false; } else if( !rsc_stricmp( (*ppStr) + 1, "h" ) ) { // Hilfe anzeigen - bHelp = sal_True; + bHelp = true; } else if( !rsc_strnicmp( (*ppStr) + 1, "presponse", 9 ) ) { // whether to use response file when parameterising preprocessor - bResponse = sal_True; + bResponse = true; } else if( !rsc_strnicmp( (*ppStr) + 1, "fo=", 3 ) ) { // anderer Name fuer .res-file @@ -254,7 +255,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) } else if( !rsc_strnicmp( (*ppStr) + 1, "fp=", 3 ) ) { // anderer Name fuer .srs-file - bSetSrs = sal_True; + bSetSrs = true; aSrsName = (*ppStr); } } @@ -280,7 +281,8 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) }; if( bHelp ) - bPrePro = sal_False; + bPrePro = false; + if( bPrePro && !aInputList.empty() ) { OString aTmpName; @@ -292,7 +294,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) if( !CallPrePro( *pString, aTmpName, &aCmdLine, bResponse ) ) { printf( "Error starting preprocessor\n" ); - bError = sal_True; + bError = true; break; } aTmpList.push_back( new OString(aTmpName) ); @@ -306,7 +308,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) if( !bHelp ) { printf( "Error starting rsc2 compiler\n" ); - bError = sal_True; + bError = true; } }; }; @@ -314,7 +316,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) for ( size_t k = 0, n = aTmpList.size(); k < n; ++k ) unlink( aTmpList[ k ]->getStr() ); - return( bError ); + return bError; } void RscExit( sal_uInt32 nExit ) diff --git a/rsc/source/res/rscarray.cxx b/rsc/source/res/rscarray.cxx index f10b9c0bf018..75ab08bff8f8 100644 --- a/rsc/source/res/rscarray.cxx +++ b/rsc/source/res/rscarray.cxx @@ -46,7 +46,7 @@ sal_uInt32 RscInstNode::GetId() const } RscArray::RscArray( Atom nId, sal_uInt32 nTypeId, RscTop * pSuper, RscEnum * pTypeCl ) - : RscTop( nId, nTypeId, pSuper ) + : RscTop( nId, nTypeId, pSuper ) { pTypeClass = pTypeCl; nOffInstData = RscTop::Size(); @@ -86,7 +86,7 @@ static RscInstNode * Create( RscInstNode * pNode ) } RSCINST RscArray::Create( RSCINST * pInst, const RSCINST & rDflt, - sal_Bool bOwnClass ) + bool bOwnClass ) { RSCINST aInst; RscArrayInst * pClassData; @@ -98,13 +98,14 @@ RSCINST RscArray::Create( RSCINST * pInst, const RSCINST & rDflt, } else aInst = *pInst; + if( !bOwnClass && rDflt.IsInst() ) bOwnClass = rDflt.pClass->InHierarchy( this ); RscTop::Create( &aInst, rDflt, bOwnClass ); - pClassData = (RscArrayInst *)(aInst.pData + nOffInstData); - pClassData->pNode = NULL; + pClassData = (RscArrayInst *)(aInst.pData + nOffInstData); + pClassData->pNode = NULL; if( bOwnClass ) { RscArrayInst * pDfltClassData; @@ -113,7 +114,7 @@ RSCINST RscArray::Create( RSCINST * pInst, const RSCINST & rDflt, pClassData->pNode = ::Create( pDfltClassData->pNode ); } - return( aInst ); + return aInst; } static void Destroy( RscInstNode * pNode ) @@ -138,13 +139,10 @@ void RscArray::Destroy( const RSCINST & rInst ) ::Destroy( pClassData->pNode ); } -ERRTYPE RscArray::GetValueEle -( - const RSCINST & rInst, - sal_Int32 lValue, - RscTop * pCreateClass, - RSCINST * pGetInst -) +ERRTYPE RscArray::GetValueEle( const RSCINST & rInst, + sal_Int32 lValue, + RscTop * pCreateClass, + RSCINST * pGetInst) { RscArrayInst * pClassData; RscInstNode * pNode; @@ -171,6 +169,7 @@ ERRTYPE RscArray::GetValueEle pNode->aInst = pCreateClass->Create( NULL, rInst ); else pNode->aInst = GetSuperClass()->Create( NULL, rInst ); + pNode->aInst.pClass->SetToDefault( pNode->aInst ); if( pClassData->pNode ) pClassData->pNode->Insert( pNode ); @@ -182,13 +181,10 @@ ERRTYPE RscArray::GetValueEle return aError; } -ERRTYPE RscArray::GetArrayEle -( - const RSCINST & rInst, - Atom nId, - RscTop * pCreateClass, - RSCINST * pGetInst -) +ERRTYPE RscArray::GetArrayEle( const RSCINST & rInst, + Atom nId, + RscTop * pCreateClass, + RSCINST * pGetInst) { sal_Int32 lValue; if( !pTypeClass->GetConstValue( nId, &lValue ) ) @@ -199,33 +195,33 @@ ERRTYPE RscArray::GetArrayEle return GetValueEle( rInst, lValue, pCreateClass, pGetInst ); } -static sal_Bool IsConsistent( RscInstNode * pNode ) +static bool IsConsistent( RscInstNode * pNode ) { - sal_Bool bRet = sal_True; + bool bRet = true; if( pNode ) { bRet = pNode->aInst.pClass->IsConsistent( pNode->aInst ); if( !IsConsistent( pNode->Left() ) ) - bRet = sal_False; + bRet = false; if( !IsConsistent( pNode->Right() ) ) - bRet = sal_False; + bRet = false; } return bRet; } -sal_Bool RscArray::IsConsistent( const RSCINST & rInst ) +bool RscArray::IsConsistent( const RSCINST & rInst ) { RscArrayInst * pClassData; - sal_Bool bRet; + bool bRet; bRet = RscTop::IsConsistent( rInst ); pClassData = (RscArrayInst *)(rInst.pData + nOffInstData); if( !::IsConsistent( pClassData->pNode ) ) - bRet = sal_False; + bRet = false; - return( bRet ); + return bRet; } static void SetToDefault( RscInstNode * pNode ) @@ -249,9 +245,9 @@ void RscArray::SetToDefault( const RSCINST & rInst ) RscTop::SetToDefault( rInst ); } -static sal_Bool IsDefault( RscInstNode * pNode ) +static bool IsDefault( RscInstNode * pNode ) { - sal_Bool bRet = sal_True; + bool bRet = true; if( pNode ) { @@ -264,22 +260,22 @@ static sal_Bool IsDefault( RscInstNode * pNode ) return bRet; } -sal_Bool RscArray::IsDefault( const RSCINST & rInst ) +bool RscArray::IsDefault( const RSCINST & rInst ) { RscArrayInst * pClassData; pClassData = (RscArrayInst *)(rInst.pData + nOffInstData); - sal_Bool bRet = ::IsDefault( pClassData->pNode ); + bool bRet = ::IsDefault( pClassData->pNode ); if( bRet ) bRet = RscTop::IsDefault( rInst ); return bRet; } -static sal_Bool IsValueDefault( RscInstNode * pNode, CLASS_DATA pDef ) +static bool IsValueDefault( RscInstNode * pNode, CLASS_DATA pDef ) { - sal_Bool bRet = sal_True; + bool bRet = true; if( pNode ) { @@ -292,9 +288,9 @@ static sal_Bool IsValueDefault( RscInstNode * pNode, CLASS_DATA pDef ) return bRet; } -sal_Bool RscArray::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) +bool RscArray::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) { - sal_Bool bRet = RscTop::IsValueDefault( rInst, pDef ); + bool bRet = RscTop::IsValueDefault( rInst, pDef ); if( bRet ) { @@ -348,8 +344,8 @@ void RscArray::WriteSrcHeader( const RSCINST & rInst, FILE * fOutput, } static void WriteSrc( RscInstNode * pNode, FILE * fOutput, RscTypCont * pTC, - sal_uInt32 nTab, const char * pVarName, - CLASS_DATA pDfltData, RscConst * pTypeClass ) + sal_uInt32 nTab, const char * pVarName, + CLASS_DATA pDfltData, RscConst * pTypeClass ) { if( pNode ) { @@ -373,8 +369,8 @@ static void WriteSrc( RscInstNode * pNode, FILE * fOutput, RscTypCont * pTC, } void RscArray::WriteSrcArray( const RSCINST & rInst, FILE * fOutput, - RscTypCont * pTC, sal_uInt32 nTab, - const char * pVarName ) + RscTypCont * pTC, sal_uInt32 nTab, + const char * pVarName ) { RscArrayInst * pClassData; @@ -392,7 +388,7 @@ void RscArray::WriteSrc( const RSCINST & rInst, FILE * fOutput, } ERRTYPE RscArray::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, - RscTypCont * pTC, sal_uInt32 nDeep, sal_Bool bExtra ) + RscTypCont * pTC, sal_uInt32 nDeep, bool bExtra ) { ERRTYPE aError; RscArrayInst * pClassData; @@ -452,12 +448,12 @@ void RscClassArray::WriteSrc( const RSCINST & rInst, FILE * fOutput, } ERRTYPE RscClassArray::WriteRcHeader( const RSCINST & rInst, RscWriteRc & aMem, - RscTypCont * pTC, const RscId & aId, - sal_uInt32 nDeep, sal_Bool bExtra ) + RscTypCont * pTC, const RscId & aId, + sal_uInt32 nDeep, bool bExtra ) { // Eigenen Typ schreiben return GetSuperClass()->WriteRcHeader( rInst, aMem, pTC, aId, - nDeep, bExtra ); + nDeep, bExtra ); } RscLangArray::RscLangArray( Atom nId, sal_uInt32 nTypeId, RscTop * pSuper, diff --git a/rsc/source/res/rscclass.cxx b/rsc/source/res/rscclass.cxx index 0205eba1e277..7e5611527782 100644 --- a/rsc/source/res/rscclass.cxx +++ b/rsc/source/res/rscclass.cxx @@ -71,7 +71,7 @@ RSCINST RscClass::GetInstData ( CLASS_DATA pData, sal_uInt32 nEle, - sal_Bool bGetCopy + bool bGetCopy ) { RSCINST aInst; @@ -100,16 +100,14 @@ RSCINST RscClass::GetInstData else if( VAR_POINTER & pVarTypeList[ nEle ].nVarType ) { if( VAR_EXTENDABLE & pVarTypeList[ nEle ].nVarType ) - aInst = *(RSCINST *) - (pData + pVarTypeList[ nEle ].nOffset); + aInst = *(RSCINST *) (pData + pVarTypeList[ nEle ].nOffset); else - aInst.pData = *(CLASS_DATA *) - (pData + pVarTypeList[ nEle ].nOffset); + aInst.pData = *(CLASS_DATA *) (pData + pVarTypeList[ nEle ].nOffset); } else aInst.pData = pData + pVarTypeList[ nEle ].nOffset; }; - return( aInst ); + return aInst; } CLASS_DATA RscClass::GetDfltData( sal_uInt32 nEle ) @@ -120,7 +118,7 @@ CLASS_DATA RscClass::GetDfltData( sal_uInt32 nEle ) return pVarTypeList[ nEle ].pClass->GetDefault().pData; } -void RscClass::SetVarDflt( CLASS_DATA pData, sal_uInt32 nEle, sal_Bool bSet ) +void RscClass::SetVarDflt( CLASS_DATA pData, sal_uInt32 nEle, bool bSet ) { RscClassInst * pClass; @@ -131,25 +129,17 @@ void RscClass::SetVarDflt( CLASS_DATA pData, sal_uInt32 nEle, sal_Bool bSet ) pClass->nVarDflt &= ~((sal_uLong)1 << nEle); } -sal_Bool RscClass::IsDflt( CLASS_DATA pData, sal_uInt32 nEle ) +bool RscClass::IsDflt( CLASS_DATA pData, sal_uInt32 nEle ) { RscClassInst * pClass; - sal_Bool bRet; pClass = (RscClassInst *)(pData + nSuperSize ); - if( pClass->nVarDflt & ((sal_uLong)1 << nEle) ) - bRet = sal_True; - else - bRet = sal_False; - return bRet; + return pClass->nVarDflt & ((sal_uLong)1 << nEle); } -RSCINST RscClass::Create -( - RSCINST * pInst, - const RSCINST & rDflt, - sal_Bool bOwnClass -) +RSCINST RscClass::Create( RSCINST * pInst, + const RSCINST & rDflt, + bool bOwnClass) { sal_uInt32 i; RSCINST aInst; @@ -162,6 +152,7 @@ RSCINST RscClass::Create } else aInst = *pInst; + if( !bOwnClass && rDflt.IsInst() ) bOwnClass = rDflt.pClass->InHierarchy( this ); @@ -175,22 +166,21 @@ RSCINST RscClass::Create for( i = 0; i < nEntries; i++ ) { - aDfltI = GetInstData( bOwnClass ? rDflt.pData : NULL, i, sal_True ); + aDfltI = GetInstData( bOwnClass ? rDflt.pData : NULL, i, true ); - if( (VAR_POINTER & pVarTypeList[ i ].nVarType) - && !(VAR_NODATAINST & pVarTypeList[ i ].nVarType) ) + if( (VAR_POINTER & pVarTypeList[ i ].nVarType) && + !(VAR_NODATAINST & pVarTypeList[ i ].nVarType) ) { CLASS_DATA * ppData; if( VAR_EXTENDABLE & pVarTypeList[ i ].nVarType ) { - RSCINST * pInstance = (RSCINST *) - (aInst.pData + pVarTypeList[ i ].nOffset ); + RSCINST * pInstance = (RSCINST *) (aInst.pData + pVarTypeList[ i ].nOffset ); pInstance->pClass = pVarTypeList[ i ].pClass; ppData = &pInstance->pData; } else - ppData = (CLASS_DATA* ) - (aInst.pData + pVarTypeList[ i ].nOffset ); + ppData = (CLASS_DATA* ) (aInst.pData + pVarTypeList[ i ].nOffset ); + *ppData = NULL; if( aDfltI.IsInst() ) { @@ -200,12 +190,12 @@ RSCINST RscClass::Create } else { - aMemInst = GetInstData( aInst.pData, i, sal_True ); + aMemInst = GetInstData( aInst.pData, i, true ); aMemInst = aMemInst.pClass->Create( &aMemInst, aDfltI ); }; } - return( aInst ); + return aInst; } void RscClass::Destroy( const RSCINST & rInst ) @@ -220,7 +210,7 @@ void RscClass::Destroy( const RSCINST & rInst ) { RSCINST aTmpI; - aTmpI = GetInstData( rInst.pData, i, sal_True ); + aTmpI = GetInstData( rInst.pData, i, true ); if( aTmpI.IsInst() ) { // Objekt loeschen @@ -235,25 +225,23 @@ void RscClass::Destroy( const RSCINST & rInst ) }; } -ERRTYPE RscClass::SetVariable -( - Atom nVarName, - RscTop * pClass, - RSCINST * pDflt, - RSCVAR nVarType, - sal_uInt32 nMask, - Atom nDataBaseName -) +ERRTYPE RscClass::SetVariable( Atom nVarName, + RscTop * pClass, + RSCINST * pDflt, + RSCVAR nVarType, + sal_uInt32 nMask, + Atom nDataBaseName) { if( pVarTypeList ) - pVarTypeList = (VARTYPE_STRUCT *) - rtl_reallocateMemory( (void *)pVarTypeList, - ((nEntries +1) * sizeof( VARTYPE_STRUCT )) ); + { + pVarTypeList = (VARTYPE_STRUCT *) rtl_reallocateMemory( (void *)pVarTypeList, + ((nEntries +1) * sizeof( VARTYPE_STRUCT )) ); + } else - pVarTypeList = (VARTYPE_STRUCT *) - rtl_allocateMemory( ((nEntries +1) - * sizeof( VARTYPE_STRUCT )) ); - + { + pVarTypeList = (VARTYPE_STRUCT *) rtl_allocateMemory( ((nEntries +1) + * sizeof( VARTYPE_STRUCT )) ); + } pVarTypeList[ nEntries ].nVarName = nVarName; pVarTypeList[ nEntries ].nMask = nMask; pVarTypeList[ nEntries ].pClass = pClass; @@ -287,7 +275,7 @@ ERRTYPE RscClass::SetVariable // Bereich fuer Default zu klein RscExit( 16 ); }; - return( ERR_OK ); + return ERR_OK; } void RscClass::EnumVariables( void * pData, VarEnumCallbackProc pProc ) @@ -298,25 +286,22 @@ void RscClass::EnumVariables( void * pData, VarEnumCallbackProc pProc ) for( i = 0; i < nEntries; i ++ ) { if( !(pVarTypeList[ i ].nVarType & VAR_NOENUM) ) - (*pProc)( pData, pVarTypeList[ i ].pClass->GetClassType(), - pVarTypeList[ i ].nVarName ); + (*pProc)( pData, pVarTypeList[ i ].pClass->GetClassType(), pVarTypeList[ i ].nVarName ); } } -RSCINST RscClass::GetVariable -( - const RSCINST & rInst, - Atom nVarName, - const RSCINST & rInitInst, - sal_Bool bInitDflt, - RscTop * pCreateClass -) +RSCINST RscClass::GetVariable( const RSCINST & rInst, + Atom nVarName, + const RSCINST & rInitInst, + bool bInitDflt, + RscTop * pCreateClass) { sal_uInt32 i = 0; RSCINST aTmpI; while( i < nEntries && pVarTypeList[ i ].nVarName != nVarName ) i++; + if( i < nEntries ) { if( VAR_NODATAINST & pVarTypeList[ i ].nVarType ) @@ -368,19 +353,15 @@ RSCINST RscClass::GetVariable } }; // auf nicht Default setzen - SetVarDflt( rInst.pData, i, sal_False ); - return( aTmpI ); + SetVarDflt( rInst.pData, i, false ); + return aTmpI; }; - return( RscTop::GetVariable( rInst, nVarName, rInitInst, - bInitDflt, pCreateClass ) ); + return RscTop::GetVariable( rInst, nVarName, rInitInst, + bInitDflt, pCreateClass ); } -RSCINST RscClass::GetCopyVar -( - const RSCINST & rInst, - Atom nVarName -) +RSCINST RscClass::GetCopyVar( const RSCINST & rInst, Atom nVarName) { sal_uInt32 i = 0; RSCINST aVarI; @@ -400,11 +381,11 @@ RSCINST RscClass::GetCopyVar if( IsDflt( rInst.pData, i ) ) { // mit Variablen Default initialiaieren - aVarI = GetVariable( rInst, nVarName, RSCINST(), sal_True ); - SetVarDflt( rInst.pData, i, sal_True ); + aVarI = GetVariable( rInst, nVarName, RSCINST(), true ); + SetVarDflt( rInst.pData, i, true ); } else - aVarI = GetInstData( rInst.pData, i, sal_True ); + aVarI = GetInstData( rInst.pData, i, true ); }; return aVarI ; @@ -413,11 +394,11 @@ RSCINST RscClass::GetCopyVar return RscTop::GetCopyVar( rInst, nVarName ); } -sal_Bool RscClass::IsConsistent( const RSCINST & rInst ) +bool RscClass::IsConsistent( const RSCINST & rInst ) { sal_uInt32 i = 0; RSCINST aTmpI; - sal_Bool bRet; + bool bRet; bRet = RscTop::IsConsistent( rInst ); @@ -425,15 +406,15 @@ sal_Bool RscClass::IsConsistent( const RSCINST & rInst ) { if( !(VAR_NODATAINST & pVarTypeList[ i ].nVarType) ) { - aTmpI = GetInstData( rInst.pData, i, sal_True ); + aTmpI = GetInstData( rInst.pData, i, true ); if( aTmpI.IsInst() ) if( ! aTmpI.pClass->IsConsistent( aTmpI ) ) - bRet = sal_False; + bRet = false; } }; - return( bRet ); + return bRet; } void RscClass::SetToDefault( const RSCINST & rInst ) @@ -450,7 +431,7 @@ void RscClass::SetToDefault( const RSCINST & rInst ) // auf Default gesetzt if( !(VAR_NODATAINST & pVarTypeList[ i ].nVarType) ) { - aTmpI = GetInstData( rInst.pData, i, sal_True ); + aTmpI = GetInstData( rInst.pData, i, true ); if( aTmpI.IsInst() ) aTmpI.pClass->SetToDefault( aTmpI ); } @@ -460,7 +441,7 @@ void RscClass::SetToDefault( const RSCINST & rInst ) RscTop::SetToDefault( rInst ); } -sal_Bool RscClass::IsDefault( const RSCINST & rInst ) +bool RscClass::IsDefault( const RSCINST & rInst ) { sal_uInt32 i; RSCINST aTmpI; @@ -471,10 +452,10 @@ sal_Bool RscClass::IsDefault( const RSCINST & rInst ) // auf Default untersucht if( !(VAR_NODATAINST & pVarTypeList[ i ].nVarType) ) if( !IsDflt( rInst.pData, i ) ) - return( sal_False ); + return false; }; - return( RscTop::IsDefault( rInst ) ); + return RscTop::IsDefault( rInst ); } RSCINST RscClass::GetDefault( Atom nVarId ) @@ -484,70 +465,71 @@ RSCINST RscClass::GetDefault( Atom nVarId ) i = 0; while( i < nEntries && pVarTypeList[ i ].nVarName != nVarId ) i++; + if( i < nEntries ) { RSCINST aTmpI; aTmpI.pClass = pVarTypeList[ i ].pClass; aTmpI.pData = GetDfltData( i ); - return( aTmpI ); + return aTmpI; }; - return( RscTop::GetDefault( nVarId ) ); + return RscTop::GetDefault( nVarId ); } -sal_Bool RscClass::IsValueDflt( CLASS_DATA pData, sal_uInt32 nEle ) +bool RscClass::IsValueDflt( CLASS_DATA pData, sal_uInt32 nEle ) { RSCINST aTmpI; - aTmpI = GetInstData( pData, nEle, sal_True ); + aTmpI = GetInstData( pData, nEle, true ); if( aTmpI.IsInst() ) { if( VAR_SVDYNAMIC & pVarTypeList[ nEle ].nVarType ) - return sal_False; + return false; if( aTmpI.pClass == pVarTypeList[ nEle ].pClass ) //sie haben auch die gleiche Klasse return aTmpI.pClass->IsValueDefault( aTmpI, GetDfltData( nEle ) ); else - return sal_False; + return false; } - return sal_True; + return true; } -sal_Bool RscClass::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) +bool RscClass::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) { RSCINST aTmpI; RSCINST aDfltI; if( !RscTop::IsValueDefault( rInst, pDef ) ) - return sal_False; + return false; if( pDef ) { for( sal_uInt32 i = 0; i < nEntries; i++ ) { - aTmpI = GetInstData( rInst.pData, i, sal_True ); + aTmpI = GetInstData( rInst.pData, i, true ); if( aTmpI.IsInst() ) { if( aTmpI.pClass != pVarTypeList[ i ].pClass ) //sie haben nicht die gleiche Klasse - return sal_False; + return false; - aDfltI = GetInstData( pDef, i, sal_True ); + aDfltI = GetInstData( pDef, i, true ); if( !aDfltI.IsInst() ) aDfltI.pData = GetDfltData( i ); if( !aTmpI.pClass->IsValueDefault( aTmpI, aDfltI.pData ) ) - return sal_False; + return false; } } } else - return sal_False; + return false; - return sal_True; + return true; } void RscClass::SetDefault( const RSCINST & rInst, Atom nVarName ) @@ -560,12 +542,12 @@ void RscClass::SetDefault( const RSCINST & rInst, Atom nVarName ) if( i < nEntries ) { - aTmpI = GetInstData( rInst.pData, i, sal_True ); + aTmpI = GetInstData( rInst.pData, i, true ); if( aTmpI.IsInst() ) { aTmpI.pClass->Destroy( aTmpI ); aTmpI.pClass->Create( &aTmpI, RSCINST() ); - SetVarDflt( rInst.pData, i, sal_True ); + SetVarDflt( rInst.pData, i, true ); } } else //In Superklasse nach Variable suchen @@ -574,14 +556,11 @@ void RscClass::SetDefault( const RSCINST & rInst, Atom nVarName ) } -void RscClass::WriteSrc -( - const RSCINST & rInst, - FILE * fOutput, - RscTypCont * pTC, - sal_uInt32 nTab, - const char * pVarName -) +void RscClass::WriteSrc( const RSCINST & rInst, + FILE * fOutput, + RscTypCont * pTC, + sal_uInt32 nTab, + const char * pVarName) { sal_uInt32 i = 0, n = 0; RSCINST aTmpI; @@ -593,15 +572,17 @@ void RscClass::WriteSrc if( !(VAR_HIDDEN & pVarTypeList[ i ].nVarType) ) { // Hack wegen Position und Dimensiuon - if( nRsc_XYMAPMODEId == pVarTypeList[ i ].nVarName - || nRsc_WHMAPMODEId == pVarTypeList[ i ].nVarName ) + if( nRsc_XYMAPMODEId == pVarTypeList[ i ].nVarName || + nRsc_WHMAPMODEId == pVarTypeList[ i ].nVarName ) { - if( !IsDflt( rInst.pData, i ) //MapUnit - || !IsDflt( rInst.pData, i+1 ) //X, Width - || !IsDflt( rInst.pData, i+2 ) )//Y, Height - {// ein Wert ist nicht Default + if( !IsDflt( rInst.pData, i ) || // MapUnit + !IsDflt( rInst.pData, i+1 ) || //X, Width + !IsDflt( rInst.pData, i+2 ) ) //Y, Height + { + // ein Wert ist nicht Default for( n = 0; n < nTab; n++ ) fputc( '\t', fOutput ); + if( nRsc_XYMAPMODEId == pVarTypeList[ i ].nVarName ) fprintf( fOutput, "Pos = " ); else @@ -609,22 +590,24 @@ void RscClass::WriteSrc if( !IsDflt( rInst.pData, i ) ) { - aTmpI = GetInstData( rInst.pData, i, sal_True ); + aTmpI = GetInstData( rInst.pData, i, true ); aTmpI.pClass->WriteSrcHeader( aTmpI, fOutput, pTC, nTab, RscId(), pVarName ); } fprintf( fOutput, "( " ); - aTmpI = GetInstData( rInst.pData, i+1, sal_True ); + aTmpI = GetInstData( rInst.pData, i+1, true ); if( !aTmpI.IsInst() ) aTmpI.pData = GetDfltData( i+1 ); - aTmpI.pClass->WriteSrcHeader( - aTmpI, fOutput, pTC, nTab, RscId(), pVarName ); + + aTmpI.pClass->WriteSrcHeader( aTmpI, fOutput, pTC, nTab, RscId(), pVarName ); fprintf( fOutput, ", " ); - aTmpI = GetInstData( rInst.pData, i+2, sal_True ); + aTmpI = GetInstData( rInst.pData, i+2, true ); + if( !aTmpI.IsInst() ) aTmpI.pData = GetDfltData( i+2 ); + aTmpI.pClass->WriteSrcHeader( aTmpI, fOutput, pTC, nTab, RscId(), pVarName ); fprintf( fOutput, " );\n" ); @@ -632,9 +615,9 @@ void RscClass::WriteSrc i += 2; //_X, _Y oder _Widht, Height ueberlesen } else if( !IsDflt( rInst.pData, i ) - && !IsValueDflt( rInst.pData, i ) ) + && !IsValueDflt( rInst.pData, i ) ) { - aTmpI = GetInstData( rInst.pData, i, sal_True ); + aTmpI = GetInstData( rInst.pData, i, true ); if( aTmpI.IsInst() ) { @@ -642,6 +625,7 @@ void RscClass::WriteSrc for( n = 0; n < nTab; n++ ) fputc( '\t', fOutput ); + fprintf( fOutput, "%s", pName ); fprintf( fOutput, " = " ); aTmpI.pClass->WriteSrcHeader( @@ -655,19 +639,16 @@ void RscClass::WriteSrc return; } -sal_Int32 RscClass::GetCorrectValues -( - const RSCINST & rInst, - sal_uInt32 nVarPos, - sal_uInt32 nTupelIdx, - RscTypCont * pTC -) +sal_Int32 RscClass::GetCorrectValues( const RSCINST & rInst, + sal_uInt32 nVarPos, + sal_uInt32 nTupelIdx, + RscTypCont * pTC) { sal_Int32 nLang = 0; sal_Int32 nBaseValue; // Basiswert holen - RSCINST aTmpI = GetInstData( rInst.pData, nVarPos, sal_True ); + RSCINST aTmpI = GetInstData( rInst.pData, nVarPos, true ); aTmpI.pClass->GetNumber( aTmpI, &nBaseValue ); // Sprach Delta holen @@ -675,21 +656,18 @@ sal_Int32 RscClass::GetCorrectValues if( aTmpI.IsInst() ) { RscWriteRc aMem; - aTmpI.pClass->WriteRc( aTmpI, aMem, pTC, 0, sal_False ); + aTmpI.pClass->WriteRc( aTmpI, aMem, pTC, 0, false ); nLang = (sal_Int32)aMem.GetShort( nTupelIdx * sizeof(sal_uInt16) ); } return nLang + nBaseValue; } -ERRTYPE RscClass::WriteInstRc -( - const RSCINST & rInst, - RscWriteRc & rMem, - RscTypCont * pTC, - sal_uInt32 nDeep, - sal_Bool bExtra -) +ERRTYPE RscClass::WriteInstRc( const RSCINST & rInst, + RscWriteRc & rMem, + RscTypCont * pTC, + sal_uInt32 nDeep, + bool bExtra) { sal_uInt32 i = 0; ERRTYPE aError; @@ -737,52 +715,49 @@ ERRTYPE RscClass::WriteInstRc } else { - aTmpI = GetInstData( rInst.pData, i, sal_True ); - // Nur an Variable Extradata bExtra nicht auf sal_False + aTmpI = GetInstData( rInst.pData, i, true ); + // Nur an Variable Extradata bExtra nicht auf false // setzen aError = aTmpI.pClass-> WriteRcHeader( aTmpI, rMem, pTC, - RscId(), nDeep, - (nRsc_EXTRADATA - == pVarTypeList[ i ].nVarName) - ? bExtra : sal_False ); + RscId(), nDeep, + (nRsc_EXTRADATA == pVarTypeList[ i ].nVarName) + ? bExtra : false ); } sal_uInt32 nMask = rMem.GetLong( nMaskOff ); nMask |= pVarTypeList[ i ].nMask; rMem.PutAt( nMaskOff, nMask ); } } - else{ + else + { if( IsDflt( rInst.pData, i ) ) { aTmpI.pClass = pVarTypeList[ i ].pClass; aTmpI.pData = GetDfltData( i ); } else - aTmpI = GetInstData( rInst.pData, i, sal_True ); - // Nur an Variable Extradata bExtra nicht auf sal_False + aTmpI = GetInstData( rInst.pData, i, true ); + + // Nur an Variable Extradata bExtra nicht auf false // setzen aError = aTmpI.pClass-> WriteRcHeader( aTmpI, rMem, pTC, RscId(), nDeep, - (nRsc_EXTRADATA - == pVarTypeList[ i ].nVarName) - ? bExtra : sal_False ); + (nRsc_EXTRADATA == pVarTypeList[ i ].nVarName) + ? bExtra : false ); } } } - return( aError ); + return aError; } -ERRTYPE RscClass::WriteRc -( - const RSCINST & rInst, - RscWriteRc & rMem, - RscTypCont * pTC, - sal_uInt32 nDeep, - sal_Bool bExtra -) +ERRTYPE RscClass::WriteRc( const RSCINST & rInst, + RscWriteRc & rMem, + RscTypCont * pTC, + sal_uInt32 nDeep, + bool bExtra) { ERRTYPE aError; @@ -790,15 +765,16 @@ ERRTYPE RscClass::WriteRc if( aError.IsOk() ) aError = WriteInstRc( rInst, rMem, pTC, nDeep, bExtra ); - return( aError ); + return aError; } RscSysDepend::RscSysDepend( Atom nId, sal_uInt32 nTypeId, RscTop * pSuper ) : RscClass( nId, nTypeId, pSuper ) -{} +{ +} ERRTYPE RscSysDepend::WriteSysDependRc( const RSCINST & rInst, RscWriteRc & rMem, - RscTypCont * pTC, sal_uInt32 nDeep, sal_Bool bExtra, sal_Bool bFirst ) + RscTypCont * pTC, sal_uInt32 nDeep, bool bExtra, bool bFirst ) { ERRTYPE aError; RSCINST aFileName; @@ -828,26 +804,29 @@ ERRTYPE RscSysDepend::WriteSysDependRc( const RSCINST & rInst, RscWriteRc & rMem else aError = ERR_ERROR; - return( aError ); + return aError; } ERRTYPE RscSysDepend::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, - RscTypCont * pTC, sal_uInt32 nDeep, sal_Bool bExtra ) + RscTypCont * pTC, sal_uInt32 nDeep, bool bExtra ) { ERRTYPE aError = RscClass::WriteRc( rInst, rMem, pTC, nDeep, bExtra ); if( this == rInst.pClass ) + { // nur wenn es eigen Klasse ist aError = WriteSysDependRc( rInst, rMem, pTC, nDeep, bExtra ); + } return aError; } RscTupel::RscTupel( Atom nId, sal_uInt32 nTypeId, RscTop * pSuper ) : RscClass( nId, nTypeId, pSuper ) -{} +{ +} RSCINST RscTupel::GetTupelVar( const RSCINST & rInst, sal_uInt32 nPos, - const RSCINST & rInitInst ) + const RSCINST & rInitInst ) { if( nPos >= nEntries ) { @@ -874,7 +853,7 @@ void RscTupel::WriteSrc( const RSCINST & rInst, FILE * fOutput, if( !IsDflt( rInst.pData, i ) && !IsValueDflt( rInst.pData, i ) ) { - aTmpI = GetInstData( rInst.pData, i, sal_True ); + aTmpI = GetInstData( rInst.pData, i, true ); if( aTmpI.IsInst() ) aTmpI.pClass->WriteSrcHeader( diff --git a/rsc/source/res/rscclobj.cxx b/rsc/source/res/rscclobj.cxx index d11ce80195bd..908030cd4b3c 100644 --- a/rsc/source/res/rscclobj.cxx +++ b/rsc/source/res/rscclobj.cxx @@ -22,46 +22,50 @@ #include <rsctop.hxx> -RefNode::RefNode( Atom nTyp ){ +RefNode::RefNode( Atom nTyp ) +{ pObjBiTree = 0; nTypNameId = nTyp; } sal_uInt32 RefNode::GetId() const { - return( nTypNameId ); + return nTypNameId; } -sal_Bool RefNode::PutObjNode( ObjNode * pPutObject ){ // insert a node in the b-tree pObjBiTree // if the node with the same name is in pObjBiTree, // return sal_False and no insert, +bool RefNode::PutObjNode( ObjNode * pPutObject ) +{ if( pObjBiTree ) - return( pObjBiTree->Insert( pPutObject ) ); + return pObjBiTree->Insert( pPutObject ); pObjBiTree = pPutObject; - return( sal_True ); + return true; } -ObjNode * RefNode :: GetObjNode( const RscId & rRscId ){ // insert a node in the b-tree pObjBiTree // if the node with the same name is in pObjBiTree, // return NULL and no insert, // if not return the pointer to the Object - +ObjNode * RefNode :: GetObjNode( const RscId & rRscId ) +{ if( pObjBiTree ) - return( pObjBiTree->Search( rRscId ) ); - return( NULL ); + return pObjBiTree->Search( rRscId ); + return NULL; } -ObjNode::ObjNode( const RscId & rId, CLASS_DATA pData, sal_uLong lKey ){ +ObjNode::ObjNode( const RscId & rId, CLASS_DATA pData, sal_uLong lKey ) +{ pRscObj = pData; aRscId = rId; lFileKey = lKey; } -ObjNode * ObjNode::DelObjNode( RscTop * pClass, sal_uLong nFileKey ){ +ObjNode * ObjNode::DelObjNode( RscTop * pClass, sal_uLong nFileKey ) +{ ObjNode * pRetNode = this; if( Right() ) @@ -69,18 +73,22 @@ ObjNode * ObjNode::DelObjNode( RscTop * pClass, sal_uLong nFileKey ){ if( Left() ) pLeft = ((ObjNode *)Left())->DelObjNode( pClass, nFileKey ); - if( GetFileKey() == nFileKey ){ - if( GetRscObj() ){ + if( GetFileKey() == nFileKey ) + { + if( GetRscObj() ) + { pClass->Destroy( RSCINST( pClass, GetRscObj() ) ); rtl_freeMemory( GetRscObj() ); } pRetNode = (ObjNode *)Right(); - if( pRetNode ){ + if( pRetNode ) + { if( Left() ) pRetNode->Insert( (ObjNode *)Left() ); } else pRetNode = (ObjNode *)Left(); + delete this; } return pRetNode; @@ -88,40 +96,44 @@ ObjNode * ObjNode::DelObjNode( RscTop * pClass, sal_uLong nFileKey ){ sal_uInt32 ObjNode::GetId() const { - return( (sal_uInt32)(long)aRscId ); + return (sal_uInt32)(long)aRscId; } -sal_Bool ObjNode::IsConsistent() +bool ObjNode::IsConsistent() { - sal_Bool bRet = sal_True; + bool bRet = true; if( (long)aRscId > 0x7FFF || (long)aRscId < 1 ) { - bRet = sal_False; + bRet = false; } else { if( Left() ) { if( !((ObjNode *)Left())->IsConsistent() ) - bRet = sal_False; + { + bRet = false; + } if( ((ObjNode *)Left())->aRscId >= aRscId ) { - bRet = sal_False; + bRet = false; } }; if( Right() ) { if( ((ObjNode *)Right())->aRscId <= aRscId ) { - bRet = sal_False; + bRet = false; } if( !((ObjNode *)Right())->IsConsistent() ) - bRet = sal_False; + { + bRet = false; + } }; }; - return( bRet ); + return bRet; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/res/rscconst.cxx b/rsc/source/res/rscconst.cxx index 2564c69f9e15..6f714958f013 100644 --- a/rsc/source/res/rscconst.cxx +++ b/rsc/source/res/rscconst.cxx @@ -44,51 +44,55 @@ RSCCLASS_TYPE RscConst::GetClassType() const return RSCCLASS_CONST; } -ERRTYPE RscConst::SetConstant( Atom nVarName, sal_Int32 lValue ){ +ERRTYPE RscConst::SetConstant( Atom nVarName, sal_Int32 lValue ) +{ if( pVarArray ) - pVarArray = (VarEle *) - rtl_reallocateMemory( (void *)pVarArray, - ((nEntries +1) * sizeof( VarEle )) ); + pVarArray = (VarEle *) rtl_reallocateMemory( (void *)pVarArray, + ((nEntries +1) * sizeof( VarEle )) ); else - pVarArray = (VarEle *) - rtl_allocateMemory( ((nEntries +1) * sizeof( VarEle )) ); + pVarArray = (VarEle *) rtl_allocateMemory( ((nEntries +1) * sizeof( VarEle )) ); pVarArray[ nEntries ].nId = nVarName; pVarArray[ nEntries ].lValue = lValue; nEntries++; - return( ERR_OK ); + return ERR_OK; } -Atom RscConst::GetConstant( sal_uInt32 nPos ){ +Atom RscConst::GetConstant( sal_uInt32 nPos ) +{ if( nPos < nEntries ) return pVarArray[ nPos ].nId; - return( InvalidAtom ); + return InvalidAtom; } -sal_Bool RscConst::GetConstValue( Atom nConst, sal_Int32 * pValue ) const +bool RscConst::GetConstValue( Atom nConst, sal_Int32 * pValue ) const { sal_uInt32 i = 0; for( i = 0; i < nEntries; i++ ) + { if( pVarArray[ i ].nId == nConst ) { *pValue = pVarArray[ i ].lValue; - return sal_True; + return true; } - return sal_False; + } + return false; } -sal_Bool RscConst::GetValueConst( sal_Int32 lValue, Atom * pConst ) const +bool RscConst::GetValueConst( sal_Int32 lValue, Atom * pConst ) const { sal_uInt32 i = 0; for( i = 0; i < nEntries; i++ ) + { if( pVarArray[ i ].lValue == lValue ) { *pConst = pVarArray[ i ].nId; - return sal_True; + return true; } - return sal_False; + } + return false; } sal_uInt32 RscConst::GetConstPos( Atom nConst ) @@ -98,14 +102,14 @@ sal_uInt32 RscConst::GetConstPos( Atom nConst ) for( i = 0; i < nEntries; i++ ) { if( pVarArray[ i ].nId == nConst ) - return( i ); + return i; } - return( nEntries ); + return nEntries; } RscEnum::RscEnum( Atom nId, sal_uInt32 nTypeId ) - : RscConst( nId, nTypeId ) + : RscConst( nId, nTypeId ) { nSize = ALIGNED_SIZE( sizeof( RscEnumInst ) ); } @@ -117,87 +121,86 @@ ERRTYPE RscEnum::SetConst( const RSCINST & rInst, Atom nConst, sal_Int32 /*nVal* if( nEntries != (i = GetConstPos( nConst )) ) { ((RscEnumInst *)rInst.pData)->nValue = i; - ((RscEnumInst *)rInst.pData)->bDflt = sal_False; - return( ERR_OK ); + ((RscEnumInst *)rInst.pData)->bDflt = false; + return ERR_OK; }; - return( ERR_RSCENUM ); + return ERR_RSCENUM; } ERRTYPE RscEnum::SetNumber( const RSCINST & rInst, sal_Int32 lValue ) { sal_uInt32 i = 0; - for( i = 0; i < nEntries; i++ ){ + for( i = 0; i < nEntries; i++ ) + { if( (sal_Int32)pVarArray[ i ].lValue == lValue ) - return( SetConst( rInst, pVarArray[ i ].nId, lValue ) ); + return SetConst( rInst, pVarArray[ i ].nId, lValue ); }; - return( ERR_RSCENUM ); + return ERR_RSCENUM; } -ERRTYPE RscEnum::GetConst( const RSCINST & rInst, Atom * pH ){ +ERRTYPE RscEnum::GetConst( const RSCINST & rInst, Atom * pH ) +{ *pH = pVarArray[ ((RscEnumInst *)rInst.pData)->nValue ].nId; - return( ERR_OK ); + return ERR_OK; } ERRTYPE RscEnum::GetNumber( const RSCINST & rInst, sal_Int32 * pNumber ){ *pNumber = pVarArray[ ((RscEnumInst *)rInst.pData)->nValue ].lValue; - return( ERR_OK ); + return ERR_OK; } -RSCINST RscEnum::Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool bOwnClass ){ +RSCINST RscEnum::Create( RSCINST * pInst, const RSCINST & rDflt, bool bOwnClass ) +{ RSCINST aInst; - if( !pInst ){ + if( !pInst ) + { aInst.pClass = this; aInst.pData = (CLASS_DATA) rtl_allocateMemory( sizeof( RscEnumInst ) ); } else aInst = *pInst; + if( !bOwnClass && rDflt.IsInst() ) bOwnClass = rDflt.pClass->InHierarchy( this ); if( bOwnClass ) memmove( aInst.pData, rDflt.pData, Size() ); - else{ + else + { ((RscEnumInst *)aInst.pData)->nValue = 0; - ((RscEnumInst *)aInst.pData)->bDflt = sal_True; + ((RscEnumInst *)aInst.pData)->bDflt = true; } - return( aInst ); + return aInst; } -sal_Bool RscEnum::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ){ - if( pDef ){ - if( ((RscEnumInst*)rInst.pData)->nValue == - ((RscEnumInst*)pDef)->nValue ) - { - return sal_True; - } - } - - return sal_False; +bool RscEnum::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) +{ + return pDef && (((RscEnumInst*)rInst.pData)->nValue == ((RscEnumInst*)pDef)->nValue ); } void RscEnum::WriteSrc( const RSCINST & rInst, FILE * fOutput, - RscTypCont *, sal_uInt32, const char * ) + RscTypCont *, sal_uInt32, const char * ) { - fprintf( fOutput, "%s", pHS->getString( - pVarArray[ ((RscEnumInst *)rInst.pData)->nValue ].nId ).getStr() ); + fprintf( fOutput, "%s", + pHS->getString( pVarArray[ ((RscEnumInst *)rInst.pData)->nValue ].nId ).getStr() ); } ERRTYPE RscEnum::WriteRc( const RSCINST & rInst, RscWriteRc & aMem, - RscTypCont *, sal_uInt32, sal_Bool ) + RscTypCont *, sal_uInt32, bool ) { aMem.Put( (sal_Int32)pVarArray[ ((RscEnumInst *)rInst.pData)->nValue ].lValue ); - return( ERR_OK ); + return ERR_OK; } RscLangEnum::RscLangEnum() - : RscEnum( pHS->getID( "LangEnum" ), RSC_NOTYPE ), - mnLangId( 0x400 ) + : RscEnum( pHS->getID( "LangEnum" ), RSC_NOTYPE ), + mnLangId( 0x400 ) { } diff --git a/rsc/source/res/rsccont.cxx b/rsc/source/res/rsccont.cxx index 2919a00a8e54..b818e95663e6 100644 --- a/rsc/source/res/rsccont.cxx +++ b/rsc/source/res/rsccont.cxx @@ -28,16 +28,17 @@ void ENTRY_STRUCT::Destroy() { aName.Destroy(); - if( aInst.IsInst() ){ + if( aInst.IsInst() ) + { aInst.pClass->Destroy( aInst ); rtl_freeMemory( aInst.pData ); }; } RscBaseCont::RscBaseCont( Atom nId, sal_uInt32 nTypeId, RscTop * pSuper, - sal_Bool bNoIdent ) - : RscTop( nId, nTypeId, pSuper ), - nSize( 0 ) + bool bNoIdent ) + : RscTop( nId, nTypeId, pSuper ) + , nSize( 0 ) { pTypeClass = NULL; pTypeClass1 = NULL; @@ -57,7 +58,8 @@ RSCCLASS_TYPE RscBaseCont::GetClassType() const void RscBaseCont::DestroyElements( RscBaseContInst * pClassData ) { - if( pClassData->nEntries ){ + if( pClassData->nEntries ) + { for (sal_uInt32 i = 0; i < pClassData->nEntries; i++ ) { pClassData->pEntries[ i ].Destroy(); @@ -69,17 +71,19 @@ void RscBaseCont::DestroyElements( RscBaseContInst * pClassData ) } RSCINST RscBaseCont::Create( RSCINST * pInst, const RSCINST & rDflt, - sal_Bool bOwnClass ) + bool bOwnClass ) { RSCINST aInst; RscBaseContInst * pClassData; - if( !pInst ){ + if( !pInst ) + { aInst.pClass = this; aInst.pData = (CLASS_DATA) rtl_allocateMemory( Size() ); } else aInst = *pInst; + if( !bOwnClass && rDflt.IsInst() ) bOwnClass = rDflt.pClass->InHierarchy( this ); @@ -88,19 +92,21 @@ RSCINST RscBaseCont::Create( RSCINST * pInst, const RSCINST & rDflt, pClassData = (RscBaseContInst *)(aInst.pData + nOffInstData); pClassData->nEntries = 0; pClassData->pEntries = NULL; - pClassData->bDflt = sal_True; + pClassData->bDflt = true; - if( bOwnClass ){ + if( bOwnClass ) + { RscBaseContInst * pDfltClassData; RSCINST aDfltI; pDfltClassData = (RscBaseContInst *)(rDflt.pData + nOffInstData); - if( 0 != pDfltClassData->nEntries ){ + if( 0 != pDfltClassData->nEntries ) + { *pClassData = *pDfltClassData; pClassData->pEntries = (ENTRY_STRUCT *)rtl_allocateMemory( sizeof( ENTRY_STRUCT ) - * pClassData->nEntries ); + * pClassData->nEntries ); for (sal_uInt32 i = 0; i < pClassData->nEntries; i++ ) { pClassData->pEntries[ i ].Create(); @@ -113,10 +119,11 @@ RSCINST RscBaseCont::Create( RSCINST * pInst, const RSCINST & rDflt, }; } - return( aInst ); + return aInst; } -void RscBaseCont::Destroy( const RSCINST & rInst ){ +void RscBaseCont::Destroy( const RSCINST & rInst ) +{ RscBaseContInst * pClassData; RscTop::Destroy( rInst); @@ -134,11 +141,12 @@ RSCINST RscBaseCont::SearchElePos( const RSCINST & rInst, const RscId & rEleName if( !pClass ) pClass = pTypeClass; - if( rEleName.IsId() ){ + if( rEleName.IsId() ) + { for (sal_uInt32 i = nPos; i < pClassData->nEntries; i++ ) { - if( pClassData->pEntries[ i ].aName == rEleName - && pClassData->pEntries[ i ].aInst.pClass == pClass ) + if( pClassData->pEntries[ i ].aName == rEleName && + pClassData->pEntries[ i ].aInst.pClass == pClass ) { return( pClassData->pEntries[ i ].aInst ); }; @@ -163,16 +171,22 @@ ERRTYPE RscBaseCont::GetElement( const RSCINST & rInst, const RscId & rEleName, if( !bNoId && !rEleName.IsId() ) aError = WRN_CONT_NOID; + pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); - if( pCreateClass ){ - if( !pCreateClass->InHierarchy( pTypeClass ) ){ - if( pTypeClass1 ){ - if( !pCreateClass->InHierarchy( pTypeClass1 ) ){ + if( pCreateClass ) + { + if( !pCreateClass->InHierarchy( pTypeClass ) ) + { + if( pTypeClass1 ) + { + if( !pCreateClass->InHierarchy( pTypeClass1 ) ) + { return ERR_CONT_INVALIDTYPE; } } - else{ + else + { return ERR_CONT_INVALIDTYPE; }; }; @@ -180,24 +194,30 @@ ERRTYPE RscBaseCont::GetElement( const RSCINST & rInst, const RscId & rEleName, else pCreateClass = pTypeClass; - pClassData->bDflt = sal_False; + pClassData->bDflt = false; + if( !bNoId ) aTmpI = SearchEle( rInst, rEleName, pCreateClass ); // Eintrag gefunden - if( aTmpI.IsInst() ){ + if( aTmpI.IsInst() ) + { aError = WRN_CONT_DOUBLEID; - if( rCreateInst.IsInst() ){ + if( rCreateInst.IsInst() ) + { aTmpI.pClass->Destroy( aTmpI ); aTmpI.pClass->Create( &aTmpI, rCreateInst ); }; } - else { - if( pClassData->pEntries ){ + else + { + if( pClassData->pEntries ) + { pClassData->pEntries = (ENTRY_STRUCT *)rtl_reallocateMemory( pClassData->pEntries, sizeof( ENTRY_STRUCT ) * (pClassData->nEntries +1) ); } - else { + else + { pClassData->pEntries = (ENTRY_STRUCT *)rtl_allocateMemory( sizeof( ENTRY_STRUCT ) * (pClassData->nEntries +1) ); @@ -206,14 +226,16 @@ ERRTYPE RscBaseCont::GetElement( const RSCINST & rInst, const RscId & rEleName, pClassData->pEntries[ pClassData->nEntries ].Create(); pClassData->pEntries[ pClassData->nEntries ].aName = rEleName; - if( rCreateInst.IsInst() ){ + if( rCreateInst.IsInst() ) + { // Instanz mit CreateInst-Daten initialisieren pClassData->pEntries[ pClassData->nEntries ].aInst = - pCreateClass->Create( NULL, rCreateInst ); + pCreateClass->Create( NULL, rCreateInst ); } - else { + else + { pClassData->pEntries[ pClassData->nEntries ].aInst = - pCreateClass->Create( NULL, RSCINST() ); + pCreateClass->Create( NULL, RSCINST() ); }; pClassData->nEntries++; @@ -224,14 +246,16 @@ ERRTYPE RscBaseCont::GetElement( const RSCINST & rInst, const RscId & rEleName, return aError; } -sal_uInt32 RscBaseCont::GetCount( const RSCINST & rInst ){ +sal_uInt32 RscBaseCont::GetCount( const RSCINST & rInst ) +{ RscBaseContInst * pClassData; pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); - return( pClassData->nEntries ); + return pClassData->nEntries; } -RSCINST RscBaseCont::GetPosEle( const RSCINST & rInst, sal_uInt32 nPos ){ +RSCINST RscBaseCont::GetPosEle( const RSCINST & rInst, sal_uInt32 nPos ) +{ RscBaseContInst * pClassData; pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); @@ -249,10 +273,11 @@ ERRTYPE RscBaseCont::MovePosEle( const RSCINST & rInst, sal_uInt32 nDestPos, pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); - if( (nDestPos < pClassData->nEntries) && (nSourcePos < pClassData->nEntries) ){ + if( (nDestPos < pClassData->nEntries) && (nSourcePos < pClassData->nEntries) ) + { ENTRY_STRUCT aEntry; - int nInc = 1; - sal_uInt32 i = 0; + int nInc = 1; + sal_uInt32 i = 0; // Quelle Merken aEntry = pClassData->pEntries[ nSourcePos ]; @@ -268,18 +293,21 @@ ERRTYPE RscBaseCont::MovePosEle( const RSCINST & rInst, sal_uInt32 nDestPos, } else aError = ERR_RSCCONT; + return aError; } ERRTYPE RscBaseCont::SetPosRscId( const RSCINST & rInst, sal_uInt32 nPos, - const RscId & rId ){ + const RscId & rId ) +{ RscBaseContInst * pClassData; RSCINST aTmpI; ERRTYPE aError; pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); - if( nPos < pClassData->nEntries ){ + if( nPos < pClassData->nEntries ) + { if( ! (rId == pClassData->pEntries[ nPos ].aName) ) aTmpI = SearchEle( rInst, rId, pClassData->pEntries[ nPos ].aInst.pClass ); @@ -290,21 +318,24 @@ ERRTYPE RscBaseCont::SetPosRscId( const RSCINST & rInst, sal_uInt32 nPos, } else aError = ERR_RSCCONT; - return( aError ); + + return aError; } -SUBINFO_STRUCT RscBaseCont::GetInfoEle( const RSCINST & rInst, sal_uInt32 nPos ){ +SUBINFO_STRUCT RscBaseCont::GetInfoEle( const RSCINST & rInst, sal_uInt32 nPos ) +{ RscBaseContInst * pClassData; SUBINFO_STRUCT aInfo; pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); - if( nPos < pClassData->nEntries ){ - aInfo.aId = pClassData->pEntries[ nPos ].aName; - aInfo.nPos = nPos; + if( nPos < pClassData->nEntries ) + { + aInfo.aId = pClassData->pEntries[ nPos ].aName; + aInfo.nPos = nPos; aInfo.pClass = pClassData->pEntries[ nPos ].aInst.pClass; } - return( aInfo ); + return aInfo; } ERRTYPE RscBaseCont::SetString( const RSCINST & rInst, const char * pStr ) @@ -316,13 +347,16 @@ ERRTYPE RscBaseCont::SetString( const RSCINST & rInst, const char * pStr ) pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); -// otherwise infinite recursion is possible - if( RSC_NOTYPE == pTypeClass->GetTypId() ){ + // otherwise infinite recursion is possible + if( RSC_NOTYPE == pTypeClass->GetTypId() ) + { aError = GetElement( rInst, RscId(), pTypeClass, RSCINST(), &aTmpI ); aError = aTmpI.pClass->GetString( aTmpI, &pTmpStr ); + if( aError.IsOk() ) aError = aTmpI.pClass->SetString( aTmpI, pStr ); - else { + else + { aError.Clear(); DeletePos( rInst, pClassData->nEntries -1 ); aError = GetElement( rInst, RscId(), pTypeClass1, RSCINST(), &aTmpI ); @@ -330,16 +364,18 @@ ERRTYPE RscBaseCont::SetString( const RSCINST & rInst, const char * pStr ) if( aError.IsOk() ) aError = aTmpI.pClass->SetString( aTmpI, pStr ); } + if( aError.IsError() ) DeletePos( rInst, pClassData->nEntries -1 ); } else aError = ERR_UNKNOWN_METHOD; - return( aError ); + return aError; } -ERRTYPE RscBaseCont::SetNumber( const RSCINST & rInst, sal_Int32 lValue ){ +ERRTYPE RscBaseCont::SetNumber( const RSCINST & rInst, sal_Int32 lValue ) +{ RscBaseContInst * pClassData; RSCINST aTmpI; ERRTYPE aError; @@ -347,13 +383,16 @@ ERRTYPE RscBaseCont::SetNumber( const RSCINST & rInst, sal_Int32 lValue ){ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); -// otherwise infinite recursion is possible - if( RSC_NOTYPE == pTypeClass->GetTypId() ){ + // otherwise infinite recursion is possible + if( RSC_NOTYPE == pTypeClass->GetTypId() ) + { aError = GetElement( rInst, RscId(), pTypeClass, RSCINST(), &aTmpI ); aError = aTmpI.pClass->GetNumber( aTmpI, &lNumber ); + if( aError.IsOk() ) aError = aTmpI.pClass->SetNumber( aTmpI, lValue ); - else { + else + { aError.Clear(); DeletePos( rInst, pClassData->nEntries -1 ); aError = GetElement( rInst, RscId(), pTypeClass1, RSCINST(), &aTmpI ); @@ -367,19 +406,16 @@ ERRTYPE RscBaseCont::SetNumber( const RSCINST & rInst, sal_Int32 lValue ){ else aError = ERR_UNKNOWN_METHOD; - return( aError ); + return aError; } -ERRTYPE RscBaseCont::SetBool -( - const RSCINST & rInst, - sal_Bool bValue -) +ERRTYPE RscBaseCont::SetBool( const RSCINST & rInst, + bool bValue) { RscBaseContInst * pClassData; RSCINST aTmpI; ERRTYPE aError; - sal_Bool bBool; + bool bBool; pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); @@ -388,9 +424,11 @@ ERRTYPE RscBaseCont::SetBool { aError = GetElement( rInst, RscId(), pTypeClass, RSCINST(), &aTmpI ); aError = aTmpI.pClass->GetBool( aTmpI, &bBool ); + if( aError.IsOk() ) aError = aTmpI.pClass->SetBool( aTmpI, bValue ); - else { + else + { aError.Clear(); DeletePos( rInst, pClassData->nEntries -1 ); aError = GetElement( rInst, RscId(), pTypeClass1, RSCINST(), &aTmpI ); @@ -398,21 +436,19 @@ ERRTYPE RscBaseCont::SetBool if( aError.IsOk() ) aError = aTmpI.pClass->SetBool( aTmpI, bValue ); } + if( aError.IsError() ) DeletePos( rInst, pClassData->nEntries -1 ); } else aError = ERR_UNKNOWN_METHOD; - return( aError ); + return aError; } -ERRTYPE RscBaseCont::SetConst -( - const RSCINST & rInst, - Atom nValueId, - sal_Int32 lValue -) +ERRTYPE RscBaseCont::SetConst( const RSCINST & rInst, + Atom nValueId, + sal_Int32 lValue) { RscBaseContInst * pClassData; RSCINST aTmpI; @@ -422,12 +458,15 @@ ERRTYPE RscBaseCont::SetConst pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); // otherwise infinite recursion is possible - if( RSC_NOTYPE == pTypeClass->GetTypId() ){ + if( RSC_NOTYPE == pTypeClass->GetTypId() ) + { aError = GetElement( rInst, RscId(), pTypeClass, RSCINST(), &aTmpI ); aError = aTmpI.pClass->GetConst( aTmpI, &nConst ); + if( aError.IsOk() ) aError = aTmpI.pClass->SetConst( aTmpI, nValueId, lValue ); - else { + else + { aError.Clear(); DeletePos( rInst, pClassData->nEntries -1 ); aError = GetElement( rInst, RscId(), pTypeClass1, RSCINST(), &aTmpI ); @@ -435,16 +474,18 @@ ERRTYPE RscBaseCont::SetConst if( aError.IsOk() ) aError = aTmpI.pClass->SetConst( aTmpI, nValueId, lValue ); } + if( aError.IsError() ) DeletePos( rInst, pClassData->nEntries -1 ); } else aError = ERR_UNKNOWN_METHOD; - return( aError ); + return aError; } -ERRTYPE RscBaseCont::SetRef( const RSCINST & rInst, const RscId & rRefId ){ +ERRTYPE RscBaseCont::SetRef( const RSCINST & rInst, const RscId & rRefId ) +{ RscBaseContInst * pClassData; RSCINST aTmpI; ERRTYPE aError; @@ -453,12 +494,15 @@ ERRTYPE RscBaseCont::SetRef( const RSCINST & rInst, const RscId & rRefId ){ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); // otherwise infinite recursion is possible - if( RSC_NOTYPE == pTypeClass->GetTypId() ){ + if( RSC_NOTYPE == pTypeClass->GetTypId() ) + { aError = GetElement( rInst, RscId(), pTypeClass, RSCINST(), &aTmpI ); aError = aTmpI.pClass->GetRef( aTmpI, &aId ); + if( aError.IsOk() ) aError = aTmpI.pClass->SetRef( aTmpI, rRefId ); - else { + else + { aError.Clear(); DeletePos( rInst, pClassData->nEntries -1 ); aError = GetElement( rInst, RscId(), pTypeClass1, RSCINST(), &aTmpI ); @@ -466,19 +510,21 @@ ERRTYPE RscBaseCont::SetRef( const RSCINST & rInst, const RscId & rRefId ){ if( aError.IsOk() ) aError = aTmpI.pClass->SetNumber( aTmpI, rRefId ); } + if( aError.IsError() ) DeletePos( rInst, pClassData->nEntries -1 ); } else aError = ERR_UNKNOWN_METHOD; - return( aError ); + return aError; } -sal_Bool RscBaseCont::IsConsistent( const RSCINST & rInst ) { +bool RscBaseCont::IsConsistent( const RSCINST & rInst ) +{ sal_uInt32 i = 0; RscBaseContInst * pClassData; - sal_Bool bRet; + bool bRet; bRet = RscTop::IsConsistent( rInst ); @@ -486,24 +532,29 @@ sal_Bool RscBaseCont::IsConsistent( const RSCINST & rInst ) { // auf doppelten Id Testen und Reihenfolge beibehalten // Komplexitaet = n^2 / 2 - for( i = 0; i < pClassData->nEntries; i++ ){ - if( !bNoId ){ - if( (sal_Int32)pClassData->pEntries[ i ].aName > 0x7FFF - || (sal_Int32)pClassData->pEntries[ i ].aName < 1 ){ - bRet = sal_False; + for( i = 0; i < pClassData->nEntries; i++ ) + { + if( !bNoId ) + { + if( (sal_Int32)pClassData->pEntries[ i ].aName > 0x7FFF || + (sal_Int32)pClassData->pEntries[ i ].aName < 1 ) + { + bRet = false; } else if( SearchElePos( rInst, pClassData->pEntries[ i ].aName, - pClassData->pEntries[ i ].aInst.pClass, i +1 ).IsInst() ) + pClassData->pEntries[ i ].aInst.pClass, i +1 ).IsInst() ) { - bRet = sal_False; - }; + bRet = false; + }; } if( ! pClassData->pEntries[ i ].aInst.pClass-> - IsConsistent( pClassData->pEntries[ i ].aInst ) ) - bRet = sal_False; + IsConsistent( pClassData->pEntries[ i ].aInst ) ) + { + bRet = false; + } }; - return( bRet ); + return bRet; } void RscBaseCont::SetToDefault( const RSCINST & rInst ) @@ -522,39 +573,41 @@ void RscBaseCont::SetToDefault( const RSCINST & rInst ) RscTop::SetToDefault( rInst ); } -sal_Bool RscBaseCont::IsDefault( const RSCINST & rInst ){ +bool RscBaseCont::IsDefault( const RSCINST & rInst ) +{ sal_uInt32 i = 0; RscBaseContInst * pClassData; pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); if( !pClassData->bDflt ) - return sal_False; + return false; - for( i = 0; i < pClassData->nEntries; i++ ){ + for( i = 0; i < pClassData->nEntries; i++ ) + { if( ! pClassData->pEntries[ i ].aInst.pClass-> - IsDefault( pClassData->pEntries[ i ].aInst ) ) + IsDefault( pClassData->pEntries[ i ].aInst ) ) { - return( sal_False ); + return( false ); }; }; - return( RscTop::IsDefault( rInst ) ); + return RscTop::IsDefault( rInst ); } -sal_Bool RscBaseCont::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) +bool RscBaseCont::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) { RscBaseContInst * pClassData; if( !RscTop::IsValueDefault( rInst, pDef ) ) - return sal_False; + return false; pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); if( pClassData->nEntries ) - return sal_False; + return false; else - return sal_True; + return true; } void RscBaseCont::Delete( const RSCINST & rInst, RscTop * pClass, @@ -567,29 +620,38 @@ void RscBaseCont::Delete( const RSCINST & rInst, RscTop * pClass, if( !pClass ) pClass = pTypeClass; - for( i = 0; i < pClassData->nEntries; i++ ){ + for( i = 0; i < pClassData->nEntries; i++ ) + { if( pClassData->pEntries[ i ].aName == rId ) - if( pClassData->pEntries[ i ].aInst.pClass == pClass || !pClass ){ + { + if( pClassData->pEntries[ i ].aInst.pClass == pClass || !pClass ) + { DeletePos( rInst, i ); return; }; + }; }; } -void RscBaseCont::DeletePos( const RSCINST & rInst, sal_uInt32 nPos ){ +void RscBaseCont::DeletePos( const RSCINST & rInst, sal_uInt32 nPos ) +{ RscBaseContInst * pClassData; pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); - if( nPos < pClassData->nEntries ){ + if( nPos < pClassData->nEntries ) + { if( 1 == pClassData->nEntries ) DestroyElements( pClassData ); - else{ + else + { pClassData->pEntries[ nPos ].Destroy(); pClassData->nEntries--; + for (sal_uInt32 i = nPos; i < pClassData->nEntries; i++ ) pClassData->pEntries[ i ] = pClassData->pEntries[ i + 1 ]; + }; }; } @@ -607,6 +669,7 @@ void RscBaseCont::ContWriteSrc( const RSCINST & rInst, FILE * fOutput, { for( t = 0; t < nTab; t++ ) fputc( '\t', fOutput ); + pClassData->pEntries[ i ].aInst.pClass-> WriteSrcHeader( pClassData->pEntries[ i ].aInst, fOutput, pTC, nTab, @@ -616,13 +679,13 @@ void RscBaseCont::ContWriteSrc( const RSCINST & rInst, FILE * fOutput, } ERRTYPE RscBaseCont::ContWriteRc( const RSCINST & rInst, RscWriteRc & rMem, - RscTypCont * pTC, sal_uInt32 nDeep, sal_Bool bExtra ) + RscTypCont * pTC, sal_uInt32 nDeep, bool bExtra ) { RscBaseContInst * pClassData; ERRTYPE aError; if( bExtra || bNoId ) - { // Nur Subresourcen schreiben, wenn bExtra == sal_True + { // Nur Subresourcen schreiben, wenn bExtra == true pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData); for (sal_uInt32 i = 0; i < pClassData->nEntries && aError.IsOk(); i++ ) @@ -635,7 +698,7 @@ ERRTYPE RscBaseCont::ContWriteRc( const RSCINST & rInst, RscWriteRc & rMem, } } - return( aError ); + return aError ; } void RscBaseCont::WriteSrc( const RSCINST & rInst, FILE * fOutput, @@ -647,7 +710,7 @@ void RscBaseCont::WriteSrc( const RSCINST & rInst, FILE * fOutput, } ERRTYPE RscBaseCont::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, - RscTypCont * pTC, sal_uInt32 nDeep, sal_Bool bExtra ) + RscTypCont * pTC, sal_uInt32 nDeep, bool bExtra ) { ERRTYPE aError; @@ -655,13 +718,14 @@ ERRTYPE RscBaseCont::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, if( aError.IsOk() ) aError = ContWriteRc( rInst, rMem, pTC, nDeep, bExtra ); - return( aError ); + return aError; } RscContWriteSrc::RscContWriteSrc( Atom nId, sal_uInt32 nTypeId, - RscTop * pSuper, sal_Bool bNoIdent ) - : RscBaseCont( nId, nTypeId, pSuper, bNoIdent ) -{} + RscTop * pSuper, bool bNoIdent ) + : RscBaseCont( nId, nTypeId, pSuper, bNoIdent ) +{ +} void RscContWriteSrc::WriteSrc( const RSCINST & rInst, FILE * fOutput, RscTypCont * pTC, sal_uInt32 nTab, @@ -674,21 +738,24 @@ void RscContWriteSrc::WriteSrc( const RSCINST & rInst, FILE * fOutput, fprintf( fOutput, "\n" ); for( i = 0; i < nTab; i++ ) fputc( '\t', fOutput ); + fprintf( fOutput, "{\n" ); ContWriteSrc( rInst, fOutput, pTC, nTab +1, pVarName ); for( i = 0; i < nTab; i++ ) fputc( '\t', fOutput ); + fprintf( fOutput, "}" ); } -RscCont::RscCont( Atom nId, sal_uInt32 nTypeId, RscTop * pSuper, sal_Bool bNoIdent ) - : RscContWriteSrc( nId, nTypeId, pSuper, bNoIdent ) -{} +RscCont::RscCont( Atom nId, sal_uInt32 nTypeId, RscTop * pSuper, bool bNoIdent ) + : RscContWriteSrc( nId, nTypeId, pSuper, bNoIdent ) +{ +} ERRTYPE RscCont::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, - RscTypCont * pTC, sal_uInt32 nDeep, sal_Bool bExtra ) + RscTypCont * pTC, sal_uInt32 nDeep, bool bExtra ) { RscBaseContInst * pClassData; ERRTYPE aError; @@ -706,12 +773,13 @@ ERRTYPE RscCont::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, } RscContExtraData::RscContExtraData( Atom nId, sal_uInt32 nTypeId, - RscTop * pSuper, sal_Bool bNoIdent ) - : RscContWriteSrc( nId, nTypeId, pSuper, bNoIdent ) -{} + RscTop * pSuper, bool bNoIdent ) + : RscContWriteSrc( nId, nTypeId, pSuper, bNoIdent ) +{ +} ERRTYPE RscContExtraData::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, - RscTypCont * pTC, sal_uInt32 nDeep, sal_Bool bExtra ) + RscTypCont * pTC, sal_uInt32 nDeep, bool bExtra ) { ERRTYPE aError; diff --git a/rsc/source/res/rscflag.cxx b/rsc/source/res/rscflag.cxx index c37e377b9a7e..0aa1efd75f1d 100644 --- a/rsc/source/res/rscflag.cxx +++ b/rsc/source/res/rscflag.cxx @@ -25,60 +25,66 @@ #include <rscflag.hxx> RscFlag::RscFlag( Atom nId, sal_uInt32 nTypeId ) - : RscConst( nId, nTypeId ) -{} + : RscConst( nId, nTypeId ) +{ +} sal_uInt32 RscFlag::Size() { - return( ALIGNED_SIZE( sizeof( RscFlagInst ) * - ( 1 + (nEntries -1) / (sizeof( sal_uInt32 ) * 8) ) ) ); + return ALIGNED_SIZE( sizeof( RscFlagInst ) * + ( 1 + (nEntries -1) / (sizeof( sal_uInt32 ) * 8) ) ); } ERRTYPE RscFlag::SetNotConst( const RSCINST & rInst, Atom nConst ) { sal_uInt32 i = 0; - if( nEntries != (i = GetConstPos( nConst )) ){ + if( nEntries != (i = GetConstPos( nConst )) ) + { sal_uInt32 nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) ); + i = i / (sizeof( sal_uInt32 ) * 8); ((RscFlagInst *)rInst.pData)[ i ].nFlags &= ~nFlag; ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags &= ~nFlag; - return( ERR_OK ); + return ERR_OK; }; - return( ERR_RSCFLAG ); + return ERR_RSCFLAG; } ERRTYPE RscFlag::SetConst( const RSCINST & rInst, Atom nConst, sal_Int32 /*nVal*/ ) { sal_uInt32 i = 0; - if( nEntries != (i = GetConstPos( nConst )) ){ + if( nEntries != (i = GetConstPos( nConst )) ) + { sal_uInt32 nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) ); + i = i / (sizeof( sal_uInt32 ) * 8); ((RscFlagInst *)rInst.pData)[ i ].nFlags |= nFlag; ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags &= ~nFlag; - return( ERR_OK ); + return ERR_OK; }; - return( ERR_RSCFLAG ); + return ERR_RSCFLAG; } RSCINST RscFlag::CreateBasic( RSCINST * pInst ) { RSCINST aInst; - if( !pInst ){ + if( !pInst ) + { aInst.pClass = this; aInst.pData = (CLASS_DATA) rtl_allocateMemory( Size() ); } else aInst = *pInst; - return( aInst ); + return aInst; } -RSCINST RscFlag::Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool bOwnClass ) +RSCINST RscFlag::Create( RSCINST * pInst, const RSCINST & rDflt, bool bOwnClass ) { RSCINST aInst = CreateBasic( pInst ); @@ -96,11 +102,11 @@ RSCINST RscFlag::Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool bOwnCl } }; - return( aInst ); + return aInst; } RSCINST RscFlag::CreateClient( RSCINST * pInst, const RSCINST & rDfltI, - sal_Bool bOwnClass, Atom nConstId ) + bool bOwnClass, Atom nConstId ) { RSCINST aInst = CreateBasic( pInst ); sal_uInt32 i = 0; @@ -112,19 +118,21 @@ RSCINST RscFlag::CreateClient( RSCINST * pInst, const RSCINST & rDfltI, { sal_uInt32 nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) ); i = i / (sizeof( sal_uInt32 ) * 8); - if( bOwnClass ){ + if( bOwnClass ) + { ((RscFlagInst *)aInst.pData)[ i ].nFlags &= - ~nFlag | ((RscFlagInst *)rDfltI.pData)[ i ].nFlags; + ~nFlag | ((RscFlagInst *)rDfltI.pData)[ i ].nFlags; ((RscFlagInst *)aInst.pData)[ i ].nDfltFlags &= - ~nFlag | ((RscFlagInst *)rDfltI.pData)[ i ].nDfltFlags; + ~nFlag | ((RscFlagInst *)rDfltI.pData)[ i ].nDfltFlags; } - else{ + else + { ((RscFlagInst *)aInst.pData)[ i ].nFlags &= ~nFlag; ((RscFlagInst *)aInst.pData)[ i ].nDfltFlags |= nFlag; } } - return( aInst ); + return aInst; } void RscFlag::SetToDefault( const RSCINST & rInst ) @@ -135,64 +143,73 @@ void RscFlag::SetToDefault( const RSCINST & rInst ) ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags = 0xFFFFFFFF; } -sal_Bool RscFlag::IsDefault( const RSCINST & rInst ) +bool RscFlag::IsDefault( const RSCINST & rInst ) { sal_uInt32 i = 0; for( i = 0; i < Size() / sizeof( RscFlagInst ); i++ ) + { if( ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags != 0xFFFFFFFF ) - return( sal_False ); - return( sal_True ); + return false; + } + return true; } -sal_Bool RscFlag::IsDefault( const RSCINST & rInst, Atom nConstId ) +bool RscFlag::IsDefault( const RSCINST & rInst, Atom nConstId ) { sal_uInt32 i = 0, nFlag = 0; - if( nEntries != (i = GetConstPos( nConstId )) ){ + if( nEntries != (i = GetConstPos( nConstId )) ) + { nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) ); i = i / (sizeof( sal_uInt32 ) * 8); + if( ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags & nFlag ) - return( sal_True ); + return true ; else - return( sal_False ); + return false; }; - return( sal_True ); + return true; } -sal_Bool RscFlag::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef, +bool RscFlag::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef, Atom nConstId ) { sal_uInt32 i = 0, nFlag = 0; - if( nEntries != (i = GetConstPos( nConstId )) ){ + if( nEntries != (i = GetConstPos( nConstId )) ) + { nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) ); i = i / (sizeof( sal_uInt32 ) * 8); - if( pDef ){ - if( (((RscFlagInst *)rInst.pData)[ i ].nFlags & nFlag) - == (((RscFlagInst *)pDef)[ i ].nFlags & nFlag) ) + if( pDef ) + { + if( (((RscFlagInst *)rInst.pData)[ i ].nFlags & nFlag) == + (((RscFlagInst *)pDef)[ i ].nFlags & nFlag) ) { - return sal_True; + return true; } } }; - return sal_False; + return false; } -sal_Bool RscFlag::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) +bool RscFlag::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) { - if( pDef ){ + if( pDef ) + { sal_uInt32 Flag = 0, nIndex = 0; Flag = 1; - for( sal_uInt32 i = 0; i < nEntries; i++ ){ + for( sal_uInt32 i = 0; i < nEntries; i++ ) + { nIndex = i / (sizeof( sal_uInt32 ) * 8); - if( (((RscFlagInst *)rInst.pData)[ nIndex ].nFlags & Flag) - != (((RscFlagInst *)pDef)[ nIndex ].nFlags & Flag) ) + + if( (((RscFlagInst *)rInst.pData)[ nIndex ].nFlags & Flag) != + (((RscFlagInst *)pDef)[ nIndex ].nFlags & Flag) ) { - return sal_False; + return false; } Flag <<= 1; if( !Flag ) @@ -200,45 +217,51 @@ sal_Bool RscFlag::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) }; } else - return sal_False; + return false; - return sal_True; + return true; } -sal_Bool RscFlag::IsSet( const RSCINST & rInst, Atom nConstId ) +bool RscFlag::IsSet( const RSCINST & rInst, Atom nConstId ) { sal_uInt32 i = 0, nFlag = 0; - if( nEntries != (i = GetConstPos( nConstId )) ){ + if( nEntries != (i = GetConstPos( nConstId )) ) + { nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) ); i = i / (sizeof( sal_uInt32 ) * 8); + if( ((RscFlagInst *)rInst.pData)[ i ].nFlags & nFlag ) - return( sal_True ); + return true; else - return( sal_False ); + return false; }; - return( sal_True ); + return true; } void RscFlag::WriteSrc( const RSCINST & rInst, FILE * fOutput, RscTypCont *, sal_uInt32, const char * ) { sal_uInt32 i = 0, Flag = 0, nIndex = 0; - sal_Bool bComma = sal_False; + bool bComma = false; Flag = 1; - for( i = 0; i < nEntries; i++ ){ + for( i = 0; i < nEntries; i++ ) + { nIndex = i / (sizeof( sal_uInt32 ) * 8); - if( !( ((RscFlagInst *)rInst.pData)[ nIndex ].nDfltFlags & Flag) ){ + if( !( ((RscFlagInst *)rInst.pData)[ nIndex ].nDfltFlags & Flag) ) + { if( bComma ) fprintf( fOutput, ", " ); + if( ((RscFlagInst *)rInst.pData)[ nIndex ].nFlags & Flag ) fprintf( fOutput, "%s", pHS->getString( pVarArray[ i ].nId ).getStr() ); - else{ + else + { fprintf( fOutput, "not " ); fprintf( fOutput, "%s", pHS->getString( pVarArray[ i ].nId ).getStr() ); } - bComma = sal_True; + bComma = true; } Flag <<= 1; if( !Flag ) @@ -247,14 +270,16 @@ void RscFlag::WriteSrc( const RSCINST & rInst, FILE * fOutput, } ERRTYPE RscFlag::WriteRc( const RSCINST & rInst, RscWriteRc & aMem, - RscTypCont *, sal_uInt32, sal_Bool ) + RscTypCont *, sal_uInt32, bool ) { sal_Int32 lVal = 0; sal_uInt32 i = 0, Flag = 0, nIndex = 0; Flag = 1; - for( i = 0; i < nEntries; i++ ){ + for( i = 0; i < nEntries; i++ ) + { nIndex = i / (sizeof( sal_uInt32 ) * 8); + if( ((RscFlagInst *)rInst.pData)[ nIndex ].nFlags & Flag ) lVal |= pVarArray[ i ].lValue; @@ -264,12 +289,12 @@ ERRTYPE RscFlag::WriteRc( const RSCINST & rInst, RscWriteRc & aMem, }; aMem.Put( (sal_Int32)lVal ); - return( ERR_OK ); + return ERR_OK; } RscClient::RscClient( Atom nId, sal_uInt32 nTypeId, RscFlag * pClass, - Atom nConstantId ) - : RscTop ( nId, nTypeId ) + Atom nConstantId ) + : RscTop ( nId, nTypeId ) { pRefClass = pClass; nConstId = nConstantId; @@ -290,18 +315,21 @@ void RscClient::WriteSrc( const RSCINST & rInst, FILE * fOutput, } RSCINST RscClient::Create( RSCINST * pInst, const RSCINST & rDflt, - sal_Bool bOwnClass ) + bool bOwnClass ) { RSCINST aTmpI, aDfltI; - if( pInst ){ + if( pInst ) + { aTmpI.pClass = pRefClass; aTmpI.pData = pInst->pData; } - if( !bOwnClass && rDflt.IsInst() ){ + if( !bOwnClass && rDflt.IsInst() ) + { bOwnClass = rDflt.pClass->InHierarchy( this ); - if( bOwnClass ){ + if( bOwnClass ) + { aDfltI.pClass = pRefClass; aDfltI.pData = rDflt.pData; } @@ -315,7 +343,7 @@ RSCINST RscClient::Create( RSCINST * pInst, const RSCINST & rDflt, bOwnClass, nConstId ); aTmpI.pClass = this; - return( aTmpI ); + return aTmpI; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/res/rscmgr.cxx b/rsc/source/res/rscmgr.cxx index 3058e01c4c20..41ff63a68401 100644 --- a/rsc/source/res/rscmgr.cxx +++ b/rsc/source/res/rscmgr.cxx @@ -27,7 +27,7 @@ #include <rscdb.hxx> RscMgr::RscMgr( Atom nId, sal_uInt32 nTypeId, RscTop * pSuperCl ) - : RscClass( nId, nTypeId, pSuperCl ) + : RscClass( nId, nTypeId, pSuperCl ) { } @@ -36,16 +36,19 @@ sal_uInt32 RscMgr::Size() return RscClass::Size() + ALIGNED_SIZE( sizeof( RscMgrInst ) ); } -RSCINST RscMgr::Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool bOwnClass ){ +RSCINST RscMgr::Create( RSCINST * pInst, const RSCINST & rDflt, bool bOwnClass ) +{ RSCINST aInst; RscMgrInst * pClassData; - if( !pInst ){ + if( !pInst ) + { aInst.pClass = this; aInst.pData = (CLASS_DATA) rtl_allocateMemory( Size() ); } else aInst = *pInst; + if( !bOwnClass && rDflt.IsInst() ) bOwnClass = rDflt.pClass->InHierarchy( this ); @@ -54,15 +57,17 @@ RSCINST RscMgr::Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool bOwnCla pClassData = (RscMgrInst *)(aInst.pData + RscClass::Size() ); pClassData->Create(); - if( bOwnClass ){ + if( bOwnClass ) + { RscMgrInst * pDfltData = (RscMgrInst *)(rDflt.pData + RscClass::Size()); *pClassData = *pDfltData; }; - return( aInst ); + return aInst; } -void RscMgr::Destroy( const RSCINST & rInst ){ +void RscMgr::Destroy( const RSCINST & rInst ) +{ RscMgrInst * pClassData; RscClass::Destroy( rInst ); @@ -76,35 +81,39 @@ void RscMgr::SetToDefault( const RSCINST & rInst ) RscMgrInst * pClassData; pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); - pClassData->bDflt = sal_True; + pClassData->bDflt = true; RscClass::SetToDefault( rInst ); } -sal_Bool RscMgr::IsDefault( const RSCINST & rInst ){ +bool RscMgr::IsDefault( const RSCINST & rInst ) +{ RscMgrInst * pClassData; pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); if( !pClassData->bDflt ) - return( sal_False ); + return false; - return( RscClass::IsDefault( rInst ) ); + return RscClass::IsDefault( rInst ); } -sal_Bool RscMgr::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ){ +bool RscMgr::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) +{ if( !RscClass::IsValueDefault( rInst, pDef ) ) - return sal_False; + return false; - if( pDef ){ + if( pDef ) + { RscMgrInst * pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); RscMgrInst * pDfltData = (RscMgrInst *)(pDef + RscClass::Size()); - if( !pClassData->aRefId.IsId() && !pDfltData->aRefId.IsId() ){ - return sal_True; + if( !pClassData->aRefId.IsId() && !pDfltData->aRefId.IsId() ) + { + return true; } } - return sal_False; + return false; } @@ -120,6 +129,7 @@ void RscMgr::WriteSrcHeader( const RSCINST & rInst, FILE * fOutput, fprintf( fOutput, "%s %s", pHS->getString( rInst.pClass->GetId() ).getStr(), (rId.GetName()).getStr() ); + if( pClassData->aRefId.IsId() ) fprintf( fOutput, ",%s", pClassData->aRefId.GetName().getStr() ); else @@ -127,6 +137,7 @@ void RscMgr::WriteSrcHeader( const RSCINST & rInst, FILE * fOutput, fprintf( fOutput, "\n" ); for( i = 0; i < nTab; i++ ) fputc( '\t', fOutput ); + fprintf( fOutput, "{\n" ); rInst.pClass->WriteSrc( rInst, fOutput, pTC, nTab +1, pVarName ); @@ -135,18 +146,19 @@ void RscMgr::WriteSrcHeader( const RSCINST & rInst, FILE * fOutput, for( i = 0; i < nTab; i++ ) fputc( '\t', fOutput ); + fprintf( fOutput, "}" ); } } void RscMgr::WriteSrc( const RSCINST &, FILE *, RscTypCont *, sal_uInt32, - const char * ) + const char * ) { } ERRTYPE RscMgr::WriteRcHeader( const RSCINST & rInst, RscWriteRc & rMem, RscTypCont * pTC, const RscId &rId, - sal_uInt32 nDeep, sal_Bool bExtra ) + sal_uInt32 nDeep, bool bExtra ) { RscMgrInst * pClassData; ERRTYPE aError; @@ -163,6 +175,7 @@ ERRTYPE RscMgr::WriteRcHeader( const RSCINST & rInst, RscWriteRc & rMem, else pObjNode = rInst.pClass->GetRefClass()-> GetObjNode( pClassData->aRefId ); + if( !pObjNode && pTC ) { OStringBuffer aMsg(pHS->getString(rInst.pClass->GetId())); @@ -228,36 +241,37 @@ ERRTYPE RscMgr::WriteRcHeader( const RSCINST & rInst, RscWriteRc & rMem, }; }; - return( aError ); + return aError; } ERRTYPE RscMgr::WriteRc( const RSCINST &, RscWriteRc &, - RscTypCont *, sal_uInt32, sal_Bool ) + RscTypCont *, sal_uInt32, bool ) { - return( ERR_OK ); + return ERR_OK; } -sal_Bool RscMgr::IsConsistent( const RSCINST & rInst ) +bool RscMgr::IsConsistent( const RSCINST & rInst ) { - sal_Bool bRet; + bool bRet; RscMgrInst * pClassData; bRet = RscClass::IsConsistent( rInst ); pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); if( pClassData->aRefId.IsId() && - ((pClassData->aRefId.GetNumber() < 1) - || (pClassData->aRefId.GetNumber() > 0x7FFF) - || IsToDeep( rInst ).IsError()) ) + ((pClassData->aRefId.GetNumber() < 1) || + (pClassData->aRefId.GetNumber() > 0x7FFF) || + IsToDeep( rInst ).IsError()) ) { - bRet = sal_False; + bRet = false; } - return( bRet ); + return bRet; } -ERRTYPE RscMgr::GetRef( const RSCINST & rInst, RscId * pRscId ){ +ERRTYPE RscMgr::GetRef( const RSCINST & rInst, RscId * pRscId ) +{ RscMgrInst * pClassData; pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size()); @@ -287,7 +301,7 @@ ERRTYPE RscMgr::IsToDeep( const RSCINST & rInst, sal_uInt32 nDeep ) aTmpI.pData = pObjNode->GetRscObj(); nDeep++; } - else //aTmpI.IsInst() wird sal_False, Schleife beenden + else //aTmpI.IsInst() wird false, Schleife beenden aTmpI.pData = NULL; } @@ -297,7 +311,7 @@ ERRTYPE RscMgr::IsToDeep( const RSCINST & rInst, sal_uInt32 nDeep ) aError = ERR_REFTODEEP; } - return( aError ); + return aError; } ERRTYPE RscMgr::SetRef( const RSCINST & rInst, const RscId & rRefId ) @@ -307,7 +321,8 @@ ERRTYPE RscMgr::SetRef( const RSCINST & rInst, const RscId & rRefId ) ERRTYPE aError; if( rRefId.IsId() && - ((rRefId.GetNumber() < 1) || (rRefId.GetNumber() > 0x7FFF)) ) + ((rRefId.GetNumber() < 1) || + (rRefId.GetNumber() > 0x7FFF)) ) { aError = ERR_IDRANGE; } @@ -321,12 +336,12 @@ ERRTYPE RscMgr::SetRef( const RSCINST & rInst, const RscId & rRefId ) aError = IsToDeep( rInst ); if( aError.IsOk() ) - pClassData->bDflt = sal_False; + pClassData->bDflt = false; else pClassData->aRefId = aOldId; } - return( aError ); + return aError; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/res/rscrange.cxx b/rsc/source/res/rscrange.cxx index fe06d341e2ae..031dc23d6963 100644 --- a/rsc/source/res/rscrange.cxx +++ b/rsc/source/res/rscrange.cxx @@ -25,7 +25,7 @@ #include <rscrange.hxx> RscRange::RscRange( Atom nId, sal_uInt32 nTypeId ) - : RscTop( nId, nTypeId ) + : RscTop( nId, nTypeId ) { nMin = nMax = 0; nSize = ALIGNED_SIZE( sizeof( RscRangeInst ) ); @@ -49,51 +49,52 @@ ERRTYPE RscRange::SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum ) nMin = nMinimum; }; - return( ERR_OK ); + return ERR_OK; } -sal_Bool RscRange::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) +bool RscRange::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) { if( pDef ) { if( ((RscRangeInst*)rInst.pData)->nValue == ((RscRangeInst*)pDef)->nValue ) { - return sal_True; + return true; } } - return sal_False; + return false; } ERRTYPE RscRange::SetNumber( const RSCINST & rInst, sal_Int32 nValue ) { if( nMax < nValue || nMin > nValue ) - return( ERR_RSCRANGE_OUTDEFSET ); + return ERR_RSCRANGE_OUTDEFSET; + ((RscRangeInst *)rInst.pData)->nValue = (sal_uInt16)( nValue - nMin ); - ((RscRangeInst *)rInst.pData)->bDflt = sal_False; - return( ERR_OK ); + ((RscRangeInst *)rInst.pData)->bDflt = false; + return ERR_OK; } ERRTYPE RscRange::GetNumber( const RSCINST & rInst, sal_Int32 * pN ) { *pN = ((RscRangeInst *)rInst.pData)->nValue + nMin; - return( ERR_OK ); + return ERR_OK; } RSCINST RscRange::Create( RSCINST * pInst, const RSCINST & rDflt, - sal_Bool bOwnClass ) + bool bOwnClass ) { RSCINST aInst; if( !pInst ) { aInst.pClass = this; - aInst.pData = (CLASS_DATA) - rtl_allocateMemory( sizeof( RscRangeInst ) ); + aInst.pData = (CLASS_DATA)rtl_allocateMemory( sizeof( RscRangeInst ) ); } else aInst = *pInst; + if( !bOwnClass && rDflt.IsInst() ) bOwnClass = rDflt.pClass->InHierarchy( this ); @@ -105,10 +106,11 @@ RSCINST RscRange::Create( RSCINST * pInst, const RSCINST & rDflt, ((RscRangeInst *)aInst.pData)->nValue = (sal_uInt16)(0L - nMin); else ((RscRangeInst *)aInst.pData)->nValue = 0; - ((RscRangeInst *)aInst.pData)->bDflt = sal_True; + + ((RscRangeInst *)aInst.pData)->bDflt = true; } - return( aInst ); + return aInst; } void RscRange::WriteSrc( const RSCINST & rInst, FILE * fOutput, @@ -118,7 +120,7 @@ void RscRange::WriteSrc( const RSCINST & rInst, FILE * fOutput, } ERRTYPE RscRange::WriteRc( const RSCINST & rInst, RscWriteRc & aMem, - RscTypCont *, sal_uInt32, sal_Bool ) + RscTypCont *, sal_uInt32, bool ) { if( nMin >= 0 ) { @@ -133,11 +135,11 @@ ERRTYPE RscRange::WriteRc( const RSCINST & rInst, RscWriteRc & aMem, aMem.Put( n ); } - return( ERR_OK ); + return ERR_OK; } RscLongRange::RscLongRange( Atom nId, sal_uInt32 nTypeId ) - : RscTop( nId, nTypeId ) + : RscTop( nId, nTypeId ) { nMin = nMax = 0; nSize = ALIGNED_SIZE( sizeof( RscLongRangeInst ) ); @@ -161,49 +163,50 @@ ERRTYPE RscLongRange::SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum ) nMin = nMinimum; }; - return( ERR_OK ); + return ERR_OK; } -sal_Bool RscLongRange::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) +bool RscLongRange::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) { if( pDef ) return 0 == memcmp( &((RscLongRangeInst*)rInst.pData)->nValue, &((RscLongRangeInst*)pDef)->nValue, sizeof( sal_Int32 ) ); - return sal_False; + return false; } ERRTYPE RscLongRange::SetNumber( const RSCINST & rInst, sal_Int32 nValue ) { if( nMax < nValue || nMin > nValue ) return( ERR_RSCRANGE_OUTDEFSET ); + void * pData = &((RscLongRangeInst*)rInst.pData)->nValue; memcpy( pData, &nValue, sizeof( sal_Int32 ) ); - ((RscLongRangeInst *)rInst.pData)->bDflt = sal_False; - return( ERR_OK ); + ((RscLongRangeInst *)rInst.pData)->bDflt = false; + return ERR_OK; } ERRTYPE RscLongRange::GetNumber( const RSCINST & rInst, sal_Int32 * pN ) { memmove( pN, &((RscLongRangeInst*)rInst.pData)->nValue, sizeof( sal_Int32 ) ); - return( ERR_OK ); + return ERR_OK; } RSCINST RscLongRange::Create( RSCINST * pInst, const RSCINST & rDflt, - sal_Bool bOwnClass ) + bool bOwnClass ) { RSCINST aInst; if( !pInst ) { aInst.pClass = this; - aInst.pData = (CLASS_DATA) - rtl_allocateMemory( sizeof( RscLongRangeInst ) ); + aInst.pData = (CLASS_DATA) rtl_allocateMemory( sizeof( RscLongRangeInst ) ); } else aInst = *pInst; + if( !bOwnClass && rDflt.IsInst() ) bOwnClass = rDflt.pClass->InHierarchy( this ); @@ -216,16 +219,17 @@ RSCINST RscLongRange::Create( RSCINST * pInst, const RSCINST & rDflt, lDflt = 0; else lDflt = nMin; + void * pData = &((RscLongRangeInst*)aInst.pData)->nValue; memcpy( pData, &lDflt, sizeof( sal_Int32 ) ); - ((RscLongRangeInst *)aInst.pData)->bDflt = sal_True; + ((RscLongRangeInst *)aInst.pData)->bDflt = true; } - return( aInst ); + return aInst; } void RscLongRange::WriteSrc( const RSCINST & rInst, FILE * fOutput, - RscTypCont *, sal_uInt32, const char * ) + RscTypCont *, sal_uInt32, const char * ) { sal_Int32 lVal; GetNumber( rInst, &lVal ); @@ -233,18 +237,18 @@ void RscLongRange::WriteSrc( const RSCINST & rInst, FILE * fOutput, } ERRTYPE RscLongRange::WriteRc( const RSCINST & rInst, RscWriteRc & aMem, - RscTypCont *, sal_uInt32, sal_Bool ) + RscTypCont *, sal_uInt32, bool ) { sal_Int32 lVal; GetNumber( rInst, &lVal ); aMem.Put( (sal_Int32)lVal ); - return( ERR_OK ); + return ERR_OK; } RscLongEnumRange::RscLongEnumRange( Atom nId, sal_uInt32 nTypeId ) - : RscLongRange( nId, nTypeId ) + : RscLongRange( nId, nTypeId ) { } @@ -255,7 +259,7 @@ ERRTYPE RscLongEnumRange::SetConst( const RSCINST & rInst, Atom /*nConst*/, } RscIdRange::RscIdRange( Atom nId, sal_uInt32 nTypeId ) - : RscTop( nId, nTypeId ) + : RscTop( nId, nTypeId ) { nSize = ALIGNED_SIZE( sizeof( RscId ) ); nMin = nMax = 0; @@ -266,11 +270,13 @@ RSCCLASS_TYPE RscIdRange::GetClassType() const return RSCCLASS_NUMBER; } -RSCINST RscIdRange::Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool bOwnClass ){ +RSCINST RscIdRange::Create( RSCINST * pInst, const RSCINST & rDflt, bool bOwnClass ) +{ RSCINST aInst; RscId * pClassData; - if( !pInst ){ + if( !pInst ) + { aInst.pClass = this; aInst.pData = (CLASS_DATA)rtl_allocateMemory( sizeof( RscId ) ); } @@ -284,75 +290,86 @@ RSCINST RscIdRange::Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool bOw pClassData = (RscId *)aInst.pData; pClassData->Create(); + if( bOwnClass ) *pClassData = *(RscId *)rDflt.pData; - else{ - *pClassData = RscId(); + else + { + *pClassData = RscId(); if( 0 >= nMin && 0 <= nMax ) *pClassData = RscId( (sal_Int32)0 ); else *pClassData = RscId( nMin ); + //cUnused wird fuer Defaultkennung verwendet - ((RscId *)aInst.pData)->aExp.cUnused = sal_True; + ((RscId *)aInst.pData)->aExp.cUnused = true; } - return( aInst ); + return aInst; } -void RscIdRange :: Destroy( const RSCINST & rInst ){ +void RscIdRange :: Destroy( const RSCINST & rInst ) +{ ((RscId *)rInst.pData)->Destroy(); } -sal_Bool RscIdRange::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ){ - if( pDef ){ - if( ((RscId*)rInst.pData)->aExp.IsNumber() - && ((RscId*)pDef)->aExp.IsNumber() ) +bool RscIdRange::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) +{ + if( pDef ) + { + if( ((RscId*)rInst.pData)->aExp.IsNumber() && + ((RscId*)pDef)->aExp.IsNumber() ) { if( ((RscId*)rInst.pData)->GetNumber() == - ((RscId*)pDef)->GetNumber() ) + ((RscId*)pDef)->GetNumber() ) { - return sal_True; + return true; } } } - return sal_False; + return false; } ERRTYPE RscIdRange::SetNumber( const RSCINST & rInst, sal_Int32 nValue ) { if( nMax < nValue || nMin > nValue ) - return( ERR_RSCRANGE_OUTDEFSET ); + return ERR_RSCRANGE_OUTDEFSET; *(RscId *)rInst.pData = RscId( nValue ); - ((RscId *)rInst.pData)->aExp.cUnused = sal_False; - return( ERR_OK ); + ((RscId *)rInst.pData)->aExp.cUnused = false; + return ERR_OK; } -ERRTYPE RscIdRange::GetNumber( const RSCINST & rInst, sal_Int32 * plValue ){ +ERRTYPE RscIdRange::GetNumber( const RSCINST & rInst, sal_Int32 * plValue ) +{ *plValue = ((RscId *)rInst.pData)->GetNumber(); - return( ERR_OK ); + return ERR_OK; } -ERRTYPE RscIdRange::SetRef( const RSCINST & rInst, const RscId & rRscId ){ +ERRTYPE RscIdRange::SetRef( const RSCINST & rInst, const RscId & rRscId ) +{ ERRTYPE aError; - if( rRscId.IsId() ){ + if( rRscId.IsId() ) + { aError = SetNumber( rInst, rRscId ); - if( aError.IsOk() ){ + if( aError.IsOk() ) + { *(RscId *)rInst.pData = rRscId; - ((RscId *)rInst.pData)->aExp.cUnused = sal_False; + ((RscId *)rInst.pData)->aExp.cUnused = false; } } else aError = ERR_RSCRANGE_OUTDEFSET; - return( aError ); + return aError; } -ERRTYPE RscIdRange::GetRef( const RSCINST & rInst, RscId * pRscId ){ +ERRTYPE RscIdRange::GetRef( const RSCINST & rInst, RscId * pRscId ) +{ *pRscId = *(RscId *)rInst.pData; - return( ERR_OK ); + return ERR_OK; } void RscIdRange::WriteSrc( const RSCINST & rInst, FILE * fOutput, @@ -362,27 +379,25 @@ void RscIdRange::WriteSrc( const RSCINST & rInst, FILE * fOutput, } ERRTYPE RscIdRange::WriteRc( const RSCINST & rInst, RscWriteRc & aMem, - RscTypCont *, sal_uInt32, sal_Bool ) + RscTypCont *, sal_uInt32, bool ) { sal_Int32 lVal = ((RscId*)rInst.pData)->GetNumber(); aMem.Put( (sal_Int32)lVal ); - return( ERR_OK ); + return ERR_OK; } -sal_Bool RscIdRange::IsConsistent( const RSCINST & rInst ) +bool RscIdRange::IsConsistent( const RSCINST & rInst ) { long nValue = ((RscId *)rInst.pData)->GetNumber(); - if( (nMax >= nValue) && (nMin <= nValue) ) - return sal_True; - else { - return sal_False; - } + + return (nMax >= nValue) && (nMin <= nValue); + } RscBool::RscBool( Atom nId, sal_uInt32 nTypeId ) - : RscRange( nId, nTypeId ) + : RscRange( nId, nTypeId ) { RscRange::SetRange( 0, 1 ); } @@ -405,20 +420,21 @@ void RscBool::WriteSrc( const RSCINST & rInst, FILE * fOutput, } RscBreakRange :: RscBreakRange( Atom nId, sal_uInt32 nTypeId ) - : RscRange( nId, nTypeId ) + : RscRange( nId, nTypeId ) { nOutRange = 0xFFFFFFFF; } -ERRTYPE RscBreakRange::SetNumber( const RSCINST & rInst, sal_Int32 nValue ){ +ERRTYPE RscBreakRange::SetNumber( const RSCINST & rInst, sal_Int32 nValue ) +{ if( nValue == nOutRange ) - return( ERR_RSCRANGE_OUTDEFSET ); + return ERR_RSCRANGE_OUTDEFSET; else - return( RscRange::SetNumber( rInst, nValue ) ); + return RscRange::SetNumber( rInst, nValue ); } RSCINST RscBreakRange::Create( RSCINST * pInst, const RSCINST & rDflt, - sal_Bool bOwnClass ) + bool bOwnClass ) { RSCINST aInst; sal_Int32 l; @@ -429,7 +445,7 @@ RSCINST RscBreakRange::Create( RSCINST * pInst, const RSCINST & rDflt, if( l == nOutRange ) ((RscRangeInst *)aInst.pData)->nValue++; - return( aInst ); + return aInst; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/res/rscstr.cxx b/rsc/source/res/rscstr.cxx index 79cf3605b502..e4aacca22b48 100644 --- a/rsc/source/res/rscstr.cxx +++ b/rsc/source/res/rscstr.cxx @@ -29,7 +29,7 @@ #include <rtl/textenc.h> RscString::RscString( Atom nId, sal_uInt32 nTypeId ) - : RscTop( nId, nTypeId ) + : RscTop( nId, nTypeId ) { nSize = ALIGNED_SIZE( sizeof( RscStringInst ) ); pRefClass = NULL; @@ -40,20 +40,24 @@ RSCCLASS_TYPE RscString::GetClassType() const return RSCCLASS_STRING; } -ERRTYPE RscString::SetString( const RSCINST & rInst, const char * pStr ){ +ERRTYPE RscString::SetString( const RSCINST & rInst, const char * pStr ) +{ char * pTmp; ERRTYPE aError; - if( aError.IsOk() ){ - ((RscStringInst *)rInst.pData)->bDflt = sal_False; + if( aError.IsOk() ) + { + ((RscStringInst *)rInst.pData)->bDflt = false; pTmp = ((RscStringInst *)rInst.pData)->pStr; - if( pTmp ){ + if( pTmp ) + { rtl_freeMemory( pTmp ); pTmp = NULL; } - if( pStr ){ + if( pStr ) + { sal_uInt32 nLen = strlen( pStr ) +1; pTmp = (char *)rtl_allocateMemory( nLen ); memcpy( pTmp, pStr, nLen ); @@ -62,23 +66,27 @@ ERRTYPE RscString::SetString( const RSCINST & rInst, const char * pStr ){ ((RscStringInst *)rInst.pData)->pStr = pTmp; } - return( aError ); + return aError; } -ERRTYPE RscString::GetString( const RSCINST & rInst, char ** ppStr ){ +ERRTYPE RscString::GetString( const RSCINST & rInst, char ** ppStr ) +{ *ppStr = ((RscStringInst *)rInst.pData)->pStr; - return( ERR_OK ); + return ERR_OK; } -ERRTYPE RscString::GetRef( const RSCINST & rInst, RscId * pRscId ){ +ERRTYPE RscString::GetRef( const RSCINST & rInst, RscId * pRscId ) +{ *pRscId = ((RscStringInst *)rInst.pData)->aRefId; - return( ERR_OK ); + return ERR_OK; } -ERRTYPE RscString::SetRef( const RSCINST & rInst, const RscId & rRefId ){ - if( pRefClass ){ +ERRTYPE RscString::SetRef( const RSCINST & rInst, const RscId & rRefId ) +{ + if( pRefClass ) + { ((RscStringInst *)rInst.pData)->aRefId = rRefId; - ((RscStringInst *)rInst.pData)->bDflt = sal_False; + ((RscStringInst *)rInst.pData)->bDflt = false; } else return( ERR_REFNOTALLOWED ); @@ -87,82 +95,92 @@ ERRTYPE RscString::SetRef( const RSCINST & rInst, const RscId & rRefId ){ } RSCINST RscString::Create( RSCINST * pInst, const RSCINST & rDflt, - sal_Bool bOwnClass ) + bool bOwnClass ) { RSCINST aInst; - if( !pInst ){ + if( !pInst ) + { aInst.pClass = this; aInst.pData = (CLASS_DATA) rtl_allocateMemory( sizeof( RscStringInst ) ); } else aInst = *pInst; + if( !bOwnClass && rDflt.IsInst() ) bOwnClass = rDflt.pClass->InHierarchy( this ); ((RscStringInst *)aInst.pData)->aRefId.Create(); ((RscStringInst *)aInst.pData)->pStr = NULL; - ((RscStringInst *)aInst.pData)->bDflt = sal_True; + ((RscStringInst *)aInst.pData)->bDflt = true; - if( bOwnClass ){ + if( bOwnClass ) + { ((RscStringInst *)aInst.pData)->aRefId = - ((RscStringInst *)rDflt.pData)->aRefId; + ((RscStringInst *)rDflt.pData)->aRefId; SetString( aInst, ((RscStringInst *)rDflt.pData)->pStr ); ((RscStringInst *)aInst.pData)->bDflt = - ((RscStringInst *)rDflt.pData)->bDflt ; + ((RscStringInst *)rDflt.pData)->bDflt ; } - return( aInst ); + return aInst; } -void RscString::Destroy( const RSCINST & rInst ){ +void RscString::Destroy( const RSCINST & rInst ) +{ if( ((RscStringInst *)rInst.pData)->pStr ) rtl_freeMemory( ((RscStringInst *)rInst.pData)->pStr ); ((RscStringInst *)rInst.pData)->aRefId.Destroy(); } -sal_Bool RscString::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ){ +bool RscString::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) +{ RscStringInst * pData = (RscStringInst*)rInst.pData; RscStringInst * pDefData = (RscStringInst*)pDef; - if( pDef ){ + if( pDef ) + { if( pData->aRefId.IsId() || pDefData->aRefId.IsId() ) { - if( pData->aRefId.aExp.IsNumber() - && pDefData->aRefId.aExp.IsNumber() ) + if( pData->aRefId.aExp.IsNumber() && + pDefData->aRefId.aExp.IsNumber() ) { // Sind die Referenzidentifier gleich if( pData->aRefId.GetNumber() == pDefData->aRefId.GetNumber() ) { - return sal_True; + return true; } } } - else { - sal_Bool bStrEmpty = sal_False; - sal_Bool bDefStrEmpty = sal_False; + else + { + bool bStrEmpty = false; + bool bDefStrEmpty = false; - if( pData->pStr ){ + if( pData->pStr ) + { bStrEmpty = ('\0' == *pData->pStr); } else - bStrEmpty = sal_True; + bStrEmpty = true; - if( pDefData->pStr ){ + if( pDefData->pStr ) + { bDefStrEmpty = ('\0' == *pDefData->pStr); } else - bDefStrEmpty = sal_True; + bDefStrEmpty = true; - if( !bStrEmpty || !bDefStrEmpty ){ - return sal_False; + if( !bStrEmpty || !bDefStrEmpty ) + { + return false; } - return sal_True; + return true; } } - return sal_False; + return false; } void RscString::WriteSrc( const RSCINST & rInst, FILE * fOutput, @@ -181,11 +199,12 @@ void RscString::WriteSrc( const RSCINST & rInst, FILE * fOutput, sal_uInt32 n = 0; sal_uInt32 nPos, nSlashPos; - do { + do + { fputc( '\"', fOutput ); nSlashPos = nPos = 0; - while( pStrI->pStr[ n ] - && (nPos < 72 || nPos - nSlashPos <= 3) ) + + while( pStrI->pStr[ n ] && (nPos < 72 || nPos - nSlashPos <= 3) ) { // nach \ mindesten 3 Zeichen wegeb \xa7 fputc( pStrI->pStr[ n ], fOutput ); if( pStrI->pStr[ n ] == '\\' ) @@ -196,8 +215,11 @@ void RscString::WriteSrc( const RSCINST & rInst, FILE * fOutput, fputc( '\"', fOutput ); if( pStrI->pStr[ n ] ) //nocht nicht zu ende + { fputc( '\n', fOutput ); - } while( pStrI->pStr[ n ] ); + } + } + while( pStrI->pStr[ n ] ); } else fprintf( fOutput, "\"\"" ); @@ -205,19 +227,21 @@ void RscString::WriteSrc( const RSCINST & rInst, FILE * fOutput, } ERRTYPE RscString::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, - RscTypCont * pTC, sal_uInt32 nDeep, sal_Bool bExtra ) + RscTypCont * pTC, sal_uInt32 nDeep, bool bExtra ) { ERRTYPE aError; ObjNode * pObjNode = NULL; - if( ((RscStringInst *)rInst.pData)->aRefId.IsId() ){ + if( ((RscStringInst *)rInst.pData)->aRefId.IsId() ) + { RscId aId( ((RscStringInst *)rInst.pData)->aRefId ); RSCINST aTmpI; aTmpI.pClass = pRefClass; - while( aError.IsOk() && aId.IsId() ){ + while( aError.IsOk() && aId.IsId() ) + { //Erhoehen und abfragen um Endlosrekusion zu vermeiden nDeep++; if( nDeep > nRefDeep ) @@ -269,7 +293,7 @@ ERRTYPE RscString::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, rMem.PutUTF8( ((RscStringInst *)rInst.pData)->pStr ); }; }; - return( aError ); + return aError; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/res/rsctop.cxx b/rsc/source/res/rsctop.cxx index e8ac3fc8b5df..7c4d80cda8d7 100644 --- a/rsc/source/res/rsctop.cxx +++ b/rsc/source/res/rsctop.cxx @@ -50,15 +50,18 @@ RSCINST RscTop::GetDefault() return aDfltInst; } -void RscTop :: Pre_dtor(){ - if( aDfltInst.IsInst() ){ +void RscTop :: Pre_dtor() +{ + if( aDfltInst.IsInst() ) + { aDfltInst.pClass->Destroy( aDfltInst ); rtl_freeMemory( aDfltInst.pData ); aDfltInst = RSCINST(); }; } -Atom RscTop :: GetConstant( sal_uInt32 ){ +Atom RscTop :: GetConstant( sal_uInt32 ) +{ return InvalidAtom; } @@ -78,19 +81,21 @@ sal_uInt32 RscTop :: Size() return 0; } -ERRTYPE RscTop :: GetRef( const RSCINST & rInst, RscId * pRscId ){ +ERRTYPE RscTop :: GetRef( const RSCINST & rInst, RscId * pRscId ) +{ if( pSuperClass ) return pSuperClass->GetRef( rInst, pRscId ); else return ERR_UNKNOWN_METHOD; } -sal_Bool RscTop::InHierarchy( RscTop * pClass ){ +bool RscTop::InHierarchy( RscTop * pClass ) +{ if( this == pClass ) - return( sal_True ); + return true; if( pSuperClass ) - return( pSuperClass->InHierarchy( pClass ) ); - return( sal_False ); + return pSuperClass->InHierarchy( pClass ); + return false; } ERRTYPE RscTop::SetVariable( Atom nVarName, RscTop * pClass, @@ -98,9 +103,8 @@ ERRTYPE RscTop::SetVariable( Atom nVarName, RscTop * pClass, Atom nDataBaseName ) { if( pSuperClass ) - return pSuperClass-> - SetVariable( nVarName, pClass, pDflt, - nVarType, nMask, nDataBaseName ); + return pSuperClass->SetVariable( nVarName, pClass, pDflt, + nVarType, nMask, nDataBaseName ); else return ERR_UNKNOWN_METHOD; } @@ -111,18 +115,14 @@ void RscTop::EnumVariables( void * pData, VarEnumCallbackProc pProc ) pSuperClass->EnumVariables( pData, pProc ); } -RSCINST RscTop::GetVariable -( - const RSCINST & rInst, - Atom nVarName, - const RSCINST & rInitInst, - sal_Bool bInitDflt, - RscTop * pCreateClass -) +RSCINST RscTop::GetVariable( const RSCINST & rInst, + Atom nVarName, + const RSCINST & rInitInst, + bool bInitDflt, + RscTop * pCreateClass) { if( pSuperClass ) - return pSuperClass-> - GetVariable( rInst, nVarName, rInitInst, bInitDflt, pCreateClass ); + return pSuperClass->GetVariable( rInst, nVarName, rInitInst, bInitDflt, pCreateClass ); else return RSCINST(); } @@ -130,8 +130,7 @@ RSCINST RscTop::GetVariable RSCINST RscTop::GetCopyVar( const RSCINST & rInst, Atom nVarName ) { if( pSuperClass ) - return pSuperClass-> - GetCopyVar( rInst, nVarName ); + return pSuperClass->GetCopyVar( rInst, nVarName ); else return RSCINST(); } @@ -150,21 +149,17 @@ ERRTYPE RscTop::GetElement( const RSCINST & rInst, const RscId & rEleName, RSCINST * pGetInst ) { if( pSuperClass ) - return pSuperClass-> - GetElement( rInst, rEleName, - pCreateClass, rCreateInst, - pGetInst ); + return pSuperClass-> GetElement( rInst, rEleName, + pCreateClass, rCreateInst, + pGetInst ); else return ERR_UNKNOWN_METHOD; } -ERRTYPE RscTop::GetArrayEle -( - const RSCINST & rInst, - Atom nId, - RscTop * pCreateClass, - RSCINST * pGetInst -) +ERRTYPE RscTop::GetArrayEle( const RSCINST & rInst, + Atom nId, + RscTop * pCreateClass, + RSCINST * pGetInst) { if( pSuperClass ) return pSuperClass->GetArrayEle( rInst, nId, pCreateClass, pGetInst ); @@ -172,13 +167,10 @@ ERRTYPE RscTop::GetArrayEle return ERR_UNKNOWN_METHOD; } -ERRTYPE RscTop::GetValueEle -( - const RSCINST & rInst, - sal_Int32 lValue, - RscTop * pCreateClass, - RSCINST * pGetInst -) +ERRTYPE RscTop::GetValueEle( const RSCINST & rInst, + sal_Int32 lValue, + RscTop * pCreateClass, + RSCINST * pGetInst) { if( pSuperClass ) return pSuperClass->GetValueEle( rInst, lValue, pCreateClass, pGetInst ); @@ -187,29 +179,27 @@ ERRTYPE RscTop::GetValueEle } RSCINST RscTop::SearchEle( const RSCINST & rInst, const RscId & rEleName, - RscTop * pClass ) + RscTop * pClass ) { if( pSuperClass ) - return pSuperClass-> - SearchEle( rInst, rEleName, pClass ); + return pSuperClass->SearchEle( rInst, rEleName, pClass ); else return RSCINST(); } -RSCINST RscTop::GetPosEle( const RSCINST & rInst, sal_uInt32 nPos ){ +RSCINST RscTop::GetPosEle( const RSCINST & rInst, sal_uInt32 nPos ) +{ if( pSuperClass ) - return pSuperClass-> - GetPosEle( rInst, nPos ); + return pSuperClass->GetPosEle( rInst, nPos ); else return RSCINST(); } ERRTYPE RscTop::MovePosEle( const RSCINST & rInst, sal_uInt32 nDestPos, - sal_uInt32 nSourcePos ) + sal_uInt32 nSourcePos ) { if( pSuperClass ) - return pSuperClass-> - MovePosEle( rInst, nDestPos, nSourcePos ); + return pSuperClass->MovePosEle( rInst, nDestPos, nSourcePos ); else return ERR_UNKNOWN_METHOD; } @@ -218,39 +208,39 @@ ERRTYPE RscTop::SetPosRscId( const RSCINST & rInst, sal_uInt32 nPos, const RscId & rRscId ) { if( pSuperClass ) - return pSuperClass-> - SetPosRscId( rInst, nPos, rRscId ); + return pSuperClass->SetPosRscId( rInst, nPos, rRscId ); else return ERR_UNKNOWN_METHOD; } -SUBINFO_STRUCT RscTop::GetInfoEle( const RSCINST & rInst, sal_uInt32 nPos ){ +SUBINFO_STRUCT RscTop::GetInfoEle( const RSCINST & rInst, sal_uInt32 nPos ) +{ if( pSuperClass ) - return pSuperClass-> - GetInfoEle( rInst, nPos ); + return pSuperClass->GetInfoEle( rInst, nPos ); else return SUBINFO_STRUCT(); } -sal_uInt32 RscTop::GetCount( const RSCINST & rInst ){ +sal_uInt32 RscTop::GetCount( const RSCINST & rInst ) +{ if( pSuperClass ) return pSuperClass->GetCount( rInst ); else return 0; } -ERRTYPE RscTop::SetNumber( const RSCINST & rInst, sal_Int32 lValue ){ +ERRTYPE RscTop::SetNumber( const RSCINST & rInst, sal_Int32 lValue ) +{ if( pSuperClass ) - return pSuperClass-> - SetNumber( rInst, lValue ); + return pSuperClass->SetNumber( rInst, lValue ); else return ERR_UNKNOWN_METHOD; } -ERRTYPE RscTop::SetBool( const RSCINST & rInst, sal_Bool bValue ){ +ERRTYPE RscTop::SetBool( const RSCINST & rInst, bool bValue ) +{ if( pSuperClass ) - return pSuperClass-> - SetBool( rInst, bValue ); + return pSuperClass->SetBool( rInst, bValue ); else return ERR_UNKNOWN_METHOD; } @@ -263,77 +253,78 @@ ERRTYPE RscTop::SetConst( const RSCINST & rInst, Atom nId, sal_Int32 nVal ) return ERR_UNKNOWN_METHOD; } -ERRTYPE RscTop::SetNotConst( const RSCINST & rInst, Atom nId ){ +ERRTYPE RscTop::SetNotConst( const RSCINST & rInst, Atom nId ) +{ if( pSuperClass ) - return pSuperClass-> - SetNotConst( rInst, nId ); + return pSuperClass->SetNotConst( rInst, nId ); else return ERR_UNKNOWN_METHOD; } -ERRTYPE RscTop::SetString( const RSCINST & rInst, const char * pStr ){ +ERRTYPE RscTop::SetString( const RSCINST & rInst, const char * pStr ) +{ if( pSuperClass ) - return pSuperClass-> - SetString( rInst, pStr ); + return pSuperClass->SetString( rInst, pStr ); else return ERR_UNKNOWN_METHOD; } -ERRTYPE RscTop::GetNumber( const RSCINST & rInst, sal_Int32 * pN ){ +ERRTYPE RscTop::GetNumber( const RSCINST & rInst, sal_Int32 * pN ) +{ if( pSuperClass ) - return pSuperClass-> - GetNumber( rInst, pN ); + return pSuperClass->GetNumber( rInst, pN ); else return ERR_UNKNOWN_METHOD; } -ERRTYPE RscTop::GetBool( const RSCINST & rInst, sal_Bool * pB ){ - if( pSuperClass ) - return pSuperClass-> - GetBool( rInst, pB ); +ERRTYPE RscTop::GetBool( const RSCINST & rInst, bool * pB ) +{ + if( pSuperClass ) + return pSuperClass->GetBool( rInst, pB ); else return ERR_UNKNOWN_METHOD; } -ERRTYPE RscTop::GetConst( const RSCINST & rInst, Atom * pH ){ +ERRTYPE RscTop::GetConst( const RSCINST & rInst, Atom * pH ) +{ if( pSuperClass ) - return pSuperClass-> - GetConst( rInst, pH ); + return pSuperClass->GetConst( rInst, pH ); else return ERR_UNKNOWN_METHOD; } -ERRTYPE RscTop::GetString( const RSCINST & rInst, char ** ppStr ){ +ERRTYPE RscTop::GetString( const RSCINST & rInst, char ** ppStr ) +{ if( pSuperClass ) - return pSuperClass-> - GetString( rInst, ppStr ); + return pSuperClass->GetString( rInst, ppStr ); else return ERR_UNKNOWN_METHOD; } -RSCINST RscTop::Create( RSCINST * pInst, const RSCINST & rDefInst, sal_Bool bOwnRange ) +RSCINST RscTop::Create( RSCINST * pInst, const RSCINST & rDefInst, bool bOwnRange ) { if( pSuperClass ) - return pSuperClass-> - Create( pInst, rDefInst, bOwnRange ); - else{ + return pSuperClass->Create( pInst, rDefInst, bOwnRange ); + else + { if( pInst ) return *pInst; return RSCINST(); } } -void RscTop::Destroy( const RSCINST & rInst ){ +void RscTop::Destroy( const RSCINST & rInst ) +{ if( pSuperClass ) pSuperClass->Destroy( rInst ); } -sal_Bool RscTop::IsConsistent( const RSCINST & rInst ) +bool RscTop::IsConsistent( const RSCINST & rInst ) { if( pSuperClass ) return pSuperClass->IsConsistent( rInst ); else - return sal_True; + return true; } void RscTop::SetToDefault( const RSCINST & rInst ) @@ -342,35 +333,38 @@ void RscTop::SetToDefault( const RSCINST & rInst ) pSuperClass->SetToDefault( rInst ); } -sal_Bool RscTop::IsDefault( const RSCINST & rInst ){ +bool RscTop::IsDefault( const RSCINST & rInst ) +{ if( pSuperClass ) return pSuperClass->IsDefault( rInst ); else - return sal_True; + return true; } -sal_Bool RscTop::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ){ +bool RscTop::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) +{ if( pSuperClass ) return pSuperClass->IsValueDefault( rInst, pDef ); else - return sal_True; + return true; } -void RscTop::SetDefault( const RSCINST & rInst, Atom nVarId ){ +void RscTop::SetDefault( const RSCINST & rInst, Atom nVarId ) +{ if( pSuperClass ) pSuperClass->SetDefault( rInst, nVarId ); } -RSCINST RscTop::GetDefault( Atom nVarId ){ +RSCINST RscTop::GetDefault( Atom nVarId ) +{ if( pSuperClass ) - return pSuperClass-> - GetDefault( nVarId ); + return pSuperClass->GetDefault( nVarId ); else return RSCINST(); } void RscTop::Delete( const RSCINST & rInst, RscTop * pClass, - const RscId & rId ) + const RscId & rId ) { if( pSuperClass ) pSuperClass->Delete( rInst, pClass, rId ); @@ -382,7 +376,8 @@ void RscTop::DeletePos( const RSCINST & rInst, sal_uInt32 nPos ) pSuperClass->DeletePos( rInst, nPos ); } -ERRTYPE RscTop::SetRef( const RSCINST & rInst, const RscId & rRefId ){ +ERRTYPE RscTop::SetRef( const RSCINST & rInst, const RscId & rRefId ) +{ if( pSuperClass ) return pSuperClass->SetRef( rInst, rRefId ); else @@ -408,23 +403,21 @@ void RscTop::WriteSrc( const RSCINST & rInst, FILE * fOutput, ERRTYPE RscTop::WriteRcHeader( const RSCINST & rInst, RscWriteRc & rMem, RscTypCont * pTC, const RscId & rId, - sal_uInt32 nDeep, sal_Bool bExtra ) + sal_uInt32 nDeep, bool bExtra ) { if( pSuperClass ) - return( pSuperClass-> - WriteRcHeader( rInst, rMem, pTC, rId, nDeep, bExtra ) ); + return pSuperClass->WriteRcHeader( rInst, rMem, pTC, rId, nDeep, bExtra ); else - return( rInst.pClass->WriteRc( rInst, rMem, pTC, nDeep, bExtra ) ); + return rInst.pClass->WriteRc( rInst, rMem, pTC, nDeep, bExtra ); } ERRTYPE RscTop::WriteRc( const RSCINST & rInst, RscWriteRc & rMem, - RscTypCont * pTC, sal_uInt32 nDeep, sal_Bool bExtra ) + RscTypCont * pTC, sal_uInt32 nDeep, bool bExtra ) { if( pSuperClass ) - return( pSuperClass-> - WriteRc( rInst, rMem, pTC, nDeep, bExtra ) ); + return pSuperClass->WriteRc( rInst, rMem, pTC, nDeep, bExtra ); else - return( ERR_OK ); + return ERR_OK; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/rsc/source/rsc/rsc.cxx b/rsc/source/rsc/rsc.cxx index aa7a54a251f0..c88de8d1d853 100644 --- a/rsc/source/rsc/rsc.cxx +++ b/rsc/source/rsc/rsc.cxx @@ -83,7 +83,7 @@ RscCmdLine::RscCmdLine( int argc, char ** argv, RscError * pEH ) char ** ppStr; RscPtrPtr aCmdLine; sal_uInt32 i; - sal_Bool bOutputSrsIsSet = sal_False; + bool bOutputSrsIsSet = false; Init(); @@ -187,7 +187,7 @@ RscCmdLine::RscCmdLine( int argc, char ** argv, RscError * pEH ) else if( !rsc_strnicmp( (*ppStr) + 1, "fp=", 3 ) ) { // define name of .srs file aOutputSrs = (*ppStr) + 4; - bOutputSrsIsSet = sal_True; + bOutputSrsIsSet = true; } else if( !rsc_strnicmp( (*ppStr) + 1, "oil=", 4 ) ) { @@ -273,6 +273,7 @@ OString RscCmdLine::substitutePaths( const OString& rIn ) aRet.append( "%" ); nIndex = last_match->second.getLength(); } + if( rIn.match( "/", nIndex ) ) aRet.append( rIn.copy( nIndex ) ); else @@ -360,7 +361,7 @@ ERRTYPE RscCompiler::Start() if( aError.IsError() ) pTC->pEH->Error( ERR_ERROR, NULL, RscId() ); - return( aError ); + return aError; } void RscCompiler::EndCompile() @@ -389,7 +390,7 @@ void RscCompiler::EndCompile() pFN = pTC->aFileTab.Get( aIndex ); if( !pFN->IsIncFile() ) { - pTC->WriteSrc( foutput, NOFILE_INDEX, sal_False ); + pTC->WriteSrc( foutput, NOFILE_INDEX, false ); break; // ?T 281091MM nur eine Src-Datei } }; @@ -424,7 +425,7 @@ ERRTYPE RscCompiler :: IncludeParser( sal_uLong lFileKey ) RscDepend * pDep; RscFileInst aFileInst( pTC, lFileKey, lFileKey, finput ); - pFName->bScanned = sal_True; + pFName->bScanned = true; ::IncludeParser( &aFileInst ); fclose( finput ); @@ -455,19 +456,19 @@ ERRTYPE RscCompiler :: ParseOneFile( sal_uLong lFileKey, const RscCmdLine::OutputFile* pOutputFile, const WriteRcContext* pContext ) { - FILE * finput = NULL; - ERRTYPE aError; - RscFile * pFName; + FILE * finput = NULL; + ERRTYPE aError; + RscFile * pFName; pFName = pTC->aFileTab.Get( lFileKey ); if( !pFName ) aError = ERR_ERROR; else if( !pFName->bLoaded ) { - RscDepend * pDep; + RscDepend * pDep; //Include-Dateien vorher lesen - pFName->bLoaded = sal_True; //Endlos Rekursion vermeiden + pFName->bLoaded = true; //Endlos Rekursion vermeiden for ( size_t i = 0; i < pFName->aDepLst.size() && aError.IsOk(); ++i ) { @@ -476,7 +477,7 @@ ERRTYPE RscCompiler :: ParseOneFile( sal_uLong lFileKey, } if( aError.IsError() ) - pFName->bLoaded = sal_False; //bei Fehler nicht geladenen + pFName->bLoaded = false; //bei Fehler nicht geladenen else { OUString aTmpPath; @@ -518,13 +519,14 @@ ERRTYPE RscCompiler :: ParseOneFile( sal_uLong lFileKey, }; }; - return( aError ); + return aError; } namespace { using namespace ::osl; class RscIoError { }; + static inline OUString lcl_getAbsoluteUrl(const OUString& i_sBaseUrl, const OString& i_sPath) { OUString sRelUrl, sAbsUrl; @@ -534,6 +536,7 @@ namespace throw RscIoError(); return sAbsUrl; }; + static inline OString lcl_getSystemPath(const OUString& i_sUrl) { OUString sSys; @@ -542,6 +545,7 @@ namespace OSL_TRACE("temporary file: %s", OUStringToOString(sSys, RTL_TEXTENCODING_UTF8).getStr()); return OUStringToOString(sSys, RTL_TEXTENCODING_MS_1252); }; + static inline OString lcl_getTempFile(OUString& sTempDirUrl) { // get a temp file name for the rc file @@ -575,7 +579,7 @@ ERRTYPE RscCompiler::Link() { pTC->Delete( aIndex ); aIndex = pTC->aFileTab.GetIndexOf( pFName ); - pFName->bLoaded = sal_False; + pFName->bLoaded = false; } } @@ -732,7 +736,7 @@ ERRTYPE RscCompiler::Link() }; } - return( aError ); + return aError; } void RscCompiler::Append( const OString& rOutputSrs, diff --git a/rsc/source/tools/rscdef.cxx b/rsc/source/tools/rscdef.cxx index d888a3e9b7ff..0c7903458c09 100644 --- a/rsc/source/tools/rscdef.cxx +++ b/rsc/source/tools/rscdef.cxx @@ -21,11 +21,15 @@ // Programmuebergreifende Includes. #include <rscdef.hxx> -sal_Bool RscId::bNames = sal_True; +bool RscId::bNames = true; -void RscId::SetNames( sal_Bool bSet ) { bNames = bSet; } +void RscId::SetNames( bool bSet ) +{ + bNames = bSet; +} -sal_Int32 RscId::GetNumber() const{ +sal_Int32 RscId::GetNumber() const +{ sal_Int32 lVal; aExp.Evaluate( &lVal ); return lVal; @@ -36,7 +40,8 @@ void RscId::Create( const RscExpType & rExpType ) aExp = rExpType; if( aExp.IsDefinition() ) aExp.aExp.pDef->IncRef(); - else if( aExp.IsExpression() ){ + else if( aExp.IsExpression() ) + { sal_Int32 lValue; aExp.Evaluate( &lValue ); @@ -44,19 +49,22 @@ void RscId::Create( const RscExpType & rExpType ) } } -void RscId::Destroy(){ +void RscId::Destroy() +{ if( aExp.IsDefinition() ) aExp.aExp.pDef->DecRef(); aExp.cType = RSCEXP_NOTHING; } -RscId::RscId( const RscId& rRscId ){ +RscId::RscId( const RscId& rRscId ) +{ aExp = rRscId.aExp; if( aExp.IsDefinition() ) aExp.aExp.pDef->IncRef(); } -RscId::RscId( RscDefine * pDef ){ +RscId::RscId( RscDefine * pDef ) +{ RscExpType aExpType; aExpType.aExp.pDef = pDef; @@ -64,7 +72,8 @@ RscId::RscId( RscDefine * pDef ){ Create( aExpType ); } -RscId& RscId::operator = ( const RscId& rRscId ){ +RscId& RscId::operator = ( const RscId& rRscId ) +{ if( rRscId.aExp.IsDefinition() ) rRscId.aExp.aExp.pDef->IncRef(); Destroy(); @@ -72,24 +81,24 @@ RscId& RscId::operator = ( const RscId& rRscId ){ return *this; } -sal_Bool RscId::operator == ( const RscId& rRscId ) const +bool RscId::operator == ( const RscId& rRscId ) const { - return( GetNumber() == rRscId.GetNumber() ); + return GetNumber() == rRscId.GetNumber(); } -sal_Bool RscId::operator < ( const RscId& rRscId ) const +bool RscId::operator < ( const RscId& rRscId ) const { - return( GetNumber() < rRscId.GetNumber() ); + return GetNumber() < rRscId.GetNumber(); } -sal_Bool RscId::operator > ( const RscId& rRscId ) const +bool RscId::operator > ( const RscId& rRscId ) const { - return( GetNumber() > rRscId.GetNumber() ); + return GetNumber() > rRscId.GetNumber(); } RscId::operator sal_Int32() const { - return( GetNumber() ); + return GetNumber(); } OString RscId::GetName() const @@ -126,16 +135,19 @@ RscDefine::RscDefine( sal_uLong lKey, const OString& rDefName, pExp = pExpression; } -RscDefine::~RscDefine(){ +RscDefine::~RscDefine() +{ if( pExp ) delete pExp; if( nRefCount ) RscExit( 14 ); } -void RscDefine::DecRef(){ +void RscDefine::DecRef() +{ nRefCount--; - if( 0 == nRefCount ){ + if( 0 == nRefCount ) + { delete this; } } @@ -148,8 +160,9 @@ void RscDefine::DefineToNumber() SetName(OString::valueOf(lId)); } -sal_Bool RscDefine::Evaluate(){ - sal_Bool bRet = sal_True; +bool RscDefine::Evaluate() +{ + bool bRet = true; if( pExp ) bRet = !pExp->Evaluate( &lId ); @@ -157,7 +170,8 @@ sal_Bool RscDefine::Evaluate(){ return bRet; } -RscDefine * RscDefine::Search( const char * pStr ){ +RscDefine * RscDefine::Search( const char * pStr ) +{ return (RscDefine *)StringNode::Search( pStr ); } @@ -180,7 +194,9 @@ RscDefine * RscDefineList::New( sal_uLong lFileKey, const OString& rDefName, RscSubDefList::iterator it = maList.begin(); ::std::advance( it, lPos ); maList.insert( it, pDef ); - } else { + } + else + { maList.push_back( pDef ); } return pDef; @@ -198,25 +214,29 @@ RscDefine * RscDefineList::New( sal_uLong lFileKey, const OString& rDefName, RscSubDefList::iterator it = maList.begin(); ::std::advance( it, lPos ); maList.insert( it, pDef ); - } else { + } + else + { maList.push_back( pDef ); } return pDef; } -sal_Bool RscDefineList::Remove() { +bool RscDefineList::Remove() +{ if ( maList.empty() ) - return sal_False; + return false; maList[ 0 ]->DefineToNumber(); maList[ 0 ]->DecRef(); maList.erase( maList.begin() ); - return sal_True; + return true; } void RscDefineList::WriteAll( FILE * fOutput ) { - for ( size_t i = 0, n = maList.size(); i < n; ++i ) { + for ( size_t i = 0, n = maList.size(); i < n; ++i ) + { RscDefine* pDefEle = maList[ i ]; fprintf( fOutput, "#define %s %s\n", pDefEle->GetName().getStr(), @@ -225,20 +245,22 @@ void RscDefineList::WriteAll( FILE * fOutput ) }; } -sal_Bool RscExpType::Evaluate( sal_Int32 * plValue ) const{ - if( IsDefinition() ){ +bool RscExpType::Evaluate( sal_Int32 * plValue ) const +{ + if( IsDefinition() ) + { aExp.pDef->Evaluate(); // Eventuellen Fehler ignorieren *plValue = aExp.pDef->GetNumber(); } else if( IsExpression() ) - return( aExp.pExp->Evaluate( plValue ) ); + return aExp.pExp->Evaluate( plValue ); else if( IsNothing() ) *plValue = 0; else *plValue = GetLong(); - return sal_True; + return true; } void RscExpType::AppendMacro(OStringBuffer& rStr) const @@ -263,7 +285,8 @@ RscExpression::RscExpression( RscExpType aLE, char cOp, RscExpType aRE ) aRightExp.aExp.pDef->IncRef(); } -RscExpression::~RscExpression(){ +RscExpression::~RscExpression() +{ if( aLeftExp.IsDefinition() ) aLeftExp.aExp.pDef->DecRef(); else if( aLeftExp.IsExpression() ) @@ -275,12 +298,14 @@ RscExpression::~RscExpression(){ delete aRightExp.aExp.pExp; } -sal_Bool RscExpression::Evaluate( sal_Int32 * plValue ){ +bool RscExpression::Evaluate( sal_Int32 * plValue ) +{ sal_Int32 lLeft; sal_Int32 lRight; // linken und rechten Zweig auswerten - if( aLeftExp.Evaluate( &lLeft ) && aRightExp.Evaluate( &lRight ) ){ + if( aLeftExp.Evaluate( &lLeft ) && aRightExp.Evaluate( &lRight ) ) + { if( cOperation == '&' ) *plValue = lLeft & lRight; else if( cOperation == '|' ) @@ -295,14 +320,15 @@ sal_Bool RscExpression::Evaluate( sal_Int32 * plValue ){ *plValue = lLeft >> lRight; else if( cOperation == 'l' ) *plValue = lLeft << lRight; - else{ + else + { if( 0L == lRight ) - return sal_False; + return false; *plValue = lLeft / lRight; }; - return sal_True; + return true; } - return sal_False; + return false; } OString RscExpression::GetMacro() @@ -319,11 +345,14 @@ OString RscExpression::GetMacro() } aRightExp.AppendMacro(aLeft); if( '-' == cOperation ) + { aLeft.append(')'); + } } else if( aRightExp.IsNothing() ) aLeftExp.AppendMacro(aLeft); - else{ + else + { aLeft.append('('); // linken Zweig auswerten aLeftExp.AppendMacro(aLeft); @@ -341,14 +370,16 @@ OString RscExpression::GetMacro() return aLeft.makeStringAndClear(); } -RscFile :: RscFile(){ - bLoaded = sal_False; - bIncFile = sal_False; - bDirty = sal_False; - bScanned = sal_False; +RscFile :: RscFile() +{ + bLoaded = false; + bIncFile = false; + bDirty = false; + bScanned = false; } -RscFile :: ~RscFile() { +RscFile :: ~RscFile() +{ for ( size_t i = 0, n = aDepLst.size(); i < n; ++i ) delete aDepLst[ i ]; aDepLst.clear(); @@ -358,67 +389,76 @@ RscFile :: ~RscFile() { while( aDefLst.Remove() ) ; } -sal_Bool RscFile::Depend( sal_uLong lDepend, sal_uLong lFree ){ +bool RscFile::Depend( sal_uLong lDepend, sal_uLong lFree ) +{ RscDepend * pDep; for ( size_t i = aDepLst.size(); i > 0; ) { pDep = aDepLst[ --i ]; - if( pDep->GetFileKey() == lDepend ) { + if( pDep->GetFileKey() == lDepend ) + { for ( size_t j = i ? --i : 0; j > 0; ) { pDep = aDepLst[ --j ]; if( pDep->GetFileKey() == lFree ) - return sal_True; + return true; } - return sal_False; + return false; } } - return sal_True; + return true; } -sal_Bool RscFile :: InsertDependFile( sal_uLong lIncFile, size_t lPos ) +bool RscFile :: InsertDependFile( sal_uLong lIncFile, size_t lPos ) { for ( size_t i = 0, n = aDepLst.size(); i < n; ++i ) { RscDepend* pDep = aDepLst[ i ]; if( pDep->GetFileKey() == lIncFile ) - return sal_True; + return true; } // Current-Zeiger steht auf letztem Element - if( lPos >= aDepLst.size() ) { //letztes Element muss immer letztes bleiben + if( lPos >= aDepLst.size() ) + { //letztes Element muss immer letztes bleiben // Abhaengigkeit vor der letzten Position eintragen aDepLst.push_back( new RscDepend( lIncFile ) ); } - else { + else + { RscDependList::iterator it = aDepLst.begin(); ::std::advance( it, lPos ); aDepLst.insert( it, new RscDepend( lIncFile ) ); } - return sal_True; + return true; } -RscDefTree::~RscDefTree(){ +RscDefTree::~RscDefTree() +{ Remove(); } -void RscDefTree::Remove(){ +void RscDefTree::Remove() +{ RscDefine * pDef; - while( pDefRoot ){ + while( pDefRoot ) + { pDef = pDefRoot; pDefRoot = (RscDefine *)pDefRoot->Remove( pDefRoot ); pDef->DecRef(); } } -RscDefine * RscDefTree::Search( const char * pName ){ +RscDefine * RscDefTree::Search( const char * pName ) +{ if( pDefRoot ) return pDefRoot->Search( pName ); return NULL; } -void RscDefTree::Insert( RscDefine * pDef ){ +void RscDefTree::Insert( RscDefine * pDef ) +{ if( pDefRoot ) pDefRoot->Insert( pDef ); else @@ -426,33 +466,40 @@ void RscDefTree::Insert( RscDefine * pDef ){ pDef->IncRef(); } -void RscDefTree::Remove( RscDefine * pDef ){ - if( pDefRoot ){ +void RscDefTree::Remove( RscDefine * pDef ) +{ + if( pDefRoot ) + { //falls pDef == pDefRoot pDefRoot = (RscDefine *)pDefRoot->Remove( pDef ); } pDef->DecRef(); } -sal_Bool RscDefTree::Evaluate( RscDefine * pDef ){ - if( pDef ){ +bool RscDefTree::Evaluate( RscDefine * pDef ) +{ + if( pDef ) + { if( !Evaluate( (RscDefine *)pDef->Left() ) ) - return sal_False; + return false; if( !Evaluate( (RscDefine *)pDef->Right() ) ) - return sal_False; + return false; }; - return sal_True; + return true; } -RscFileTab::RscFileTab(){ +RscFileTab::RscFileTab() +{ } -RscFileTab :: ~RscFileTab(){ +RscFileTab :: ~RscFileTab() +{ aDefTree.Remove(); sal_uIntPtr aIndex = LastIndex(); - while( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND ) { + while( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND ) + { delete Remove( aIndex ); aIndex = LastIndex(); }; @@ -470,67 +517,74 @@ sal_uLong RscFileTab :: Find( const OString& rName ) return NOFILE_INDEX; } -RscDefine * RscFileTab::FindDef( const char * pName ){ +RscDefine * RscFileTab::FindDef( const char * pName ) +{ return aDefTree.Search( pName ); } -/* This method gives back sal_True when lDepend +/* This method gives back true when lDepend exists and is behind lFree, or when lDepend does not exist. */ -sal_Bool RscFileTab::Depend( sal_uLong lDepend, sal_uLong lFree ){ +bool RscFileTab::Depend( sal_uLong lDepend, sal_uLong lFree ) +{ if( lDepend == lFree ) - return sal_True; + return true; sal_uIntPtr aIndex = FirstIndex(); - while( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND ){ + while( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND ) + { RscFile * pFile = Get(aIndex); - if( !pFile->IsIncFile() ){ + if( !pFile->IsIncFile() ) + { if( !pFile->Depend( lDepend, lFree ) ) - return sal_False; + return false; }; aIndex = NextIndex(aIndex); }; - return sal_True; + return true; } -sal_Bool RscFileTab::TestDef( sal_uLong lFileKey, size_t lPos, +bool RscFileTab::TestDef( sal_uLong lFileKey, size_t lPos, const RscDefine * pDefDec ) { - if( lFileKey == pDefDec->GetFileKey() ) { + if( lFileKey == pDefDec->GetFileKey() ) + { RscFile * pFile = GetFile( pDefDec->GetFileKey() ); if( pFile && (lPos <= pFile->aDefLst.GetPos( (RscDefine *)pDefDec )) - && (lPos != ULONG_MAX ) ) - return sal_False; + && (lPos != ULONG_MAX ) ) + { + return false; + } } else if( !Depend( lFileKey, pDefDec->GetFileKey() ) ) - return sal_False; + return false; return TestDef( lFileKey, lPos, pDefDec->pExp ); } -sal_Bool RscFileTab::TestDef( sal_uLong lFileKey, size_t lPos, +bool RscFileTab::TestDef( sal_uLong lFileKey, size_t lPos, const RscExpression * pExpDec ) { if( !pExpDec ) - return sal_True; + return true; if( pExpDec->aLeftExp.IsExpression() ) if( !TestDef( lFileKey, lPos, pExpDec->aLeftExp.aExp.pExp ) ) - return sal_False; + return false; if( pExpDec->aLeftExp.IsDefinition() ) if( !TestDef( lFileKey, lPos, pExpDec->aLeftExp.aExp.pDef ) ) - return sal_False; + return false; if( pExpDec->aRightExp.IsExpression() ) if( !TestDef( lFileKey, lPos, pExpDec->aRightExp.aExp.pExp ) ) - return sal_False; + return false; if( pExpDec->aRightExp.IsDefinition() ) if( !TestDef( lFileKey, lPos, pExpDec->aRightExp.aExp.pDef ) ) - return sal_False; + return false; - return sal_True; + return true; } RscDefine * RscFileTab::NewDef( sal_uLong lFileKey, const OString& rDefName, @@ -538,10 +592,12 @@ RscDefine * RscFileTab::NewDef( sal_uLong lFileKey, const OString& rDefName, { RscDefine * pDef = FindDef( rDefName ); - if( !pDef ){ + if( !pDef ) + { RscFile * pFile = GetFile( lFileKey ); - if( pFile ){ + if( pFile ) + { pDef = pFile->aDefLst.New( lFileKey, rDefName, lId, lPos ); aDefTree.Insert( pDef ); } @@ -549,7 +605,7 @@ RscDefine * RscFileTab::NewDef( sal_uLong lFileKey, const OString& rDefName, else pDef = NULL; - return( pDef ); + return pDef; } RscDefine * RscFileTab::NewDef( sal_uLong lFileKey, const OString& rDefName, @@ -557,12 +613,15 @@ RscDefine * RscFileTab::NewDef( sal_uLong lFileKey, const OString& rDefName, { RscDefine * pDef = FindDef( rDefName ); - if( !pDef ){ + if( !pDef ) + { //Macros in den Expressions sind definiert ? - if( TestDef( lFileKey, lPos, pExp ) ){ + if( TestDef( lFileKey, lPos, pExp ) ) + { RscFile * pFile = GetFile( lFileKey ); - if( pFile ){ + if( pFile ) + { pDef = pFile->aDefLst.New( lFileKey, rDefName, pExp, lPos ); aDefTree.Insert( pDef ); } @@ -571,25 +630,30 @@ RscDefine * RscFileTab::NewDef( sal_uLong lFileKey, const OString& rDefName, else pDef = NULL; - if( !pDef ){ + if( !pDef ) + { // pExp wird immer Eigentum und muss, wenn es nicht benoetigt wird // geloescht werden delete pExp; } - return( pDef ); + return pDef; } -void RscFileTab :: DeleteFileContext( sal_uLong lFileKey ){ +void RscFileTab :: DeleteFileContext( sal_uLong lFileKey ) +{ RscFile * pFName; pFName = GetFile( lFileKey ); - if( pFName ){ + if( pFName ) + { RscDefine * pDef; - for ( size_t i = 0, n = pFName->aDefLst.maList.size(); i < n; ++i ) { + for ( size_t i = 0, n = pFName->aDefLst.maList.size(); i < n; ++i ) + { pDef = pFName->aDefLst.maList[ i ]; aDefTree.Remove( pDef ); }; + while( pFName->aDefLst.Remove() ) ; } } @@ -609,7 +673,7 @@ sal_uLong RscFileTab :: NewCodeFile( const OString& rName ) } sal_uLong RscFileTab :: NewIncFile(const OString& rName, - const OString& rPath) + const OString& rPath) { sal_uLong lKey = Find( rName ); if( UNIQUEINDEX_ENTRY_NOTFOUND == lKey ) diff --git a/rsc/source/tools/rsctools.cxx b/rsc/source/tools/rsctools.cxx index b766ead5b62f..a6796991e96a 100644 --- a/rsc/source/tools/rsctools.cxx +++ b/rsc/source/tools/rsctools.cxx @@ -40,34 +40,35 @@ int rsc_strnicmp( const char *string1, const char *string2, size_t count ) for( i = 0; ( i < count ) && string1[ i ] && string2[ i ] ; i++ ) { if( tolower( string1[ i ] ) < tolower( string2[ i ] ) ) - return( -1 ); + return -1; else if( tolower( string1[ i ] ) > tolower( string2[ i ] ) ) - return( 1 ); + return 1; } if( i == count ) - return( 0 ); + return 0; else if( tolower( string1[ i ] ) < tolower( string2[ i ] ) ) - return( -1 ); + return -1; else if( tolower( string1[ i ] ) > tolower( string2[ i ] ) ) - return( 1 ); - return( 0 ); + return 1; + return 0; } /* case insensitive compare of two strings */ int rsc_stricmp( const char *string1, const char *string2 ){ int i; - for( i = 0; string1[ i ] && string2[ i ]; i++ ){ + for( i = 0; string1[ i ] && string2[ i ]; i++ ) + { if( tolower( string1[ i ] ) < tolower( string2[ i ] ) ) - return( -1 ); + return -1; else if( tolower( string1[ i ] ) > tolower( string2[ i ] ) ) - return( 1 ); + return 1; } if( tolower( string1[ i ] ) < tolower( string2[ i ] ) ) - return( -1 ); + return -1; else if( tolower( string1[ i ] ) > tolower( string2[ i ] ) ) - return( 1 ); - return( 0 ); + return 1; + return 0; } char* rsc_strdup( const char* pStr ) @@ -86,7 +87,7 @@ OString GetTmpFileName() return OUStringToOString( aTmpFile, RTL_TEXTENCODING_MS_1252 ); } -sal_Bool Append(FILE * fDest, const OString &rTmpFile) +bool Append(FILE * fDest, const OString &rTmpFile) { #define MAX_BUF 4096 FILE *fSource = fopen(rTmpFile.getStr(), "rb"); @@ -94,7 +95,7 @@ sal_Bool Append(FILE * fDest, const OString &rTmpFile) { if( fSource ) fclose( fSource ); - return sal_False; + return false; } bool bSuccess = true; @@ -106,17 +107,18 @@ sal_Bool Append(FILE * fDest, const OString &rTmpFile) nItems = fread( szBuf, 1, MAX_BUF, fSource ); bSuccess = (nItems == fwrite(szBuf, 1, nItems, fDest)); SAL_WARN_IF(!bSuccess, "rsc", "short write"); - } while (MAX_BUF == nItems && bSuccess); + } + while (MAX_BUF == nItems && bSuccess); fclose( fSource ); return bSuccess; } -sal_Bool Append(const OString &rOutputSrs, const OString &rTmpFile) +bool Append(const OString &rOutputSrs, const OString &rTmpFile) { FILE * fDest = fopen(rOutputSrs.getStr(), "ab"); - sal_Bool bRet = Append(fDest, rTmpFile); + bool bRet = Append(fDest, rTmpFile); if( fDest ) fclose( fDest ); @@ -185,24 +187,29 @@ char * ResponseFile( RscPtrPtr * ppCmd, char ** ppArgv, sal_uInt32 nArgc ) ppCmd->Append( rsc_strdup( *(ppArgv +i) ) ); }; ppCmd->Append( (void *)0 ); - return( NULL ); + return NULL; } -RscPtrPtr :: RscPtrPtr(){ +RscPtrPtr :: RscPtrPtr() +{ nCount = 0; pMem = NULL; } -RscPtrPtr :: ~RscPtrPtr(){ +RscPtrPtr :: ~RscPtrPtr() +{ Reset(); } -void RscPtrPtr :: Reset(){ +void RscPtrPtr :: Reset() +{ sal_uInt32 i; - if( pMem ){ - for( i = 0; i < nCount; i++ ){ + if( pMem ) + { + for( i = 0; i < nCount; i++ ) + { if( pMem[ i ] ) rtl_freeMemory( pMem[ i ] ); } @@ -212,7 +219,8 @@ void RscPtrPtr :: Reset(){ pMem = NULL; } -sal_uInt32 RscPtrPtr :: Append( void * pBuffer ){ +sal_uInt32 RscPtrPtr :: Append( void * pBuffer ) +{ if( !pMem ) pMem = (void **)rtl_allocateMemory( (nCount +1) * sizeof( void * ) ); else @@ -220,13 +228,14 @@ sal_uInt32 RscPtrPtr :: Append( void * pBuffer ){ ((nCount +1) * sizeof( void * ) ) ); pMem[ nCount ] = pBuffer; - return( nCount++ ); + return nCount++; } -void * RscPtrPtr :: GetEntry( sal_uInt32 nEntry ){ +void * RscPtrPtr :: GetEntry( sal_uInt32 nEntry ) +{ if( nEntry < nCount ) - return( pMem[ nEntry ] ); - return( NULL ); + return pMem[ nEntry ]; + return NULL; } RscWriteRc::RscWriteRc( RSCBYTEORDER_TYPE nOrder ) @@ -234,7 +243,7 @@ RscWriteRc::RscWriteRc( RSCBYTEORDER_TYPE nOrder ) short nSwapTest = 1; RSCBYTEORDER_TYPE nMachineOrder; - bSwap = sal_False; + bSwap = false; if( nOrder != RSC_SYSTEMENDIAN ) { if( (sal_uInt8)*(sal_uInt8 *)&nSwapTest ) @@ -272,7 +281,7 @@ char * RscWriteRc :: GetPointer( sal_uInt32 nSize ) pMem = (char *)rtl_allocateMemory( nLen ); memset( pMem, 0, nLen ); } - return( pMem + nSize ); + return pMem + nSize; } diff --git a/rsc/source/tools/rsctree.cxx b/rsc/source/tools/rsctree.cxx index b174bc1153b6..25a645062123 100644 --- a/rsc/source/tools/rsctree.cxx +++ b/rsc/source/tools/rsctree.cxx @@ -26,14 +26,17 @@ #include <rsctree.hxx> -BiNode::BiNode(){ +BiNode::BiNode() +{ pLeft = pRight = NULL; } -BiNode::~BiNode(){ +BiNode::~BiNode() +{ } -void BiNode::EnumNodes( Link aLink ) const{ +void BiNode::EnumNodes( Link aLink ) const +{ if( Left() ) Left()->EnumNodes( aLink ); aLink.Call( (BiNode *)this ); @@ -41,24 +44,33 @@ void BiNode::EnumNodes( Link aLink ) const{ Right()->EnumNodes( aLink ); } -BiNode * BiNode::ChangeDLListBTree( BiNode * pList ){ +BiNode * BiNode::ChangeDLListBTree( BiNode * pList ) +{ BiNode * pMiddle; BiNode * pTmp; sal_uInt32 nEle, i; - if( pList ){ + if( pList ) +{ while( pList->Left() ) pList = pList->Left(); pTmp = pList; + for( nEle = 0; pTmp->Right(); nEle++ ) pTmp = pTmp->Right(); + pMiddle = pList; if( nEle / 2 ) + { for( i = 0; i < (nEle / 2); i++ ) + { pMiddle = pMiddle->Right(); + } + } else + { pList = (BiNode *)0; - + } if( NULL != (pTmp = pMiddle->Left()) ) // rechten Zeiger auf Null pTmp->pRight = (BiNode *)0; @@ -70,56 +82,68 @@ BiNode * BiNode::ChangeDLListBTree( BiNode * pList ){ pMiddle->pLeft = ChangeDLListBTree( pList ); pMiddle->pRight = ChangeDLListBTree( pRightNode ); - return( pMiddle ); + return pMiddle; } - return( pList ); + return pList; } -BiNode * BiNode::ChangeBTreeDLList(){ +BiNode * BiNode::ChangeBTreeDLList() +{ BiNode * pList; BiNode * pLL_RN; // linke Liste rechter Knoten - if( Right() ){ + if( Right() ) + { pList = Right()->ChangeBTreeDLList(); pRight = pList; pList->pLeft = this; } pList = this; - if( Left() ){ + if( Left() ) + { pLL_RN = pList = Left()->ChangeBTreeDLList(); + while( pLL_RN->Right() ) pLL_RN = pLL_RN->Right(); + pLeft = pLL_RN; pLL_RN->pRight = this; } - return( pList ); + return pList; } -NameNode * NameNode::Remove( NameNode * pRemove ){ +NameNode * NameNode::Remove( NameNode * pRemove ) +{ NameNode * pRoot = this; NameNode * pParent = SearchParent( pRemove ); - if( pParent ){ - if( pParent->Left() - && (EQUAL == pRemove->Compare( pParent->Left() ) ) ){ + if( pParent ) + { + if( pParent->Left() && + (EQUAL == pRemove->Compare( pParent->Left() ) ) ) + { pParent->pLeft = pRemove->Left(); if( pRemove->Right() ) pParent->Insert( pRemove->Right() ); } - else if( pParent->Right() - && (EQUAL == pRemove->Compare( pParent->Right() ) ) ){ + else if( pParent->Right() && + (EQUAL == pRemove->Compare( pParent->Right() ) ) ) + { pParent->pRight = pRemove->Right(); if( pRemove->Left() ) pParent->Insert( pRemove->Left() ); } } - else if( EQUAL == this->Compare( pRemove ) ){ - if( Right() ){ + else if( EQUAL == this->Compare( pRemove ) ) + { + if( Right() ) + { pRoot = Right(); if( Left() ) Right()->Insert( Left() ); } - else{ + else + { pRoot = Left(); } } @@ -129,7 +153,8 @@ NameNode * NameNode::Remove( NameNode * pRemove ){ } -COMPARE NameNode::Compare( const NameNode * pCompare ) const{ +COMPARE NameNode::Compare( const NameNode * pCompare ) const +{ if( (long)this < (long)pCompare ) return LESS; else if( (long)this > (long)pCompare ) @@ -138,7 +163,8 @@ COMPARE NameNode::Compare( const NameNode * pCompare ) const{ return EQUAL; } -COMPARE NameNode::Compare( const void * pCompare ) const{ +COMPARE NameNode::Compare( const void * pCompare ) const +{ if( (long)this < (long)pCompare ) return LESS; else if( (long)this > (long)pCompare ) @@ -147,105 +173,123 @@ COMPARE NameNode::Compare( const void * pCompare ) const{ return EQUAL; } -NameNode* NameNode::SearchParent( const NameNode * pSearch ) const{ // search for a parent node. // return a pointer to the parent node if found. // otherwise return 0. +NameNode* NameNode::SearchParent( const NameNode * pSearch ) const +{ int nCmp = Compare( pSearch ); - if( nCmp == GREATER ){ - if( Left() ){ + if( nCmp == GREATER ) + { + if( Left() ) + { if( ((NameNode *)Left())->Compare( pSearch ) == EQUAL ) return (NameNode *)this; return ((NameNode *)Left())->SearchParent( pSearch ); }; } - else if( nCmp == LESS ){ - if( Right() ){ + else if( nCmp == LESS ) + { + if( Right() ) + { if( ((NameNode *)Right())->Compare( pSearch ) == EQUAL ) return (NameNode *)this; return ((NameNode *)Right())->SearchParent( pSearch ); } - }; - return( (NameNode *)NULL ); + } + return (NameNode *)NULL; } -NameNode* NameNode::Search( const NameNode * pSearch ) const{ // search for a node. // return a pointer to the node if found. // otherwise return 0. +NameNode* NameNode::Search( const NameNode * pSearch ) const +{ int nCmp = Compare( pSearch ); - if( nCmp == GREATER ){ + if( nCmp == GREATER ) + { if( Left() ) return ((NameNode *)Left())->Search( pSearch ); } - else if( nCmp == LESS ){ + else if( nCmp == LESS ) + { if( Right() ) return ((NameNode *)Right())->Search( pSearch ); } else - return( (NameNode *)this ); + return (NameNode *)this; - return( NULL ); + return NULL; } -NameNode* NameNode::Search( const void * pSearch ) const{ // search for a node. // return a pointer to the node if found. // otherwise return 0. +NameNode* NameNode::Search( const void * pSearch ) const +{ int nCmp = Compare( pSearch ); - if( nCmp == GREATER ){ + if( nCmp == GREATER ) + { if( Left() ) return ((NameNode *)Left())->Search( pSearch ); } - else if( nCmp == LESS ){ + else if( nCmp == LESS ) + { if( Right() ) return ((NameNode *)Right())->Search( pSearch ); } else - return( (NameNode *)this ); + return (NameNode *)this; - return( NULL ); + return NULL; } -sal_Bool NameNode::Insert( NameNode * pTN, sal_uInt32* pnDepth ){ // Ein Knoten wird in den Baum eingefuegt -// Gibt es einen Knoten mit dem gleichen Namen, dann return sal_False -// sonst return sal_True. Der Knoten wird auf jeden Fall eingefuegt. +// Gibt es einen Knoten mit dem gleichen Namen, dann return false +// sonst return true. Der Knoten wird auf jeden Fall eingefuegt. - sal_Bool bRet = sal_True; +bool NameNode::Insert( NameNode * pTN, sal_uInt32* pnDepth ) +{ + bool bRet = true; int nCmp = Compare( pTN ); *pnDepth += 1; - if( nCmp == GREATER ){ + if( nCmp == GREATER ) + { if( Left() ) bRet = ((NameNode *)Left())->Insert( pTN, pnDepth ); else pLeft = pTN; } - else{ + else + { if( Right() ) bRet = ((NameNode *)Right())->Insert( pTN, pnDepth ); else pRight = pTN; + if( nCmp == EQUAL ) - bRet = sal_False; - }; - return( bRet ); + bRet = false; + } + return bRet; } -sal_Bool NameNode::Insert( NameNode * pTN ){ // insert a node in the tree. -// if the node with the same name is in, return sal_False and no insert. +// if the node with the same name is in, return false and no insert. // if not return true. +bool NameNode::Insert( NameNode * pTN ) +{ sal_uInt32 nDepth = 0; - sal_Bool bRet; + bool bRet; bRet = Insert( pTN, &nDepth ); - if( bRet ){ - if( nDepth > 20 ){ + if( bRet ) + { + if( nDepth > 20 ) + { if( Left() ) pLeft = ChangeDLListBTree( Left()->ChangeBTreeDLList() ); if( Right() ) @@ -253,10 +297,11 @@ sal_Bool NameNode::Insert( NameNode * pTN ){ } } - return( bRet ); + return bRet; } -void NameNode::OrderTree(){ +void NameNode::OrderTree() +{ NameNode * pTmpLeft = (NameNode *)Left(); NameNode * pTmpRight = (NameNode *)Right(); @@ -266,8 +311,10 @@ void NameNode::OrderTree(){ SubOrderTree( pTmpRight ); } -void NameNode::SubOrderTree( NameNode * pOrderNode ){ - if( pOrderNode ){ +void NameNode::SubOrderTree( NameNode * pOrderNode ) +{ + if( pOrderNode ) + { NameNode * pTmpLeft = (NameNode *)pOrderNode->Left(); NameNode * pTmpRight = (NameNode *)pOrderNode->Right(); pOrderNode->pLeft = NULL; @@ -278,8 +325,9 @@ void NameNode::SubOrderTree( NameNode * pOrderNode ){ } } -IdNode * IdNode::Search( sal_uInt32 nTypeName ) const{ - return( (IdNode *)NameNode::Search( (const void *)&nTypeName ) ); +IdNode * IdNode::Search( sal_uInt32 nTypeName ) const +{ + return (IdNode *)NameNode::Search( (const void *)&nTypeName ); } COMPARE IdNode::Compare( const NameNode * pSearch ) const @@ -292,9 +340,9 @@ COMPARE IdNode::Compare( const NameNode * pSearch ) const return EQUAL; } -COMPARE IdNode::Compare( const void * pSearch ) const{ // pSearch ist ein Zeiger auf sal_uInt32 - +COMPARE IdNode::Compare( const void * pSearch ) const +{ if( GetId() < *((const sal_uInt32 *)pSearch) ) return LESS; else if( GetId() > *((const sal_uInt32 *)pSearch) ) @@ -305,10 +353,11 @@ COMPARE IdNode::Compare( const void * pSearch ) const{ sal_uInt32 IdNode::GetId() const { - return( 0xFFFFFFFF ); + return 0xFFFFFFFF; } -StringNode * StringNode::Search( const char * pSearch ) const{ +StringNode * StringNode::Search( const char * pSearch ) const +{ return (StringNode *)NameNode::Search( (const void *)pSearch ); } @@ -324,9 +373,9 @@ COMPARE StringNode::Compare( const NameNode * pSearch ) const return EQUAL; } +// pSearch ist ein Zeiger auf const char * COMPARE StringNode::Compare( const void * pSearch ) const { -// pSearch ist ein Zeiger auf const char * int nCmp = strcmp( m_aName.getStr(), (const char *)pSearch ); if( nCmp < 0 ) |