#include <scoped_safearray.h>
Definition at line 22 of file scoped_safearray.h.
◆ ScopedSafearray() [1/2]
base::win::ScopedSafearray::ScopedSafearray |
( |
SAFEARRAY * |
safearray = nullptr | ) |
|
|
inlineexplicit |
◆ ScopedSafearray() [2/2]
Definition at line 123 of file scoped_safearray.h.
123 : safearray_(r.safearray_) {
124 r.safearray_ = nullptr;
125 }
◆ ~ScopedSafearray()
base::win::ScopedSafearray::~ScopedSafearray |
( |
| ) |
|
|
inline |
◆ CreateLockScope()
template<VARTYPE ElementVartype>
std::optional< LockScope< ElementVartype > > base::win::ScopedSafearray::CreateLockScope |
( |
| ) |
const |
|
inline |
Definition at line 138 of file scoped_safearray.h.
138 {
139 if (!safearray_ || SafeArrayGetDim(safearray_) != 1)
140 return std::nullopt;
141
142 VARTYPE vartype;
143 HRESULT hr = SafeArrayGetVartype(safearray_, &vartype);
146 return std::nullopt;
147 }
148
150 hr = SafeArrayAccessData(safearray_, reinterpret_cast<void**>(&array));
152 return std::nullopt;
153
154 const size_t array_size =
GetCount();
155 return LockScope<ElementVartype>(safearray_, vartype, array, array_size);
156 }
size_t GetCount(UINT dimension=0) const
static constexpr bool IsConvertibleTo(VARTYPE vartype)
◆ Destroy()
void base::win::ScopedSafearray::Destroy |
( |
| ) |
|
|
inline |
Definition at line 158 of file scoped_safearray.h.
158 {
159 if (safearray_) {
160 HRESULT hr = SafeArrayDestroy(safearray_);
162 safearray_ = nullptr;
163 }
164 }
#define BASE_DCHECK(condition)
◆ Get()
SAFEARRAY * base::win::ScopedSafearray::Get |
( |
| ) |
const |
|
inline |
◆ GetCount()
size_t base::win::ScopedSafearray::GetCount |
( |
UINT |
dimension = 0 | ) |
const |
|
inline |
Definition at line 193 of file scoped_safearray.h.
193 {
195
196
197
200 BASE_DCHECK(dimension < SafeArrayGetDim(safearray_));
201 HRESULT hr = SafeArrayGetLBound(safearray_, dimension + 1, &
lower);
203 hr = SafeArrayGetUBound(safearray_, dimension + 1, &upper);
205 return (upper -
lower + 1);
206 }
◆ operator!=()
bool base::win::ScopedSafearray::operator!= |
( |
const ScopedSafearray & |
safearray2 | ) |
const |
|
delete |
◆ operator=()
Definition at line 128 of file scoped_safearray.h.
128 {
129 Reset(rvalue.Release());
130 return *this;
131 }
void Reset(SAFEARRAY *safearray=nullptr)
◆ operator==()
bool base::win::ScopedSafearray::operator== |
( |
const ScopedSafearray & |
safearray2 | ) |
const |
|
delete |
◆ Receive()
SAFEARRAY ** base::win::ScopedSafearray::Receive |
( |
| ) |
|
|
inline |
◆ Release()
SAFEARRAY * base::win::ScopedSafearray::Release |
( |
| ) |
|
|
inline |
Definition at line 176 of file scoped_safearray.h.
176 {
177 SAFEARRAY* safearray = safearray_;
178 safearray_ = nullptr;
179 return safearray;
180 }
◆ Reset()
void base::win::ScopedSafearray::Reset |
( |
SAFEARRAY * |
safearray = nullptr | ) |
|
|
inline |
Definition at line 168 of file scoped_safearray.h.
168 {
169 if (safearray != safearray_) {
171 safearray_ = safearray;
172 }
173 }
The documentation for this class was generated from the following file: