1 // Copyright 2019 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef V8_CRDTP_JSON_PLATFORM_H_ 6 #define V8_CRDTP_JSON_PLATFORM_H_ 7 8 #include <string> 9 10 namespace v8_crdtp { 11 namespace json { 12 // These routines are implemented in json_platform.cc, or in a 13 // platform-dependent (code-base dependent) custom replacement. 14 // E.g., json_platform_chromium.cc, json_platform_v8.cc. 15 namespace platform { 16 // Parses |str| into |result|. Returns false iff there are 17 // leftover characters or parsing errors. 18 bool StrToD(const char* str, double* result); 19 20 // Prints |value| in a format suitable for JSON. 21 std::string DToStr(double value); 22 } // namespace platform 23 } // namespace json 24 } // namespace v8_crdtp 25 26 #endif // V8_CRDTP_JSON_PLATFORM_H_ 27