#include <scoped_bstr.h>
Definition at line 22 of file scoped_bstr.h.
◆ ScopedBstr() [1/2]
base::win::ScopedBstr::ScopedBstr |
( |
| ) |
|
|
default |
◆ ScopedBstr() [2/2]
base::win::ScopedBstr::ScopedBstr |
( |
std::wstring_view |
non_bstr | ) |
|
|
explicit |
Definition at line 34 of file scoped_bstr.cc.
35 : bstr_(AllocBstrOrDie(non_bstr)) {}
◆ ~ScopedBstr()
base::win::ScopedBstr::~ScopedBstr |
( |
| ) |
|
Definition at line 37 of file scoped_bstr.cc.
37 {
38 static_assert(
sizeof(
ScopedBstr) ==
sizeof(BSTR),
"ScopedBstrSize");
39 ::SysFreeString(bstr_);
40}
◆ Allocate()
BSTR base::win::ScopedBstr::Allocate |
( |
std::wstring_view |
str | ) |
|
Definition at line 67 of file scoped_bstr.cc.
67 {
68 Reset(AllocBstrOrDie(str));
69 return bstr_;
70}
void Reset(BSTR bstr=nullptr)
◆ AllocateBytes()
BSTR base::win::ScopedBstr::AllocateBytes |
( |
size_t |
bytes | ) |
|
Definition at line 72 of file scoped_bstr.cc.
72 {
73 Reset(AllocBstrBytesOrDie(bytes));
74 return bstr_;
75}
◆ ByteLength()
size_t base::win::ScopedBstr::ByteLength |
( |
| ) |
const |
Definition at line 87 of file scoped_bstr.cc.
87 {
88 return ::SysStringByteLen(bstr_);
89}
◆ Get()
BSTR base::win::ScopedBstr::Get |
( |
| ) |
const |
|
inline |
◆ Length()
size_t base::win::ScopedBstr::Length |
( |
| ) |
const |
Definition at line 83 of file scoped_bstr.cc.
83 {
84 return ::SysStringLen(bstr_);
85}
◆ operator!=()
bool base::win::ScopedBstr::operator!= |
( |
const ScopedBstr & |
bstr2 | ) |
const |
|
delete |
◆ operator==()
bool base::win::ScopedBstr::operator== |
( |
const ScopedBstr & |
bstr2 | ) |
const |
|
delete |
◆ Receive()
BSTR * base::win::ScopedBstr::Receive |
( |
| ) |
|
Definition at line 62 of file scoped_bstr.cc.
62 {
64 return &bstr_;
65}
#define BASE_DCHECK(condition)
◆ Release()
BSTR base::win::ScopedBstr::Release |
( |
| ) |
|
Definition at line 50 of file scoped_bstr.cc.
50 {
51 BSTR bstr = bstr_;
52 bstr_ = nullptr;
53 return bstr;
54}
◆ Reset()
void base::win::ScopedBstr::Reset |
( |
BSTR |
bstr = nullptr | ) |
|
Definition at line 42 of file scoped_bstr.cc.
42 {
43 if (bstr != bstr_) {
44
45 ::SysFreeString(bstr_);
46 bstr_ = bstr;
47 }
48}
◆ SetByteLen()
void base::win::ScopedBstr::SetByteLen |
( |
size_t |
bytes | ) |
|
Definition at line 77 of file scoped_bstr.cc.
77 {
79 uint32_t*
data =
reinterpret_cast<uint32_t*
>(bstr_);
80 data[-1] = checked_cast<uint32_t>(bytes);
81}
std::shared_ptr< const fml::Mapping > data
◆ Swap()
void base::win::ScopedBstr::Swap |
( |
ScopedBstr & |
bstr2 | ) |
|
Definition at line 56 of file scoped_bstr.cc.
56 {
57 BSTR tmp = bstr_;
58 bstr_ = bstr2.bstr_;
59 bstr2.bstr_ = tmp;
60}
The documentation for this class was generated from the following files: