libzeep

PrevUpHomeNext

Class element

zeep::json::element

Synopsis

// In header: <zeep/json/element.hpp>


class element {
public:
  // types
  typedef unspecified                      value_type;        
  typedef std::nullptr_t                   nullptr_type;      
  typedef std::map< std::string, element > object_type;       
  typedef std::vector< element >           array_type;        
  typedef std::string                      string_type;       
  typedef int64_t                          int_type;          
  typedef double                           float_type;        
  typedef bool                             boolean_type;      
  typedef element *                        pointer;           
  typedef const element *                  const_pointer;     
  typedef std::ptrdiff_t                   difference_type;   
  typedef std::size_t                      size_type;         
  typedef unspecified                      initializer_list_t;
  typedef element &                        reference;         
  typedef const element &                  const_reference;   
  typedef unspecified                      iterator;          
  typedef unspecified                      const_iterator;    
  typedef unspecified                      iteration_proxy;   

  // member classes/structs/unions

  union element_data {
    // construct/copy/destruct
    element_data() = default;
    element_data(bool) noexcept;
    element_data(int64_t) noexcept;
    element_data(double) noexcept;
    element_data(value_type);
    element_data(const object_type &);
    element_data(object_type &&);
    element_data(const string_type &);
    element_data(string_type &&);
    element_data(const array_type &);
    element_data(array_type &&);

    // public member functions
    void destroy(value_type) noexcept;

    // public data members
    object_type * m_object;
    array_type * m_array;
    string_type * m_string;
    int64_t m_int;
    double m_float;
    bool m_boolean;
  };

  // construct/copy/destruct
  element(value_type);
  element(std::nullptr_t = nullptr);
  element(const element &);
  element(element &&);
  template<typename ElementRef, unspecified  = 0> element(const ElementRef &);
  template<typename T, 
           typename U = typename std::remove_cv_t<typename std::remove_reference_t<T>>, 
           unspecified  = 0> 
    element(T &&) noexcept(noexcept(element_serializer< U, void >::to_element(std::declval< element & >(), std::forward< T >(v)))));
  element(initializer_list_t);
  element(size_t, const element &);
  element & operator=(element) noexcept(std::is_nothrow_move_constructible_v< value_type > and std::is_nothrow_move_assignable_v< value_type > and std::is_nothrow_move_constructible_v< element_data > and std::is_nothrow_move_assignable_v< element_data >));
  ~element();

  // private static functions
  template<typename T, typename... Args> static T * create(Args &&...);

  // public member functions
  constexpr bool is_null() const noexcept;
  constexpr bool is_object() const noexcept;
  constexpr bool is_array() const noexcept;
  constexpr bool is_string() const noexcept;
  constexpr bool is_number() const noexcept;
  constexpr bool is_number_int() const noexcept;
  constexpr bool is_number_float() const noexcept;
  constexpr bool is_true() const noexcept;
  constexpr bool is_false() const noexcept;
  constexpr bool is_boolean() const noexcept;
  constexpr value_type type() const;
  std::string type_name() const;
  explicit operator bool() const noexcept;
  reference at(const typename object_type::key_type &);
  const_reference at(const typename object_type::key_type &) const;
  reference operator[](const typename object_type::key_type &);
  const_reference operator[](const typename object_type::key_type &) const;
  reference at(size_t);
  const_reference at(size_t) const;
  reference operator[](size_t);
  const_reference operator[](size_t) const;
  iterator begin() noexcept;
  iterator end() noexcept;
  const_iterator begin() const noexcept;
  const_iterator end() const noexcept;
  const_iterator cbegin() const noexcept;
  const_iterator cend() const noexcept;
  reference front();
  const_reference front() const;
  reference back();
  const_reference back() const;
  void clear() noexcept;
  iterator insert(const_iterator, const element &);
  iterator insert(const_iterator, element &&);
  iterator insert(const_iterator, size_type, const element &);
  iterator insert(const_iterator, const_iterator, const_iterator);
  iterator insert(const_iterator, initializer_list_t);
  void insert(const_iterator, const_iterator);
  void push_back(element &&);
  void push_back(const element &);
  template<typename... Args> std::pair< iterator, bool > emplace(Args &&...);
  template<typename... Args> void emplace_back(Args &&...);
  template<typename Iterator, 
           typename std::enable_if_t< std::is_same_v< Iterator, iterator > or std::is_same_v< Iterator, const_iterator >, int > = 0> 
    Iterator erase(Iterator);
  template<typename Iterator, 
           typename std::enable_if_t< std::is_same_v< Iterator, iterator > or std::is_same_v< Iterator, const_iterator >, int > = 0> 
    Iterator erase(Iterator, Iterator);
  size_type erase(const typename object_type::key_type &);
  void erase(const size_type);
  void swap(reference) noexcept(std::is_nothrow_move_constructible_v< value_type > and std::is_nothrow_move_assignable_v< value_type > and std::is_nothrow_move_constructible_v< element_data > and std::is_nothrow_move_assignable_v< element_data >));
  template<typename T> const_iterator find(T &&) const;
  bool contains(element) const;
  iteration_proxy< iterator > items() noexcept;
  iteration_proxy< const_iterator > items() const noexcept;
  bool empty() const;
  size_t size() const;
  size_t max_size() const noexcept;
  element & operator-();
  template<typename P, 
           typename std::enable_if_t< std::is_pointer_v< P >, int > = 0> 
    auto get_ptr() noexcept;
  template<typename P, 
           typename std::enable_if_t< std::is_pointer_v< P > and std::is_const_v< typename std::remove_pointer_t< P >>, int > = 0> 
    constexpr auto get_ptr() const noexcept;
  template<typename T, 
           typename U = typename std::remove_cv_t<typename std::remove_reference_t<T>>, 
           unspecified  = 0> 
    T as() const noexcept(noexcept(element_serializer< U >::from_element(std::declval< const element & >(), std::declval< U & >()))));
  template<> bool as() const;

  // public static functions
  static element object();
  static element array();
  static element object(initializer_list_t);
  static element array(initializer_list_t);

  // private member functions
  template<typename... Args> iterator insert_iterator(const_iterator, Args...);
  object_type * get_impl_ptr(object_type *) noexcept;
  constexpr const object_type * 
  get_impl_ptr(const object_type *) const noexcept;
  array_type * get_impl_ptr(array_type *) noexcept;
  constexpr const array_type * get_impl_ptr(const array_type *) const noexcept;
  string_type * get_impl_ptr(string_type *) noexcept;
  constexpr const string_type * 
  get_impl_ptr(const string_type *) const noexcept;
  int_type * get_impl_ptr(int_type *) noexcept;
  constexpr const int_type * get_impl_ptr(const int_type *) const noexcept;
  float_type * get_impl_ptr(float_type *) noexcept;
  constexpr const float_type * get_impl_ptr(const float_type *) const noexcept;
  boolean_type * get_impl_ptr(boolean_type *) noexcept;
  constexpr const boolean_type * 
  get_impl_ptr(const boolean_type *) const noexcept;
  void validate() const;

  // public data members
  value_type m_type;
  element_data m_data;
};

