summaryrefslogtreecommitdiff
path: root/sax
diff options
context:
space:
mode:
authorBayram Çiçek <bayram.cicek@libreoffice.org>2023-04-11 22:46:12 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-04-12 14:45:51 +0200
commit9bee4cec215e2694f6e6e1aa4a463b47b69cc1ff (patch)
tree27a2a45db974d37f315259394dbcb146df8f3f50 /sax
parent0c5c1e831aaf139379134fee63797f02ca5a75e5 (diff)
tdf#39593: remove trim(), use o3tl::trim() instead
trim(std::u16string_view in) and trim(std::string_view in) functions were removed and replaced with o3tl::trim(rString) function Change-Id: I29b2274422dbfe9dc26177c3e1dbf20786c811d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150245 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sax')
-rw-r--r--sax/source/tools/converter.cxx34
1 files changed, 4 insertions, 30 deletions
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index e9ef4494c5de..818d04a9bd1a 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -913,32 +913,6 @@ void Converter::convertDuration(OUStringBuffer& rBuffer,
rBuffer.append( 'S');
}
-static std::u16string_view trim(std::u16string_view in) {
- auto left = in.begin();
- for (;; ++left) {
- if (left == in.end())
- return std::u16string_view();
- if (!isspace(*left))
- break;
- }
- auto right = in.end() - 1;
- for (; right > left && isspace(*right); --right);
- return std::u16string_view(&*left, std::distance(left, right) + 1);
-}
-
-static std::string_view trim(std::string_view in) {
- auto left = in.begin();
- for (;; ++left) {
- if (left == in.end())
- return std::string_view();
- if (!isspace(*left))
- break;
- }
- auto right = in.end() - 1;
- for (; right > left && isspace(*right); --right);
- return std::string_view(&*left, std::distance(left, right) + 1);
-}
-
/** helper function of Converter::convertDuration */
template<typename V>
static bool convertDurationHelper(double& rfTime, V pStr)
@@ -1068,7 +1042,7 @@ static bool convertDurationHelper(double& rfTime, V pStr)
bool Converter::convertDuration(double& rfTime,
std::string_view rString)
{
- std::string_view aTrimmed = trim(rString);
+ std::string_view aTrimmed = o3tl::trim(rString);
const char* pStr = aTrimmed.data();
return convertDurationHelper(rfTime, pStr);
@@ -1429,14 +1403,14 @@ static bool convertDurationHelper(util::Duration& rDuration, V string)
bool Converter::convertDuration(util::Duration& rDuration,
std::u16string_view rString)
{
- return convertDurationHelper(rDuration, trim(rString));
+ return convertDurationHelper(rDuration, o3tl::trim(rString));
}
/** convert ISO8601 "duration" string to util::Duration */
bool Converter::convertDuration(util::Duration& rDuration,
std::string_view rString)
{
- return convertDurationHelper(rDuration, trim(rString));
+ return convertDurationHelper(rDuration, o3tl::trim(rString));
}
static void
@@ -1824,7 +1798,7 @@ static bool lcl_parseDateTime(
{
bool bSuccess = true;
- string = trim(string);
+ string = o3tl::trim(string);
bool isNegative(false);
sal_Int32 nYear(0);