[email protected] | 001bbfdc | 2014-07-17 19:28:46 | [diff] [blame] | 1 | // Copyright 2014 The Chromium Authors. All rights reserved. |
[email protected] | 8516471 | 2010-06-23 01:13:56 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | // | ||||
5 | // Various utilities for dealing with invalidation data types. | ||||
6 | |||||
knn | 062cdbb | 2015-06-26 18:18:42 | [diff] [blame] | 7 | #ifndef COMPONENTS_INVALIDATION_PUBLIC_INVALIDATION_UTIL_H_ |
8 | #define COMPONENTS_INVALIDATION_PUBLIC_INVALIDATION_UTIL_H_ | ||||
[email protected] | 8516471 | 2010-06-23 01:13:56 | [diff] [blame] | 9 | |
[email protected] | 9364154f | 2014-03-31 17:39:24 | [diff] [blame] | 10 | #include <map> |
dcheng | b753c6f | 2016-04-23 01:22:17 | [diff] [blame] | 11 | #include <memory> |
[email protected] | 8e4c8887 | 2012-06-28 04:34:35 | [diff] [blame] | 12 | #include <set> |
[email protected] | 8516471 | 2010-06-23 01:13:56 | [diff] [blame] | 13 | #include <string> |
14 | |||||
knn | 062cdbb | 2015-06-26 18:18:42 | [diff] [blame] | 15 | #include "components/invalidation/public/invalidation_export.h" |
[email protected] | d49f4633 | 2011-07-15 21:31:07 | [diff] [blame] | 16 | |
[email protected] | 33596da | 2012-08-31 23:39:25 | [diff] [blame] | 17 | namespace base { |
18 | class DictionaryValue; | ||||
19 | } // namespace | ||||
20 | |||||
[email protected] | d49f4633 | 2011-07-15 21:31:07 | [diff] [blame] | 21 | namespace invalidation { |
[email protected] | d49f4633 | 2011-07-15 21:31:07 | [diff] [blame] | 22 | class Invalidation; |
23 | class ObjectId; | ||||
[email protected] | d49f4633 | 2011-07-15 21:31:07 | [diff] [blame] | 24 | } // namespace invalidation |
[email protected] | 8516471 | 2010-06-23 01:13:56 | [diff] [blame] | 25 | |
[email protected] | 65f17355 | 2012-06-28 22:43:58 | [diff] [blame] | 26 | namespace syncer { |
[email protected] | 8516471 | 2010-06-23 01:13:56 | [diff] [blame] | 27 | |
[email protected] | bea426f | 2013-10-23 22:43:48 | [diff] [blame] | 28 | class Invalidation; |
29 | |||||
[email protected] | 51766bf | 2014-07-24 01:13:47 | [diff] [blame] | 30 | struct INVALIDATION_EXPORT ObjectIdLessThan { |
[email protected] | 739cee3 | 2012-06-20 20:37:28 | [diff] [blame] | 31 | bool operator()(const invalidation::ObjectId& lhs, |
32 | const invalidation::ObjectId& rhs) const; | ||||
33 | }; | ||||
[email protected] | 8516471 | 2010-06-23 01:13:56 | [diff] [blame] | 34 | |
[email protected] | 51766bf | 2014-07-24 01:13:47 | [diff] [blame] | 35 | struct INVALIDATION_EXPORT InvalidationVersionLessThan { |
[email protected] | bea426f | 2013-10-23 22:43:48 | [diff] [blame] | 36 | bool operator()(const syncer::Invalidation& a, |
37 | const syncer::Invalidation& b) const; | ||||
38 | }; | ||||
39 | |||||
[email protected] | 8e4c8887 | 2012-06-28 04:34:35 | [diff] [blame] | 40 | typedef std::set<invalidation::ObjectId, ObjectIdLessThan> ObjectIdSet; |
41 | |||||
[email protected] | 9364154f | 2014-03-31 17:39:24 | [diff] [blame] | 42 | typedef std::map<invalidation::ObjectId, int, ObjectIdLessThan> |
43 | ObjectIdCountMap; | ||||
44 | |||||
[email protected] | 33596da | 2012-08-31 23:39:25 | [diff] [blame] | 45 | // Caller owns the returned DictionaryValue. |
dcheng | b753c6f | 2016-04-23 01:22:17 | [diff] [blame] | 46 | std::unique_ptr<base::DictionaryValue> ObjectIdToValue( |
[email protected] | 33596da | 2012-08-31 23:39:25 | [diff] [blame] | 47 | const invalidation::ObjectId& object_id); |
48 | |||||
49 | bool ObjectIdFromValue(const base::DictionaryValue& value, | ||||
50 | invalidation::ObjectId* out); | ||||
[email protected] | d914f02 | 2012-07-27 02:02:00 | [diff] [blame] | 51 | |
[email protected] | 51766bf | 2014-07-24 01:13:47 | [diff] [blame] | 52 | INVALIDATION_EXPORT std::string ObjectIdToString( |
[email protected] | cc7a544c | 2013-01-02 08:31:51 | [diff] [blame] | 53 | const invalidation::ObjectId& object_id); |
[email protected] | 8516471 | 2010-06-23 01:13:56 | [diff] [blame] | 54 | |
[email protected] | 65f17355 | 2012-06-28 22:43:58 | [diff] [blame] | 55 | } // namespace syncer |
[email protected] | 8516471 | 2010-06-23 01:13:56 | [diff] [blame] | 56 | |
knn | 062cdbb | 2015-06-26 18:18:42 | [diff] [blame] | 57 | #endif // COMPONENTS_INVALIDATION_PUBLIC_INVALIDATION_UTIL_H_ |