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_BASE_MODEL_TYPE_H_ | 5 #ifndef COMPONENTS_SYNC_BASE_MODEL_TYPE_H_ |
6 #define COMPONENTS_SYNC_BASE_MODEL_TYPE_H_ | 6 #define COMPONENTS_SYNC_BASE_MODEL_TYPE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <ostream> | 10 #include <ostream> |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 157 |
158 // If you are adding a new sync datatype that is exposed to the user via the | 158 // If you are adding a new sync datatype that is exposed to the user via the |
159 // sync preferences UI, be sure to update the list in | 159 // sync preferences UI, be sure to update the list in |
160 // components/sync/driver/user_selectable_sync_type.h so that the UMA | 160 // components/sync/driver/user_selectable_sync_type.h so that the UMA |
161 // histograms for sync include your new type. In this case, be sure to also | 161 // histograms for sync include your new type. In this case, be sure to also |
162 // update the UserSelectableTypes() definition in | 162 // update the UserSelectableTypes() definition in |
163 // sync/syncable/model_type.cc. | 163 // sync/syncable/model_type.cc. |
164 MODEL_TYPE_COUNT, | 164 MODEL_TYPE_COUNT, |
165 }; | 165 }; |
166 | 166 |
167 typedef EnumSet<ModelType, FIRST_REAL_MODEL_TYPE, LAST_REAL_MODEL_TYPE> | 167 using ModelTypeSet = |
168 ModelTypeSet; | 168 EnumSet<ModelType, FIRST_REAL_MODEL_TYPE, LAST_REAL_MODEL_TYPE>; |
169 typedef EnumSet<ModelType, UNSPECIFIED, LAST_REAL_MODEL_TYPE> FullModelTypeSet; | 169 using FullModelTypeSet = EnumSet<ModelType, UNSPECIFIED, LAST_REAL_MODEL_TYPE>; |
170 typedef std::map<ModelType, const char*> ModelTypeNameMap; | 170 using ModelTypeNameMap = std::map<ModelType, const char*>; |
171 | 171 |
172 inline ModelType ModelTypeFromInt(int i) { | 172 inline ModelType ModelTypeFromInt(int i) { |
173 DCHECK_GE(i, 0); | 173 DCHECK_GE(i, 0); |
174 DCHECK_LT(i, MODEL_TYPE_COUNT); | 174 DCHECK_LT(i, MODEL_TYPE_COUNT); |
175 return static_cast<ModelType>(i); | 175 return static_cast<ModelType>(i); |
176 } | 176 } |
177 | 177 |
178 // Used by tests outside of sync/. | 178 // Used by tests outside of sync/. |
179 void AddDefaultFieldValue(ModelType datatype, | 179 void AddDefaultFieldValue(ModelType datatype, |
180 sync_pb::EntitySpecifics* specifics); | 180 sync_pb::EntitySpecifics* specifics); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 | 348 |
349 // Returns true if |model_type| supports parent-child hierarchy or entries. | 349 // Returns true if |model_type| supports parent-child hierarchy or entries. |
350 bool TypeSupportsHierarchy(ModelType model_type); | 350 bool TypeSupportsHierarchy(ModelType model_type); |
351 | 351 |
352 // Returns true if |model_type| supports ordering of sibling entries. | 352 // Returns true if |model_type| supports ordering of sibling entries. |
353 bool TypeSupportsOrdering(ModelType model_type); | 353 bool TypeSupportsOrdering(ModelType model_type); |
354 | 354 |
355 } // namespace syncer | 355 } // namespace syncer |
356 | 356 |
357 #endif // COMPONENTS_SYNC_BASE_MODEL_TYPE_H_ | 357 #endif // COMPONENTS_SYNC_BASE_MODEL_TYPE_H_ |
OLD | NEW |