Merge "aconfig: update codegen templates" into main am: e381a17cfc
Original change: https://android-review.googlesource.com/c/platform/build/+/2883370 Change-Id: I2a05b657ca3046b51e6972423ba609e4fd49d4f9 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -5,10 +5,10 @@ import android.compat.annotation.UnsupportedAppUsage;
|
|||||||
/** @hide */
|
/** @hide */
|
||||||
public interface FeatureFlags \{
|
public interface FeatureFlags \{
|
||||||
{{ for item in flag_elements }}
|
{{ for item in flag_elements }}
|
||||||
{{ if library_exported }}
|
{{ -if library_exported }}
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
boolean {item.method_name}();
|
boolean {item.method_name}();
|
||||||
{{ else }}
|
{{ -else }}
|
||||||
{{ -if not item.is_read_write }}
|
{{ -if not item.is_read_write }}
|
||||||
{{ -if item.default_value }}
|
{{ -if item.default_value }}
|
||||||
@com.android.aconfig.annotations.AssumeTrueForR8
|
@com.android.aconfig.annotations.AssumeTrueForR8
|
||||||
@@ -19,5 +19,5 @@ public interface FeatureFlags \{
|
|||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
boolean {item.method_name}();
|
boolean {item.method_name}();
|
||||||
{{ endif }}
|
{{ endif }}
|
||||||
{{ endfor }}
|
{{ -endfor }}
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
package {package_name};
|
package {package_name};
|
||||||
// TODO(b/303773055): Remove the annotation after access issue is resolved.
|
// TODO(b/303773055): Remove the annotation after access issue is resolved.
|
||||||
import android.compat.annotation.UnsupportedAppUsage;
|
import android.compat.annotation.UnsupportedAppUsage;
|
||||||
{{ if not is_test_mode }}
|
{{ -if not is_test_mode }}
|
||||||
{{ if runtime_lookup_required- }}
|
{{ -if runtime_lookup_required }}
|
||||||
import android.provider.DeviceConfig;
|
import android.provider.DeviceConfig;
|
||||||
import android.provider.DeviceConfig.Properties;
|
import android.provider.DeviceConfig.Properties;
|
||||||
{{ endif }}
|
{{ endif }}
|
||||||
@@ -14,31 +14,29 @@ public final class FeatureFlagsImpl implements FeatureFlags \{
|
|||||||
{{ -endfor- }}
|
{{ -endfor- }}
|
||||||
|
|
||||||
{{ for flag in flag_elements }}
|
{{ for flag in flag_elements }}
|
||||||
{{ if library_exported }}
|
{{ -if library_exported }}
|
||||||
private static boolean {flag.method_name} = false;
|
private static boolean {flag.method_name} = false;
|
||||||
{{ else }}
|
{{ -else }}
|
||||||
{{- if flag.is_read_write }}
|
{{- if flag.is_read_write }}
|
||||||
private static boolean {flag.method_name} = {flag.default_value};
|
private static boolean {flag.method_name} = {flag.default_value};
|
||||||
{{- endif- }}
|
{{- endif- }}
|
||||||
{{ endif }}
|
{{ -endif }}
|
||||||
{{ endfor }}
|
{{ -endfor }}
|
||||||
|
|
||||||
{{ for namespace_with_flags in namespace_flags }}
|
{{ for namespace_with_flags in namespace_flags }}
|
||||||
private void load_overrides_{namespace_with_flags.namespace}() \{
|
private void load_overrides_{namespace_with_flags.namespace}() \{
|
||||||
try \{
|
try \{
|
||||||
Properties properties = DeviceConfig.getProperties("{namespace_with_flags.namespace}");
|
Properties properties = DeviceConfig.getProperties("{namespace_with_flags.namespace}");
|
||||||
|
|
||||||
{{ -for flag in namespace_with_flags.flags }}
|
{{ -for flag in namespace_with_flags.flags }}
|
||||||
{{ if library_exported }}
|
{{ -if library_exported }}
|
||||||
{flag.method_name} =
|
{flag.method_name} =
|
||||||
properties.getBoolean("{flag.device_config_flag}", false);
|
properties.getBoolean("{flag.device_config_flag}", false);
|
||||||
{{ else }}
|
{{ -else }}
|
||||||
{{ if flag.is_read_write }}
|
{{ -if flag.is_read_write }}
|
||||||
{flag.method_name} =
|
{flag.method_name} =
|
||||||
properties.getBoolean("{flag.device_config_flag}", {flag.default_value});
|
properties.getBoolean("{flag.device_config_flag}", {flag.default_value});
|
||||||
{{ endif }}
|
{{ -endif }}
|
||||||
{{ endif }}
|
{{ -endif }}
|
||||||
{{ endfor }}
|
{{ -endfor }}
|
||||||
} catch (NullPointerException e) \{
|
} catch (NullPointerException e) \{
|
||||||
throw new RuntimeException(
|
throw new RuntimeException(
|
||||||
"Cannot read value from namespace {namespace_with_flags.namespace} "
|
"Cannot read value from namespace {namespace_with_flags.namespace} "
|
||||||
@@ -52,9 +50,8 @@ public final class FeatureFlagsImpl implements FeatureFlags \{
|
|||||||
{namespace_with_flags.namespace}_is_cached = true;
|
{namespace_with_flags.namespace}_is_cached = true;
|
||||||
}
|
}
|
||||||
{{ endfor- }}
|
{{ endfor- }}
|
||||||
{{ endif- }}
|
{{ -endif }}{#- end of runtime_lookup_required #}
|
||||||
|
{{ -for flag in flag_elements }}
|
||||||
{{ for flag in flag_elements }}
|
|
||||||
@Override
|
@Override
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public boolean {flag.method_name}() \{
|
public boolean {flag.method_name}() \{
|
||||||
@@ -63,13 +60,13 @@ public final class FeatureFlagsImpl implements FeatureFlags \{
|
|||||||
load_overrides_{flag.device_config_namespace}();
|
load_overrides_{flag.device_config_namespace}();
|
||||||
}
|
}
|
||||||
return {flag.method_name};
|
return {flag.method_name};
|
||||||
{{ else }}
|
{{ -else }}
|
||||||
{{ -if flag.is_read_write }}
|
{{ -if flag.is_read_write }}
|
||||||
if (!{flag.device_config_namespace}_is_cached) \{
|
if (!{flag.device_config_namespace}_is_cached) \{
|
||||||
load_overrides_{flag.device_config_namespace}();
|
load_overrides_{flag.device_config_namespace}();
|
||||||
}
|
}
|
||||||
return {flag.method_name};
|
return {flag.method_name};
|
||||||
{{ else }}
|
{{ -else }}
|
||||||
return {flag.default_value};
|
return {flag.default_value};
|
||||||
{{ -endif- }}
|
{{ -endif- }}
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
|
@@ -9,8 +9,8 @@ public final class Flags \{
|
|||||||
/** @hide */
|
/** @hide */
|
||||||
public static final String FLAG_{item.flag_name_constant_suffix} = "{item.device_config_flag}";
|
public static final String FLAG_{item.flag_name_constant_suffix} = "{item.device_config_flag}";
|
||||||
{{- endfor }}
|
{{- endfor }}
|
||||||
{{ for item in flag_elements}}
|
{{ -for item in flag_elements}}
|
||||||
{{ -if library_exported }}
|
{{ if library_exported }}
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public static boolean {item.method_name}() \{
|
public static boolean {item.method_name}() \{
|
||||||
return FEATURE_FLAGS.{item.method_name}();
|
return FEATURE_FLAGS.{item.method_name}();
|
||||||
@@ -21,14 +21,14 @@ public final class Flags \{
|
|||||||
@com.android.aconfig.annotations.AssumeTrueForR8
|
@com.android.aconfig.annotations.AssumeTrueForR8
|
||||||
{{ -else }}
|
{{ -else }}
|
||||||
@com.android.aconfig.annotations.AssumeFalseForR8
|
@com.android.aconfig.annotations.AssumeFalseForR8
|
||||||
{{ -endif- }}
|
{{ -endif }}
|
||||||
{{ endif }}
|
{{ -endif }}
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public static boolean {item.method_name}() \{
|
public static boolean {item.method_name}() \{
|
||||||
return FEATURE_FLAGS.{item.method_name}();
|
return FEATURE_FLAGS.{item.method_name}();
|
||||||
}
|
}
|
||||||
{{ endif }}
|
{{ -endif }}
|
||||||
{{ endfor }}
|
{{ -endfor }}
|
||||||
{{ -if is_test_mode }}
|
{{ -if is_test_mode }}
|
||||||
public static void setFeatureFlags(FeatureFlags featureFlags) \{
|
public static void setFeatureFlags(FeatureFlags featureFlags) \{
|
||||||
Flags.FEATURE_FLAGS = featureFlags;
|
Flags.FEATURE_FLAGS = featureFlags;
|
||||||
@@ -37,7 +37,8 @@ public final class Flags \{
|
|||||||
public static void unsetFeatureFlags() \{
|
public static void unsetFeatureFlags() \{
|
||||||
Flags.FEATURE_FLAGS = null;
|
Flags.FEATURE_FLAGS = null;
|
||||||
}
|
}
|
||||||
{{ endif }}
|
{{ -endif }}
|
||||||
|
|
||||||
private static FeatureFlags FEATURE_FLAGS{{ -if not is_test_mode }} = new FeatureFlagsImpl(){{ -endif- }};
|
private static FeatureFlags FEATURE_FLAGS{{ -if not is_test_mode }} = new FeatureFlagsImpl(){{ -endif- }};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -6,13 +6,11 @@
|
|||||||
#define {package_macro}(FLAG) {package_macro}_##FLAG
|
#define {package_macro}(FLAG) {package_macro}_##FLAG
|
||||||
#endif
|
#endif
|
||||||
{{ for item in class_elements }}
|
{{ for item in class_elements }}
|
||||||
|
{{ -if item.is_fixed_read_only }}
|
||||||
{{ if item.is_fixed_read_only- }}
|
|
||||||
#ifndef {package_macro}_{item.flag_macro}
|
#ifndef {package_macro}_{item.flag_macro}
|
||||||
#define {package_macro}_{item.flag_macro} {item.default_value}
|
#define {package_macro}_{item.flag_macro} {item.default_value}
|
||||||
#endif
|
#endif
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
|
|
||||||
{{ -endfor }}
|
{{ -endfor }}
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
@@ -26,15 +24,15 @@ namespace {cpp_namespace} \{
|
|||||||
class flag_provider_interface \{
|
class flag_provider_interface \{
|
||||||
public:
|
public:
|
||||||
virtual ~flag_provider_interface() = default;
|
virtual ~flag_provider_interface() = default;
|
||||||
{{ for item in class_elements}}
|
{{ -for item in class_elements}}
|
||||||
virtual bool {item.flag_name}() = 0;
|
virtual bool {item.flag_name}() = 0;
|
||||||
|
|
||||||
{{ if is_test_mode }}
|
{{ -if is_test_mode }}
|
||||||
virtual void {item.flag_name}(bool val) = 0;
|
virtual void {item.flag_name}(bool val) = 0;
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
{{ -endfor }}
|
{{ -endfor }}
|
||||||
|
|
||||||
{{ if is_test_mode }}
|
{{ -if is_test_mode }}
|
||||||
virtual void reset_flags() \{}
|
virtual void reset_flags() \{}
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
};
|
};
|
||||||
@@ -43,35 +41,35 @@ extern std::unique_ptr<flag_provider_interface> provider_;
|
|||||||
|
|
||||||
{{ for item in class_elements}}
|
{{ for item in class_elements}}
|
||||||
inline bool {item.flag_name}() \{
|
inline bool {item.flag_name}() \{
|
||||||
{{ if is_test_mode }}
|
{{ -if is_test_mode }}
|
||||||
return provider_->{item.flag_name}();
|
return provider_->{item.flag_name}();
|
||||||
{{ -else- }}
|
{{ -else }}
|
||||||
{{ if is_prod_mode- }}
|
{{ -if is_prod_mode }}
|
||||||
{{ if item.readwrite- }}
|
{{ -if item.readwrite }}
|
||||||
return provider_->{item.flag_name}();
|
return provider_->{item.flag_name}();
|
||||||
{{ -else- }}
|
{{ -else }}
|
||||||
{{ if item.is_fixed_read_only- }}
|
{{ -if item.is_fixed_read_only }}
|
||||||
return {package_macro}_{item.flag_macro};
|
return {package_macro}_{item.flag_macro};
|
||||||
{{ -else- }}
|
{{ -else }}
|
||||||
return {item.default_value};
|
return {item.default_value};
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
{{ -else- }}
|
{{ -else }}
|
||||||
{{ if is_exported_mode- }}
|
{{ -if is_exported_mode }}
|
||||||
return provider_->{item.flag_name}();
|
return provider_->{item.flag_name}();
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
}
|
}
|
||||||
|
|
||||||
{{ if is_test_mode }}
|
{{ -if is_test_mode }}
|
||||||
inline void {item.flag_name}(bool val) \{
|
inline void {item.flag_name}(bool val) \{
|
||||||
provider_->{item.flag_name}(val);
|
provider_->{item.flag_name}(val);
|
||||||
}
|
}
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
{{ -endfor }}
|
{{ -endfor }}
|
||||||
|
|
||||||
{{ if is_test_mode }}
|
{{ -if is_test_mode }}
|
||||||
inline void reset_flags() \{
|
inline void reset_flags() \{
|
||||||
return provider_->reset_flags();
|
return provider_->reset_flags();
|
||||||
}
|
}
|
||||||
@@ -85,12 +83,12 @@ extern "C" \{
|
|||||||
{{ for item in class_elements }}
|
{{ for item in class_elements }}
|
||||||
bool {header}_{item.flag_name}();
|
bool {header}_{item.flag_name}();
|
||||||
|
|
||||||
{{ if is_test_mode }}
|
{{ -if is_test_mode }}
|
||||||
void set_{header}_{item.flag_name}(bool val);
|
void set_{header}_{item.flag_name}(bool val);
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
{{ -endfor }}
|
{{ -endfor }}
|
||||||
|
|
||||||
{{ if is_test_mode }}
|
{{ -if is_test_mode }}
|
||||||
void {header}_reset_flags();
|
void {header}_reset_flags();
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
|
|
||||||
|
@@ -35,7 +35,7 @@ namespace {cpp_namespace} \{
|
|||||||
"aconfig_flags.{item.device_config_namespace}",
|
"aconfig_flags.{item.device_config_namespace}",
|
||||||
"{item.device_config_flag}",
|
"{item.device_config_flag}",
|
||||||
"{item.default_value}") == "true";
|
"{item.default_value}") == "true";
|
||||||
{{ -else- }}
|
{{ -else }}
|
||||||
return {item.default_value};
|
return {item.default_value};
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,7 @@ namespace {cpp_namespace} \{
|
|||||||
virtual void {item.flag_name}(bool val) override \{
|
virtual void {item.flag_name}(bool val) override \{
|
||||||
overrides_["{item.flag_name}"] = val;
|
overrides_["{item.flag_name}"] = val;
|
||||||
}
|
}
|
||||||
{{ -endfor }}
|
{{ endfor }}
|
||||||
|
|
||||||
virtual void reset_flags() override \{
|
virtual void reset_flags() override \{
|
||||||
overrides_.clear();
|
overrides_.clear();
|
||||||
@@ -56,10 +56,11 @@ namespace {cpp_namespace} \{
|
|||||||
class flag_provider : public flag_provider_interface \{
|
class flag_provider : public flag_provider_interface \{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
{{ for item in class_elements }}
|
{{ -for item in class_elements }}
|
||||||
|
|
||||||
virtual bool {item.flag_name}() override \{
|
virtual bool {item.flag_name}() override \{
|
||||||
{{ if is_prod_mode- }}
|
{{ -if is_prod_mode }}
|
||||||
{{ if item.readwrite- }}
|
{{ -if item.readwrite }}
|
||||||
if (cache_[{item.readwrite_idx}] == -1) \{
|
if (cache_[{item.readwrite_idx}] == -1) \{
|
||||||
cache_[{item.readwrite_idx}] = server_configurable_flags::GetServerConfigurableFlag(
|
cache_[{item.readwrite_idx}] = server_configurable_flags::GetServerConfigurableFlag(
|
||||||
"aconfig_flags.{item.device_config_namespace}",
|
"aconfig_flags.{item.device_config_namespace}",
|
||||||
@@ -67,15 +68,15 @@ namespace {cpp_namespace} \{
|
|||||||
"{item.default_value}") == "true";
|
"{item.default_value}") == "true";
|
||||||
}
|
}
|
||||||
return cache_[{item.readwrite_idx}];
|
return cache_[{item.readwrite_idx}];
|
||||||
{{ -else- }}
|
{{ -else }}
|
||||||
{{ if item.is_fixed_read_only }}
|
{{ -if item.is_fixed_read_only }}
|
||||||
return {package_macro}_{item.flag_macro};
|
return {package_macro}_{item.flag_macro};
|
||||||
{{ -else- }}
|
{{ -else }}
|
||||||
return {item.default_value};
|
return {item.default_value};
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
{{ -else- }}
|
{{ -else- }}
|
||||||
{{ if is_exported_mode-}}
|
{{ -if is_exported_mode }}
|
||||||
if (cache_[{item.readwrite_idx}] == -1) \{
|
if (cache_[{item.readwrite_idx}] == -1) \{
|
||||||
cache_[{item.readwrite_idx}] = server_configurable_flags::GetServerConfigurableFlag(
|
cache_[{item.readwrite_idx}] = server_configurable_flags::GetServerConfigurableFlag(
|
||||||
"aconfig_flags.{item.device_config_namespace}",
|
"aconfig_flags.{item.device_config_namespace}",
|
||||||
@@ -86,7 +87,7 @@ namespace {cpp_namespace} \{
|
|||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
}
|
}
|
||||||
{{ endfor }}
|
{{ -endfor }}
|
||||||
{{ if readwrite- }}
|
{{ if readwrite- }}
|
||||||
private:
|
private:
|
||||||
std::vector<int8_t> cache_ = std::vector<int8_t>({readwrite_count}, -1);
|
std::vector<int8_t> cache_ = std::vector<int8_t>({readwrite_count}, -1);
|
||||||
@@ -102,35 +103,35 @@ std::unique_ptr<flag_provider_interface> provider_ =
|
|||||||
|
|
||||||
{{ for item in class_elements }}
|
{{ for item in class_elements }}
|
||||||
bool {header}_{item.flag_name}() \{
|
bool {header}_{item.flag_name}() \{
|
||||||
{{ if is_test_mode }}
|
{{ -if is_test_mode }}
|
||||||
return {cpp_namespace}::{item.flag_name}();
|
return {cpp_namespace}::{item.flag_name}();
|
||||||
{{ -else- }}
|
{{ -else }}
|
||||||
{{ if is_prod_mode- }}
|
{{ -if is_prod_mode }}
|
||||||
{{ if item.readwrite- }}
|
{{ -if item.readwrite }}
|
||||||
return {cpp_namespace}::{item.flag_name}();
|
return {cpp_namespace}::{item.flag_name}();
|
||||||
{{ -else- }}
|
{{ -else }}
|
||||||
{{ if item.is_fixed_read_only }}
|
{{ -if item.is_fixed_read_only }}
|
||||||
return {package_macro}_{item.flag_macro};
|
return {package_macro}_{item.flag_macro};
|
||||||
{{ -else- }}
|
{{ -else }}
|
||||||
return {item.default_value};
|
return {item.default_value};
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
{{ -else- }}
|
{{ -else }}
|
||||||
{{ if is_exported_mode- }}
|
{{ -if is_exported_mode }}
|
||||||
return {cpp_namespace}::{item.flag_name}();
|
return {cpp_namespace}::{item.flag_name}();
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
}
|
}
|
||||||
|
|
||||||
{{ if is_test_mode }}
|
{{ -if is_test_mode }}
|
||||||
void set_{header}_{item.flag_name}(bool val) \{
|
void set_{header}_{item.flag_name}(bool val) \{
|
||||||
{cpp_namespace}::{item.flag_name}(val);
|
{cpp_namespace}::{item.flag_name}(val);
|
||||||
}
|
}
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
{{ endfor-}}
|
{{ endfor }}
|
||||||
|
|
||||||
{{ if is_test_mode }}
|
{{ -if is_test_mode }}
|
||||||
void {header}_reset_flags() \{
|
void {header}_reset_flags() \{
|
||||||
{cpp_namespace}::reset_flags();
|
{cpp_namespace}::reset_flags();
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,6 @@ lazy_static::lazy_static! \{
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl FlagProvider \{
|
impl FlagProvider \{
|
||||||
|
|
||||||
{{ for flag in template_flags }}
|
{{ for flag in template_flags }}
|
||||||
/// query flag {flag.name}
|
/// query flag {flag.name}
|
||||||
pub fn {flag.name}(&self) -> bool \{
|
pub fn {flag.name}(&self) -> bool \{
|
||||||
|
@@ -5,15 +5,15 @@ pub struct FlagProvider;
|
|||||||
|
|
||||||
{{ if has_readwrite- }}
|
{{ if has_readwrite- }}
|
||||||
lazy_static::lazy_static! \{
|
lazy_static::lazy_static! \{
|
||||||
{{ for flag in template_flags }}
|
{{ -for flag in template_flags }}
|
||||||
{{ if flag.readwrite -}}
|
{{ -if flag.readwrite }}
|
||||||
/// flag value cache for {flag.name}
|
/// flag value cache for {flag.name}
|
||||||
static ref CACHED_{flag.name}: bool = flags_rust::GetServerConfigurableFlag(
|
static ref CACHED_{flag.name}: bool = flags_rust::GetServerConfigurableFlag(
|
||||||
"aconfig_flags.{flag.device_config_namespace}",
|
"aconfig_flags.{flag.device_config_namespace}",
|
||||||
"{flag.device_config_flag}",
|
"{flag.device_config_flag}",
|
||||||
"{flag.default_value}") == "true";
|
"{flag.default_value}") == "true";
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
{{ endfor }}
|
{{ -endfor }}
|
||||||
}
|
}
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
|
|
||||||
@@ -22,9 +22,9 @@ impl FlagProvider \{
|
|||||||
{{ for flag in template_flags }}
|
{{ for flag in template_flags }}
|
||||||
/// query flag {flag.name}
|
/// query flag {flag.name}
|
||||||
pub fn {flag.name}(&self) -> bool \{
|
pub fn {flag.name}(&self) -> bool \{
|
||||||
{{ if flag.readwrite -}}
|
{{ -if flag.readwrite }}
|
||||||
*CACHED_{flag.name}
|
*CACHED_{flag.name}
|
||||||
{{ -else- }}
|
{{ -else }}
|
||||||
{flag.default_value}
|
{flag.default_value}
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
}
|
}
|
||||||
@@ -38,10 +38,10 @@ pub static PROVIDER: FlagProvider = FlagProvider;
|
|||||||
{{ for flag in template_flags }}
|
{{ for flag in template_flags }}
|
||||||
/// query flag {flag.name}
|
/// query flag {flag.name}
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
{{ if flag.readwrite -}}
|
{{ -if flag.readwrite }}
|
||||||
pub fn {flag.name}() -> bool \{
|
pub fn {flag.name}() -> bool \{
|
||||||
PROVIDER.{flag.name}()
|
PROVIDER.{flag.name}()
|
||||||
{{ -else- }}
|
{{ -else }}
|
||||||
pub fn {flag.name}() -> bool \{
|
pub fn {flag.name}() -> bool \{
|
||||||
{flag.default_value}
|
{flag.default_value}
|
||||||
{{ -endif }}
|
{{ -endif }}
|
||||||
|
Reference in New Issue
Block a user