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 COMPONENTS_SYNC_SYNCABLE_SYNCABLE_PROTO_UTIL_H_ | 5 #ifndef COMPONENTS_SYNC_SYNCABLE_SYNCABLE_PROTO_UTIL_H_ |
6 #define COMPONENTS_SYNC_SYNCABLE_SYNCABLE_PROTO_UTIL_H_ | 6 #define COMPONENTS_SYNC_SYNCABLE_SYNCABLE_PROTO_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "components/sync/syncable/syncable_id.h" | 10 #include "components/sync/syncable/syncable_id.h" |
11 | 11 |
12 namespace sync_pb { | 12 namespace sync_pb { |
13 class SyncEntity; | 13 class SyncEntity; |
14 } | 14 } // namespace sync_pb |
15 | 15 |
16 namespace syncer { | 16 namespace syncer { |
17 | 17 |
18 // Converts from a specially formatted string field to a syncable::Id. Used | 18 // Converts from a specially formatted string field to a syncable::Id. Used |
19 // when interpreting the fields of protocol buffers received from the server. | 19 // when interpreting the fields of protocol buffers received from the server. |
20 syncable::Id SyncableIdFromProto(const std::string& proto_string); | 20 syncable::Id SyncableIdFromProto(const std::string& proto_string); |
21 | 21 |
22 // Converts from a syncable::Id to a formatted std::string. This is useful for | 22 // Converts from a syncable::Id to a formatted std::string. This is useful for |
23 // populating the fields of a protobuf which will be sent to the server. | 23 // populating the fields of a protobuf which will be sent to the server. |
24 std::string SyncableIdToProto(const syncable::Id& syncable_id); | 24 std::string SyncableIdToProto(const syncable::Id& syncable_id); |
25 | 25 |
26 // Helper function to determine if this SyncEntity's properties indicate that it | 26 // Helper function to determine if this SyncEntity's properties indicate that it |
27 // is a folder. | 27 // is a folder. |
28 bool IsFolder(const sync_pb::SyncEntity& entity); | 28 bool IsFolder(const sync_pb::SyncEntity& entity); |
29 | 29 |
30 // Helper function to determine if this SyncEntity's properties indicate that it | 30 // Helper function to determine if this SyncEntity's properties indicate that it |
31 // is the root node. | 31 // is the root node. |
32 bool IsRoot(const sync_pb::SyncEntity& entity); | 32 bool IsRoot(const sync_pb::SyncEntity& entity); |
33 | 33 |
34 } // namespace syncer | 34 } // namespace syncer |
35 | 35 |
36 #endif // COMPONENTS_SYNC_SYNCABLE_SYNCABLE_PROTO_UTIL_H_ | 36 #endif // COMPONENTS_SYNC_SYNCABLE_SYNCABLE_PROTO_UTIL_H_ |
OLD | NEW |