Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dart::BaseGrowableArray< T, B, Allocator > Class Template Reference

#include <growable_array.h>

Inheritance diagram for dart::BaseGrowableArray< T, B, Allocator >:
B A dart::GrowableArray< FunctionTypePtr > dart::GrowableArray< intptr_t > dart::GrowableArray< T * > dart::GrowableArray< ObjectPtr > dart::GrowableArray< RecordTypePtr > dart::GrowableArray< StringPtr > dart::GrowableArray< TypeArgumentsPtr > dart::GrowableArray< TypeParameterPtr > dart::GrowableArray< TypePtr > dart::GrowableArray< const dart::Place * > dart::GrowableArray< dart::BitVector * > dart::GrowableArray< dart::Definition * > dart::GrowableArray< dart::MaterializeObjectInstr * > dart::GrowableArray< dart::Instruction * > dart::GrowableArray< _Dart_CObject * > dart::GrowableArray< dart::Array * > dart::GrowableArray< ArrayPtr > dart::GrowableArray< dart::MessageSerializationCluster * > dart::GrowableArray< std::pair< intptr_t, intptr_t > > dart::GrowableArray< dart::BlockEntryInstr * > dart::GrowableArray< GuardedClassInfo > dart::GrowableArray< dart::ParsedFunction * > dart::GrowableArray< dart::InlinedInfo > dart::GrowableArray< dart::CallSites::CallInfo< dart::StaticCallInstr > > dart::GrowableArray< dart::CallSites::CallInfo< dart::ClosureCallInstr > > dart::GrowableArray< dart::CallSites::CallInfo< dart::PolymorphicInstanceCallInstr > > dart::GrowableArray< dart::CallSites::CallInfo< dart::InstanceCallInstr > > dart::GrowableArray< PointerType > dart::GrowableArray< dart::Capability * > dart::GrowableArray< dart::CatchEntryMove > dart::GrowableArray< dart::CatchEntryMovesMapBuilder::TrieNode * > dart::GrowableArray< dart::CidRange * > dart::GrowableArray< dart::Class * > dart::GrowableArray< ClassPtr > dart::GrowableArray< ClosureDataPtr > dart::GrowableArray< ClosurePtr > dart::GrowableArray< CodePtr > dart::GrowableArray< dart::TokenPosition > dart::GrowableArray< CodeSourceMapPtr > dart::GrowableArray< const dart::Function * > dart::GrowableArray< CompressedStackMapsPtr > dart::GrowableArray< PhiInfo > dart::GrowableArray< ContextScopePtr > dart::GrowableArray< ContextPtr > dart::GrowableArray< TypedDataPtr > dart::GrowableArray< dart::DeoptInstr * > dart::GrowableArray< dart::DeoptInfoBuilder::TrieNode * > dart::GrowableArray< dart::Double * > dart::GrowableArray< DoublePtr > dart::GrowableArray< dart::Value * > dart::GrowableArray< struct dart::ExceptionHandlerList::HandlerDesc > dart::GrowableArray< ExceptionHandlersPtr > dart::GrowableArray< dart::ExternalTypedData * > dart::GrowableArray< ExternalTypedDataPtr > dart::GrowableArray< dart::ObjectPtr > dart::GrowableArray< TransferableTypedDataPtr > dart::GrowableArray< WeakPropertyPtr > dart::GrowableArray< WeakReferencePtr > dart::GrowableArray< FfiTrampolineDataPtr > dart::GrowableArray< FieldPtr > dart::GrowableArray< std::pair< Location, Representation > > dart::GrowableArray< Representation > dart::GrowableArray< dart::ExtraLoopInfo * > dart::GrowableArray< dart::LiveRange * > dart::GrowableArray< dart::ZoneGrowableArray< dart::LiveRange * > * > dart::GrowableArray< bool > dart::GrowableArray< PendingPhiInput > dart::GrowableArray< BlockInfo * > dart::GrowableArray< dart::CompilerDeoptInfo * > dart::GrowableArray< dart::SlowPathCode * > dart::GrowableArray< const dart::Field * > dart::GrowableArray< StaticCallsStruct * > dart::GrowableArray< const dart::compiler::TableSelector * > dart::GrowableArray< dart::IndirectGotoInstr * > dart::GrowableArray< const dart::Object * > dart::GrowableArray< dart::CompileType * > dart::GrowableArray< RollbackEntry > dart::GrowableArray< FunctionPtr > dart::GrowableArray< dart::Object * > dart::GrowableArray< dart::CatchBlockEntryInstr * > dart::GrowableArray< dart::IndirectEntryInstr * > dart::GrowableArray< dart::GrowableObjectArray * > dart::GrowableArray< GrowableObjectArrayPtr > dart::GrowableArray< ICDataPtr > dart::GrowableArray< dart::ImageWriter::ObjectData > dart::GrowableArray< dart::ImageWriter::InstructionsData > dart::GrowableArray< dart::TargetEntryInstr * > dart::GrowableArray< dart::InductionVar::Bound > dart::GrowableArray< dart::BranchInstr * > dart::GrowableArray< Data > dart::GrowableArray< const dart::Instance * > dart::GrowableArray< InstancePtr > dart::GrowableArray< const dart::KernelProgramInfo * > dart::GrowableArray< const dart::SuspendState * > dart::GrowableArray< dart::InstanceMorpher * > dart::GrowableArray< dart::ReasonForCancelling * > dart::GrowableArray< KernelProgramInfoPtr > dart::GrowableArray< LanguageErrorPtr > dart::GrowableArray< LibraryPrefixPtr > dart::GrowableArray< LibraryPtr > dart::GrowableArray< dart::ZoneGrowableArray< dart::Definition * > * > dart::GrowableArray< dart::PhiInstr * > dart::GrowableArray< LoadingUnitPtr > dart::GrowableArray< dart::Code * > dart::GrowableArray< dart::LocalVariable * > dart::GrowableArray< dart::LocalVarDescriptorsBuilder::VarDesc > dart::GrowableArray< dart::Map * > dart::GrowableArray< MapPtr > dart::GrowableArray< MegamorphicCachePtr > dart::GrowableArray< dart::Mint * > dart::GrowableArray< SmiPtr > dart::GrowableArray< MintPtr > dart::GrowableArray< NamespacePtr > dart::GrowableArray< ObjectPoolPtr > dart::GrowableArray< dart::ObjectSetRegion * > dart::GrowableArray< dart::String * > dart::GrowableArray< dart::MoveOperands * > dart::GrowableArray< dart::MoveOperands > dart::GrowableArray< Op > dart::GrowableArray< PatchClassPtr > dart::GrowableArray< PcDescriptorsPtr > dart::GrowableArray< dart::ZoneGrowableArray< dart::PhiPlaceMoves::Move > * > dart::GrowableArray< dart::BinaryInt64OpInstr * > dart::GrowableArray< dart::ShiftIntegerOpInstr * > dart::GrowableArray< dart::CheckBoundBaseInstr * > dart::GrowableArray< dart::ConstraintInstr * > dart::GrowableArray< RecordPtr > dart::GrowableArray< dart::RegExpTree * > dart::GrowableArray< RegExpPtr > dart::GrowableArray< dart::TextElement > dart::GrowableArray< Dart_Port > dart::GrowableArray< const dart::String * > dart::GrowableArray< ScriptPtr > dart::GrowableArray< dart::SendPort * > dart::GrowableArray< StackEntry > dart::GrowableArray< dart::LoadingUnitSerializationData * > dart::GrowableArray< dart::Set * > dart::GrowableArray< SetPtr > dart::GrowableArray< const dart::PassiveObject * > dart::GrowableArray< const dart::TransferableTypedData * > dart::GrowableArray< const dart::ExternalTypedData * > dart::GrowableArray< const dart::WeakProperty * > dart::GrowableArray< const dart::WeakReference * > dart::GrowableArray< dart::Smi * > dart::GrowableArray< ScriptTableEntry * > dart::GrowableArray< StackTracePtr > dart::GrowableArray< dart::ZoneGrowableArray< dart::Instruction * > * > dart::GrowableArray< SubtypeTestCachePtr > dart::GrowableArray< char * > dart::GrowableArray< uint8_t * > dart::GrowableArray< dart::TransferableTypedData * > dart::GrowableArray< ParameterInfo * > dart::GrowableArray< dart::TypeArguments * > dart::GrowableArray< dart::Type * > dart::GrowableArray< TypeParametersPtr > dart::GrowableArray< dart::TypedData * > dart::GrowableArray< dart::TypedDataView * > dart::GrowableArray< TypedDataViewPtr > dart::GrowableArray< UnhandledExceptionPtr > dart::GrowableArray< UnlinkedCallPtr > dart::GrowableArray< Value * > dart::GrowableArray< WeakArrayPtr > dart::GrowableArray< dart::compiler::AssemblerBase::CodeComment * > dart::GrowableArray< SelectorRow * > dart::GrowableArray< dart::compiler::ObjectPoolBuilderEntry > dart::GrowableArray< dart::compiler::TableSelector > dart::GrowableArray< dart::kernel::FunctionScope > dart::GrowableArray< ConcatPiece > dart::GrowableArray< dart::kernel::Fragment > dart::GrowableArray< dart::kernel::SwitchExpression > dart::GrowableArray< dart::kernel::SwitchExpression * > dart::GrowableArray< dart::kernel::TableSelectorInfo > dart::GrowableArray< dart::kernel::UnboxingInfoMetadata::UnboxingType > dart::MallocGrowableArray< dart::ObjectPtr > dart::MallocGrowableArray< ScriptPtr > dart::MallocGrowableArray< std::pair< void *, Deleter > > dart::MallocGrowableArray< dart::BreakpointLocation * > dart::MallocGrowableArray< dart::VirtualMemory * > dart::MallocGrowableArray< dart::ObjectPtr * > dart::MallocGrowableArray< TypedDataViewPtr > dart::MallocGrowableArray< SuspendStatePtr > dart::MallocGrowableArray< dart::Array * > dart::MallocGrowableArray< dart::Class * > dart::MallocGrowableArray< dart::AbstractType * > dart::MallocGrowableArray< char * > dart::MallocGrowableArray< char > dart::MallocGrowableArray< dart::FinalizableData > dart::MallocGrowableArray< dart::PendingLazyDeopt > dart::MallocGrowableArray< LibraryInfo > dart::MallocGrowableArray< T * > dart::MallocGrowableArray< dart::GrowableObjectArray * > dart::MallocGrowableArray< dart::ThreadLocalEntry > dart::MallocGrowableArray< const char * > dart::MallocGrowableArray< dart::bin::AppSnapshot * > dart::ZoneGrowableArray< intptr_t > dart::ZoneGrowableArray< dart::BoyerMoorePositionInfo * > dart::ZoneGrowableArray< bool > dart::ZoneGrowableArray< uint8_t > dart::ZoneGrowableArray< dart::CharacterRange > dart::ZoneGrowableArray< dart::GuardedAlternative > dart::ZoneGrowableArray< dart::CodeDescriptor * > dart::ZoneGrowableArray< dart::ZoneGrowableArray< const dart::Slot * > * > dart::ZoneGrowableArray< const dart::Slot * > dart::ZoneGrowableArray< dart::LocalVariable * > dart::ZoneGrowableArray< dart::ActivationFrame * > dart::ZoneGrowableArray< dart::BitVector * > dart::ZoneGrowableArray< dart::LiveRange * > dart::ZoneGrowableArray< const dart::ICData * > dart::ZoneGrowableArray< dart::AssertAssignableInstr * > dart::ZoneGrowableArray< dart::Guard * > dart::ZoneGrowableArray< dart::Definition * > dart::ZoneGrowableArray< dart::Object * > dart::ZoneGrowableArray< dart::BlockEntryInstr * > dart::ZoneGrowableArray< unsigned > dart::ZoneGrowableArray< dart::OutSet * > dart::ZoneGrowableArray< const dart::Instance * > dart::ZoneGrowableArray< dart::PhiInstr * > dart::ZoneGrowableArray< dart::PhiPlaceMoves::Move > dart::ZoneGrowableArray< uword > dart::ZoneGrowableArray< dart::ProcessedSample * > dart::ZoneGrowableArray< dart::ProfileCodeAddress > dart::ZoneGrowableArray< dart::ProfileCode * > dart::ZoneGrowableArray< dart::ProfileFunctionSourcePosition > dart::ZoneGrowableArray< dart::ProfileFunction * > dart::ZoneGrowableArray< dart::RegExpTree * > dart::ZoneGrowableArray< uint16_t > dart::ZoneGrowableArray< dart::RegExpNode * > dart::ZoneGrowableArray< dart::RegExpCapture * > dart::ZoneGrowableArray< dart::RegExpBackReference * > dart::ZoneGrowableArray< dart::Instruction * > dart::ZoneGrowableArray< dart::TextElement > dart::ZoneGrowableArray< Register >

