Chromium Code Reviews| 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 #include "base/win/iunknown_impl.h" | |
| 13 | |
| 14 namespace base { | |
| 15 namespace win { | |
| 16 | |
| 17 // A simple implementation of IEnumVARIANT. | |
| 18 class BASE_EXPORT EnumVariant | |
| 19 : public IEnumVARIANT, | |
| 20 public IUnknownImpl { | |
| 21 public: | |
| 22 // The constructor allocates an array of size |count|. Then use | |
| 23 // ItemAt to set the value of each item in the array to initialize it. | |
| 24 explicit EnumVariant(unsigned long count); | |
|
M-A Ruel
2011/11/29 20:28:32
why do you alternate between unsigned long and ULO
dmazzoni
2011/11/29 21:55:00
My intent was to use ULONG only in arguments and r
| |
| 25 | |
| 26 // Returns a mutable pointer to the item at position |index|. | |
| 27 VARIANT* ItemAt(unsigned long index); | |
| 28 | |
| 29 // IUnknown. | |
| 30 ULONG STDMETHODCALLTYPE AddRef() OVERRIDE; | |
| 31 ULONG STDMETHODCALLTYPE Release() OVERRIDE; | |
| 32 STDMETHODIMP QueryInterface(REFIID riid, void** ppv) OVERRIDE; | |
| 33 | |
| 34 // IEnumVARIANT. | |
| 35 STDMETHODIMP Next(ULONG requested_count, | |
| 36 VARIANT* out_elements, | |
| 37 ULONG* out_elements_received); | |
| 38 STDMETHODIMP Skip(ULONG skip_count); | |
| 39 STDMETHODIMP Reset(); | |
| 40 STDMETHODIMP Clone(IEnumVARIANT** out_cloned_object); | |
| 41 | |
| 42 private: | |
| 43 ~EnumVariant(); | |
| 44 | |
| 45 scoped_array<VARIANT> items_; | |
| 46 ULONG count_; | |
| 47 ULONG current_index_; | |
| 48 }; | |
| 49 | |
| 50 } // namespace win | |
| 51 } // namespace base | |
| 52 | |
| 53 #endif // BASE_WIN_ENUM_VARIANT_H_ | |
| OLD | NEW |