blob: 30c2f023a4e3f082f75e210556fe705405f5e66d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#pragma once
class StringReferenceWrapper
{
public:
StringReferenceWrapper(_In_reads_(length) PCWSTR stringRef, _In_ UINT32 length) throw()
{ WindowsCreateStringReference(stringRef, length, &_header, &_hstring);
}
template <size_t N>
StringReferenceWrapper(_In_reads_(N) wchar_t const (&stringRef)[N]) throw()
{ WindowsCreateStringReference(stringRef, (UINT32)(N - 1), &_header, &_hstring);
}
template <size_t _>
StringReferenceWrapper(_In_reads_(_) wchar_t(&stringRef)[_]) throw()
{ WindowsCreateStringReference(stringRef, mir_wstrlen(stringRef), &_header, &_hstring);
}
~StringReferenceWrapper()
{ WindowsDeleteString(_hstring);
}
HSTRING Get() const throw()
{ return _hstring;
}
private:
HSTRING _hstring;
HSTRING_HEADER _header;
};
|