MCPcopy Create free account
hub / github.com/bytedance/Fastbot_Android / iteration_proxy_value

Class iteration_proxy_value

native/thirdpart/json/json.hpp:3297–3382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3295 target = std::to_string(value);
3296}
3297template <typename IteratorType> class iteration_proxy_value
3298{
3299 public:
3300 using difference_type = std::ptrdiff_t;
3301 using value_type = iteration_proxy_value;
3302 using pointer = value_type * ;
3303 using reference = value_type & ;
3304 using iterator_category = std::input_iterator_tag;
3305 using string_type = typename std::remove_cv< typename std::remove_reference<decltype( std::declval<IteratorType>().key() ) >::type >::type;
3306
3307 private:
3308 /// the iterator
3309 IteratorType anchor;
3310 /// an index for arrays (used to create key names)
3311 std::size_t array_index = 0;
3312 /// last stringified array index
3313 mutable std::size_t array_index_last = 0;
3314 /// a string representation of the array index
3315 mutable string_type array_index_str = "0";
3316 /// an empty string (to return a reference for primitive values)
3317 const string_type empty_str = "";
3318
3319 public:
3320 explicit iteration_proxy_value(IteratorType it) noexcept : anchor(it) {}
3321
3322 /// dereference operator (needed for range-based for)
3323 iteration_proxy_value& operator*()
3324 {
3325 return *this;
3326 }
3327
3328 /// increment operator (needed for range-based for)
3329 iteration_proxy_value& operator++()
3330 {
3331 ++anchor;
3332 ++array_index;
3333
3334 return *this;
3335 }
3336
3337 /// equality operator (needed for InputIterator)
3338 bool operator==(const iteration_proxy_value& o) const
3339 {
3340 return anchor == o.anchor;
3341 }
3342
3343 /// inequality operator (needed for range-based for)
3344 bool operator!=(const iteration_proxy_value& o) const
3345 {
3346 return anchor != o.anchor;
3347 }
3348
3349 /// return key of the iterator
3350 const string_type& key() const
3351 {
3352 assert(anchor.m_object != nullptr);
3353
3354 switch (anchor.m_object->type())

Callers

nothing calls this directly

Calls 2

int_to_stringFunction · 0.85
keyMethod · 0.45

Tested by

no test coverage detected