Kaydet (Commit) 0c13d0fb authored tarafından Eike Rathke's avatar Eike Rathke

Also EnglishKeywords is a NfKeywordTable, not just some vector

Change-Id: I0683fe5f7632e9941f347773c2679af82421bdc4
Reviewed-on: https://gerrit.libreoffice.org/46455Reviewed-by: 's avatarEike Rathke <erack@redhat.com>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst 700e1e7f
...@@ -111,9 +111,15 @@ class NfKeywordTable final ...@@ -111,9 +111,15 @@ class NfKeywordTable final
public: public:
NfKeywordTable() : m_keywords(NF_KEYWORD_ENTRIES_COUNT) {}; NfKeywordTable() : m_keywords(NF_KEYWORD_ENTRIES_COUNT) {};
NfKeywordTable( const std::initializer_list<OUString> & l ) : m_keywords(l)
{
assert(m_keywords.size() == NF_KEYWORD_ENTRIES_COUNT);
}
OUString & operator[] (Keywords_t::size_type n) { return m_keywords[n]; } OUString & operator[] (Keywords_t::size_type n) { return m_keywords[n]; }
const OUString & operator[] (Keywords_t::size_type n) const { return m_keywords[n]; } const OUString & operator[] (Keywords_t::size_type n) const { return m_keywords[n]; }
Keywords_t::size_type size() const { return m_keywords.size(); }
}; };
#endif // INCLUDED_SVL_NFKEYTAB_HXX #endif // INCLUDED_SVL_NFKEYTAB_HXX
......
...@@ -822,7 +822,7 @@ public: ...@@ -822,7 +822,7 @@ public:
const NfKeywordTable & GetKeywords( sal_uInt32 nKey ); const NfKeywordTable & GetKeywords( sal_uInt32 nKey );
/** Access for unit tests. */ /** Access for unit tests. */
const std::vector<OUString> & GetEnglishKeywords() const; const NfKeywordTable & GetEnglishKeywords() const;
/** Access for unit tests. */ /** Access for unit tests. */
const std::vector<Color> & GetStandardColors() const; const std::vector<Color> & GetStandardColors() const;
......
...@@ -1393,7 +1393,7 @@ void Test::testUserDefinedNumberFormats() ...@@ -1393,7 +1393,7 @@ void Test::testUserDefinedNumberFormats()
void Test::testNfEnglishKeywordsIntegrity() void Test::testNfEnglishKeywordsIntegrity()
{ {
SvNumberFormatter aFormatter(m_xContext, LANGUAGE_ENGLISH_US); SvNumberFormatter aFormatter(m_xContext, LANGUAGE_ENGLISH_US);
const ::std::vector<OUString> & rEnglishKeywords = aFormatter.GetEnglishKeywords(); const NfKeywordTable& rEnglishKeywords = aFormatter.GetEnglishKeywords();
const NfKeywordTable& sKeywords = aFormatter.GetKeywords(0); const NfKeywordTable& sKeywords = aFormatter.GetKeywords(0);
CPPUNIT_ASSERT_EQUAL( size_t(NF_KEYWORD_ENTRIES_COUNT), rEnglishKeywords.size() ); CPPUNIT_ASSERT_EQUAL( size_t(NF_KEYWORD_ENTRIES_COUNT), rEnglishKeywords.size() );
for (size_t i = 0; i < size_t(NF_KEYWORD_ENTRIES_COUNT); ++i) for (size_t i = 0; i < size_t(NF_KEYWORD_ENTRIES_COUNT); ++i)
...@@ -1478,7 +1478,7 @@ void Test::testStandardColorIntegrity() ...@@ -1478,7 +1478,7 @@ void Test::testStandardColorIntegrity()
void Test::testColorNamesConversion() void Test::testColorNamesConversion()
{ {
SvNumberFormatter aFormatter(m_xContext, LANGUAGE_GERMAN); SvNumberFormatter aFormatter(m_xContext, LANGUAGE_GERMAN);
const ::std::vector<OUString> & rEnglishKeywords = aFormatter.GetEnglishKeywords(); const NfKeywordTable& rEnglishKeywords = aFormatter.GetEnglishKeywords();
const NfKeywordTable& rKeywords = aFormatter.GetKeywords(0); const NfKeywordTable& rKeywords = aFormatter.GetKeywords(0);
// Holding a reference to the NfKeywordTable doesn't help if we switch // Holding a reference to the NfKeywordTable doesn't help if we switch
......
...@@ -4628,7 +4628,7 @@ const NfKeywordTable & SvNumberFormatter::GetKeywords( sal_uInt32 nKey ) ...@@ -4628,7 +4628,7 @@ const NfKeywordTable & SvNumberFormatter::GetKeywords( sal_uInt32 nKey )
return pFormatScanner->GetKeywords(); return pFormatScanner->GetKeywords();
} }
const std::vector<OUString> & SvNumberFormatter::GetEnglishKeywords() const const NfKeywordTable & SvNumberFormatter::GetEnglishKeywords() const
{ {
return ImpSvNumberformatScan::GetEnglishKeywords(); return ImpSvNumberformatScan::GetEnglishKeywords();
} }
......
...@@ -39,9 +39,9 @@ using namespace svt; ...@@ -39,9 +39,9 @@ using namespace svt;
const sal_Unicode cNoBreakSpace = 0xA0; const sal_Unicode cNoBreakSpace = 0xA0;
const sal_Unicode cNarrowNoBreakSpace = 0x202F; const sal_Unicode cNarrowNoBreakSpace = 0x202F;
const ::std::vector<OUString> ImpSvNumberformatScan::sEnglishKeyword = const NfKeywordTable ImpSvNumberformatScan::sEnglishKeyword =
{ // Syntax keywords in English (USA) { // Syntax keywords in English (USA)
//! All keywords MUST be UPPERCASE! In same order as NfKeywordTable //! All keywords MUST be UPPERCASE! In same order as NfKeywordIndex
"", // NF_KEY_NONE 0 "", // NF_KEY_NONE 0
"E", // NF_KEY_E Exponent "E", // NF_KEY_E Exponent
"AM/PM", // NF_KEY_AMPM AM/PM "AM/PM", // NF_KEY_AMPM AM/PM
......
...@@ -74,7 +74,7 @@ public: ...@@ -74,7 +74,7 @@ public:
return sKeyword; return sKeyword;
} }
static const ::std::vector<OUString> & GetEnglishKeywords() static const NfKeywordTable & GetEnglishKeywords()
{ {
return sEnglishKeyword; return sEnglishKeyword;
} }
...@@ -172,7 +172,7 @@ public: ...@@ -172,7 +172,7 @@ public:
private: // Private section private: // Private section
NfKeywordTable sKeyword; // Syntax keywords NfKeywordTable sKeyword; // Syntax keywords
static const ::std::vector<OUString> sEnglishKeyword; // English Syntax keywords static const NfKeywordTable sEnglishKeyword; // English Syntax keywords
static ::std::vector<Color> StandardColor; // Standard color array static ::std::vector<Color> StandardColor; // Standard color array
static bool bStandardColorNeedInitialization; // initialize Standard color array static bool bStandardColorNeedInitialization; // initialize Standard color array
static ::std::vector<OUString> sGermanColorNames; // German color names array static ::std::vector<OUString> sGermanColorNames; // German color names array
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment