Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6052)

Unified Diff: chrome/browser/sync/syncable/model_type.h

Issue 8772074: [Sync] Convert syncable/ directory to ModelEnumSet (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typo Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/syncable/model_type.h
diff --git a/chrome/browser/sync/syncable/model_type.h b/chrome/browser/sync/syncable/model_type.h
index f2dc74ff77da0afd17e7b3e4e614fd0a100feddd..97cb6cd7c2ef5a75d50362df39ae505ccff9ee5b 100644
--- a/chrome/browser/sync/syncable/model_type.h
+++ b/chrome/browser/sync/syncable/model_type.h
@@ -16,6 +16,7 @@
#include "base/logging.h"
#include "base/time.h"
+#include "chrome/browser/sync/util/enum_set.h"
namespace base {
class ListValue;
@@ -80,12 +81,15 @@ enum ModelType {
EXTENSION_SETTINGS,
// App notifications.
APP_NOTIFICATIONS,
+ LAST_REAL_MODEL_TYPE = APP_NOTIFICATIONS,
MODEL_TYPE_COUNT,
};
typedef std::bitset<MODEL_TYPE_COUNT> ModelTypeBitSet;
typedef std::set<ModelType> ModelTypeSet;
+typedef browser_sync::EnumSet<
+ ModelType, FIRST_REAL_MODEL_TYPE, LAST_REAL_MODEL_TYPE> ModelEnumSet;
inline ModelType ModelTypeFromInt(int i) {
DCHECK_GE(i, 0);
@@ -140,15 +144,26 @@ ModelType ModelTypeFromString(const std::string& model_type_string);
std::string ModelTypeBitSetToString(const ModelTypeBitSet& model_types);
+std::string ModelEnumSetToString(ModelEnumSet model_types);
+
// Convert a ModelTypeSet to a ModelTypeBitSet.
ModelTypeBitSet ModelTypeBitSetFromSet(const ModelTypeSet& set);
// Convert a ModelTypeBitSet to a ModelTypeSet.
ModelTypeSet ModelTypeBitSetToSet(const ModelTypeBitSet& bit_set);
+ModelEnumSet ModelTypeBitSetToEnumSet(const ModelTypeBitSet& bitset);
+
+ModelTypeSet ModelEnumSetToSet(ModelEnumSet enum_set);
+
+ModelEnumSet ModelTypeSetToEnumSet(const ModelTypeSet& model_type_set);
+
// Caller takes ownership of returned list.
base::ListValue* ModelTypeBitSetToValue(const ModelTypeBitSet& model_types);
+// Caller takes ownership of returned list.
+base::ListValue* ModelEnumSetToValue(ModelEnumSet model_types);
+
ModelTypeBitSet ModelTypeBitSetFromValue(const base::ListValue& value);
// Caller takes ownership of returned list.
@@ -156,6 +171,8 @@ base::ListValue* ModelTypeSetToValue(const ModelTypeSet& model_types);
ModelTypeSet ModelTypeSetFromValue(const base::ListValue& value);
+ModelEnumSet ModelEnumSetFromValue(const base::ListValue& value);
+
// Returns a string corresponding to the syncable tag for this datatype.
std::string ModelTypeToRootTag(ModelType type);
« no previous file with comments | « chrome/browser/sync/syncable/directory_change_delegate.h ('k') | chrome/browser/sync/syncable/model_type.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698