fix bug for negative shift value
[folly.git] / folly / dynamic.h
index ef4fdf682d6a792cb42447cada369eaa512295cf..cc75cdfaf9c6dd88bafde4e2faca17aa300fd771 100644 (file)
@@ -60,8 +60,7 @@
  * @author Jordan DeLong <delong.j@fb.com>
  */
 
-#ifndef FOLLY_DYNAMIC_H_
-#define FOLLY_DYNAMIC_H_
+#pragma once
 
 #include <cstdint>
 #include <initializer_list>
@@ -75,7 +74,6 @@
 
 #include <boost/operators.hpp>
 
-#include <folly/FBString.h>
 #include <folly/Range.h>
 #include <folly/Traits.h>
 
@@ -158,8 +156,7 @@ public:
   /* implicit */ dynamic(StringPiece val);
   /* implicit */ dynamic(char const* val);
   /* implicit */ dynamic(std::string const& val);
-  /* implicit */ dynamic(fbstring const& val);
-  /* implicit */ dynamic(fbstring&& val);
+  /* implicit */ dynamic(std::string&& val);
 
   /*
    * This is part of the plumbing for array() and object(), above.
@@ -182,7 +179,6 @@ public:
   FOLLY_DEPRECATED(
       "Initializer list syntax is deprecated (#10300209). Use dynamic::array.")
   /* implicit */ dynamic(std::initializer_list<dynamic> il);
-  dynamic(std::initializer_list<dynamic> il, PrivateTag);
   FOLLY_DEPRECATED(
       "Initializer list syntax is deprecated (#10300209). Use dynamic::array.")
   dynamic& operator=(std::initializer_list<dynamic> il);
@@ -292,7 +288,7 @@ public:
    * since arrays and objects are generally best dealt with as a
    * dynamic.
    */
-  fbstring asString() const;
+  std::string asString() const;
   double   asDouble() const;
   int64_t  asInt() const;
   bool     asBool() const;
@@ -302,15 +298,15 @@ public:
    *
    * These will throw a TypeError if the dynamic has a different type.
    */
-  const fbstring& getString() const&;
+  const std::string& getString() const&;
   double          getDouble() const&;
   int64_t         getInt() const&;
   bool            getBool() const&;
-  fbstring& getString() &;
+  std::string& getString() &;
   double&   getDouble() &;
   int64_t&  getInt() &;
   bool&     getBool() &;
-  fbstring getString() &&;
+  std::string getString() &&;
   double   getDouble() &&;
   int64_t  getInt() &&;
   bool     getBool() &&;
@@ -539,6 +535,8 @@ private:
   template<class T> struct GetAddrImpl;
   template<class T> struct PrintImpl;
 
+  dynamic(Array&& array, PrivateTag);
+
   template<class T> T const& get() const;
   template<class T> T&       get();
   template<class T> T*       get_nothrow() & noexcept;
@@ -567,7 +565,7 @@ private:
     bool boolean;
     double doubl;
     int64_t integer;
-    fbstring string;
+    std::string string;
 
     /*
      * Objects are placement new'd here.  We have to use a char buffer
@@ -588,5 +586,3 @@ private:
 }
 
 #include <folly/dynamic-inl.h>
-
-#endif