• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2017 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef SKSL_STRING
9 #define SKSL_STRING
10 
11 #include "include/private/SkSLDefines.h"
12 #include <cstring>
13 #include <stdarg.h>
14 #include <string>
15 #include <string_view>
16 
17 #ifndef SKSL_STANDALONE
18 #include "include/core/SkString.h"
19 #endif
20 
21 namespace SkSL {
22 
23 bool stod(std::string_view s, SKSL_FLOAT* value);
24 bool stoi(std::string_view s, SKSL_INT* value);
25 
26 namespace String {
27 
28 std::string printf(const char* fmt, ...) SK_PRINTF_LIKE(1, 2);
29 void appendf(std::string* str, const char* fmt, ...) SK_PRINTF_LIKE(2, 3);
30 void vappendf(std::string* str, const char* fmt, va_list va) SK_PRINTF_LIKE(2, 0);
31 
32 }  // namespace String
33 }  // namespace SkSL
34 
35 namespace skstd {
36 
37 // We use a custom to_string(float|double) which ignores locale settings and writes `1.0` instead
38 // of `1.00000`.
39 std::string to_string(float value);
40 std::string to_string(double value);
41 
42 }  // namespace skstd
43 
44 #endif
45