aconfig: update cpp codegen to use static methods
Update c++ codegen to static methods interface. Bug: b/279483801 Test: atest aconfig.test Change-Id: I78da3bbca6240bee660c692807930d00f2242b0a
This commit is contained in:
@@ -134,19 +134,13 @@ mod tests {
|
|||||||
|
|
||||||
namespace com::example {
|
namespace com::example {
|
||||||
|
|
||||||
class my_flag_one {
|
static const bool my_flag_one() {
|
||||||
public:
|
|
||||||
virtual const bool value() {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
class my_flag_two {
|
static const bool my_flag_two() {
|
||||||
public:
|
|
||||||
virtual const bool value() {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -201,25 +195,19 @@ mod tests {
|
|||||||
|
|
||||||
namespace com::example {
|
namespace com::example {
|
||||||
|
|
||||||
class my_flag_one {
|
static const bool my_flag_one() {
|
||||||
public:
|
|
||||||
virtual const bool value() {
|
|
||||||
return GetServerConfigurableFlag(
|
return GetServerConfigurableFlag(
|
||||||
"ns",
|
"ns",
|
||||||
"com.example.my_flag_one",
|
"com.example.my_flag_one",
|
||||||
"false") == "true";
|
"false") == "true";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
class my_flag_two {
|
static const bool my_flag_two() {
|
||||||
public:
|
|
||||||
virtual const bool value() {
|
|
||||||
return GetServerConfigurableFlag(
|
return GetServerConfigurableFlag(
|
||||||
"ns",
|
"ns",
|
||||||
"com.example.my_flag_two",
|
"com.example.my_flag_two",
|
||||||
"true") == "true";
|
"true") == "true";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -6,9 +6,7 @@ using namespace server_configurable_flags;
|
|||||||
{{ endif }}
|
{{ endif }}
|
||||||
namespace {cpp_namespace} \{
|
namespace {cpp_namespace} \{
|
||||||
{{ for item in class_elements}}
|
{{ for item in class_elements}}
|
||||||
class {item.flag_name} \{
|
static const bool {item.flag_name}() \{
|
||||||
public:
|
|
||||||
virtual const bool value() \{
|
|
||||||
{{ if item.readwrite- }}
|
{{ if item.readwrite- }}
|
||||||
return GetServerConfigurableFlag(
|
return GetServerConfigurableFlag(
|
||||||
"{item.device_config_namespace}",
|
"{item.device_config_namespace}",
|
||||||
@@ -18,7 +16,6 @@ namespace {cpp_namespace} \{
|
|||||||
return {item.default_value};
|
return {item.default_value};
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
{{ endfor }}
|
{{ endfor }}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user