diagnostic_writer.h 902 B

1234567891011121314151617181920212223242526272829
  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 COMPONENTS_CBOR_DIAGNOSTIC_WRITER_H_
  5. #define COMPONENTS_CBOR_DIAGNOSTIC_WRITER_H_
  6. #include <string>
  7. #include "components/cbor/cbor_export.h"
  8. namespace cbor {
  9. class Value;
  10. class CBOR_EXPORT DiagnosticWriter {
  11. public:
  12. // Write converts the given CBOR value to a compact string, following the
  13. // "Diagnostic Notation" format for CBOR
  14. // (https://tools.ietf.org/html/rfc7049#section-6). |rough_max_output_bytes|
  15. // provides a loose upper bound on the size of the result and the result may
  16. // be truncated if it exceeds this size.
  17. static std::string Write(const Value& node,
  18. size_t rough_max_output_bytes = 4096);
  19. };
  20. } // namespace cbor
  21. #endif // COMPONENTS_CBOR_DIAGNOSTIC_WRITER_H_