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

Class Array

native/thirdpart/flatbuffers/flatbuffers.h:439–569  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

437
438// This is used as a helper type for accessing arrays.
439template<typename T, uint16_t length> class Array {
440 typedef
441 typename flatbuffers::integral_constant<bool,
442 flatbuffers::is_scalar<T>::value>
443 scalar_tag;
444 typedef
445 typename flatbuffers::conditional<scalar_tag::value, T, const T *>::type
446 IndirectHelperType;
447
448 public:
449 typedef uint16_t size_type;
450 typedef typename IndirectHelper<IndirectHelperType>::return_type return_type;
451 typedef VectorIterator<T, return_type> const_iterator;
452 typedef VectorReverseIterator<const_iterator> const_reverse_iterator;
453
454 FLATBUFFERS_CONSTEXPR uint16_t size() const { return length; }
455
456 return_type Get(uoffset_t i) const {
457 FLATBUFFERS_ASSERT(i < size());
458 return IndirectHelper<IndirectHelperType>::Read(Data(), i);
459 }
460
461 return_type operator[](uoffset_t i) const { return Get(i); }
462
463 // If this is a Vector of enums, T will be its storage type, not the enum
464 // type. This function makes it convenient to retrieve value with enum
465 // type E.
466 template<typename E> E GetEnum(uoffset_t i) const {
467 return static_cast<E>(Get(i));
468 }
469
470 const_iterator begin() const { return const_iterator(Data(), 0); }
471 const_iterator end() const { return const_iterator(Data(), size()); }
472
473 const_reverse_iterator rbegin() const {
474 return const_reverse_iterator(end());
475 }
476 const_reverse_iterator rend() const {
477 return const_reverse_iterator(begin());
478 }
479
480 const_iterator cbegin() const { return begin(); }
481 const_iterator cend() const { return end(); }
482
483 const_reverse_iterator crbegin() const { return rbegin(); }
484 const_reverse_iterator crend() const { return rend(); }
485
486 // Get a mutable pointer to elements inside this array.
487 // This method used to mutate arrays of structs followed by a @p Mutate
488 // operation. For primitive types use @p Mutate directly.
489 // @warning Assignments and reads to/from the dereferenced pointer are not
490 // automatically converted to the correct endianness.
491 typename flatbuffers::conditional<scalar_tag::value, void, T *>::type
492 GetMutablePointer(uoffset_t i) const {
493 FLATBUFFERS_ASSERT(i < size());
494 return const_cast<T *>(&data()[i]);
495 }
496

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected