/*
- * Copyright 2014 Facebook, Inc.
+ * Copyright 2015 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#ifndef FOLLY_JSON_H_
#define FOLLY_JSON_H_
-#include "folly/dynamic.h"
-#include "folly/FBString.h"
-#include "folly/Range.h"
+#include <iosfwd>
+
+#include <folly/dynamic.h>
+#include <folly/FBString.h>
+#include <folly/Range.h>
namespace folly {
, sort_keys(false)
, skip_invalid_utf8(false)
, allow_nan_inf(false)
+ , double_mode(double_conversion::DoubleToStringConverter::SHORTEST)
+ , double_num_digits(0) // ignored when mode is SHORTEST
+ , double_fallback(false)
+ , parse_numbers_as_strings(false)
{}
// If true, keys in an object can be non-strings. (In strict
// true to allow NaN or INF values
bool allow_nan_inf;
+
+ // Options for how to print floating point values. See Conv.h
+ // toAppend implementation for floating point for more info
+ double_conversion::DoubleToStringConverter::DtoaMode double_mode;
+ unsigned int double_num_digits;
+
+ // Fallback to double when a value that looks like integer is too big to
+ // fit in an int64_t. Can result in loss a of precision.
+ bool double_fallback;
+
+ // Do not parse numbers. Instead, store them as strings and leave the
+ // conversion up to the user.
+ bool parse_numbers_as_strings;
};
/*
void escapeString(StringPiece input,
fbstring& out,
const serialization_opts& opts);
+
+ /*
+ * Strip all C99-like comments (i.e. // and / * ... * /)
+ */
+ fbstring stripComments(StringPiece jsonC);
}
//////////////////////////////////////////////////////////////////////
*/
fbstring toPrettyJson(dynamic const&);
+/*
+ * Printer for GTest.
+ * Uppercase name to fill GTest's API, which calls this method through ADL.
+ */
+void PrintTo(const dynamic&, std::ostream*);
//////////////////////////////////////////////////////////////////////
}