summaryrefslogtreecommitdiff
path: root/src/components/policy/policy_regular/src/policy_table/enums.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/policy/policy_regular/src/policy_table/enums.cc')
-rw-r--r--src/components/policy/policy_regular/src/policy_table/enums.cc35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/components/policy/policy_regular/src/policy_table/enums.cc b/src/components/policy/policy_regular/src/policy_table/enums.cc
index bec9a2ec2d..2ddf74af7e 100644
--- a/src/components/policy/policy_regular/src/policy_table/enums.cc
+++ b/src/components/policy/policy_regular/src/policy_table/enums.cc
@@ -1,5 +1,5 @@
-// This file is generated, do not edit
#include "policy/policy_table/enums.h"
+#include <cstring>
namespace rpc {
namespace policy_table_interface_base {
@@ -669,6 +669,7 @@ bool IsValidEnum(ModuleType val) {
return false;
}
}
+
const char* EnumToJsonString(ModuleType val) {
switch (val) {
case MT_CLIMATE:
@@ -716,6 +717,38 @@ bool EnumFromJsonString(const std::string& literal, ModuleType* result) {
return false;
}
+bool IsValidEnum(HybridAppPreference val) {
+ return strlen(EnumToJsonString(val)) > 0;
+}
+
+const char* EnumToJsonString(HybridAppPreference val) {
+ switch (val) {
+ case HAP_MOBILE:
+ return "MOBILE";
+ case HAP_CLOUD:
+ return "CLOUD";
+ case HAP_BOTH:
+ return "BOTH";
+ default:
+ return "";
+ }
+}
+
+bool EnumFromJsonString(const std::string& literal,
+ HybridAppPreference* result) {
+ if ("MOBILE" == literal) {
+ *result = HAP_MOBILE;
+ return true;
+ } else if ("CLOUD" == literal) {
+ *result = HAP_CLOUD;
+ return true;
+ } else if ("BOTH" == literal) {
+ *result = HAP_BOTH;
+ return true;
+ }
+ return false;
+}
+
bool IsValidEnum(FunctionID val) {
switch (val) {
case RegisterAppInterfaceID: