#ifndef FOLLY_DYNAMIC_H_
#define FOLLY_DYNAMIC_H_
-#include <unordered_map>
+#include <cstdint>
+#include <initializer_list>
#include <memory>
-#include <string>
-#include <utility>
#include <ostream>
+#include <string>
#include <type_traits>
-#include <initializer_list>
+#include <unordered_map>
+#include <utility>
#include <vector>
-#include <cstdint>
+
#include <boost/operators.hpp>
-#include "folly/Traits.h"
-#include "folly/FBString.h"
+#include <folly/FBString.h>
+#include <folly/Range.h>
+#include <folly/Traits.h>
namespace folly {
/*
* String compatibility constructors.
*/
+ /* implicit */ dynamic(StringPiece val);
/* implicit */ dynamic(char const* val);
/* implicit */ dynamic(std::string const& val);
+ /* implicit */ dynamic(fbstring const& val);
+ /* implicit */ dynamic(fbstring&& val);
/*
* This is part of the plumbing for object(), above. Used to create
int64_t asInt() const;
bool asBool() const;
+ /*
+ * Extract the value stored in this dynamic without type conversion.
+ *
+ * These will throw a TypeError if the dynamic has a different type.
+ */
+ const fbstring& getString() const;
+ double getDouble() const;
+ int64_t getInt() const;
+ bool getBool() const;
+ fbstring& getString();
+ double& getDouble();
+ int64_t& getInt();
+ bool& getBool();
+
/*
* It is occasionally useful to access a string's internal pointer
* directly, without the type conversion of `asString()`.
*/
const char* data() const;
const char* c_str() const;
+ StringPiece stringPiece() const;
/*
* Returns: true if this dynamic is null, an empty array, an empty
*/
const_item_iterator find(dynamic const&) const;
-
/*
* If this is an object, returns whether it contains a field with
* the given name. Otherwise throws TypeError.
}
-#include "folly/dynamic-inl.h"
+#include <folly/dynamic-inl.h>
#endif