Split get_default() into two for deferred default construction and added forwarding...
[folly.git] / folly / json.cpp
index ae2f2937ff95d52bd95fb37f74267f8955e7b737..029278e245f5a16b506a21a8e93e9d64a8a4ff00 100644 (file)
@@ -85,7 +85,7 @@ struct Printer {
     }
   }
 
-private:
+ private:
   void printKV(const std::pair<const dynamic, dynamic>& p) const {
     if (!opts_.allow_non_string_keys && !p.first.isString()) {
       throw std::runtime_error("folly::toJson: JSON object key was not a "
@@ -156,7 +156,7 @@ private:
     out_ += ']';
   }
 
-private:
+ private:
   void outdent() const {
     if (indentLevel_) {
       --*indentLevel_;
@@ -179,10 +179,10 @@ private:
     out_ += indentLevel_ ? " : " : ":";
   }
 
-private:
- std::string& out_;
- unsigned* const indentLevel_;
- serialization_opts const& opts_;
+ private:
 std::string& out_;
 unsigned* const indentLevel_;
 serialization_opts const& opts_;
 };
 
 //////////////////////////////////////////////////////////////////////
@@ -217,7 +217,7 @@ struct Input {
 
   // Parse ahead for as long as the supplied predicate is satisfied,
   // returning a range of what was skipped.
-  template<class Predicate>
+  template <class Predicate>
   StringPiece skipWhile(const Predicate& p) {
     std::size_t skipped = 0;
     for (; skipped < range_.size(); ++skipped) {
@@ -273,7 +273,7 @@ struct Input {
     storeCurrent();
   }
 
-  template<class T>
+  template <class T>
   T extract() {
     try {
       return to<T>(&range_);
@@ -319,7 +319,7 @@ struct Input {
     current_ = range_.empty() ? EOF : range_.front();
   }
 
-private:
+ private:
   StringPiece range_;
   json::serialization_opts const& opts_;
   unsigned lineNum_;
@@ -597,7 +597,7 @@ dynamic parseValue(Input& in) {
          in.error("expected json value");
 }
 
-}
+} // namespace
 
 //////////////////////////////////////////////////////////////////////
 
@@ -615,8 +615,8 @@ std::string serialize(dynamic const& dyn, serialization_opts const& opts) {
 template <class T>
 size_t firstEscapableInWord(T s) {
   static_assert(std::is_unsigned<T>::value, "Unsigned integer required");
-  constexpr T kOnes = ~T() / 255; // 0x...0101
-  constexpr T kMsbs = kOnes * 0x80; // 0x...8080
+  static constexpr T kOnes = ~T() / 255; // 0x...0101
+  static constexpr T kMsbs = kOnes * 0x80; // 0x...8080
 
   // Sets the MSB of bytes < b. Precondition: b < 128.
   auto isLess = [](T w, uint8_t b) {
@@ -813,7 +813,7 @@ std::string stripComments(StringPiece jsonC) {
   return result;
 }
 
-}
+} // namespace json
 
 //////////////////////////////////////////////////////////////////////
 
@@ -868,4 +868,4 @@ void PrintTo(const dynamic& dyn, std::ostream* os) {
 
 //////////////////////////////////////////////////////////////////////
 
-}
+} // namespace folly