diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-12-11 17:44:34 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-12-11 21:25:10 +0100 |
commit | 35e471bb4d1388cf5afcdcee214cf5111edf44e3 (patch) | |
tree | bb78f4f13f131f0cb206a9707cc3cfc495a3876a /i18npool/source/localedata/LocaleNode.cxx | |
parent | 0c06e77c122f10a1842bc908bd6e25b1110ddbd2 (diff) |
Adapt the remaining OUString functions to std string_view
...for LIBO_INTERNAL_ONLY. These had been missed by
1b43cceaea2084a0489db68cd0113508f34b6643 "Make many OUString functions take
std::u16string_view parameters" because they did not match the multi-overload
pattern that was addressed there, but they nevertheless benefit from being
changed just as well (witness e.g. the various resulting changes from copy() to
subView()).
This showed a conversion from OStringChar to std::string_view to be missing
(while the corresponding conversion form OUStringChar to std::u16string_view was
already present).
The improvement to loplugin:stringadd became necessary to fix
> [CPT] compilerplugins/clang/test/stringadd.cxx
> error: 'error' diagnostics expected but not seen:
> File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 43 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:42): simplify by merging with the preceding assignment [loplugin:stringadd]
> File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 61 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:60): simplify by merging with the preceding assignment [loplugin:stringadd]
> 2 errors generated.
Change-Id: Ie40de0616a66e60e289c1af0ca60aed6f9ecc279
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107602
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'i18npool/source/localedata/LocaleNode.cxx')
-rw-r--r-- | i18npool/source/localedata/LocaleNode.cxx | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx index 997355ffab4e..3040f3312d42 100644 --- a/i18npool/source/localedata/LocaleNode.cxx +++ b/i18npool/source/localedata/LocaleNode.cxx @@ -201,7 +201,7 @@ void LocaleNode::incError( const char* pStr ) const fprintf( stderr, "Error: %s\n", pStr); } -void LocaleNode::incError( const OUString& rStr ) const +void LocaleNode::incError( std::u16string_view rStr ) const { incError( OSTR( rStr)); } @@ -212,13 +212,13 @@ void LocaleNode::incErrorInt( const char* pStr, int nVal ) const fprintf( stderr, pStr, nVal); } -void LocaleNode::incErrorStr( const char* pStr, const OUString& rVal ) const +void LocaleNode::incErrorStr( const char* pStr, std::u16string_view rVal ) const { ++nError; fprintf( stderr, pStr, OSTR( rVal)); } -void LocaleNode::incErrorStrStr( const char* pStr, const OUString& rVal1, const OUString& rVal2 ) const +void LocaleNode::incErrorStrStr( const char* pStr, std::u16string_view rVal1, std::u16string_view rVal2 ) const { ++nError; fprintf(stderr, pStr, OSTR(rVal1), OSTR(rVal2)); @@ -1526,8 +1526,8 @@ static void lcl_writeAbbrFullNarrArrays( const OFileWriter & of, sal_Int16 nCoun } } -bool LCCalendarNode::expectedCalendarElement( const OUString& rName, - const LocaleNode* pNode, sal_Int16 nChild, const OUString& rCalendarID ) const +bool LCCalendarNode::expectedCalendarElement( std::u16string_view rName, + const LocaleNode* pNode, sal_Int16 nChild, std::u16string_view rCalendarID ) const { bool bFound = true; if (nChild >= 0) @@ -1734,7 +1734,7 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const } else { if (erasNode == nullptr) erasNode = calNode -> getChildAt(nChild); - if (!expectedCalendarElement("Eras", erasNode, -1, calendarID)) + if (!expectedCalendarElement(u"Eras", erasNode, -1, calendarID)) { --nChild; } @@ -1746,7 +1746,7 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const elementTag = "era"; for (j = 0; j < nbOfEras[i]; j++) { LocaleNode *currNode = erasNode -> getChildAt(j); - if (!expectedCalendarElement("Era", currNode, -1, calendarID)) + if (!expectedCalendarElement(u"Era", currNode, -1, calendarID)) { continue; // for } @@ -1764,7 +1764,7 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const } ++nChild; - if (expectedCalendarElement("StartDayOfWeek", calNode, nChild, calendarID)) + if (expectedCalendarElement(u"StartDayOfWeek", calNode, nChild, calendarID)) { str = calNode->getChildAt(nChild)->getChildAt(0)->getValue(); if (nbOfDays[i]) @@ -1783,7 +1783,7 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const ++nChild; } - if (expectedCalendarElement("MinimalDaysInFirstWeek", calNode, nChild, calendarID)) + if (expectedCalendarElement(u"MinimalDaysInFirstWeek", calNode, nChild, calendarID)) { str = calNode ->getChildAt(nChild)-> getValue(); sal_Int16 nDays = sal::static_int_cast<sal_Int16>( str.toInt32() ); |