summaryrefslogtreecommitdiff
path: root/rsc/inc
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/inc
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/inc')
-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
9 files changed, 16 insertions, 21 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 * );