proxygen
dynamic.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011-present Facebook, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
53 #pragma once
54 
55 #include <cstdint>
56 #include <memory>
57 #include <ostream>
58 #include <string>
59 #include <type_traits>
60 #include <utility>
61 #include <vector>
62 
63 #include <boost/operators.hpp>
64 
65 #include <folly/Range.h>
66 #include <folly/Traits.h>
67 #include <folly/container/F14Map.h>
68 #include <folly/json_pointer.h>
69 
70 namespace folly {
71 
73 
74 struct dynamic;
75 struct TypeError;
76 
78 
79 struct dynamic : private boost::operators<dynamic> {
80  enum Type {
88  };
89  template <class T, class Enable = void>
91 
92  /*
93  * We support direct iteration of arrays, and indirect iteration of objects.
94  * See begin(), end(), keys(), values(), and items() for more.
95  *
96  * Array iterators dereference as the elements in the array.
97  * Object key iterators dereference as the keys in the object.
98  * Object value iterators dereference as the values in the object.
99  * Object item iterators dereference as pairs of (key, value).
100  */
101  private:
102  typedef std::vector<dynamic> Array;
103 
104  /*
105  * Violating spec, std::vector<bool>::const_reference is not bool in libcpp:
106  * http://howardhinnant.github.io/onvectorbool.html
107  *
108  * This is used to add a public ctor which is only enabled under libcpp taking
109  * std::vector<bool>::const_reference without using the preprocessor.
110  */
112  using VectorBoolConstRefCtorType = std::conditional_t<
113  std::is_same<std::vector<bool>::const_reference, bool>::value,
115  std::vector<bool>::const_reference>;
116 
117  public:
118  typedef Array::iterator iterator;
119  typedef Array::const_iterator const_iterator;
121 
122  struct const_key_iterator;
123  struct const_value_iterator;
124  struct const_item_iterator;
125 
126  struct value_iterator;
127  struct item_iterator;
128 
129  /*
130  * Creation routines for making dynamic objects and arrays. Objects
131  * are maps from key to value (so named due to json-related origins
132  * here).
133  *
134  * Example:
135  *
136  * // Make a fairly complex dynamic:
137  * dynamic d = dynamic::object("key", "value1")
138  * ("key2", dynamic::array("value",
139  * "with",
140  * 4,
141  * "words"));
142  *
143  * // Build an object in a few steps:
144  * dynamic d = dynamic::object;
145  * d["key"] = 12;
146  * d["something_else"] = dynamic::array(1, 2, 3, nullptr);
147  */
148  private:
149  struct EmptyArrayTag {};
150  struct ObjectMaker;
151 
152  public:
153  static void array(EmptyArrayTag);
154  template <class... Args>
155  static dynamic array(Args&&... args);
156 
157  static ObjectMaker object();
159 
163  dynamic();
164 
165  /*
166  * String compatibility constructors.
167  */
168  /* implicit */ dynamic(std::nullptr_t);
169  /* implicit */ dynamic(StringPiece val);
170  /* implicit */ dynamic(char const* val);
171  /* implicit */ dynamic(std::string val);
172 
173  /*
174  * This is part of the plumbing for array() and object(), above.
175  * Used to create a new array or object dynamic.
176  */
177  /* implicit */ dynamic(void (*)(EmptyArrayTag));
178  /* implicit */ dynamic(ObjectMaker (*)());
179  /* implicit */ dynamic(ObjectMaker const&) = delete;
180  /* implicit */ dynamic(ObjectMaker&&);
181 
182  /*
183  * Constructors for integral and float types.
184  * Other types are SFINAEd out with NumericTypeHelper.
185  */
187  /* implicit */ dynamic(T t);
188 
189  /*
190  * If v is vector<bool>, v[idx] is a proxy object implicitly convertible to
191  * bool. Calling a function f(dynamic) with f(v[idx]) would require a double
192  * implicit conversion (reference -> bool -> dynamic) which is not allowed,
193  * hence we explicitly accept the reference proxy.
194  */
195  /* implicit */ dynamic(std::vector<bool>::reference val);
196  /* implicit */ dynamic(VectorBoolConstRefCtorType val);
197 
198  /*
199  * Create a dynamic that is an array of the values from the supplied
200  * iterator range.
201  */
202  template <class Iterator>
203  explicit dynamic(Iterator first, Iterator last);
204 
205  dynamic(dynamic const&);
206  dynamic(dynamic&&) noexcept;
207  ~dynamic() noexcept;
208 
209  /*
210  * "Deep" equality comparison. This will compare all the way down
211  * an object or array, and is potentially expensive.
212  */
213  bool operator==(dynamic const& o) const;
214 
215  /*
216  * For all types except object this returns the natural ordering on
217  * those types. For objects, we throw TypeError.
218  */
219  bool operator<(dynamic const& o) const;
220 
221  /*
222  * General operators.
223  *
224  * These throw TypeError when used with types or type combinations
225  * that don't support them.
226  *
227  * These functions may also throw if you use 64-bit integers with
228  * doubles when the integers are too big to fit in a double.
229  */
230  dynamic& operator+=(dynamic const&);
231  dynamic& operator-=(dynamic const&);
232  dynamic& operator*=(dynamic const&);
233  dynamic& operator/=(dynamic const&);
234  dynamic& operator%=(dynamic const&);
235  dynamic& operator|=(dynamic const&);
236  dynamic& operator&=(dynamic const&);
237  dynamic& operator^=(dynamic const&);
238  dynamic& operator++();
239  dynamic& operator--();
240 
241  /*
242  * Assignment from other dynamics. Because of the implicit conversion
243  * to dynamic from its potential types, you can use this to change the
244  * type pretty intuitively.
245  *
246  * Basic guarantee only.
247  */
248  dynamic& operator=(dynamic const&);
249  dynamic& operator=(dynamic&&) noexcept;
250 
251  /*
252  * For simple dynamics (not arrays or objects), this prints the
253  * value to an std::ostream in the expected way. Respects the
254  * formatting manipulators that have been sent to the stream
255  * already.
256  *
257  * If the dynamic holds an object or array, this prints them in a
258  * format very similar to JSON. (It will in fact actually be JSON
259  * as long as the dynamic validly represents a JSON object---i.e. it
260  * can't have non-string keys.)
261  */
262  friend std::ostream& operator<<(std::ostream&, dynamic const&);
263 
264  /*
265  * Returns true if this dynamic is of the specified type.
266  */
267  bool isString() const;
268  bool isObject() const;
269  bool isBool() const;
270  bool isNull() const;
271  bool isArray() const;
272  bool isDouble() const;
273  bool isInt() const;
274 
275  /*
276  * Returns: isInt() || isDouble().
277  */
278  bool isNumber() const;
279 
280  /*
281  * Returns the type of this dynamic.
282  */
283  Type type() const;
284 
285  /*
286  * Returns the type of this dynamic as a printable string.
287  */
288  const char* typeName() const;
289 
290  /*
291  * Extract a value while trying to convert to the specified type.
292  * Throws exceptions if we cannot convert from the real type to the
293  * requested type.
294  *
295  * Note you can only use this to access integral types or strings,
296  * since arrays and objects are generally best dealt with as a
297  * dynamic.
298  */
299  std::string asString() const;
300  double asDouble() const;
301  int64_t asInt() const;
302  bool asBool() const;
303 
304  /*
305  * Extract the value stored in this dynamic without type conversion.
306  *
307  * These will throw a TypeError if the dynamic has a different type.
308  */
309  const std::string& getString() const&;
310  double getDouble() const&;
311  int64_t getInt() const&;
312  bool getBool() const&;
313  std::string& getString() &;
314  double& getDouble() &;
315  int64_t& getInt() &;
316  bool& getBool() &;
317  std::string&& getString() &&;
318  double getDouble() &&;
319  int64_t getInt() &&;
320  bool getBool() &&;
321 
322  /*
323  * It is occasionally useful to access a string's internal pointer
324  * directly, without the type conversion of `asString()`.
325  *
326  * These will throw a TypeError if the dynamic is not a string.
327  */
328  const char* data() const&;
329  const char* data() && = delete;
330  const char* c_str() const&;
331  const char* c_str() && = delete;
332  StringPiece stringPiece() const;
333 
334  /*
335  * Returns: true if this dynamic is null, an empty array, an empty
336  * object, or an empty string.
337  */
338  bool empty() const;
339 
340  /*
341  * If this is an array or an object, returns the number of elements
342  * contained. If it is a string, returns the length. Otherwise
343  * throws TypeError.
344  */
345  std::size_t size() const;
346 
347  /*
348  * You can iterate over the values of the array. Calling these on
349  * non-arrays will throw a TypeError.
350  */
351  const_iterator begin() const;
352  const_iterator end() const;
353  iterator begin();
354  iterator end();
355 
356  private:
357  /*
358  * Helper object returned by keys(), values(), and items().
359  */
360  template <class T>
361  struct IterableProxy;
362 
363  /*
364  * Helper for heterogeneous lookup and mutation on objects: at(), find(),
365  * count(), erase(), operator[]
366  */
367  template <typename K, typename T>
368  using IfIsNonStringDynamicConvertible = std::enable_if_t<
371  T>;
372 
373  public:
374  /*
375  * You can iterate over the keys, values, or items (std::pair of key and
376  * value) in an object. Calling these on non-objects will throw a TypeError.
377  */
383 
384  /*
385  * AssociativeContainer-style find interface for objects. Throws if
386  * this is not an object.
387  *
388  * Returns: items().end() if the key is not present, or a
389  * const_item_iterator pointing to the item.
390  */
391  template <typename K>
393  template <typename K>
395 
398 
399  /*
400  * If this is an object, returns whether it contains a field with
401  * the given name. Otherwise throws TypeError.
402  */
403  template <typename K>
405 
406  std::size_t count(StringPiece) const;
407 
408  /*
409  * For objects or arrays, provides access to sub-fields by index or
410  * field name.
411  *
412  * Using these with dynamic objects that are not arrays or objects
413  * will throw a TypeError. Using an index that is out of range or
414  * object-element that's not present throws std::out_of_range.
415  */
416  private:
417  dynamic const& atImpl(dynamic const&) const&;
418 
419  public:
420  template <typename K>
421  IfIsNonStringDynamicConvertible<K, dynamic const&> at(K&&) const&;
422  template <typename K>
423  IfIsNonStringDynamicConvertible<K, dynamic&> at(K&&) &;
424  template <typename K>
425  IfIsNonStringDynamicConvertible<K, dynamic&&> at(K&&) &&;
426 
427  dynamic const& at(StringPiece) const&;
428  dynamic& at(StringPiece) &;
429  dynamic&& at(StringPiece) &&;
430 
431  /*
432  * Locate element using JSON pointer, per RFC 6901. Returns nullptr if
433  * element could not be located. Throws if pointer does not match the
434  * shape of the document, e.g. uses string to index in array.
435  */
436  const dynamic* get_ptr(json_pointer const&) const&;
437  dynamic* get_ptr(json_pointer const&) &;
438  const dynamic* get_ptr(json_pointer const&) const&& = delete;
439  dynamic* get_ptr(json_pointer const&) && = delete;
440 
441  /*
442  * Like 'at', above, except it returns either a pointer to the contained
443  * object or nullptr if it wasn't found. This allows a key to be tested for
444  * containment and retrieved in one operation. Example:
445  *
446  * if (auto* found = d.get_ptr(key))
447  * // use *found;
448  *
449  * Using these with dynamic objects that are not arrays or objects
450  * will throw a TypeError.
451  */
452  private:
453  const dynamic* get_ptrImpl(dynamic const&) const&;
454 
455  public:
456  template <typename K>
457  IfIsNonStringDynamicConvertible<K, const dynamic*> get_ptr(K&&) const&;
458  template <typename K>
459  IfIsNonStringDynamicConvertible<K, dynamic*> get_ptr(K&&) &;
460  template <typename K>
461  IfIsNonStringDynamicConvertible<K, dynamic*> get_ptr(K&&) && = delete;
462 
463  const dynamic* get_ptr(StringPiece) const&;
464  dynamic* get_ptr(StringPiece) &;
465  dynamic* get_ptr(StringPiece) && = delete;
466 
467  /*
468  * This works for access to both objects and arrays.
469  *
470  * In the case of an array, the index must be an integer, and this
471  * will throw std::out_of_range if it is less than zero or greater
472  * than size().
473  *
474  * In the case of an object, the non-const overload inserts a null
475  * value if the key isn't present. The const overload will throw
476  * std::out_of_range if the key is not present.
477  *
478  * These functions do not invalidate iterators except when a null value
479  * is inserted into an object as described above.
480  */
481  template <typename K>
482  IfIsNonStringDynamicConvertible<K, dynamic&> operator[](K&&) &;
483  template <typename K>
484  IfIsNonStringDynamicConvertible<K, dynamic const&> operator[](K&&) const&;
485  template <typename K>
486  IfIsNonStringDynamicConvertible<K, dynamic&&> operator[](K&&) &&;
487 
488  dynamic& operator[](StringPiece) &;
489  dynamic const& operator[](StringPiece) const&;
490  dynamic&& operator[](StringPiece) &&;
491 
492  /*
493  * Only defined for objects, throws TypeError otherwise.
494  *
495  * getDefault will return the value associated with the supplied key, the
496  * supplied default otherwise. setDefault will set the key to the supplied
497  * default if it is not yet set, otherwise leaving it. setDefault returns
498  * a reference to the existing value if present, the new value otherwise.
499  */
500  template <typename K>
502  K&& k,
503  const dynamic& v = dynamic::object) const&;
504  template <typename K>
505  IfIsNonStringDynamicConvertible<K, dynamic> getDefault(K&& k, dynamic&& v)
506  const&;
507  template <typename K>
509  K&& k,
510  const dynamic& v = dynamic::object) &&;
511  template <typename K>
512  IfIsNonStringDynamicConvertible<K, dynamic> getDefault(K&& k, dynamic&& v) &&;
513 
514  dynamic getDefault(StringPiece k, const dynamic& v = dynamic::object) const&;
515  dynamic getDefault(StringPiece k, dynamic&& v) const&;
516  dynamic getDefault(StringPiece k, const dynamic& v = dynamic::object) &&;
517  dynamic getDefault(StringPiece k, dynamic&& v) &&;
518 
519  template <typename K, typename V>
520  IfIsNonStringDynamicConvertible<K, dynamic&> setDefault(K&& k, V&& v);
521  template <typename V>
522  dynamic& setDefault(StringPiece k, V&& v);
523  // MSVC 2015 Update 3 needs these extra overloads because if V were a
524  // defaulted template parameter, it causes MSVC to consider v an rvalue
525  // reference rather than a universal reference, resulting in it not being
526  // able to find the correct overload to construct a dynamic with.
527  template <typename K>
528  IfIsNonStringDynamicConvertible<K, dynamic&> setDefault(K&& k, dynamic&& v);
529  template <typename K>
531  K&& k,
532  const dynamic& v = dynamic::object);
533 
534  dynamic& setDefault(StringPiece k, dynamic&& v);
535  dynamic& setDefault(StringPiece k, const dynamic& v = dynamic::object);
536 
537  /*
538  * Resizes an array so it has at n elements, using the supplied
539  * default to fill new elements. Throws TypeError if this dynamic
540  * is not an array.
541  *
542  * May invalidate iterators.
543  *
544  * Post: size() == n
545  */
546  void resize(std::size_t n, dynamic const& = nullptr);
547 
548  /*
549  * Inserts the supplied key-value pair to an object, or throws if
550  * it's not an object. If the key already exists, insert will overwrite the
551  * value, i.e., similar to insert_or_assign.
552  *
553  * Invalidates iterators.
554  */
555  template <class K, class V>
556  void insert(K&&, V&& val);
557 
558  /*
559  * These functions merge two folly dynamic objects.
560  * The "update" and "update_missing" functions extend the object by
561  * inserting the key/value pairs of mergeObj into the current object.
562  * For update, if key is duplicated between the two objects, it
563  * will overwrite with the value of the object being inserted (mergeObj).
564  * For "update_missing", it will prefer the value in the original object
565  *
566  * The "merge" function creates a new object consisting of the key/value
567  * pairs of both mergeObj1 and mergeObj2
568  * If the key is duplicated between the two objects,
569  * it will prefer value in the second object (mergeObj2)
570  */
571  void update(const dynamic& mergeObj);
572  void update_missing(const dynamic& other);
573  static dynamic merge(const dynamic& mergeObj1, const dynamic& mergeObj2);
574 
575  /*
576  * Implement recursive version of RFC7386: JSON merge patch. This modifies
577  * the current object.
578  */
579  void merge_patch(const dynamic& patch);
580 
581  /*
582  * Computes JSON merge patch (RFC7386) needed to mutate from source to target
583  */
584  static dynamic merge_diff(const dynamic& source, const dynamic& target);
585 
586  /*
587  * Erase an element from a dynamic object, by key.
588  *
589  * Invalidates iterators to the element being erased.
590  *
591  * Returns the number of elements erased (i.e. 1 or 0).
592  */
593  template <typename K>
594  IfIsNonStringDynamicConvertible<K, std::size_t> erase(K&&);
595 
596  std::size_t erase(StringPiece);
597 
598  /*
599  * Erase an element from a dynamic object or array, using an
600  * iterator or an iterator range.
601  *
602  * In arrays, invalidates iterators to elements after the element
603  * being erased. In objects, invalidates iterators to the elements
604  * being erased.
605  *
606  * Returns a new iterator to the first element beyond any elements
607  * removed, or end() if there are none. (The iteration order does
608  * not change.)
609  */
610  iterator erase(const_iterator it);
611  iterator erase(const_iterator first, const_iterator last);
612 
615 
618 
621  /*
622  * Append elements to an array. If this is not an array, throws
623  * TypeError.
624  *
625  * Invalidates iterators.
626  */
627  void push_back(dynamic const&);
628  void push_back(dynamic&&);
629 
630  /*
631  * Remove an element from the back of an array. If this is not an array,
632  * throws TypeError.
633  *
634  * Does not invalidate iterators.
635  */
636  void pop_back();
637 
638  /*
639  * Get a hash code. This function is called by a std::hash<>
640  * specialization, also.
641  *
642  * Throws TypeError if this is an object, array, or null.
643  */
644  std::size_t hash() const;
645 
646  private:
647  friend struct TypeError;
648  struct ObjectImpl;
649  template <class T>
650  struct TypeInfo;
651  template <class T>
652  struct CompareOp;
653  template <class T>
654  struct GetAddrImpl;
655  template <class T>
656  struct PrintImpl;
657 
658  explicit dynamic(Array&& array);
659 
660  template <class T>
661  T const& get() const;
662  template <class T>
663  T& get();
664  // clang-format off
665  template <class T>
666  T* get_nothrow() & noexcept;
667  // clang-format on
668  template <class T>
669  T const* get_nothrow() const& noexcept;
670  // clang-format off
671  template <class T>
672  T* get_nothrow() && noexcept = delete;
673  // clang-format on
674  template <class T>
675  T* getAddress() noexcept;
676  template <class T>
677  T const* getAddress() const noexcept;
678 
679  template <class T>
680  T asImpl() const;
681 
682  static char const* typeName(Type);
683  void destroy() noexcept;
684  void print(std::ostream&) const;
685  void print_as_pseudo_json(std::ostream&) const; // see json.cpp
686 
687  private:
688  Type type_;
689  union Data {
690  explicit Data() : nul(nullptr) {}
691  ~Data() {}
692 
693  std::nullptr_t nul;
694  Array array;
695  bool boolean;
696  double doubl;
699 
700  /*
701  * Objects are placement new'd here. We have to use a char buffer
702  * because we don't know the type here (F14NodeMap<> with
703  * dynamic would be parameterizing a std:: template with an
704  * incomplete type right now). (Note that in contrast we know it
705  * is ok to do this with fbvector because we own it.)
706  */
707  std::aligned_storage<
708  sizeof(F14NodeMap<int, int>),
710  } u_;
711 };
712 
714 
715 } // namespace folly
716 
717 #include <folly/dynamic-inl.h>
IterableProxy< const_value_iterator > values() const
Definition: dynamic-inl.h:471
const char * data() const &
Definition: dynamic-inl.h:570
static ObjectMaker object()
Definition: dynamic-inl.h:240
bool operator<(dynamic const &o) const
Definition: dynamic.cpp:107
std::vector< dynamic > Array
Definition: dynamic.h:90
StringPiece stringPiece() const
Definition: dynamic-inl.h:576
IfIsNonStringDynamicConvertible< K, dynamic > getDefault(K &&k, const dynamic &v=dynamic::object) const &
Definition: dynamic-inl.h:685
const char * typeName() const
Definition: dynamic.cpp:45
dynamic const & atImpl(dynamic const &) const &
Definition: dynamic.cpp:169
T const & get() const
Definition: dynamic-inl.h:1113
double getDouble() const &
Definition: dynamic-inl.h:534
dynamic & operator/=(dynamic const &)
Definition: dynamic-inl.h:619
PskType type
std::aligned_storage< sizeof(F14NodeMap< int, int >), alignof(F14NodeMap< int, int >)>::type objectBuffer
Definition: dynamic.h:709
Array::iterator iterator
Definition: dynamic.h:118
~dynamic() noexcept
Definition: dynamic-inl.h:385
T * getAddress() noexcept
Definition: dynamic-inl.h:1043
double asDouble() const
Definition: dynamic-inl.h:521
std::enable_if_t< !std::is_convertible< K, StringPiece >::value &&std::is_convertible< K, dynamic >::value, T > IfIsNonStringDynamicConvertible
Definition: dynamic.h:371
STL namespace.
double val
Definition: String.cpp:273
IfIsNonStringDynamicConvertible< K, std::size_t > count(K &&) const
Definition: dynamic-inl.h:843
void destroy() noexcept
Definition: dynamic.cpp:330
const std::string & getString() const &
Definition: dynamic-inl.h:531
union folly::dynamic::Data u_
folly::std T
bool asBool() const
Definition: dynamic-inl.h:527
internal::ArgsMatcher< InnerMatcher > Args(const InnerMatcher &matcher)
std::size_t hash() const
Definition: dynamic.cpp:294
—— Concurrent Priority Queue Implementation ——
Definition: AtomicBitSet.h:29
IfIsNonStringDynamicConvertible< K, dynamic & > setDefault(K &&k, V &&v)
Definition: dynamic-inl.h:731
requires E e noexcept(noexcept(s.error(std::move(e))))
bool isBool() const
Definition: dynamic-inl.h:495
dynamic & operator^=(dynamic const &)
Definition: dynamic-inl.h:636
bool isArray() const
Definition: dynamic-inl.h:498
bool isNumber() const
Definition: dynamic-inl.h:510
static dynamic merge(const dynamic &mergeObj1, const dynamic &mergeObj2)
Definition: dynamic-inl.h:904
const dynamic * get_ptrImpl(dynamic const &) const &
Definition: dynamic.cpp:243
int64_t getInt() const &
Definition: dynamic-inl.h:537
static dynamic merge_diff(const dynamic &source, const dynamic &target)
Definition: dynamic.cpp:343
bool isNull() const
Definition: dynamic-inl.h:507
bool empty() const
Definition: dynamic-inl.h:815
bool operator==(dynamic const &o) const
Definition: dynamic.cpp:120
std::string asString() const
Definition: dynamic-inl.h:518
dynamic & operator=(dynamic const &)
Definition: dynamic.cpp:135
bool isString() const
Definition: dynamic-inl.h:489
dynamic & operator--()
Definition: dynamic-inl.h:645
std::string string
Definition: dynamic.h:698
std::nullptr_t nul
Definition: dynamic.h:693
void insert(K &&, V &&val)
Definition: dynamic-inl.h:853
int64_t asInt() const
Definition: dynamic-inl.h:524
IfIsNonStringDynamicConvertible< K, const_item_iterator > find(K &&) const
Definition: dynamic-inl.h:824
void print_as_pseudo_json(std::ostream &) const
Definition: json.cpp:930
void push_back(dynamic const &)
Definition: dynamic-inl.h:969
static const char *const value
Definition: Conv.cpp:50
IfIsNonStringDynamicConvertible< K, std::size_t > erase(K &&)
Definition: dynamic-inl.h:916
dynamic & operator*=(dynamic const &)
Definition: dynamic-inl.h:614
IterableProxy< const_key_iterator > keys() const
Definition: dynamic-inl.h:466
dynamic & operator+=(dynamic const &)
Definition: dynamic-inl.h:600
dynamic & operator-=(dynamic const &)
Definition: dynamic-inl.h:609
void update(const dynamic &mergeObj)
Definition: dynamic-inl.h:858
T asImpl() const
Definition: dynamic-inl.h:1009
IterableProxy< const_item_iterator > items() const
Definition: dynamic-inl.h:476
const char * string
Definition: Conv.cpp:212
std::size_t size() const
Definition: dynamic.cpp:275
dynamic & operator|=(dynamic const &)
Definition: dynamic-inl.h:634
static void array(EmptyArrayTag)
Definition: dynamic-inl.h:233
const
Definition: upload.py:398
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)
dynamic value_type
Definition: dynamic.h:120
bool_constant< false > false_type
Definition: gtest-port.h:2209
bool getBool() const &
Definition: dynamic-inl.h:540
bool isInt() const
Definition: dynamic-inl.h:504
IfIsNonStringDynamicConvertible< K, dynamic const & > at(K &&) const &
Definition: dynamic-inl.h:792
dynamic & operator%=(dynamic const &)
Definition: dynamic-inl.h:633
Type type() const
Definition: dynamic-inl.h:514
std::conditional_t< std::is_same< std::vector< bool >::const_reference, bool >::value, VectorBoolConstRefFake, std::vector< bool >::const_reference > VectorBoolConstRefCtorType
Definition: dynamic.h:115
dynamic & operator&=(dynamic const &)
Definition: dynamic-inl.h:635
friend std::ostream & operator<<(std::ostream &, dynamic const &)
Definition: dynamic-inl.h:1158
void update_missing(const dynamic &other)
Definition: dynamic-inl.h:868
const_iterator begin() const
Definition: dynamic-inl.h:432
Array::const_iterator const_iterator
Definition: dynamic.h:119
void merge_patch(const dynamic &patch)
Definition: dynamic-inl.h:881
KeyT k
bool isObject() const
Definition: dynamic-inl.h:492
bool isDouble() const
Definition: dynamic-inl.h:501
void print(std::ostream &) const
Definition: dynamic-inl.h:1152
void resize(std::size_t n, dynamic const &=nullptr)
Definition: dynamic-inl.h:964
T * get_nothrow()&noexcept
Definition: dynamic-inl.h:1027
dynamic & operator++()
Definition: dynamic-inl.h:640
const_iterator end() const
Definition: dynamic-inl.h:435
const dynamic * get_ptr(json_pointer const &) const &
Definition: dynamic.cpp:371
constexpr detail::First first
Definition: Base-inl.h:2553
const char * c_str() const &
Definition: dynamic-inl.h:573