| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_WIN_SCOPED_VARIANT_H_ | 5 #ifndef BASE_WIN_SCOPED_VARIANT_H_ |
| 6 #define BASE_WIN_SCOPED_VARIANT_H_ | 6 #define BASE_WIN_SCOPED_VARIANT_H_ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <oleauto.h> | 9 #include <oleauto.h> |
| 10 | 10 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 void Set(SAFEARRAY* array); | 115 void Set(SAFEARRAY* array); |
| 116 | 116 |
| 117 // Special setter for DATE since DATE is a double and we already have | 117 // Special setter for DATE since DATE is a double and we already have |
| 118 // a setter for double. | 118 // a setter for double. |
| 119 void SetDate(DATE date); | 119 void SetDate(DATE date); |
| 120 | 120 |
| 121 // Allows const access to the contained variant without DCHECKs etc. | 121 // Allows const access to the contained variant without DCHECKs etc. |
| 122 // This support is necessary for the V_XYZ (e.g. V_BSTR) set of macros to | 122 // This support is necessary for the V_XYZ (e.g. V_BSTR) set of macros to |
| 123 // work properly but still doesn't allow modifications since we want control | 123 // work properly but still doesn't allow modifications since we want control |
| 124 // over that. | 124 // over that. |
| 125 const VARIANT* operator&() const { | 125 const VARIANT* ptr() const { return &var_; } |
| 126 return &var_; | |
| 127 } | |
| 128 | 126 |
| 129 // Like other scoped classes (e.g scoped_refptr, ScopedComPtr, ScopedBstr) | 127 // Like other scoped classes (e.g scoped_refptr, ScopedComPtr, ScopedBstr) |
| 130 // we support the assignment operator for the type we wrap. | 128 // we support the assignment operator for the type we wrap. |
| 131 ScopedVariant& operator=(const VARIANT& var); | 129 ScopedVariant& operator=(const VARIANT& var); |
| 132 | 130 |
| 133 // A hack to pass a pointer to the variant where the accepting | 131 // A hack to pass a pointer to the variant where the accepting |
| 134 // function treats the variant as an input-only, read-only value | 132 // function treats the variant as an input-only, read-only value |
| 135 // but the function prototype requires a non const variant pointer. | 133 // but the function prototype requires a non const variant pointer. |
| 136 // There's no DCHECK or anything here. Callers must know what they're doing. | 134 // There's no DCHECK or anything here. Callers must know what they're doing. |
| 137 VARIANT* AsInput() const { | 135 VARIANT* AsInput() const { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 154 | 152 |
| 155 private: | 153 private: |
| 156 // Comparison operators for ScopedVariant are not supported at this point. | 154 // Comparison operators for ScopedVariant are not supported at this point. |
| 157 // Use the Compare method instead. | 155 // Use the Compare method instead. |
| 158 bool operator==(const ScopedVariant& var) const; | 156 bool operator==(const ScopedVariant& var) const; |
| 159 bool operator!=(const ScopedVariant& var) const; | 157 bool operator!=(const ScopedVariant& var) const; |
| 160 DISALLOW_COPY_AND_ASSIGN(ScopedVariant); | 158 DISALLOW_COPY_AND_ASSIGN(ScopedVariant); |
| 161 }; | 159 }; |
| 162 | 160 |
| 163 } // namespace win | 161 } // namespace win |
| 164 } // namesoace base | 162 } // namespace base |
| 165 | 163 |
| 166 #endif // BASE_WIN_SCOPED_VARIANT_H_ | 164 #endif // BASE_WIN_SCOPED_VARIANT_H_ |
| OLD | NEW |