| 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 // | 46 // The sync tag must be a string unique to this datatype and is used as a node |
| 47 // |sync_tag| Must be a string unique to this datatype and is used as a node | |
| 48 // identifier server-side. | 47 // identifier server-side. |
| 49 // | |
| 50 // For deletes: |datatype| must specify the datatype who node is being | 48 // For deletes: |datatype| must specify the datatype who node is being |
| 51 // deleted. | 49 // deleted. |
| 52 // | 50 // For adds/updates: the specifics must be valid and the non-unique title (can |
| 53 // For adds/updates: |specifics| must be valid and |non_unique_title| (can be | 51 // be the same as sync tag) must be specfied. |
| 54 // the same as |sync_tag|) must be specfied. Note: |non_unique_title| is | 52 // Note: the non_unique_title is primarily for debug purposes, and will be |
| 55 // primarily for debug purposes, and will be overwritten if the datatype is | 53 // overwritten if the datatype is encrypted. |
| 56 // encrypted. | |
| 57 // | |
| 58 // For data with attachments: |attachments| must not contain duplicates. | |
| 59 static SyncData CreateLocalDelete( | 54 static SyncData CreateLocalDelete( |
| 60 const std::string& sync_tag, | 55 const std::string& sync_tag, |
| 61 ModelType datatype); | 56 ModelType datatype); |
| 62 static SyncData CreateLocalData( | 57 static SyncData CreateLocalData( |
| 63 const std::string& sync_tag, | 58 const std::string& sync_tag, |
| 64 const std::string& non_unique_title, | 59 const std::string& non_unique_title, |
| 65 const sync_pb::EntitySpecifics& specifics); | 60 const sync_pb::EntitySpecifics& specifics); |
| 66 static SyncData CreateLocalDataWithAttachments( | 61 static SyncData CreateLocalDataWithAttachments( |
| 67 const std::string& sync_tag, | 62 const std::string& sync_tag, |
| 68 const std::string& non_unique_title, | 63 const std::string& non_unique_title, |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 }; | 203 }; |
| 209 | 204 |
| 210 // gmock printer helper. | 205 // gmock printer helper. |
| 211 void PrintTo(const SyncData& sync_data, std::ostream* os); | 206 void PrintTo(const SyncData& sync_data, std::ostream* os); |
| 212 | 207 |
| 213 typedef std::vector<SyncData> SyncDataList; | 208 typedef std::vector<SyncData> SyncDataList; |
| 214 | 209 |
| 215 } // namespace syncer | 210 } // namespace syncer |
| 216 | 211 |
| 217 #endif // SYNC_API_SYNC_DATA_H_ | 212 #endif // SYNC_API_SYNC_DATA_H_ |
| OLD | NEW |