OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_NOTIFIER_INVALIDATION_UTIL_H_ | 7 #ifndef SYNC_NOTIFIER_INVALIDATION_UTIL_H_ |
8 #define SYNC_NOTIFIER_INVALIDATION_UTIL_H_ | 8 #define SYNC_NOTIFIER_INVALIDATION_UTIL_H_ |
9 | 9 |
| 10 #include <iosfwd> |
10 #include <set> | 11 #include <set> |
11 #include <string> | 12 #include <string> |
12 | 13 |
13 #include "sync/internal_api/public/base/model_type.h" | 14 #include "sync/internal_api/public/base/model_type.h" |
14 | 15 |
15 namespace invalidation { | 16 namespace invalidation { |
16 | 17 |
17 class Invalidation; | 18 class Invalidation; |
18 class ObjectId; | 19 class ObjectId; |
19 | 20 |
| 21 // Gmock print helper |
| 22 void PrintTo(const invalidation::ObjectId& id, std::ostream* os); |
| 23 |
20 } // namespace invalidation | 24 } // namespace invalidation |
21 | 25 |
22 namespace syncer { | 26 namespace syncer { |
23 | 27 |
24 struct ObjectIdLessThan { | 28 struct ObjectIdLessThan { |
25 bool operator()(const invalidation::ObjectId& lhs, | 29 bool operator()(const invalidation::ObjectId& lhs, |
26 const invalidation::ObjectId& rhs) const; | 30 const invalidation::ObjectId& rhs) const; |
27 }; | 31 }; |
28 | 32 |
29 typedef std::set<invalidation::ObjectId, ObjectIdLessThan> ObjectIdSet; | 33 typedef std::set<invalidation::ObjectId, ObjectIdLessThan> ObjectIdSet; |
30 | 34 |
31 bool RealModelTypeToObjectId(ModelType model_type, | 35 bool RealModelTypeToObjectId(ModelType model_type, |
32 invalidation::ObjectId* object_id); | 36 invalidation::ObjectId* object_id); |
33 | 37 |
34 bool ObjectIdToRealModelType(const invalidation::ObjectId& object_id, | 38 bool ObjectIdToRealModelType(const invalidation::ObjectId& object_id, |
35 ModelType* model_type); | 39 ModelType* model_type); |
36 | 40 |
37 ObjectIdSet ModelTypeSetToObjectIdSet(const ModelTypeSet& models); | 41 ObjectIdSet ModelTypeSetToObjectIdSet(const ModelTypeSet& models); |
38 ModelTypeSet ObjectIdSetToModelTypeSet(const ObjectIdSet& ids); | 42 ModelTypeSet ObjectIdSetToModelTypeSet(const ObjectIdSet& ids); |
39 | 43 |
40 std::string ObjectIdToString(const invalidation::ObjectId& object_id); | 44 std::string ObjectIdToString(const invalidation::ObjectId& object_id); |
41 | 45 |
42 std::string InvalidationToString( | 46 std::string InvalidationToString( |
43 const invalidation::Invalidation& invalidation); | 47 const invalidation::Invalidation& invalidation); |
44 | 48 |
45 } // namespace syncer | 49 } // namespace syncer |
46 | 50 |
47 #endif // SYNC_NOTIFIER_INVALIDATION_UTIL_H_ | 51 #endif // SYNC_NOTIFIER_INVALIDATION_UTIL_H_ |
OLD | NEW |