Public Member Functions

 BaseGrowableArray (Allocator *allocator)
 
 BaseGrowableArray (intptr_t initial_capacity, Allocator *allocator)
 
 BaseGrowableArray (BaseGrowableArray &&other)
 
 ~BaseGrowableArray ()
 
BaseGrowableArrayoperator= (BaseGrowableArray &&other)
 
intptr_t length () const
 
Tdata () const
 
bool is_empty () const
 
void TruncateTo (intptr_t length)
 
bool Contains (const T &other, bool isEqual(const T &, const T &)=nullptr) const
 
void Add (const T &value)
 
TRemoveLast ()
 
Toperator[] (intptr_t index) const
 
void FillWith (const T &value, intptr_t start, intptr_t length)
 
void EnsureLength (intptr_t new_length, const T &default_value)
 
const TAt (intptr_t index) const
 
TLast () const
 
void AddArray (const BaseGrowableArray< T, B, Allocator > &src)
 
void Clear ()
 
void InsertAt (intptr_t idx, const T &value)
 
void Reverse ()
 
void Swap (intptr_t i, intptr_t j)
 
void RemoveAt (intptr_t i)
 
void EraseAt (intptr_t idx)
 
void SetLength (intptr_t new_length)
 
void Resize (intptr_t new_length)
 
