summaryrefslogtreecommitdiff
path: root/rsc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-04-20 14:05:07 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-04-21 11:45:59 +0200
commit76a3df733ebe016d8adf681d1cf591970d6f2a64 (patch)
tree05ee35a96782a22661dac66195687d3ea4ff0158 /rsc
parentdc2598b7b45638847ac81c1b53bdbe43e5acef19 (diff)
loplugin:mergeclasses RscConst with RscEnum
Change-Id: I7bd35df0751c9ffce076848edd5373e00815dbc5 Reviewed-on: https://gerrit.libreoffice.org/36772 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'rsc')
-rw-r--r--rsc/inc/rscconst.hxx22
-rw-r--r--rsc/inc/rscdb.hxx4
-rw-r--r--rsc/source/parser/rscibas.cxx4
-rw-r--r--rsc/source/res/rscarray.cxx2
-rw-r--r--rsc/source/res/rscconst.cxx17
5 files changed, 19 insertions, 30 deletions
diff --git a/rsc/inc/rscconst.hxx b/rsc/inc/rscconst.hxx
index b9678751e452..a9ce5040a168 100644
--- a/rsc/inc/rscconst.hxx
+++ b/rsc/inc/rscconst.hxx
@@ -25,9 +25,13 @@
#include <rsctop.hxx>
#include <tools/resid.hxx>
-class RscConst : public RscTop
+class RscEnum : public RscTop
{
-protected:
+ struct RscEnumInst
+ {
+ sal_uInt32 nValue; // constant position in the array
+ bool bDflt; // is default
+ };
struct VarEle
{
Atom nId; // constant name
@@ -36,24 +40,14 @@ protected:
VarEle * pVarArray; // pointer to the field with constant
sal_uInt32 nEntries; // number of entries in field
public:
- RscConst( Atom nId, RESOURCE_TYPE nTypId );
- virtual ~RscConst() override;
+ RscEnum( Atom nId, RESOURCE_TYPE nTypId );
+ virtual ~RscEnum() override;
// sets the allowed values
void SetConstant( Atom nVarName, sal_Int32 lValue );
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
- {
- sal_uInt32 nValue; // constant position in the array
- bool bDflt; // is default
- };
-public:
- RscEnum( Atom nId, RESOURCE_TYPE nTypId );
RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, bool bOwnClass = false ) override;
sal_uInt32 Size() const override { return ALIGNED_SIZE(sizeof(RscEnumInst)); }
diff --git a/rsc/inc/rscdb.hxx b/rsc/inc/rscdb.hxx
index d9b222154c9a..0fbe8064fc9d 100644
--- a/rsc/inc/rscdb.hxx
+++ b/rsc/inc/rscdb.hxx
@@ -77,8 +77,8 @@ class RscTypCont
aSysLst; // list of system resources
void Init(); // initializes classes and tables
- void SETCONST( RscConst *, const char *, sal_uInt32 );
- void SETCONST( RscConst *, Atom, sal_uInt32 );
+ void SETCONST( RscEnum *, const char *, sal_uInt32 );
+ void SETCONST( RscEnum *, Atom, sal_uInt32 );
RscEnum * InitFieldUnitsType();
RscTupel * InitStringLongTupel();
static RscCont * InitStringLongTupelList( RscTupel * pStringLongTupel );
diff --git a/rsc/source/parser/rscibas.cxx b/rsc/source/parser/rscibas.cxx
index 8aea89f93937..a0b677e7a1e6 100644
--- a/rsc/source/parser/rscibas.cxx
+++ b/rsc/source/parser/rscibas.cxx
@@ -44,7 +44,7 @@
#include <unordered_map>
-void RscTypCont::SETCONST( RscConst * pClass, const char * szString, sal_uInt32 nVal )
+void RscTypCont::SETCONST( RscEnum * pClass, const char * szString, sal_uInt32 nVal )
{
#if OSL_DEBUG_LEVEL > 2
fprintf( stderr, "setconst : %s\n", szString );
@@ -53,7 +53,7 @@ void RscTypCont::SETCONST( RscConst * pClass, const char * szString, sal_uInt32
CONSTNAME, nVal ), nVal );
}
-void RscTypCont::SETCONST( RscConst * pClass, Atom nName, sal_uInt32 nVal )
+void RscTypCont::SETCONST( RscEnum * pClass, Atom nName, sal_uInt32 nVal )
{
#if OSL_DEBUG_LEVEL > 2
fprintf( stderr, "setconst hash: %u\n", (unsigned int)nName );
diff --git a/rsc/source/res/rscarray.cxx b/rsc/source/res/rscarray.cxx
index 3efd01a3dad0..08dd08d4b8cc 100644
--- a/rsc/source/res/rscarray.cxx
+++ b/rsc/source/res/rscarray.cxx
@@ -339,7 +339,7 @@ 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 )
+ CLASS_DATA pDfltData, RscEnum * pTypeClass )
{
if( pNode )
{
diff --git a/rsc/source/res/rscconst.cxx b/rsc/source/res/rscconst.cxx
index 281c8b02ad3b..f791eb2b6b63 100644
--- a/rsc/source/res/rscconst.cxx
+++ b/rsc/source/res/rscconst.cxx
@@ -26,19 +26,19 @@
#include <rschash.hxx>
#include <tools/resid.hxx>
-RscConst::RscConst( Atom nId, RESOURCE_TYPE nTypeId )
+RscEnum::RscEnum( Atom nId, RESOURCE_TYPE nTypeId )
: RscTop( nId, nTypeId )
, pVarArray(nullptr), nEntries(0)
{
}
-RscConst::~RscConst()
+RscEnum::~RscEnum()
{
if( pVarArray )
rtl_freeMemory( static_cast<void *>(pVarArray) );
}
-void RscConst::SetConstant( Atom nVarName, sal_Int32 lValue )
+void RscEnum::SetConstant( Atom nVarName, sal_Int32 lValue )
{
if( pVarArray )
pVarArray = static_cast<VarEle *>(rtl_reallocateMemory( static_cast<void *>(pVarArray),
@@ -50,7 +50,7 @@ void RscConst::SetConstant( Atom nVarName, sal_Int32 lValue )
nEntries++;
}
-bool RscConst::GetConstValue( Atom nConst, sal_Int32 * pValue ) const
+bool RscEnum::GetConstValue( Atom nConst, sal_Int32 * pValue ) const
{
sal_uInt32 i = 0;
@@ -65,7 +65,7 @@ bool RscConst::GetConstValue( Atom nConst, sal_Int32 * pValue ) const
return false;
}
-bool RscConst::GetValueConst( sal_Int32 lValue, Atom * pConst ) const
+bool RscEnum::GetValueConst( sal_Int32 lValue, Atom * pConst ) const
{
sal_uInt32 i = 0;
@@ -80,7 +80,7 @@ bool RscConst::GetValueConst( sal_Int32 lValue, Atom * pConst ) const
return false;
}
-sal_uInt32 RscConst::GetConstPos( Atom nConst )
+sal_uInt32 RscEnum::GetConstPos( Atom nConst )
{
sal_uInt32 i = 0;
@@ -93,11 +93,6 @@ sal_uInt32 RscConst::GetConstPos( Atom nConst )
return nEntries;
}
-RscEnum::RscEnum( Atom nId, RESOURCE_TYPE nTypeId )
- : RscConst( nId, nTypeId )
-{
-}
-
ERRTYPE RscEnum::SetConst( const RSCINST & rInst, Atom nConst, sal_Int32 /*nVal*/ )
{
sal_uInt32 i = 0;