Move minimalRole constants from schema_constants.h to a local .cc file These constants are not being used outside of component_manager_impl.cc and they will be used for both command and state attributes, so the namespaces for the constants are no longer applicable either. BUG:24622262 Change-Id: I178c07cca7d4620d0eb0aad3f54d2428a09d01e8 Reviewed-on: https://weave-review.googlesource.com/2719 Reviewed-by: Alex Vakulenko <avakulenko@google.com>
diff --git a/src/commands/schema_constants.cc b/src/commands/schema_constants.cc index 732cf44..37bee4c 100644 --- a/src/commands/schema_constants.cc +++ b/src/commands/schema_constants.cc
@@ -32,12 +32,6 @@ const char kCommand_State[] = "state"; const char kCommand_Error[] = "error"; -const char kCommand_Role[] = "minimalRole"; -const char kCommand_Role_Manager[] = "manager"; -const char kCommand_Role_Owner[] = "owner"; -const char kCommand_Role_User[] = "user"; -const char kCommand_Role_Viewer[] = "viewer"; - } // namespace attributes } // namespace commands
diff --git a/src/commands/schema_constants.h b/src/commands/schema_constants.h index 360079a..623fec3 100644 --- a/src/commands/schema_constants.h +++ b/src/commands/schema_constants.h
@@ -34,12 +34,6 @@ extern const char kCommand_State[]; extern const char kCommand_Error[]; -extern const char kCommand_Role[]; -extern const char kCommand_Role_Manager[]; -extern const char kCommand_Role_Owner[]; -extern const char kCommand_Role_User[]; -extern const char kCommand_Role_Viewer[]; - } // namespace attributes } // namespace commands
diff --git a/src/component_manager_impl.cc b/src/component_manager_impl.cc index dec4a48..6e609a2 100644 --- a/src/component_manager_impl.cc +++ b/src/component_manager_impl.cc
@@ -19,11 +19,13 @@ // Max of 100 state update events should be enough in the queue. const size_t kMaxStateChangeQueueSize = 100; +const char kMinimalRole[] = "minimalRole"; + const EnumToStringMap<UserRole>::Map kMap[] = { - {UserRole::kViewer, commands::attributes::kCommand_Role_Viewer}, - {UserRole::kUser, commands::attributes::kCommand_Role_User}, - {UserRole::kOwner, commands::attributes::kCommand_Role_Owner}, - {UserRole::kManager, commands::attributes::kCommand_Role_Manager}, + {UserRole::kViewer, "viewer"}, + {UserRole::kUser, "user"}, + {UserRole::kOwner, "owner"}, + {UserRole::kManager, "manager"}, }; } // anonymous namespace @@ -356,7 +358,7 @@ std::string value; // The JSON definition has been pre-validated already in LoadCommands, so // just using CHECKs here. - CHECK(command->GetString(commands::attributes::kCommand_Role, &value)); + CHECK(command->GetString(kMinimalRole, &value)); CHECK(StringToEnum(value, minimal_role)); return true; }