OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef SYNC_API_SYNC_DATA_H_ | 5 #ifndef SYNC_API_SYNC_DATA_H_ |
6 #define SYNC_API_SYNC_DATA_H_ | 6 #define SYNC_API_SYNC_DATA_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 25 matching lines...) Expand all Loading... |
36 // in STL containers are supported and encouraged if helpful. | 36 // in STL containers are supported and encouraged if helpful. |
37 class SYNC_EXPORT SyncData { | 37 class SYNC_EXPORT SyncData { |
38 public: | 38 public: |
39 // Creates an empty and invalid SyncData. | 39 // Creates an empty and invalid SyncData. |
40 SyncData(); | 40 SyncData(); |
41 ~SyncData(); | 41 ~SyncData(); |
42 | 42 |
43 // Default copy and assign welcome. | 43 // Default copy and assign welcome. |
44 | 44 |
45 // Helper methods for creating SyncData objects for local data. | 45 // Helper methods for creating SyncData objects for local data. |
46 // The sync tag must be a string unique to this datatype and is used as a node | 46 // |
| 47 // |sync_tag| Must be a string unique to this datatype and is used as a node |
47 // identifier server-side. | 48 // identifier server-side. |
| 49 // |
48 // For deletes: |datatype| must specify the datatype who node is being | 50 // For deletes: |datatype| must specify the datatype who node is being |
49 // deleted. | 51 // deleted. |
50 // For adds/updates: the specifics must be valid and the non-unique title (can | 52 // |
51 // be the same as sync tag) must be specfied. | 53 // For adds/updates: |specifics| must be valid and |non_unique_title| (can be |
52 // Note: the non_unique_title is primarily for debug purposes, and will be | 54 // the same as |sync_tag|) must be specfied. Note: |non_unique_title| is |
53 // overwritten if the datatype is encrypted. | 55 // primarily for debug purposes, and will be overwritten if the datatype is |
| 56 // encrypted. |
| 57 // |
| 58 // For data with attachments: |attachments| must not contain duplicates. |
54 static SyncData CreateLocalDelete( | 59 static SyncData CreateLocalDelete( |
55 const std::string& sync_tag, | 60 const std::string& sync_tag, |
56 ModelType datatype); | 61 ModelType datatype); |
57 static SyncData CreateLocalData( | 62 static SyncData CreateLocalData( |
58 const std::string& sync_tag, | 63 const std::string& sync_tag, |
59 const std::string& non_unique_title, | 64 const std::string& non_unique_title, |
60 const sync_pb::EntitySpecifics& specifics); | 65 const sync_pb::EntitySpecifics& specifics); |
61 static SyncData CreateLocalDataWithAttachments( | 66 static SyncData CreateLocalDataWithAttachments( |
62 const std::string& sync_tag, | 67 const std::string& sync_tag, |
63 const std::string& non_unique_title, | 68 const std::string& non_unique_title, |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 }; | 208 }; |
204 | 209 |
205 // gmock printer helper. | 210 // gmock printer helper. |
206 void PrintTo(const SyncData& sync_data, std::ostream* os); | 211 void PrintTo(const SyncData& sync_data, std::ostream* os); |
207 | 212 |
208 typedef std::vector<SyncData> SyncDataList; | 213 typedef std::vector<SyncData> SyncDataList; |
209 | 214 |
210 } // namespace syncer | 215 } // namespace syncer |
211 | 216 |
212 #endif // SYNC_API_SYNC_DATA_H_ | 217 #endif // SYNC_API_SYNC_DATA_H_ |
OLD | NEW |