summaryrefslogtreecommitdiffstats
path: root/base/scoped_variant_win.h
diff options
context:
space:
mode:
authortommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-25 22:35:45 +0000
committertommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-25 22:35:45 +0000
commit6e1f48fb52edc5583db8c6deea2f00600bdddb8b (patch)
tree01689bb373f9383c66755b47f1c8b0b846537078 /base/scoped_variant_win.h
parent003849a2a44f7e8c7ae7a081d7c6bc0c0f9b5a2d (diff)
downloadchromium_src-6e1f48fb52edc5583db8c6deea2f00600bdddb8b.zip
chromium_src-6e1f48fb52edc5583db8c6deea2f00600bdddb8b.tar.gz
chromium_src-6e1f48fb52edc5583db8c6deea2f00600bdddb8b.tar.bz2
Adding a Set() method for copying (not taking ownership) a variant over to the ScopedVariant and a couple of new constructors for IDispatch and IUnknown. includes tests.
Review URL: http://codereview.chromium.org/42569 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12506 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/scoped_variant_win.h')
-rw-r--r--base/scoped_variant_win.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/base/scoped_variant_win.h b/base/scoped_variant_win.h
index 50c9ce3..909e4da 100644
--- a/base/scoped_variant_win.h
+++ b/base/scoped_variant_win.h
@@ -40,6 +40,15 @@ class ScopedVariant {
// VARIANT.lVal (32 bit sized field).
explicit ScopedVariant(int value, VARTYPE vt = VT_I4);
+ // VT_DISPATCH
+ explicit ScopedVariant(IDispatch* dispatch);
+
+ // VT_UNKNOWN
+ explicit ScopedVariant(IUnknown* unknown);
+
+ // Copies the variant.
+ explicit ScopedVariant(const VARIANT& var);
+
~ScopedVariant();
inline VARTYPE type() const {
@@ -83,6 +92,11 @@ class ScopedVariant {
void Set(double r64);
void Set(bool b);
+ // Creates a copy of |var| and assigns as this instance's value.
+ // Note that this is different from the Reset() method that's used to
+ // free the current value and assume ownership.
+ void Set(const VARIANT& var);
+
// COM object setters
void Set(IDispatch* disp);
void Set(IUnknown* unk);
@@ -102,6 +116,10 @@ class ScopedVariant {
return &var_;
}
+ // Like other scoped classes (e.g scoped_refptr, ScopedComPtr, ScopedBstr)
+ // we support the assignment operator for the type we wrap.
+ ScopedVariant& operator=(const VARIANT& var);
+
// A hack to pass a pointer to the variant where the accepting
// function treats the variant as an input-only, read-only value
// but the function prototype requires a non const variant pointer.