summaryrefslogtreecommitdiffstats
path: root/sync/notifier/invalidation_util.h
blob: bf5388f2431274bbad2ab2d045e7674995891484 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Various utilities for dealing with invalidation data types.

#ifndef SYNC_NOTIFIER_INVALIDATION_UTIL_H_
#define SYNC_NOTIFIER_INVALIDATION_UTIL_H_
#pragma once

#include <set>
#include <string>

#include "sync/internal_api/public/base/model_type.h"

namespace invalidation {

class Invalidation;
class ObjectId;

}  // namespace invalidation

namespace syncer {

struct ObjectIdLessThan {
  bool operator()(const invalidation::ObjectId& lhs,
                  const invalidation::ObjectId& rhs) const;
};

typedef std::set<invalidation::ObjectId, ObjectIdLessThan> ObjectIdSet;

bool RealModelTypeToObjectId(syncer::ModelType model_type,
                             invalidation::ObjectId* object_id);

bool ObjectIdToRealModelType(const invalidation::ObjectId& object_id,
                             syncer::ModelType* model_type);

std::string ObjectIdToString(const invalidation::ObjectId& object_id);

std::string InvalidationToString(
    const invalidation::Invalidation& invalidation);

}  // namespace syncer

#endif  // SYNC_NOTIFIER_INVALIDATION_UTIL_H_