Index: base/win/enum_variant.h |
=================================================================== |
--- base/win/enum_variant.h (revision 0) |
+++ base/win/enum_variant.h (revision 0) |
@@ -0,0 +1,56 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef BASE_WIN_ENUM_VARIANT_H_ |
+#define BASE_WIN_ENUM_VARIANT_H_ |
+#pragma once |
+ |
+#include <unknwn.h> |
+ |
+#include "base/memory/scoped_ptr.h" |
+ |
+namespace base { |
+namespace win { |
+ |
+// A simple implementation of IEnumVARIANT. |
+class BASE_EXPORT EnumVariant : public IEnumVARIANT { |
darin (slow to review)
2011/11/22 01:16:52
I know you are naming this based on the interface
dmazzoni
2011/11/22 08:08:14
In this case, I favor something closer to the inte
|
+ public: |
+ // The constructor allocates an array of size |count|. Then use |
+ // itemAt to set the value of each item in the array to initialize it. |
darin (slow to review)
2011/11/22 01:16:52
This comment refers to a function named "itemAt" t
dmazzoni
2011/11/22 08:08:14
Renamed get() -> ItemAt() as per your suggestion b
|
+ EnumVariant(unsigned long count); |
+ virtual ~EnumVariant(); |
darin (slow to review)
2011/11/22 01:16:52
The destructor should not be public as deleting a
dmazzoni
2011/11/22 08:08:14
Done.
|
+ |
+ VARIANT* get(unsigned long index); |
darin (slow to review)
2011/11/22 01:16:52
nit: non-inline functions should be given CamelCas
dmazzoni
2011/11/22 08:08:14
Changed back to ItemAt (as you can see from the co
|
+ |
+ // IUnknown. |
+ ULONG STDMETHODCALLTYPE AddRef(); |
+ |
darin (slow to review)
2011/11/22 01:16:52
nit: nuke the extra new lines between method decla
dmazzoni
2011/11/22 08:08:14
Done.
|
+ ULONG STDMETHODCALLTYPE Release(); |
+ |
+ STDMETHODIMP QueryInterface(REFIID riid, void** ppv); |
+ |
+ // IEnumVARIANT. |
+ STDMETHODIMP Next(ULONG requested_count, |
+ VARIANT* out_elements, |
+ ULONG* out_elements_received); |
+ |
+ STDMETHODIMP Skip(ULONG skip_count); |
+ |
+ STDMETHODIMP Reset(); |
+ |
+ STDMETHODIMP Clone(IEnumVARIANT** out_cloned_object); |
+ |
+ private: |
+ scoped_array<VARIANT> items_; |
+ ULONG count_; |
+ ULONG current_index_; |
+ |
+ // IUnknown ref count. |
+ ULONG iunknown_ref_count_; |
darin (slow to review)
2011/11/22 01:16:52
nit: why bother with the iunknown_ prefix here? i
dmazzoni
2011/11/22 08:08:14
Unfortunately RefCountedThreadSafe has its own Add
|
+}; |
+ |
+} // namespace win |
+} // namespace base |
+ |
+#endif // BASE_WIN_ENUM_VARIANT_H_ |