Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
skia_private::AutoTArray< T > Class Template Reference

#include <SkTemplates.h>

Public Member Functions

 AutoTArray ()
 
 AutoTArray (size_t size)
 
 AutoTArray (int size)
 
 AutoTArray (AutoTArray &&other)
 
AutoTArrayoperator= (AutoTArray &&other)
 
void reset (size_t count=0)
 
Tget () const
 
Toperator[] (size_t index) const
 
const Tdata () const
 
Tdata ()
 
size_t size () const
 
bool empty () const
 
size_t size_bytes () const
 
Tbegin ()
 
const Tbegin () const
 
Tend ()
 
const Tend () const
 

Detailed Description

template<typename T>
class skia_private::AutoTArray< T >

Allocate an array of T elements, and free the array in the destructor

Definition at line 99 of file SkTemplates.h.

Constructor & Destructor Documentation

◆ AutoTArray() [1/4]

template<typename T >
skia_private::AutoTArray< T >::AutoTArray ( )
inline

Definition at line 101 of file SkTemplates.h.

101{}

◆ AutoTArray() [2/4]

template<typename T >
skia_private::AutoTArray< T >::AutoTArray ( size_t  size)
inlineexplicit

Definition at line 103 of file SkTemplates.h.

103 {
104 fSize = check_size_bytes_too_big<T>(size);
105 fData.reset(size > 0 ? new T[size] : nullptr);
106 }
#define T
Definition: precompiler.cc:65

◆ AutoTArray() [3/4]

template<typename T >
skia_private::AutoTArray< T >::AutoTArray ( int  size)
inlineexplicit

Definition at line 109 of file SkTemplates.h.

constexpr size_t SkToSizeT(S x)
Definition: SkTo.h:31

◆ AutoTArray() [4/4]

template<typename T >
skia_private::AutoTArray< T >::AutoTArray ( AutoTArray< T > &&  other)
inline

Definition at line 111 of file SkTemplates.h.

111 : fData(std::move(other.fData)) {
112 fSize = std::exchange(other.fSize, 0);
113 }

Member Function Documentation

◆ begin() [1/2]

template<typename T >
T * skia_private::AutoTArray< T >::begin ( )
inline

Definition at line 140 of file SkTemplates.h.

140 {
141 return fData;
142 }

◆ begin() [2/2]

template<typename T >
const T * skia_private::AutoTArray< T >::begin ( ) const
inline

Definition at line 143 of file SkTemplates.h.

143 {
144 return fData;
145 }

◆ data() [1/2]

template<typename T >
T * skia_private::AutoTArray< T >::data ( )
inline

Definition at line 134 of file SkTemplates.h.

134{ return fData.get(); }

◆ data() [2/2]

template<typename T >
const T * skia_private::AutoTArray< T >::data ( ) const
inline

Definition at line 133 of file SkTemplates.h.

133{ return fData.get(); }

◆ empty()

template<typename T >
bool skia_private::AutoTArray< T >::empty ( ) const
inline

Definition at line 137 of file SkTemplates.h.

137{ return fSize == 0; }

◆ end() [1/2]

template<typename T >
T * skia_private::AutoTArray< T >::end ( )
inline

Definition at line 149 of file SkTemplates.h.

149 {
150 if (fData == nullptr) {
151 SkASSERT(fSize == 0);
152 }
153 return fData + fSize;
154 }
#define SkASSERT(cond)
Definition: SkAssert.h:116

◆ end() [2/2]

template<typename T >
const T * skia_private::AutoTArray< T >::end ( ) const
inline

Definition at line 155 of file SkTemplates.h.

155 {
156 if (fData == nullptr) {
157 SkASSERT(fSize == 0);
158 }
159 return fData + fSize;
160 }

◆ get()

template<typename T >
T * skia_private::AutoTArray< T >::get ( ) const
inline

Definition at line 127 of file SkTemplates.h.

127{ return fData.get(); }

◆ operator=()

template<typename T >
AutoTArray & skia_private::AutoTArray< T >::operator= ( AutoTArray< T > &&  other)
inline

Definition at line 114 of file SkTemplates.h.

114 {
115 if (this != &other) {
116 fData = std::move(other.fData);
117 fSize = std::exchange(other.fSize, 0);
118 }
119 return *this;
120 }

◆ operator[]()

template<typename T >
T & skia_private::AutoTArray< T >::operator[] ( size_t  index) const
inline

Definition at line 129 of file SkTemplates.h.

129 {
130 return fData[sk_collection_check_bounds(index, fSize)];
131 }
SK_API T sk_collection_check_bounds(T i, T size)
Definition: SkAssert.h:143

◆ reset()

template<typename T >
void skia_private::AutoTArray< T >::reset ( size_t  count = 0)
inline

Definition at line 123 of file SkTemplates.h.

123 {
124 *this = AutoTArray(count);
125 }
int count
Definition: FontMgrTest.cpp:50

◆ size()

template<typename T >
size_t skia_private::AutoTArray< T >::size ( ) const
inline

Definition at line 136 of file SkTemplates.h.

136{ return fSize; }

◆ size_bytes()

template<typename T >
size_t skia_private::AutoTArray< T >::size_bytes ( ) const
inline

Definition at line 138 of file SkTemplates.h.

138{ return sizeof(T) * fSize; }

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