summaryrefslogtreecommitdiff
path: root/rsc
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2016-08-31 14:14:50 +0200
committerJochen Nitschke <j.nitschke+logerrit@ok.de>2016-08-31 16:34:15 +0000
commitf322c52b89f514b792179c4d7e6ee2c3aa893a4e (patch)
tree0abd175058dd939b1cb0379c4dd4a9355c2d7997 /rsc
parent2a1431208e4292e8563935f5e8cd0107113f65ea (diff)
use initializer list ctors for res types
make nSize and nOffInstData const, let Size() return fixed sizes Change-Id: I7e2792e1cd990e65582020353054087f94856151 Reviewed-on: https://gerrit.libreoffice.org/28545 Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de> Tested-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
Diffstat (limited to 'rsc')
-rw-r--r--rsc/inc/rscarray.hxx6
-rw-r--r--rsc/inc/rscclass.hxx2
-rw-r--r--rsc/inc/rscconst.hxx3
-rw-r--r--rsc/inc/rsccont.hxx6
-rw-r--r--rsc/inc/rscflag.hxx4
-rw-r--r--rsc/inc/rscmgr.hxx2
-rw-r--r--rsc/inc/rscrange.hxx9
-rw-r--r--rsc/inc/rscstr.hxx3
-rw-r--r--rsc/inc/rsctop.hxx2
-rw-r--r--rsc/source/res/rscarray.cxx9
-rw-r--r--rsc/source/res/rscclass.cxx7
-rw-r--r--rsc/source/res/rscclobj.cxx9
-rw-r--r--rsc/source/res/rscconst.cxx4
-rw-r--r--rsc/source/res/rsccont.cxx14
-rw-r--r--rsc/source/res/rscflag.cxx6
-rw-r--r--rsc/source/res/rscmgr.cxx2
-rw-r--r--rsc/source/res/rscrange.cxx12
-rw-r--r--rsc/source/res/rscstr.cxx3
-rw-r--r--rsc/source/res/rsctop.cxx2
19 files changed, 43 insertions, 62 deletions
diff --git a/rsc/inc/rscarray.hxx b/rsc/inc/rscarray.hxx
index c917db5d86d6..a7bf2c4252e2 100644
--- a/rsc/inc/rscarray.hxx
+++ b/rsc/inc/rscarray.hxx
@@ -54,8 +54,8 @@ class RscArray : public RscTop
{
protected:
RscEnum * pTypeClass; // type of entries
- sal_uInt32 nSize; // size of this class instance data with super class
- sal_uInt32 nOffInstData;// Offset of self instance data
+ const sal_uInt32 nOffInstData;// Offset of self instance data
+ const sal_uInt32 nSize; // size of this class instance data with super class
void WriteSrcArray( const RSCINST & rInst, FILE * fOutput,
RscTypCont * pTC, sal_uInt32 nTab, const char * );
public:
@@ -75,7 +75,7 @@ public:
RSCINST * pGetInst ) override;
// gives the size of the class in bytes
- sal_uInt32 Size() override { return nSize; }
+ sal_uInt32 Size() const override { return nSize; }
bool IsConsistent( const RSCINST & rInst ) override;
virtual void SetToDefault( const RSCINST & rInst ) override;
diff --git a/rsc/inc/rscclass.hxx b/rsc/inc/rscclass.hxx
index 1b78859010c6..46fe526639ae 100644
--- a/rsc/inc/rscclass.hxx
+++ b/rsc/inc/rscclass.hxx
@@ -82,7 +82,7 @@ public:
RSCINST GetCopyVar( const RSCINST & rInst, Atom nVarName ) override;
// gives the class size in bytes
- sal_uInt32 Size() override { return nSize; }
+ sal_uInt32 Size() const override { return nSize; }
bool IsConsistent( const RSCINST & rInst ) override;
void SetToDefault( const RSCINST & rInst ) override;
diff --git a/rsc/inc/rscconst.hxx b/rsc/inc/rscconst.hxx
index 275996feb8f0..ec3d3621b5f7 100644
--- a/rsc/inc/rscconst.hxx
+++ b/rsc/inc/rscconst.hxx
@@ -52,11 +52,10 @@ class RscEnum : public RscConst
sal_uInt32 nValue; // constant position in the array
bool bDflt; // is default
};
- sal_uInt32 nSize;
public:
RscEnum( Atom nId, sal_uInt32 nTypId );
RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, bool bOwnClass = false ) override;
- sal_uInt32 Size() override { return nSize; }
+ sal_uInt32 Size() const override { return ALIGNED_SIZE(sizeof(RscEnumInst)); }
virtual void SetToDefault( const RSCINST & rInst ) override
{
diff --git a/rsc/inc/rsccont.hxx b/rsc/inc/rsccont.hxx
index 36aa2cfaba55..f72f1ae4643e 100644
--- a/rsc/inc/rsccont.hxx
+++ b/rsc/inc/rsccont.hxx
@@ -43,8 +43,8 @@ protected:
RscTop * pTypeClass; // type of entries
RscTop * pTypeClass1;// two different types may exist
bool bNoId; // whether there is no identifier
- sal_uInt32 nSize; // size of this class and super classes instance data
- sal_uInt32 nOffInstData;// offset of own instance data
+ const sal_uInt32 nOffInstData;// offset of own instance data
+ const sal_uInt32 nSize; // size of this class and super classes instance data
static void DestroyElements( RscBaseContInst * pClassData );
RSCINST SearchElePos( const RSCINST & rInst, const RscId & rEleName,
RscTop * pClass, sal_uInt32 nPos );
@@ -86,7 +86,7 @@ public:
ERRTYPE SetRef( const RSCINST & rInst, const RscId & rRefId ) override;
// returns the class size in bytes
- sal_uInt32 Size() override { return nSize; }
+ sal_uInt32 Size() const override { return nSize; }
bool IsConsistent( const RSCINST & rInst ) override;
void SetToDefault( const RSCINST & rInst ) override;
diff --git a/rsc/inc/rscflag.hxx b/rsc/inc/rscflag.hxx
index a783ed418bf7..77b21f3fc6e4 100644
--- a/rsc/inc/rscflag.hxx
+++ b/rsc/inc/rscflag.hxx
@@ -38,7 +38,7 @@ public:
RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, bool bOwnClass = false ) override;
RSCINST CreateClient( RSCINST * pInst, const RSCINST & rDflt,
bool bOwnClass, Atom nConsId );
- sal_uInt32 Size() override;
+ sal_uInt32 Size() const override;
virtual void SetToDefault( const RSCINST & rInst ) override;
bool IsDefault( const RSCINST & rInst ) override;
@@ -71,7 +71,7 @@ public:
Atom nConstantId );
virtual RSCCLASS_TYPE GetClassType() const override;
RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, bool bOwnClass = false ) override;
- sal_uInt32 Size() override { return pRefClass->Size(); }
+ sal_uInt32 Size() const override { return pRefClass->Size(); }
// an assignment to a variable
bool IsDefault( const RSCINST & rInst ) override {
diff --git a/rsc/inc/rscmgr.hxx b/rsc/inc/rscmgr.hxx
index f70cdf88f51b..3fd9afaab78c 100644
--- a/rsc/inc/rscmgr.hxx
+++ b/rsc/inc/rscmgr.hxx
@@ -45,7 +45,7 @@ public:
RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, bool bOwnClass = false ) override;
void Destroy( const RSCINST & rInst ) override;
- sal_uInt32 Size() override;
+ sal_uInt32 Size() const override;
void WriteSrcHeader( const RSCINST & aInst, FILE * fOutput,
RscTypCont * pTC, sal_uInt32 nTab,
const RscId & rId, const char * ) override;
diff --git a/rsc/inc/rscrange.hxx b/rsc/inc/rscrange.hxx
index bbcd8a736649..aee604bcc7d5 100644
--- a/rsc/inc/rscrange.hxx
+++ b/rsc/inc/rscrange.hxx
@@ -34,7 +34,6 @@ protected:
};
sal_Int32 nMin; // range minimum value
sal_Int32 nMax; // range maximum value
- sal_uInt32 nSize;
public:
RscRange( Atom nId, sal_uInt32 nTypId );
virtual RSCCLASS_TYPE GetClassType() const override;
@@ -42,7 +41,7 @@ public:
// sets the allowed range
void SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum );
// returns the class size in bytes
- sal_uInt32 Size() override { return nSize; }
+ sal_uInt32 Size() const override { return ALIGNED_SIZE(sizeof(RscRangeInst)); }
// an assignment to a variable
virtual void SetToDefault( const RSCINST & rInst ) override
{
@@ -72,7 +71,6 @@ protected:
};
sal_Int32 nMin; // range minimum value
sal_Int32 nMax; // range maximum value
- sal_uInt32 nSize;
public:
RscLongRange( Atom nId, sal_uInt32 nTypId );
virtual RSCCLASS_TYPE GetClassType() const override;
@@ -80,7 +78,7 @@ public:
// sets the allowed range
void SetRange( sal_Int32 nMinimum, sal_Int32 nMaximum );
// returns the class size in bytes
- sal_uInt32 Size() override { return nSize; }
+ sal_uInt32 Size() const override { return ALIGNED_SIZE(sizeof(RscLongRangeInst)); }
// an assignment to a variable
virtual void SetToDefault( const RSCINST & rInst ) override
{
@@ -112,7 +110,6 @@ public:
class RscIdRange : public RscTop
{
- sal_uInt32 nSize;
protected:
sal_Int32 nMin; // range minimum value
sal_Int32 nMax; // range maximum value
@@ -127,7 +124,7 @@ public:
}
RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, bool bOwnClass = false ) override;
void Destroy( const RSCINST & rInst ) override;
- sal_uInt32 Size() override { return nSize; }
+ sal_uInt32 Size() const override { return ALIGNED_SIZE(sizeof(RscId)); }
virtual void SetToDefault( const RSCINST & rInst ) override
{
reinterpret_cast<RscId*>(rInst.pData)->aExp.cUnused = true;
diff --git a/rsc/inc/rscstr.hxx b/rsc/inc/rscstr.hxx
index c51f4a6c9345..ae20f04351a6 100644
--- a/rsc/inc/rscstr.hxx
+++ b/rsc/inc/rscstr.hxx
@@ -33,7 +33,6 @@ class RscString : public RscTop
bool bDflt; // is default
RscId aRefId; // reference name
};
- sal_uInt32 nSize;
public:
RscString( Atom nId, sal_uInt32 nTypId );
virtual RSCCLASS_TYPE GetClassType() const override;
@@ -42,7 +41,7 @@ public:
RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, bool bOwnClass = false ) override;
// sets the allowed range
void Destroy( const RSCINST & rInst ) override;
- sal_uInt32 Size() override { return nSize; }
+ sal_uInt32 Size() const override { return ALIGNED_SIZE(sizeof(RscStringInst)); }
void SetToDefault( const RSCINST & rInst ) override
{
reinterpret_cast<RscStringInst*>(rInst.pData)->bDflt = true;
diff --git a/rsc/inc/rsctop.hxx b/rsc/inc/rsctop.hxx
index 6d571145ced7..f4da6ee3b601 100644
--- a/rsc/inc/rsctop.hxx
+++ b/rsc/inc/rsctop.hxx
@@ -72,7 +72,7 @@ public:
virtual RscTop* GetTypeClass() const;
// returns the class size in bytes
- virtual sal_uInt32 Size();
+ virtual sal_uInt32 Size() const;
// returns the reference
virtual ERRTYPE GetRef( const RSCINST & rInst, RscId * );
diff --git a/rsc/source/res/rscarray.cxx b/rsc/source/res/rscarray.cxx
index 595963b67ebc..b73c9324d239 100644
--- a/rsc/source/res/rscarray.cxx
+++ b/rsc/source/res/rscarray.cxx
@@ -26,9 +26,8 @@
#include <rscarray.hxx>
#include <rscdb.hxx>
-RscInstNode::RscInstNode( sal_uInt32 nId )
+RscInstNode::RscInstNode(sal_uInt32 nId) : nTypeId(nId)
{
- nTypeId = nId;
}
RscInstNode::~RscInstNode()
@@ -47,10 +46,10 @@ sal_uInt32 RscInstNode::GetId() const
RscArray::RscArray( Atom nId, sal_uInt32 nTypeId, RscTop * pSuper, RscEnum * pTypeCl )
: RscTop( nId, nTypeId, pSuper )
+ , pTypeClass(pTypeCl)
+ , nOffInstData(RscTop::Size())
+ , nSize(nOffInstData + ALIGNED_SIZE(sizeof(RscArrayInst)))
{
- pTypeClass = pTypeCl;
- nOffInstData = RscTop::Size();
- nSize = nOffInstData + ALIGNED_SIZE( sizeof( RscArrayInst ) );
}
RscArray::~RscArray()
diff --git a/rsc/source/res/rscclass.cxx b/rsc/source/res/rscclass.cxx
index 27500f60cf4a..366d6836b068 100644
--- a/rsc/source/res/rscclass.cxx
+++ b/rsc/source/res/rscclass.cxx
@@ -30,11 +30,10 @@
RscClass::RscClass( Atom nId, sal_uInt32 nTypeId, RscTop * pSuperCl )
: RscTop( nId, nTypeId, pSuperCl )
+ , nSuperSize(RscTop::Size())
+ , nSize(nSuperSize + ALIGNED_SIZE(sizeof(RscClassInst )))
+ , nEntries(0), pVarTypeList(nullptr)
{
- nEntries = 0;
- pVarTypeList = nullptr;
- nSuperSize = RscTop::Size();
- nSize = nSuperSize + ALIGNED_SIZE( sizeof( RscClassInst ) );
}
void RscClass::Pre_dtor()
diff --git a/rsc/source/res/rscclobj.cxx b/rsc/source/res/rscclobj.cxx
index 940163644632..993be7fbd285 100644
--- a/rsc/source/res/rscclobj.cxx
+++ b/rsc/source/res/rscclobj.cxx
@@ -23,9 +23,8 @@
RefNode::RefNode( Atom nTyp )
+ : nTypNameId(nTyp), pObjBiTree(nullptr)
{
- pObjBiTree = nullptr;
- nTypNameId = nTyp;
}
sal_uInt32 RefNode::GetId() const
@@ -58,10 +57,10 @@ ObjNode * RefNode::GetObjNode( const RscId & rRscId )
}
ObjNode::ObjNode( const RscId & rId, CLASS_DATA pData, sal_uLong lKey )
+ : aRscId(rId)
+ , pRscObj(pData)
+ , lFileKey(lKey)
{
- pRscObj = pData;
- aRscId = rId;
- lFileKey = lKey;
}
ObjNode * ObjNode::DelObjNode( RscTop * pClass, sal_uLong nFileKey )
diff --git a/rsc/source/res/rscconst.cxx b/rsc/source/res/rscconst.cxx
index a61af44b2a47..f45045b9d1da 100644
--- a/rsc/source/res/rscconst.cxx
+++ b/rsc/source/res/rscconst.cxx
@@ -28,9 +28,8 @@
RscConst::RscConst( Atom nId, sal_uInt32 nTypeId )
: RscTop( nId, nTypeId )
+ , pVarArray(nullptr), nEntries(0)
{
- pVarArray = nullptr;
- nEntries = 0;
}
RscConst::~RscConst()
@@ -102,7 +101,6 @@ sal_uInt32 RscConst::GetConstPos( Atom nConst )
RscEnum::RscEnum( Atom nId, sal_uInt32 nTypeId )
: RscConst( nId, nTypeId )
{
- nSize = ALIGNED_SIZE( sizeof( RscEnumInst ) );
}
ERRTYPE RscEnum::SetConst( const RSCINST & rInst, Atom nConst, sal_Int32 /*nVal*/ )
diff --git a/rsc/source/res/rsccont.cxx b/rsc/source/res/rsccont.cxx
index 012aa28c0d4d..c3bf6193e6fa 100644
--- a/rsc/source/res/rsccont.cxx
+++ b/rsc/source/res/rsccont.cxx
@@ -37,14 +37,12 @@ void ENTRY_STRUCT::Destroy()
RscBaseCont::RscBaseCont( Atom nId, sal_uInt32 nTypeId, RscTop * pSuper,
bool bNoIdent )
- : RscTop( nId, nTypeId, pSuper )
- , nSize( 0 )
-{
- pTypeClass = nullptr;
- pTypeClass1 = nullptr;
- bNoId = bNoIdent;
- nOffInstData = RscTop::Size();
- nSize = nOffInstData + ALIGNED_SIZE( sizeof( RscBaseContInst ) );
+ : RscTop(nId, nTypeId, pSuper)
+ , pTypeClass(nullptr), pTypeClass1(nullptr)
+ , bNoId(bNoIdent), nOffInstData(RscTop::Size())
+ , nSize(nOffInstData + ALIGNED_SIZE(sizeof(RscBaseContInst)))
+
+{
}
RscBaseCont::~RscBaseCont()
diff --git a/rsc/source/res/rscflag.cxx b/rsc/source/res/rscflag.cxx
index 1c4b04ba1974..4ac6473294cc 100644
--- a/rsc/source/res/rscflag.cxx
+++ b/rsc/source/res/rscflag.cxx
@@ -29,7 +29,7 @@ RscFlag::RscFlag( Atom nId, sal_uInt32 nTypeId )
{
}
-sal_uInt32 RscFlag::Size()
+sal_uInt32 RscFlag::Size() const
{
return ALIGNED_SIZE( sizeof( RscFlagInst ) *
( 1 + (nEntries -1) / (sizeof( sal_uInt32 ) * 8) ) );
@@ -294,10 +294,8 @@ ERRTYPE RscFlag::WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
RscClient::RscClient( Atom nId, sal_uInt32 nTypeId, RscFlag * pClass,
Atom nConstantId )
- : RscTop ( nId, nTypeId )
+ : RscTop(nId, nTypeId), pRefClass(pClass), nConstId(nConstantId)
{
- pRefClass = pClass;
- nConstId = nConstantId;
}
RSCCLASS_TYPE RscClient::GetClassType() const
diff --git a/rsc/source/res/rscmgr.cxx b/rsc/source/res/rscmgr.cxx
index 682ea0c6ecef..2de220dca5f1 100644
--- a/rsc/source/res/rscmgr.cxx
+++ b/rsc/source/res/rscmgr.cxx
@@ -31,7 +31,7 @@ RscMgr::RscMgr( Atom nId, sal_uInt32 nTypeId, RscTop * pSuperCl )
{
}
-sal_uInt32 RscMgr::Size()
+sal_uInt32 RscMgr::Size() const
{
return RscClass::Size() + ALIGNED_SIZE( sizeof( RscMgrInst ) );
}
diff --git a/rsc/source/res/rscrange.cxx b/rsc/source/res/rscrange.cxx
index 6e379ffdcc64..d243ca8a4be7 100644
--- a/rsc/source/res/rscrange.cxx
+++ b/rsc/source/res/rscrange.cxx
@@ -26,9 +26,8 @@
RscRange::RscRange( Atom nId, sal_uInt32 nTypeId )
: RscTop( nId, nTypeId )
+ , nMin(0), nMax(0)
{
- nMin = nMax = 0;
- nSize = ALIGNED_SIZE( sizeof( RscRangeInst ) );
}
RSCCLASS_TYPE RscRange::GetClassType() const
@@ -138,9 +137,8 @@ ERRTYPE RscRange::WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
RscLongRange::RscLongRange( Atom nId, sal_uInt32 nTypeId )
: RscTop( nId, nTypeId )
+ , nMin(0), nMax(0)
{
- nMin = nMax = 0;
- nSize = ALIGNED_SIZE( sizeof( RscLongRangeInst ) );
}
RSCCLASS_TYPE RscLongRange::GetClassType() const
@@ -256,9 +254,8 @@ ERRTYPE RscLongEnumRange::SetConst( const RSCINST & rInst, Atom /*nConst*/,
RscIdRange::RscIdRange( Atom nId, sal_uInt32 nTypeId )
: RscTop( nId, nTypeId )
+ , nMin(0), nMax(0)
{
- nSize = ALIGNED_SIZE( sizeof( RscId ) );
- nMin = nMax = 0;
}
RSCCLASS_TYPE RscIdRange::GetClassType() const
@@ -416,9 +413,8 @@ void RscBool::WriteSrc( const RSCINST & rInst, FILE * fOutput,
}
RscBreakRange::RscBreakRange( Atom nId, sal_uInt32 nTypeId )
- : RscRange( nId, nTypeId )
+ : RscRange(nId, nTypeId), nOutRange(0xFFFFFFFF)
{
- nOutRange = 0xFFFFFFFF;
}
ERRTYPE RscBreakRange::SetNumber( const RSCINST & rInst, sal_Int32 nValue )
diff --git a/rsc/source/res/rscstr.cxx b/rsc/source/res/rscstr.cxx
index 5bd886e44460..f03bf4e8d350 100644
--- a/rsc/source/res/rscstr.cxx
+++ b/rsc/source/res/rscstr.cxx
@@ -30,9 +30,8 @@
RscString::RscString( Atom nId, sal_uInt32 nTypeId )
: RscTop( nId, nTypeId )
+ , pRefClass(nullptr)
{
- nSize = ALIGNED_SIZE( sizeof( RscStringInst ) );
- pRefClass = nullptr;
}
RSCCLASS_TYPE RscString::GetClassType() const
diff --git a/rsc/source/res/rsctop.cxx b/rsc/source/res/rsctop.cxx
index 47fa95a7f1bd..bf172951dab4 100644
--- a/rsc/source/res/rsctop.cxx
+++ b/rsc/source/res/rsctop.cxx
@@ -66,7 +66,7 @@ RscTop * RscTop::GetTypeClass() const
return nullptr;
}
-sal_uInt32 RscTop::Size()
+sal_uInt32 RscTop::Size() const
{
if( pSuperClass )
return pSuperClass->Size();