json_platform.h 822 B

1234567891011121314151617181920212223242526
  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. #ifndef CRDTP_JSON_PLATFORM_H_
  5. #define CRDTP_JSON_PLATFORM_H_
  6. #include <string>
  7. namespace crdtp {
  8. namespace json {
  9. // These routines are implemented in json_platform.cc, or in a
  10. // platform-dependent (code-base dependent) custom replacement.
  11. // E.g., json_platform_chromium.cc, json_platform_v8.cc.
  12. namespace platform {
  13. // Parses |str| into |result|. Returns false iff there are
  14. // leftover characters or parsing errors.
  15. bool StrToD(const char* str, double* result);
  16. // Prints |value| in a format suitable for JSON.
  17. std::string DToStr(double value);
  18. } // namespace platform
  19. } // namespace json
  20. } // namespace crdtp
  21. #endif // CRDTP_JSON_PLATFORM_H_