void Sort (int compare(const T *, const T *))
 
void StealBuffer (T **buffer, intptr_t *length)
 
Tbegin ()
 
const Tbegin () const
 
Tend ()
 
const Tend () const
 
- Public Member Functions inherited from B
 B ()
 
void setValues (int v) override
 
bool checkValues (int v) override
 
- Public Member Functions inherited from A
 A ()
 
virtual ~A ()
 
void * operator new (size_t size)
 
void operator delete (void *p)
 

Additional Inherited Members

- Static Public Member Functions inherited from A
static ACreate (SkRandom *r)
 
static void SetAllocator (size_t preallocSize, size_t minAllocSize)
 
static void ResetAllocator ()
 
static void ValidatePool ()
 

Detailed Description

template<typename T, typename B, typename Allocator>
class dart::BaseGrowableArray< T, B, Allocator >

Definition at line 19 of file growable_array.h.

Constructor & Destructor Documentation

◆ BaseGrowableArray() [1/3]

template<typename T , typename B , typename Allocator >
dart::BaseGrowableArray< T, B, Allocator >::BaseGrowableArray ( Allocator allocator)
inlineexplicit

Definition at line 21 of file growable_array.h.

22 : length_(0), capacity_(0), data_(nullptr), allocator_(allocator) {}

