/*
- * 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.
template<class Iterator> dynamic(Iterator first, Iterator last);
dynamic(dynamic const&);
- dynamic(dynamic&&);
- ~dynamic();
+ dynamic(dynamic&&) noexcept;
+ ~dynamic() noexcept;
/*
* "Deep" equality comparison. This will compare all the way down
* Basic guarantee only.
*/
dynamic& operator=(dynamic const&);
- dynamic& operator=(dynamic&&);
+ dynamic& operator=(dynamic&&) noexcept;
/*
* For simple dynamics (not arrays or objects), this prints the
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
template<class T> T const& get() const;
template<class T> T& get();
- template<class T> T* get_nothrow();
- template<class T> T const* get_nothrow() const;
- template<class T> T* getAddress();
- template<class T> T const* getAddress() const;
+ template<class T> T* get_nothrow() noexcept;
+ template<class T> T const* get_nothrow() const noexcept;
+ template<class T> T* getAddress() noexcept;
+ template<class T> T const* getAddress() const noexcept;
template<class T> T asImpl() const;
static char const* typeName(Type);
- void destroy();
+ void destroy() noexcept;
void print(std::ostream&) const;
void print_as_pseudo_json(std::ostream&) const; // see json.cpp