jmarantz commented on a change in pull request #1935: [WIP] Bazel build system
URL: 
https://github.com/apache/incubator-pagespeed-mod/pull/1935#discussion_r308244482
 
 

 ##########
 File path: pagespeed/kernel/base/string_util.h
 ##########
 @@ -17,48 +17,182 @@
  * under the License.
  */
 
-
 #ifndef PAGESPEED_KERNEL_BASE_STRING_UTIL_H_
 #define PAGESPEED_KERNEL_BASE_STRING_UTIL_H_
 
-#include <cctype>                      // for isascii
+#include <cctype> // for isascii
 #include <cstddef>
 #include <map>
 #include <set>
 #include <vector>
 
-#include "base/logging.h"
+#include <iostream>
+
+#include "absl/strings/numbers.h"
+#include "absl/strings/str_cat.h"
+#include "absl/strings/string_view.h"
+// XXX(oschaaf): internal util
+#include "absl/strings/internal/memutil.h"
+#include "absl/strings/match.h"
+
+//#include "base/logging.h"
 #include "pagespeed/kernel/base/basictypes.h"
 #include "pagespeed/kernel/base/string.h"
 
+#include "fmt/printf.h"
 
-#include <cstdlib>  // NOLINT
+#include <cstdlib> // NOLINT
 #include <string>  // NOLINT
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/string_piece.h"
-#include "base/strings/string_util.h"
-#include "base/strings/stringprintf.h"
 
-using base::StringAppendF;
-using base::StringAppendV;
-using base::SStringPrintf;
-using base::StringPiece;
-using base::StringPrintf;
+static const int32 kint32max = 0x7FFFFFFF;
+static const int32 kint32min = -kint32max - 1;
+
+using namespace absl;
+
+class StringPiece : public string_view {
+public:
+  StringPiece(const absl::string_view& s) : absl::string_view(s) {}
+  StringPiece(const GoogleString& s) : absl::string_view(s.data(), s.size()) {}
+
+  using string_view::string_view;
+  void CopyToString(GoogleString* dest) const {
+    *dest = std::string(*this);
+  }
+  void AppendToString(GoogleString* dest) const {
+    (*dest).append(std::string(*this));
+  }
+  GoogleString as_string() const {
+    return std::string(*this);
+  }
+
+  bool starts_with(StringPiece prefix) const {
+    return absl::StartsWith(*this, prefix);
+  }
+
+  bool ends_with(StringPiece postfix) const {
+    return absl::EndsWith(*this, postfix);
+  }
+
+  void set(StringPiece newvalue, uint32_t size) {
+    absl::string_view tmp(newvalue.data(), size);
 
 Review comment:
   can assign to *this.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to