OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 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 CHROME_COMMON_EXTENSIONS_VALUE_SET_H_ | |
6 #define CHROME_COMMON_EXTENSIONS_VALUE_SET_H_ | |
7 #pragma once | |
8 | |
9 #include "base/memory/linked_ptr.h" | |
10 | |
11 #include <vector> | |
12 | |
13 namespace base { | |
14 class Value; | |
15 } | |
16 | |
17 class ValueSet { | |
Matt Perry
2012/06/13 01:24:27
class comment
Matt Perry
2012/06/13 01:24:27
extensions namespace
koz (OOO until 15th September)
2012/06/14 02:15:55
Done.
koz (OOO until 15th September)
2012/06/14 02:15:55
Done.
| |
18 public: | |
19 ValueSet(); | |
20 ~ValueSet(); | |
21 | |
22 // Adds |value| to the set and returns how many equal values are in the | |
23 // set after. | |
24 int Add(const base::Value* value); | |
battre
2012/06/13 09:21:54
how is the ownership of |value| handled?
koz (OOO until 15th September)
2012/06/14 02:15:55
Done.
| |
25 | |
26 // Removes |value| from the set and returns how many equal values are in | |
27 // the set after. | |
28 int Remove(const base::Value* value); | |
29 | |
30 // Same as Add() but only performs the add if the value isn't present. | |
31 int AddIfMissing(const base::Value* value); | |
32 | |
33 private: | |
34 struct Entry { | |
35 explicit Entry(const base::Value* value); | |
36 ~Entry(); | |
37 | |
38 int Increment(); | |
39 int Decrement(); | |
40 | |
41 linked_ptr<base::Value> value; | |
42 int count; | |
43 }; | |
44 typedef std::vector<linked_ptr<Entry> > EntryList; | |
45 | |
46 int AddImpl(const base::Value* value, bool increment); | |
47 | |
48 EntryList entries_; | |
battre
2012/06/13 09:21:54
DISALLOW_COPY_AND_ASSIGN
koz (OOO until 15th September)
2012/06/14 02:15:55
Done.
| |
49 }; | |
50 | |
51 #endif // CHROME_COMMON_EXTENSIONS_VALUE_SET_H_ | |
OLD | NEW |