using syncer::ModelType;
// The separator used when formatting IDs.
-const char kIdSeparator[] = "/";
+//
+// We chose the underscore character because it doesn't conflict with the
+// special characters used by base/base64.h's encoding, which is also used in
+// the construction of some IDs.
+const char kIdSeparator[] = "_";
namespace fake_server {
}
// static
+std::string FakeServerEntity::GetTopLevelId(const ModelType& model_type) {
+ return FakeServerEntity::CreateId(
+ model_type,
+ syncer::ModelTypeToRootTag(model_type));
+}
+
+// static
ModelType FakeServerEntity::GetModelTypeFromId(const string& id) {
vector<string> tokens;
size_t token_count = Tokenize(id, kIdSeparator, &tokens);
const ModelType& model_type,
int64 version,
const string& name)
- : id_(id),
- model_type_(model_type),
+ : model_type_(model_type),
+ id_(id),
version_(version),
name_(name) {}