Added constrains to id generator
This commit prevents id with more than one '/'. Slash can be used to
create namespaces to avoid id conflicts between multiple users.
Changed generator logic to take provided id as a name if no name was
provided.
Tested:
- Tested that id and name generates correctly
- It is no longer possible to add id with more than one '/'
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
Change-Id: Ieef32ddb71b5a4870117aab0d624cbd46b5893e6
diff --git a/src/types/report_updates.hpp b/src/types/report_updates.hpp
index a47e8fb..2640bf0 100644
--- a/src/types/report_updates.hpp
+++ b/src/types/report_updates.hpp
@@ -13,8 +13,7 @@
{
overwrite,
appendStopsWhenFull,
- appendWrapsWhenFull,
- newReport
+ appendWrapsWhenFull
};
namespace utils
@@ -31,16 +30,13 @@
}
};
-constexpr std::array<std::pair<std::string_view, ReportUpdates>, 4>
- convDataReportUpdates = {
- {std::make_pair<std::string_view, ReportUpdates>(
- "Overwrite", ReportUpdates::overwrite),
- std::make_pair<std::string_view, ReportUpdates>(
- "AppendStopsWhenFull", ReportUpdates::appendStopsWhenFull),
- std::make_pair<std::string_view, ReportUpdates>(
- "AppendWrapsWhenFull", ReportUpdates::appendWrapsWhenFull),
- std::make_pair<std::string_view, ReportUpdates>(
- "NewReport", ReportUpdates::newReport)}};
+constexpr auto convDataReportUpdates =
+ std::array{std::make_pair<std::string_view, ReportUpdates>(
+ "Overwrite", ReportUpdates::overwrite),
+ std::make_pair<std::string_view, ReportUpdates>(
+ "AppendStopsWhenFull", ReportUpdates::appendStopsWhenFull),
+ std::make_pair<std::string_view, ReportUpdates>(
+ "AppendWrapsWhenFull", ReportUpdates::appendWrapsWhenFull)};
inline ReportUpdates
toReportUpdates(std::underlying_type_t<ReportUpdates> value)