[poppler] goo/GooString.cc goo/GooString.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Mar 8 13:30:55 UTC 2022


 goo/GooString.cc |   17 ++++++++++++++---
 goo/GooString.h  |    6 +++++-
 2 files changed, 19 insertions(+), 4 deletions(-)

New commits:
commit 6e1fe42a6a3c3f7b7cfb259f7de3d8a1de279016
Author: Albert Astals Cid <aacid at kde.org>
Date:   Mon Mar 7 16:24:06 2022 +0100

    GooString: Add lowercase helpers for std::string

diff --git a/goo/GooString.cc b/goo/GooString.cc
index 54e8bc52..42436234 100644
--- a/goo/GooString.cc
+++ b/goo/GooString.cc
@@ -18,7 +18,7 @@
 // Copyright (C) 2006 Kristian Høgsberg <krh at redhat.com>
 // Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk at gmail.com>
 // Copyright (C) 2007 Jeff Muizelaar <jeff at infidigm.net>
-// Copyright (C) 2008-2011, 2016-2018, 2021 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2008-2011, 2016-2018, 2022 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2011 Kenji Uno <ku at digitaldolphins.jp>
 // Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso at hotmail.it>
 // Copyright (C) 2012, 2017 Adrian Johnson <ajohnson at redneon.com>
@@ -589,13 +589,24 @@ void formatDoubleSmallAware(double x, char *buf, int bufSize, int prec, bool tri
 
 GooString *GooString::lowerCase()
 {
-    for (auto &c : *this) {
+    lowerCase(*this);
+    return this;
+}
+
+void GooString::lowerCase(std::string &s)
+{
+    for (auto &c : s) {
         if (std::isupper(c)) {
             c = std::tolower(c);
         }
     }
+}
 
-    return this;
+std::string GooString::toLowerCase(const std::string &s)
+{
+    std::string newString = s;
+    lowerCase(newString);
+    return s;
 }
 
 void GooString::prependUnicodeMarker()
diff --git a/goo/GooString.h b/goo/GooString.h
index aa68635c..d6747f90 100644
--- a/goo/GooString.h
+++ b/goo/GooString.h
@@ -17,7 +17,7 @@
 //
 // Copyright (C) 2006 Kristian Høgsberg <krh at redhat.com>
 // Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk at gmail.com>
-// Copyright (C) 2008-2010, 2012, 2014, 2017-2021 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2008-2010, 2012, 2014, 2017-2022 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2012-2014 Fabio D'Urso <fabiodurso at hotmail.it>
 // Copyright (C) 2013 Jason Crain <jason at aquaticape.us>
 // Copyright (C) 2015, 2018 Adam Reichold <adam.reichold at t-online.de>
@@ -222,6 +222,10 @@ public:
 
     // Convert string to all-lower case.
     GooString *lowerCase();
+    static void lowerCase(std::string &s);
+
+    // Returns a new string converted to all-lower case.
+    static std::string toLowerCase(const std::string &s);
 
     // Compare two strings:  -1:<  0:=  +1:>
     int cmp(const GooString *str) const { return compare(*str); }


More information about the poppler mailing list