blob: 3b68a19fe7874a3f9a9725a6ff42c19137f2f5cc [file] [log] [blame]
[email protected]001bbfdc2014-07-17 19:28:461// Copyright 2014 The Chromium Authors. All rights reserved.
[email protected]85164712010-06-23 01:13:562// 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
knn062cdbb2015-06-26 18:18:427#ifndef COMPONENTS_INVALIDATION_PUBLIC_INVALIDATION_UTIL_H_
8#define COMPONENTS_INVALIDATION_PUBLIC_INVALIDATION_UTIL_H_
[email protected]85164712010-06-23 01:13:569
[email protected]9364154f2014-03-31 17:39:2410#include <map>
dchengb753c6f2016-04-23 01:22:1711#include <memory>
[email protected]8e4c88872012-06-28 04:34:3512#include <set>
[email protected]85164712010-06-23 01:13:5613#include <string>
14
knn062cdbb2015-06-26 18:18:4215#include "components/invalidation/public/invalidation_export.h"
[email protected]d49f46332011-07-15 21:31:0716
[email protected]33596da2012-08-31 23:39:2517namespace base {
18class DictionaryValue;
19} // namespace
20
[email protected]d49f46332011-07-15 21:31:0721namespace invalidation {
[email protected]d49f46332011-07-15 21:31:0722class Invalidation;
23class ObjectId;
[email protected]d49f46332011-07-15 21:31:0724} // namespace invalidation
[email protected]85164712010-06-23 01:13:5625
[email protected]65f173552012-06-28 22:43:5826namespace syncer {
[email protected]85164712010-06-23 01:13:5627
[email protected]bea426f2013-10-23 22:43:4828class Invalidation;
29
[email protected]51766bf2014-07-24 01:13:4730struct INVALIDATION_EXPORT ObjectIdLessThan {
[email protected]739cee32012-06-20 20:37:2831 bool operator()(const invalidation::ObjectId& lhs,
32 const invalidation::ObjectId& rhs) const;
33};
[email protected]85164712010-06-23 01:13:5634
[email protected]51766bf2014-07-24 01:13:4735struct INVALIDATION_EXPORT InvalidationVersionLessThan {
[email protected]bea426f2013-10-23 22:43:4836 bool operator()(const syncer::Invalidation& a,
37 const syncer::Invalidation& b) const;
38};
39
[email protected]8e4c88872012-06-28 04:34:3540typedef std::set<invalidation::ObjectId, ObjectIdLessThan> ObjectIdSet;
41
[email protected]9364154f2014-03-31 17:39:2442typedef std::map<invalidation::ObjectId, int, ObjectIdLessThan>
43 ObjectIdCountMap;
44
[email protected]33596da2012-08-31 23:39:2545// Caller owns the returned DictionaryValue.
dchengb753c6f2016-04-23 01:22:1746std::unique_ptr<base::DictionaryValue> ObjectIdToValue(
[email protected]33596da2012-08-31 23:39:2547 const invalidation::ObjectId& object_id);
48
49bool ObjectIdFromValue(const base::DictionaryValue& value,
50 invalidation::ObjectId* out);
[email protected]d914f022012-07-27 02:02:0051
[email protected]51766bf2014-07-24 01:13:4752INVALIDATION_EXPORT std::string ObjectIdToString(
[email protected]cc7a544c2013-01-02 08:31:5153 const invalidation::ObjectId& object_id);
[email protected]85164712010-06-23 01:13:5654
[email protected]65f173552012-06-28 22:43:5855} // namespace syncer
[email protected]85164712010-06-23 01:13:5656
knn062cdbb2015-06-26 18:18:4257#endif // COMPONENTS_INVALIDATION_PUBLIC_INVALIDATION_UTIL_H_