OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // Various utilities for dealing with invalidation data types. | 5 // Various utilities for dealing with invalidation data types. |
6 | 6 |
7 #ifndef SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_UTIL_H_ | 7 #ifndef COMPONENTS_INVALIDATION_INVALIDATION_UTIL_H_ |
8 #define SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_UTIL_H_ | 8 #define COMPONENTS_INVALIDATION_INVALIDATION_UTIL_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "sync/base/sync_export.h" | 15 #include "components/invalidation/invalidation_export.h" |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class DictionaryValue; | 18 class DictionaryValue; |
19 } // namespace | 19 } // namespace |
20 | 20 |
21 namespace invalidation { | 21 namespace invalidation { |
22 | |
23 class Invalidation; | 22 class Invalidation; |
24 class ObjectId; | 23 class ObjectId; |
25 | |
26 } // namespace invalidation | 24 } // namespace invalidation |
27 | 25 |
28 namespace syncer { | 26 namespace syncer { |
29 | 27 |
30 class Invalidation; | 28 class Invalidation; |
31 | 29 |
32 struct SYNC_EXPORT ObjectIdLessThan { | 30 struct INVALIDATION_EXPORT ObjectIdLessThan { |
33 bool operator()(const invalidation::ObjectId& lhs, | 31 bool operator()(const invalidation::ObjectId& lhs, |
34 const invalidation::ObjectId& rhs) const; | 32 const invalidation::ObjectId& rhs) const; |
35 }; | 33 }; |
36 | 34 |
37 struct SYNC_EXPORT InvalidationVersionLessThan { | 35 struct INVALIDATION_EXPORT InvalidationVersionLessThan { |
38 bool operator()(const syncer::Invalidation& a, | 36 bool operator()(const syncer::Invalidation& a, |
39 const syncer::Invalidation& b) const; | 37 const syncer::Invalidation& b) const; |
40 }; | 38 }; |
41 | 39 |
42 typedef std::set<invalidation::ObjectId, ObjectIdLessThan> ObjectIdSet; | 40 typedef std::set<invalidation::ObjectId, ObjectIdLessThan> ObjectIdSet; |
43 | 41 |
44 typedef std::map<invalidation::ObjectId, int, ObjectIdLessThan> | 42 typedef std::map<invalidation::ObjectId, int, ObjectIdLessThan> |
45 ObjectIdCountMap; | 43 ObjectIdCountMap; |
46 | 44 |
47 // Caller owns the returned DictionaryValue. | 45 // Caller owns the returned DictionaryValue. |
48 scoped_ptr<base::DictionaryValue> ObjectIdToValue( | 46 scoped_ptr<base::DictionaryValue> ObjectIdToValue( |
49 const invalidation::ObjectId& object_id); | 47 const invalidation::ObjectId& object_id); |
50 | 48 |
51 bool ObjectIdFromValue(const base::DictionaryValue& value, | 49 bool ObjectIdFromValue(const base::DictionaryValue& value, |
52 invalidation::ObjectId* out); | 50 invalidation::ObjectId* out); |
53 | 51 |
54 SYNC_EXPORT_PRIVATE std::string ObjectIdToString( | 52 INVALIDATION_EXPORT std::string ObjectIdToString( |
55 const invalidation::ObjectId& object_id); | 53 const invalidation::ObjectId& object_id); |
56 | 54 |
57 } // namespace syncer | 55 } // namespace syncer |
58 | 56 |
59 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_UTIL_H_ | 57 #endif // COMPONENTS_INVALIDATION_INVALIDATION_UTIL_H_ |
OLD | NEW |