◆ BaseGrowableArray() [2/3]

template<typename T , typename B , typename Allocator >
dart::BaseGrowableArray< T, B, Allocator >::BaseGrowableArray ( intptr_t  initial_capacity,
Allocator allocator 
)
inline

Definition at line 24 of file growable_array.h.

25 : length_(0), capacity_(0), data_(nullptr), allocator_(allocator) {
26 if (initial_capacity > 0) {
27 capacity_ = Utils::RoundUpToPowerOfTwo(initial_capacity);
28 data_ = allocator_->template Alloc<T>(capacity_);
29 }
30 }
static constexpr uintptr_t RoundUpToPowerOfTwo(uintptr_t x)
Definition utils.h:120

◆ BaseGrowableArray() [3/3]

template<typename T , typename B , typename Allocator >
dart::BaseGrowableArray< T, B, Allocator >::BaseGrowableArray ( BaseGrowableArray< T, B, Allocator > &&  other)
inline

Definition at line 32 of file growable_array.h.

33 : length_(other.length_),
34 capacity_(other.capacity_),
35 data_(other.data_),
36 allocator_(other.allocator_) {
37 other.length_ = 0;
38 other.capacity_ = 0;
39 other.data_ = nullptr;
40 }

◆ ~BaseGrowableArray()

