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 #include "base/basictypes.h" | |
11 #include "base/logging.h" | |
12 | |
13 namespace base { | |
14 namespace win { | |
15 | |
16 // A PROPVARIANT that is automatically initialized and cleared upon respective | |
17 // construction and destruction of this class. | |
18 class ScopedPropVariant { | |
19 public: | |
20 ScopedPropVariant() { | |
21 PropVariantInit(&pv_); | |
22 } | |
23 ~ScopedPropVariant() { | |
grt (UTC plus 2)
2013/01/10 16:05:20
nit: empty line before this
gab
2013/01/10 18:11:38
Done.
| |
24 Reset(); | |
25 } | |
26 | |
27 PROPVARIANT* Receive() { | |
grt (UTC plus 2)
2013/01/10 16:05:20
i can haz doc comment?
gab
2013/01/10 18:11:38
Done.
| |
28 DCHECK_EQ(pv_.vt, VT_EMPTY); | |
29 return &pv_; | |
30 } | |
31 | |
32 void Reset() { | |
grt (UTC plus 2)
2013/01/10 16:05:20
here, too?
gab
2013/01/10 18:11:38
Done.
| |
33 HRESULT result = PropVariantClear(&pv_); | |
34 DCHECK_EQ(result, S_OK); | |
35 } | |
36 | |
37 const PROPVARIANT& get() const { return pv_; } | |
38 | |
39 const PROPVARIANT* operator&() const { return &pv_; } | |
40 | |
41 private: | |
42 PROPVARIANT pv_; | |
43 | |
44 // Comparison operators for ScopedPropVariant are not supported at this point. | |
45 bool operator==(const ScopedPropVariant&) const; | |
46 bool operator!=(const ScopedPropVariant&) const; | |
47 DISALLOW_COPY_AND_ASSIGN(ScopedPropVariant); | |
48 }; | |
49 | |
50 } // namespace win | |
51 } // namespace base | |
52 | |
53 #endif // BASE_WIN_SCOPED_PROPVARIANT_H_ | |
OLD | NEW |