MCPcopy Create free account
hub / github.com/OpenCppCoverage/OpenCppCoverage / DiaString

Class DiaString

CppCoverage/DebugInformationEnumerator.cpp:37–78  ·  view source on GitHub ↗

----------------------------------------------------------------------

Source from the content-addressed store, hash-verified

35 {
36 //----------------------------------------------------------------------
37 class DiaString
38 {
39 public:
40 DiaString() = default;
41 DiaString(const DiaString&) = delete;
42 DiaString(DiaString&&) = delete;
43
44 DiaString& operator=(const DiaString&) = delete;
45 DiaString& operator=(DiaString&&) = delete;
46
47 ~DiaString()
48 {
49 ReleaseMemory();
50 }
51
52 BSTR* operator&()
53 {
54 ReleaseMemory();
55 return &str_;
56 }
57
58 operator std::wstring() const
59 {
60 if (!str_)
61 return L"";
62 return str_;
63 }
64
65 private:
66 void ReleaseMemory()
67 {
68 if (str_ != nullptr)
69 {
70 // Cannot call SysFreeString as dia generated invalid BSTR
71 // for x64.
72 LocalFree(str_ - 2);
73 str_ = nullptr;
74 }
75 }
76
77 BSTR str_ = nullptr;
78 };
79
80 //----------------------------------------------------------------------
81 template <typename Value, typename Collection, typename Fct>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected