diff options
author | Eike Rathke <erack@redhat.com> | 2012-02-08 13:04:17 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2012-02-08 13:15:30 +0100 |
commit | 9472e9c77d55a0b9cdf75ce91375765243c0e1f1 (patch) | |
tree | 3aa6fea6c5eadf7b42b24f669568c98e9b67ca86 /svl/inc | |
parent | 0979307bbf769399f97da10a29f04936a6cf117c (diff) |
changes to "tools/table.hxx to std::map conversion"
* use consistent indenting with 4 spaces (instead of tabs (plus one space))
* use erase(it++) instead of erase(it); ++it to not access invalidated
iterator
* for First(); Remove(); Next() loops over entire Table use map::clear()
at the end if it isn't in a dtor
* use existing typedef SvNumberFormatTable in numfmtsh.hxx instead of
redefining, which means include zforlist.hxx now and some other forward
declarations can be removed
* removed inlined duplicated code of GetEntry(), implemented it in
zforlist.cxx instead and made const GetFormatEntry() just call GetEntry()
* removed the temporary sal_uIntPtr nFormat to be used as key, the sal_uIntPtr
was only used because Table effectively had pointer size as keys.
* made initial assignments of nDefaultFormat and nDefaultCurrencyFormat use
the ternary conditional operator
Diffstat (limited to 'svl/inc')
-rw-r--r-- | svl/inc/svl/zforlist.hxx | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx index 14229a06c6d1..a8cca86fa2e4 100644 --- a/svl/inc/svl/zforlist.hxx +++ b/svl/inc/svl/zforlist.hxx @@ -561,8 +561,7 @@ public: sal_uInt32 GetEntryKey( const String& sStr, LanguageType eLnge = LANGUAGE_DONTKNOW ); /// Return the format for a format index - const SvNumberformat* GetEntry(sal_uInt32 nKey) const - { SvNumberFormatTable::const_iterator it = aFTable.find(nKey); return it == aFTable.end() ? 0 : it->second; } + const SvNumberformat* GetEntry( sal_uInt32 nKey ) const; /// Return the format index of the standard default number format for language/country sal_uInt32 GetStandardIndex(LanguageType eLnge = LANGUAGE_DONTKNOW); @@ -800,7 +799,7 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager; ::com::sun::star::lang::Locale aLocale; SvNumberFormatTable aFTable; // Table of format keys to format entries - typedef std::map<sal_uInt32, sal_uInt32> DefaultFormatKeysMap; + typedef std::map<sal_uInt32, sal_uInt32> DefaultFormatKeysMap; DefaultFormatKeysMap aDefaultFormatKeys; // Table of default standard to format keys SvNumberFormatTable* pFormatTable; // For the UI dialog SvNumberFormatterIndexTable* pMergeTable; // List of indices for merging two formatters @@ -913,8 +912,12 @@ private: sal_Int32 nCount, bool bCheckCorrectness = true ); - SVL_DLLPRIVATE SvNumberformat* GetFormatEntry(sal_uInt32 nKey); - SVL_DLLPRIVATE const SvNumberformat* GetFormatEntry(sal_uInt32 nKey) const; + // Obtain the format entry for a given key index. + SVL_DLLPRIVATE SvNumberformat* GetFormatEntry( sal_uInt32 nKey ); + SVL_DLLPRIVATE const SvNumberformat* GetFormatEntry( sal_uInt32 nKey ) const + { + return GetEntry( nKey); + } // used as a loop body inside of GetNewCurrencySymbolString() and GetCurrencyEntry() #ifndef DBG_UTIL @@ -1001,13 +1004,13 @@ public: inline sal_uInt32 SvNumberFormatter::GetMergeFmtIndex( sal_uInt32 nOldFmt ) const { - if (pMergeTable) - { - SvNumberFormatterIndexTable::iterator it = pMergeTable->find(nOldFmt); - if (it != pMergeTable->end()) - return it->second; - } - return nOldFmt; + if (pMergeTable) + { + SvNumberFormatterIndexTable::iterator it = pMergeTable->find(nOldFmt); + if (it != pMergeTable->end()) + return it->second; + } + return nOldFmt; } inline bool SvNumberFormatter::HasMergeFmtTbl() const |