diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2014-02-28 00:37:25 +0100 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2014-03-02 20:17:57 +0100 |
commit | 04deb742f6bddf2881ab6c088ca212500d4931a1 (patch) | |
tree | c7539d0d42c62e62d53e8121585e8000cec8aeaf /sw | |
parent | 0d5652ab10721082f81d11df92ae69e7bce59856 (diff) |
Don't use tricks to get normal C++ features
* Use "mutable" to allow modification of a flag, maintaining logical constness
* No need to explicitly cast this to the base type inside a base class method
Change-Id: I50c015ba977d93e82331c97259d9f9fb774bb198
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/inc/txmsrt.hxx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sw/source/core/inc/txmsrt.hxx b/sw/source/core/inc/txmsrt.hxx index bd8300c21896..f102c5392602 100644 --- a/sw/source/core/inc/txmsrt.hxx +++ b/sw/source/core/inc/txmsrt.hxx @@ -152,7 +152,7 @@ struct SwTOXSortTabBase inline const ::com::sun::star::lang::Locale& GetLocale() const; private: - bool bValidTxt; + mutable bool bValidTxt; TextAndReading m_aSort; virtual TextAndReading GetText_Impl() const = 0; @@ -162,9 +162,10 @@ inline TextAndReading SwTOXSortTabBase::GetTxt() const { if( !bValidTxt ) { - SwTOXSortTabBase* pThis = (SwTOXSortTabBase*)this; - pThis->m_aSort = pThis->GetText_Impl(); - pThis->bValidTxt = true; + // 'this' is 'SwTOXSortTabBase const*', so the virtual + // mechanism will call the derived class' GetText_Impl + GetText_Impl(); + bValidTxt = true; } return m_aSort; } |