OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef BASE_WIN_SCOPED_PROPVARIANT_H_ | |
6 #define BASE_WIN_SCOPED_PROPVARIANT_H_ | |
7 | |
8 #include <propidl.h> | |
9 | |
10 namespace base { | |
11 namespace win { | |
12 | |
13 // A PROPVARIANT that is automatically initialized and cleared upon respective | |
14 // construction and destruction of this class. | |
15 class ScopedPropVariant { | |
grt (UTC plus 2)
2013/01/09 14:30:10
it'd be nice if this scoper was safe to use. as it
grt (UTC plus 2)
2013/01/09 16:06:16
A Reset() method that calls PropVariantClear would
gab
2013/01/09 20:43:39
Ah good point, done.
gab
2013/01/09 20:43:39
Done.
| |
16 public: | |
17 ScopedPropVariant() { | |
18 PropVariantInit(&pv_); | |
19 } | |
20 ~ScopedPropVariant() { | |
21 PropVariantClear(&pv_); | |
22 } | |
23 | |
24 PROPVARIANT* operator&() { | |
25 return &pv_; | |
26 } | |
27 | |
28 // Allow direct read-only access to the members of |pv_| with the -> operator. | |
29 const PROPVARIANT* operator->() const { | |
grt (UTC plus 2)
2013/01/09 14:30:10
a conversion function would be a nice fit:
oper
gab
2013/01/09 20:43:39
This doesn't work directly: i.e. pv_app_it.vt stil
grt (UTC plus 2)
2013/01/10 03:24:05
Doh!
gab
2013/01/10 15:30:42
Ok change removed operator->, added get() method.
| |
30 return &pv_; | |
31 } | |
32 | |
33 private: | |
34 PROPVARIANT pv_; | |
35 }; | |
36 | |
37 } // namespace win | |
38 } // namespace base | |
39 | |
40 #endif // BASE_WIN_SCOPED_PROPVARIANT_H_ | |
OLD | NEW |