Description

element public construct/copy/destruct

  1. element(value_type t);
    empty constructor with a certain type
  2. element(std::nullptr_t = nullptr);
    default constructor
  3. element(const element & j);
  4. element(element && j);
  5. template<typename ElementRef, unspecified  = 0> element(const ElementRef & r);
  6. template<typename T, 
             typename U = typename std::remove_cv_t<typename std::remove_reference_t<T>>, 
             unspecified  = 0> 
      element(T && v) noexcept(noexcept(element_serializer< U, void >::to_element(std::declval< element & >(), std::forward< T >(v)))));
  7. element(initializer_list_t init);
  8. element(size_t cnt, const element & v);
  9. element & operator=(element j) noexcept(std::is_nothrow_move_constructible_v< value_type > and std::is_nothrow_move_assignable_v< value_type > and std::is_nothrow_move_constructible_v< element_data > and std::is_nothrow_move_assignable_v< element_data >));
  10. ~element();

element private static functions

  1. template<typename T, typename... Args> static T * create(Args &&... args);

element public member functions

  1. constexpr bool is_null() const noexcept;
  2. constexpr bool is_object() const noexcept;
  3. constexpr bool is_array() const noexcept;
  4. constexpr bool is_string() const noexcept;
  5. constexpr bool is_number() const noexcept;
  6. constexpr bool is_number_int() const noexcept;
  7. constexpr bool is_number_float() const noexcept;
  8. constexpr bool is_true() const noexcept;
  9. constexpr bool is_false() const noexcept;
  10. constexpr bool is_boolean() const noexcept;
  11. constexpr value_type type() const;
  12. std::string type_name() const;
  13. explicit operator bool() const noexcept;
  14. reference at(const typename object_type::key_type & key);
  15. const_reference at(const typename object_type::key_type & key) const;
  16. reference operator[](const typename object_type::key_type & key);
  17. const_reference operator[](const typename object_type::key_type & key) const;
  18. reference at(size_t index);
  19. const_reference at(size_t index) const;
  20. reference operator[](size_t index);
  21. const_reference operator[](size_t index) const;
  22. iterator begin() noexcept;
  23. iterator end() noexcept;
  24. const_iterator begin() const noexcept;
  25. const_iterator end() const noexcept;
  26. const_iterator cbegin() const noexcept;
  27. const_iterator cend() const noexcept;
  28. reference front();
  29. const_reference front() const;
  30. reference back();
  31. const_reference back() const;
  32. void clear() noexcept;
  33. iterator insert(const_iterator pos, const element & val);
  34. iterator insert(const_iterator pos, element && val);
  35. iterator insert(const_iterator pos, size_type cnt, const element & val);
  36. iterator insert(const_iterator pos, const_iterator first, const_iterator last);
  37. iterator insert(const_iterator pos, initializer_list_t lst);
  38. void insert(const_iterator first, const_iterator last);
  39. void push_back(element && val);
  40. void push_back(const element & val);
  41. template<typename... Args> 
      std::pair< iterator, bool > emplace(Args &&... args);
  42. template<typename... Args> void emplace_back(Args &&... args);
  43. template<typename Iterator, 
             typename std::enable_if_t< std::is_same_v< Iterator, iterator > or std::is_same_v< Iterator, const_iterator >, int > = 0> 
      Iterator erase(Iterator pos);
  44. template<typename Iterator, 
             typename std::enable_if_t< std::is_same_v< Iterator, iterator > or std::is_same_v< Iterator, const_iterator >, int > = 0> 
      Iterator erase(Iterator first, Iterator last);
  45. size_type erase(const typename object_type::key_type & key);
  46. void erase(const size_type index);
  47. void swap(reference other) noexcept(std::is_nothrow_move_constructible_v< value_type > and std::is_nothrow_move_assignable_v< value_type > and std::is_nothrow_move_constructible_v< element_data > and std::is_nothrow_move_assignable_v< element_data >));
  48. template<typename T> const_iterator find(T && key) const;
  49. bool contains(element test) const;
  50. iteration_proxy< iterator > items() noexcept;
  51. iteration_proxy< const_iterator > items() const noexcept;
  52. bool empty() const;
  53. size_t size() const;
  54. size_t max_size() const noexcept;
  55. element & operator-();
  56. template<typename P, 
             typename std::enable_if_t< std::is_pointer_v< P >, int > = 0> 
      auto get_ptr() noexcept;
  57. template<typename P, 
             typename std::enable_if_t< std::is_pointer_v< P > and std::is_const_v< typename std::remove_pointer_t< P >>, int > = 0> 
      constexpr auto get_ptr() const noexcept;
  58. template<typename T, 
             typename U = typename std::remove_cv_t<typename std::remove_reference_t<T>>, 
             unspecified  = 0> 
      T as() const noexcept(noexcept(element_serializer< U >::from_element(std::declval< const element & >(), std::declval< U & >()))));
  59. template<> bool as() const;

element public static functions

  1. static element object();
  2. static element array();
  3. static element object(initializer_list_t init);
  4. static element array(initializer_list_t init);

element private member functions

  1. template<typename... Args> 
      iterator insert_iterator(const_iterator pos, Args... args);
  2. object_type * get_impl_ptr(object_type *) noexcept;
  3. constexpr const object_type * get_impl_ptr(const object_type *) const noexcept;
  4. array_type * get_impl_ptr(array_type *) noexcept;
  5. constexpr const array_type * get_impl_ptr(const array_type *) const noexcept;
  6. string_type * get_impl_ptr(string_type *) noexcept;
  7. constexpr const string_type * get_impl_ptr(const string_type *) const noexcept;
  8. int_type * get_impl_ptr(int_type *) noexcept;
  9. constexpr const int_type * get_impl_ptr(const int_type *) const noexcept;
  10. float_type * get_impl_ptr(float_type *) noexcept;
  11. constexpr const float_type * get_impl_ptr(const float_type *) const noexcept;
  12. boolean_type * get_impl_ptr(boolean_type *) noexcept;
  13. constexpr const boolean_type * 
    get_impl_ptr(const boolean_type *) const noexcept;
  14. void validate() const;

PrevUpHomeNext