diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2016-11-17 16:13:37 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-11-18 14:34:08 +0000 |
commit | d8df21a1e08b5b3380261f4b90acfbdc538ef93c (patch) | |
tree | d0d9454eec7c469335c40938aa497c055f89297b /src/sksl/SkSLUtil.h | |
parent | 833dcf48844dd053ddf7ecea20e3e1c2b6b47e01 (diff) |
switched skslc from std::string to SkString
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4977
Change-Id: I15e24963b09b719a2c07da67745114f5ac66cee8
Reviewed-on: https://skia-review.googlesource.com/4977
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/sksl/SkSLUtil.h')
-rw-r--r-- | src/sksl/SkSLUtil.h | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/src/sksl/SkSLUtil.h b/src/sksl/SkSLUtil.h index ede21830e5..ad8287e39f 100644 --- a/src/sksl/SkSLUtil.h +++ b/src/sksl/SkSLUtil.h @@ -8,12 +8,12 @@ #ifndef SKSL_UTIL #define SKSL_UTIL -#include <iomanip> -#include <string> -#include <sstream> #include "stdlib.h" #include "assert.h" +#include "SkOpts.h" #include "SkRefCnt.h" +#include "SkStream.h" +#include "SkString.h" #include "SkTypes.h" #include "glsl/GrGLSLCaps.h" #include "GrContextOptions.h" @@ -73,40 +73,47 @@ public: } }; -// our own definitions of certain std:: functions, because they are not always present on Android +void write_data(const SkData& d, SkWStream& out); -std::string to_string(double value); +SkString operator+(const SkString& s, const char* c); -std::string to_string(int32_t value); +SkString operator+(const char* c, const SkString& s); -std::string to_string(uint32_t value); +SkString operator+(const SkString& s1, const SkString& s2); -std::string to_string(int64_t value); +bool operator==(const SkString& s1, const char* s2); -std::string to_string(uint64_t value); +bool operator!=(const SkString& s1, const char* s2); + +bool operator!=(const char* s1, const SkString& s2); + +SkString to_string(double value); + +SkString to_string(int32_t value); + +SkString to_string(uint32_t value); + +SkString to_string(int64_t value); + +SkString to_string(uint64_t value); #if _MSC_VER #define NORETURN __declspec(noreturn) #else #define NORETURN __attribute__((__noreturn__)) #endif -int stoi(std::string s); +int stoi(SkString s); -double stod(std::string s); +double stod(SkString s); -long stol(std::string s); +long stol(SkString s); NORETURN void sksl_abort(); } // namespace -#ifdef DEBUG -#define ASSERT(x) assert(x) -#define ASSERT_RESULT(x) ASSERT(x); -#else -#define ASSERT(x) -#define ASSERT_RESULT(x) x -#endif +#define ASSERT(x) SkASSERT(x) +#define ASSERT_RESULT(x) SkAssertResult(x); #ifdef SKIA #define ABORT(...) { SkDebugf(__VA_ARGS__); sksl_abort(); } @@ -114,4 +121,11 @@ NORETURN void sksl_abort(); #define ABORT(...) { sksl_abort(); } #endif +namespace std { + template<> struct hash<SkString> { + size_t operator()(const SkString& s) const { + return SkOpts::hash_fn(s.c_str(), s.size(), 0); + } + }; +} #endif |