blob: db1a9a04699d857d1ed03d229b9a9ccbf4f38d25 (
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
46
|
// Copyright 2015 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.
#ifndef SYNC_API_ENTITY_CHANGE_H_
#define SYNC_API_ENTITY_CHANGE_H_
#include <string>
#include <vector>
#include "sync/api/entity_data.h"
#include "sync/base/sync_export.h"
namespace syncer_v2 {
class SYNC_EXPORT EntityChange {
public:
enum ChangeType {
ACTION_ADD,
ACTION_UPDATE,
ACTION_DELETE
};
static EntityChange CreateAdd(std::string client_tag, EntityDataPtr data);
static EntityChange CreateUpdate(std::string client_tag, EntityDataPtr data);
static EntityChange CreateDelete(std::string client_tag);
virtual ~EntityChange();
std::string client_tag() const { return client_tag_; }
ChangeType type() const { return type_; }
const EntityData& data() const { return data_.value(); }
private:
EntityChange(std::string client_tag, ChangeType type, EntityDataPtr data);
std::string client_tag_;
ChangeType type_;
EntityDataPtr data_;
};
typedef std::vector<EntityChange> EntityChangeList;
} // namespace syncer_v2
#endif // SYNC_API_ENTITY_CHANGE_H_
|