template<typename T , typename B , typename Allocator >
dart::BaseGrowableArray< T, B, Allocator >::~BaseGrowableArray ( )
inline

Definition at line 42 of file growable_array.h.

42{ allocator_->template Free<T>(data_, capacity_); }

Member Function Documentation

◆ Add()

template<typename T , typename B , typename Allocator >
void dart::BaseGrowableArray< T, B, Allocator >::Add ( const T value)
inline

Definition at line 84 of file growable_array.h.

84 {
85 Resize(length() + 1);
86 Last() = value;
87 }
void Resize(intptr_t new_length)
intptr_t length() const
uint8_t value

◆ AddArray()

template<typename T , typename B , typename Allocator >
void dart::BaseGrowableArray< T, B, Allocator >::AddArray ( const BaseGrowableArray< T, B, Allocator > &  src)
inline

Definition at line 131 of file growable_array.h.

131 {
132 for (intptr_t i = 0; i < src.length(); i++) {
133 Add(src[i]);
134 }
135 }
void Add(const T &value)

◆ At()

template<typename T , typename B , typename Allocator >
const T & dart::BaseGrowableArray< T, B, Allocator >::At ( intptr_t  index) const
inline

Definition at line 124 of file growable_array.h.

124{ return operator[](index); }
T & operator[](intptr_t index) const

◆ begin() [1/2]

template<typename T , typename B , typename Allocator >
T * dart::BaseGrowableArray< T, B, Allocator >::begin ( )
inline

Definition at line 206 of file growable_array.h.

206{ return &data_[0]; }

◆ begin() [2/2]

template<typename T , typename B , typename Allocator >
const T * dart::BaseGrowableArray< T, B, Allocator >::begin ( ) const
inline

Definition at line 207 of file growable_array.h.

207{ return &data_[0]; }

◆ Clear()

template<typename T , typename B , typename Allocator >
void dart::BaseGrowableArray< T, B, Allocator >::Clear ( )
inline

Definition at line 137 of file growable_array.h.

137{ length_ = 0; }

◆ Contains()

template<typename T , typename B , typename Allocator >
bool dart::BaseGrowableArray< T, B, Allocator >::Contains ( const T other,
bool   isEqualconst T &, const T & = nullptr 
) const
inline

Definition at line 69 of file growable_array.h.

70 {
71 for (const auto& value : *this) {
72 if (value == other) {
73 // Value identity should imply isEqual.
74 ASSERT(isEqual == nullptr || isEqual(value, other));
75 return true;
76 }
77 if (isEqual != nullptr && isEqual(value, other)) {
78 return true;
79 }
80 }
81 return false;
82 }
#define ASSERT(E)

◆ data()

template<typename T , typename B , typename Allocator >
T * dart::BaseGrowableArray< T, B, Allocator >::data ( ) const
inline

Definition at line 61 of file growable_array.h.

61{ return data_; }

◆ end() [1/2]

template<typename T , typename B , typename Allocator >
T * dart::BaseGrowableArray< T, B, Allocator >::end ( )
inline

Definition at line 209 of file growable_array.h.

209{ return &data_[length_]; }

◆ end() [2/2]

template<typename T , typename B , typename Allocator >
const T * dart::BaseGrowableArray< T, B, Allocator >::end ( ) const
inline

Definition at line 210 of file growable_array.h.

210{ return &data_[length_]; }

◆ EnsureLength()

template<typename T , typename B , typename Allocator >
void dart::BaseGrowableArray< T, B, Allocator >::EnsureLength ( intptr_t  new_length,
const T default_value 
)
inline

