2017-03-31 17:56:23 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2017 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SKSL_STRING
|
|
|
|
#define SKSL_STRING
|
|
|
|
|
2022-03-18 20:40:58 +00:00
|
|
|
#include "include/core/SkTypes.h"
|
2021-03-04 19:30:25 +00:00
|
|
|
#include "include/private/SkSLDefines.h"
|
2022-03-18 20:40:58 +00:00
|
|
|
|
2017-09-11 13:42:09 +00:00
|
|
|
#include <stdarg.h>
|
2019-06-07 16:32:35 +00:00
|
|
|
#include <string>
|
2022-02-01 20:31:57 +00:00
|
|
|
#include <string_view>
|
2019-06-06 14:04:27 +00:00
|
|
|
|
2017-03-31 17:56:23 +00:00
|
|
|
namespace SkSL {
|
|
|
|
|
2022-02-01 20:31:57 +00:00
|
|
|
bool stod(std::string_view s, SKSL_FLOAT* value);
|
|
|
|
bool stoi(std::string_view s, SKSL_INT* value);
|
2017-03-31 17:56:23 +00:00
|
|
|
|
2022-02-02 21:51:18 +00:00
|
|
|
namespace String {
|
|
|
|
|
|
|
|
std::string printf(const char* fmt, ...) SK_PRINTF_LIKE(1, 2);
|
|
|
|
void appendf(std::string* str, const char* fmt, ...) SK_PRINTF_LIKE(2, 3);
|
2022-02-04 23:17:59 +00:00
|
|
|
void vappendf(std::string* str, const char* fmt, va_list va) SK_PRINTF_LIKE(2, 0);
|
2017-03-31 17:56:23 +00:00
|
|
|
|
2022-02-02 21:51:18 +00:00
|
|
|
} // namespace String
|
|
|
|
} // namespace SkSL
|
2017-03-31 17:56:23 +00:00
|
|
|
|
2022-02-02 14:41:04 +00:00
|
|
|
namespace skstd {
|
|
|
|
|
2022-02-03 21:53:32 +00:00
|
|
|
// We use a custom to_string(float|double) which ignores locale settings and writes `1.0` instead
|
|
|
|
// of `1.00000`.
|
|
|
|
std::string to_string(float value);
|
|
|
|
std::string to_string(double value);
|
2022-02-02 14:41:04 +00:00
|
|
|
|
|
|
|
} // namespace skstd
|
|
|
|
|
2017-03-31 17:56:23 +00:00
|
|
|
#endif
|