Bug: 283479529 Test: m aconfig_hello_world_cc && adb push $TOP/out/target/product/panther/system/bin/aconfig_hello_world_cc /system/bin && adb shell aconfig_hello_world_cc Change-Id: I1890aff70262343e18a62fb2efb2fd0e13a48fb2
74 lines
1.3 KiB
Plaintext
74 lines
1.3 KiB
Plaintext
#pragma once
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#include <memory>
|
|
|
|
namespace {cpp_namespace} \{
|
|
|
|
class flag_provider_interface \{
|
|
public:
|
|
virtual ~flag_provider_interface() = default;
|
|
{{ for item in class_elements}}
|
|
virtual bool {item.flag_name}() = 0;
|
|
|
|
{{ if for_test }}
|
|
virtual void {item.flag_name}(bool val) = 0;
|
|
{{ -endif }}
|
|
{{ endfor }}
|
|
|
|
{{ if for_test }}
|
|
virtual void reset_flags() \{}
|
|
{{ -endif }}
|
|
};
|
|
|
|
extern std::unique_ptr<flag_provider_interface> provider_;
|
|
|
|
{{ for item in class_elements}}
|
|
inline bool {item.flag_name}() \{
|
|
{{ if for_test }}
|
|
return provider_->{item.flag_name}();
|
|
{{ -else- }}
|
|
{{ if not item.readwrite- }}
|
|
return {item.default_value};
|
|
{{ -else- }}
|
|
return provider_->{item.flag_name}();
|
|
{{ -endif }}
|
|
{{ -endif }}
|
|
}
|
|
|
|
{{ if for_test }}
|
|
inline void {item.flag_name}(bool val) \{
|
|
provider_->{item.flag_name}(val);
|
|
}
|
|
{{ -endif }}
|
|
{{ endfor }}
|
|
|
|
{{ if for_test }}
|
|
inline void reset_flags() \{
|
|
return provider_->reset_flags();
|
|
}
|
|
{{ -endif }}
|
|
|
|
}
|
|
|
|
extern "C" \{
|
|
#endif // __cplusplus
|
|
|
|
{{ for item in class_elements }}
|
|
bool {header}_{item.flag_name}();
|
|
|
|
{{ if for_test }}
|
|
void set_{header}_{item.flag_name}(bool val);
|
|
{{ -endif }}
|
|
{{ endfor - }}
|
|
|
|
{{ if for_test }}
|
|
void {header}_reset_flags();
|
|
{{ -endif }}
|
|
|
|
#ifdef __cplusplus
|
|
} // extern "C"
|
|
#endif
|
|
|