Definition at line 114 of file growable_array.h.

114 {
115 const intptr_t old_length = length_;
116 if (old_length < new_length) {
117 Resize(new_length);
118 for (intptr_t i = old_length; i < new_length; ++i) {
119 (*this)[i] = default_value;
120 }
121 }
122 }

◆ EraseAt()

template<typename T , typename B , typename Allocator >
void dart::BaseGrowableArray< T, B, Allocator >::EraseAt ( intptr_t  idx)
inline

Definition at line 179 of file growable_array.h.

179 {
180 ASSERT(idx >= 0);
181 ASSERT(idx < length_);
182 for (intptr_t i = idx; i < length_ - 1; i++) {
183 data_[i] = data_[i + 1];
184 }
185 RemoveLast();
186 }

◆ FillWith()

template<typename T , typename B , typename Allocator >
void dart::BaseGrowableArray< T, B, Allocator >::FillWith ( const T value,
intptr_t  start,
intptr_t  length 
)
inline

Definition at line 103 of file growable_array.h.

103 {
104 ASSERT(start >= 0);
105 ASSERT(length >= 0);
106 ASSERT(start <= length_);
107
109 for (intptr_t i = 0; i < length; ++i) {
110 data_[start + i] = value;
111 }
112 }

◆ InsertAt()

template<typename T , typename B , typename Allocator >
void dart::BaseGrowableArray< T, B, Allocator >::InsertAt ( intptr_t  idx,
const T value 
)
inline

Definition at line 139 of file growable_array.h.

139 {
140 Resize(length() + 1);
141 for (intptr_t i = length_ - 2; i >= idx; i--) {
142 data_[i + 1] = data_[i];
143 }
144 data_[idx] = value;
145 }

◆ is_empty()

template<typename T , typename B , typename Allocator >
bool dart::BaseGrowableArray< T, B, Allocator >::is_empty ( ) const
inline

Definition at line 62 of file growable_array.h.

62{ return length_ == 0; }

◆ Last()

template<typename T , typename B , typename Allocator >
T & dart::BaseGrowableArray< T, B, Allocator >::Last ( ) const
inline

Definition at line 126 of file growable_array.h.

126 {
127 ASSERT(length_ > 0);
128 return operator[](length_ - 1);
129 }

◆ length()

template<typename T , typename B , typename Allocator >
intptr_t dart::BaseGrowableArray< T, B, Allocator >::length ( ) const
inline

Definition at line 60 of file growable_array.h.

60{ return length_; }

◆ operator=()

template<typename T , typename B , typename Allocator >
BaseGrowableArray & dart::BaseGrowableArray< T, B, Allocator >::operator= ( BaseGrowableArray< T, B, Allocator > &&  other)
inline

Definition at line 44 of file growable_array.h.

44 {
45 intptr_t temp = other.length_;
46 other.length_ = length_;
47 length_ = temp;
48 temp = other.capacity_;
49 other.capacity_ = capacity_;
50 capacity_ = temp;
51 T* temp_data = other.data_;
52 other.data_ = data_;
53 data_ = temp_data;
54 Allocator* temp_allocator = other.allocator_;
55 other.allocator_ = allocator_;
56 allocator_ = temp_allocator;
57 return *this;
58 }
#define T

◆ operator[]()

template<typename T , typename B , typename Allocator >
T & dart::BaseGrowableArray< T, B, Allocator >::operator[] ( intptr_t  index) const
inline

Definition at line 96 of file growable_array.h.

96 {
97 ASSERT(0 <= index);
98 ASSERT(index < length_);
99 ASSERT(length_ <= capacity_);
100 return data_[index];
101 }

◆ RemoveAt()

template<typename T , typename B , typename Allocator >
void dart::BaseGrowableArray< T, B, Allocator >::RemoveAt ( intptr_t  i)
inline

Definition at line 168 of file growable_array.h.

168 {
169 ASSERT(i >= 0);
170 ASSERT(i < length_);
171 intptr_t last = length_ - 1;
172 if (i < last) {
173 Swap(i, last);
174 }
175 RemoveLast();
176 }
void Swap(intptr_t i, intptr_t j)

◆ RemoveLast()

template<typename T , typename B , typename Allocator >
T & dart::BaseGrowableArray< T, B, Allocator >::RemoveLast ( )
inline

Definition at line 89 of file growable_array.h.

89 {
90 ASSERT(length_ > 0);
91 T& result = operator[](length_ - 1);
92 length_--;
93 return result;
94 }
GAsyncResult * result

◆ Resize()

template<typename T , typename B , typename Allocator >
void dart::BaseGrowableArray< T, B, Allocator >::Resize ( intptr_t  new_length)

Definition at line 232 of file growable_array.h.

232 {
233 if (new_length > capacity_) {
234 intptr_t new_capacity = Utils::RoundUpToPowerOfTwo(new_length);
235 T* new_data =
236 allocator_->template Realloc<T>(data_, capacity_, new_capacity);
237 ASSERT(new_data != nullptr);
238 data_ = new_data;
239 capacity_ = new_capacity;
240 }
241 length_ = new_length;
242}

◆ Reverse()

template<typename T , typename B , typename Allocator >
void dart::BaseGrowableArray< T, B, Allocator >::Reverse ( )
inline

Definition at line 147 of file growable_array.h.

147 {
148 for (intptr_t i = 0; i < length_ / 2; i++) {
149 const intptr_t j = length_ - 1 - i;
150 T temp = data_[i];
151 data_[i] = data_[j];
152 data_[j] = temp;
153 }
154 }

◆ SetLength()

template<typename T , typename B , typename Allocator >
void dart::BaseGrowableArray< T, B, Allocator >::SetLength ( intptr_t  new_length)

Definition at line 245 of file growable_array.h.

245 {
246 if (new_length > capacity_) {
247 T* new_data = allocator_->template Alloc<T>(new_length);
248 ASSERT(new_data != nullptr);
249 data_ = new_data;
250 capacity_ = new_length;
251 }
252 length_ = new_length;
253}

◆ Sort()

template<typename T , typename B , typename Allocator >
void dart::BaseGrowableArray< T, B, Allocator >::Sort ( int   compareconst T *, const T *)
inline

Definition at line 222 of file growable_array.h.

223 {
224 // Avoid calling qsort with a null array.
225 if (length_ == 0) return;
226
227 typedef int (*CompareFunction)(const void*, const void*);
228 qsort(data_, length_, sizeof(T), reinterpret_cast<CompareFunction>(compare));
229}
static bool compare(const SkBitmap &ref, const SkIRect &iref, const SkBitmap &test, const SkIRect &itest)
Definition BlurTest.cpp:100
Type::kYUV Type::kRGBA() int(0.7 *637)
CompareFunction
Definition formats.h:534

◆ StealBuffer()

template<typename T , typename B , typename Allocator >
void dart::BaseGrowableArray< T, B, Allocator >::StealBuffer ( T **  buffer,
intptr_t *  length 
)
inline

Definition at line 198 of file growable_array.h.

198 {
199 *buffer = data_;
200 *length = length_;
201 data_ = nullptr;
202 length_ = 0;
203 capacity_ = 0;
204 }
static const uint8_t buffer[]

◆ Swap()

template<typename T , typename B , typename Allocator >
void dart::BaseGrowableArray< T, B, Allocator >::Swap ( intptr_t  i,
intptr_t  j 
)
inline

Definition at line 157 of file growable_array.h.

157 {
158 ASSERT(i >= 0);
159 ASSERT(j >= 0);
160 ASSERT(i < length_);
161 ASSERT(j < length_);
162 T temp = data_[i];
163 data_[i] = data_[j];
164 data_[j] = temp;
165 }

◆ TruncateTo()

template<typename T , typename B , typename Allocator >
void dart::BaseGrowableArray< T, B, Allocator >::TruncateTo ( intptr_t  length)
inline

Definition at line 64 of file growable_array.h.

64 {
65 ASSERT(length_ >= length);
66 length_ = length;
67 }

The documentation for this class was generated from the following file: