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 { | |
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
| |
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. | |
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
| |
21 EnumVariant(unsigned long count); | |
22 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.
| |
23 | |
24 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
| |
25 | |
26 // IUnknown. | |
27 ULONG STDMETHODCALLTYPE AddRef(); | |
28 | |
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.
| |
29 ULONG STDMETHODCALLTYPE Release(); | |
30 | |
31 STDMETHODIMP QueryInterface(REFIID riid, void** ppv); | |
32 | |
33 // IEnumVARIANT. | |
34 STDMETHODIMP Next(ULONG requested_count, | |
35 VARIANT* out_elements, | |
36 ULONG* out_elements_received); | |
37 | |
38 STDMETHODIMP Skip(ULONG skip_count); | |
39 | |
40 STDMETHODIMP Reset(); | |
41 | |
42 STDMETHODIMP Clone(IEnumVARIANT** out_cloned_object); | |
43 | |
44 private: | |
45 scoped_array<VARIANT> items_; | |
46 ULONG count_; | |
47 ULONG current_index_; | |
48 | |
49 // IUnknown ref count. | |
50 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
| |
51 }; | |
52 | |
53 } // namespace win | |
54 } // namespace base | |
55 | |
56 #endif // BASE_WIN_ENUM_VARIANT_H_ | |
OLD | NEW |