| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_MODEL_ATTACHMENTS_ATTACHMENT_ID_H_ | 5 #ifndef COMPONENTS_SYNC_MODEL_ATTACHMENTS_ATTACHMENT_ID_H_ |
| 6 #define COMPONENTS_SYNC_MODEL_ATTACHMENTS_ATTACHMENT_ID_H_ | 6 #define COMPONENTS_SYNC_MODEL_ATTACHMENTS_ATTACHMENT_ID_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // Returns the size (in bytes) the attachment. | 53 // Returns the size (in bytes) the attachment. |
| 54 size_t GetSize() const; | 54 size_t GetSize() const; |
| 55 | 55 |
| 56 // Returns the crc32c the attachment. | 56 // Returns the crc32c the attachment. |
| 57 uint32_t GetCrc32c() const; | 57 uint32_t GetCrc32c() const; |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 // Necessary since we forward-declare sync_pb::AttachmentIdProto; see comments | 60 // Necessary since we forward-declare sync_pb::AttachmentIdProto; see comments |
| 61 // in immutable.h. | 61 // in immutable.h. |
| 62 struct ImmutableAttachmentIdProtoTraits { | 62 struct ImmutableAttachmentIdProtoTraits { |
| 63 typedef sync_pb::AttachmentIdProto* Wrapper; | 63 using Wrapper = sync_pb::AttachmentIdProto*; |
| 64 static void InitializeWrapper(Wrapper* wrapper); | 64 static void InitializeWrapper(Wrapper* wrapper); |
| 65 static void DestroyWrapper(Wrapper* wrapper); | 65 static void DestroyWrapper(Wrapper* wrapper); |
| 66 static const sync_pb::AttachmentIdProto& Unwrap(const Wrapper& wrapper); | 66 static const sync_pb::AttachmentIdProto& Unwrap(const Wrapper& wrapper); |
| 67 static sync_pb::AttachmentIdProto* UnwrapMutable(Wrapper* wrapper); | 67 static sync_pb::AttachmentIdProto* UnwrapMutable(Wrapper* wrapper); |
| 68 static void Swap(sync_pb::AttachmentIdProto* t1, | 68 static void Swap(sync_pb::AttachmentIdProto* t1, |
| 69 sync_pb::AttachmentIdProto* t2); | 69 sync_pb::AttachmentIdProto* t2); |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 typedef Immutable<sync_pb::AttachmentIdProto, | 72 using ImmutableAttachmentIdProto = |
| 73 ImmutableAttachmentIdProtoTraits> | 73 Immutable<sync_pb::AttachmentIdProto, ImmutableAttachmentIdProtoTraits>; |
| 74 ImmutableAttachmentIdProto; | |
| 75 | 74 |
| 76 ImmutableAttachmentIdProto proto_; | 75 ImmutableAttachmentIdProto proto_; |
| 77 | 76 |
| 78 explicit AttachmentId(sync_pb::AttachmentIdProto* proto); | 77 explicit AttachmentId(sync_pb::AttachmentIdProto* proto); |
| 79 }; | 78 }; |
| 80 | 79 |
| 81 // All public interfaces use AttachmentIdList. AttachmentIdSet is used in | 80 // All public interfaces use AttachmentIdList. AttachmentIdSet is used in |
| 82 // implementations of algorithms where set properties are needed. | 81 // implementations of algorithms where set properties are needed. |
| 83 typedef std::vector<AttachmentId> AttachmentIdList; | 82 using AttachmentIdList = std::vector<AttachmentId>; |
| 84 typedef std::set<AttachmentId> AttachmentIdSet; | 83 using AttachmentIdSet = std::set<AttachmentId>; |
| 85 | 84 |
| 86 } // namespace syncer | 85 } // namespace syncer |
| 87 | 86 |
| 88 #endif // COMPONENTS_SYNC_MODEL_ATTACHMENTS_ATTACHMENT_ID_H_ | 87 #endif // COMPONENTS_SYNC_MODEL_ATTACHMENTS_ATTACHMENT_ID_H_ |
| OLD | NEW |