| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef BASE_WIN_ENUM_VARIANT_H_ |
| 6 #define BASE_WIN_ENUM_VARIANT_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <unknwn.h> |
| 10 |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 |
| 13 namespace base { |
| 14 namespace win { |
| 15 |
| 16 // A simple implementation of IEnumVARIANT. |
| 17 class BASE_EXPORT EnumVariant : public IEnumVARIANT { |
| 18 public: |
| 19 // The constructor allocates an array of size |count|. Then use |
| 20 // ItemAt to set the value of each item in the array to initialize it. |
| 21 explicit EnumVariant(unsigned long count); |
| 22 |
| 23 // Returns a mutable pointer to the item at position |index|. |
| 24 VARIANT* ItemAt(unsigned long index); |
| 25 |
| 26 // IUnknown. |
| 27 ULONG STDMETHODCALLTYPE AddRef(); |
| 28 ULONG STDMETHODCALLTYPE Release(); |
| 29 STDMETHODIMP QueryInterface(REFIID riid, void** ppv); |
| 30 |
| 31 // IEnumVARIANT. |
| 32 STDMETHODIMP Next(ULONG requested_count, |
| 33 VARIANT* out_elements, |
| 34 ULONG* out_elements_received); |
| 35 STDMETHODIMP Skip(ULONG skip_count); |
| 36 STDMETHODIMP Reset(); |
| 37 STDMETHODIMP Clone(IEnumVARIANT** out_cloned_object); |
| 38 |
| 39 private: |
| 40 virtual ~EnumVariant(); |
| 41 |
| 42 scoped_array<VARIANT> items_; |
| 43 ULONG count_; |
| 44 ULONG current_index_; |
| 45 |
| 46 // Reference count for the IUnknown interface. |
| 47 ULONG ref_count_; |
| 48 }; |
| 49 |
| 50 } // namespace win |
| 51 } // namespace base |
| 52 |
| 53 #endif // BASE_WIN_ENUM_VARIANT_H_ |
| OLD | NEW |