Files
build/tools/aconfig/templates/cpp.template
Mårten Kongstad fbd71e2773 aconfig: allow dots in package fields
Allow package fields to include dots.

Update the generated code based on the package name: if the package name
is com.android.example:

  - java: package com.android.example; ...
  - C++: namespace com::android::example { ... }
  - Rust: mod com { mod android { mod example { ... } } }

Also, update examples to use dots in the package fields.

Also, remove unnecessary #include from the auto-generated C++ code: the
header should not include itself.

Bug: 285000854
Test: atest aconfig.test
Change-Id: I8a5352e25c64c34dee0725202a1b7c9957819de8
2023-06-08 11:25:43 +02:00

25 lines
696 B
Plaintext

#ifndef {header}_HEADER_H
#define {header}_HEADER_H
{{ if readwrite }}
#include <server_configurable_flags/get_flags.h>
using namespace server_configurable_flags;
{{ endif }}
namespace {cpp_namespace} \{
{{ for item in class_elements}}
class {item.flag_name} \{
public:
virtual const bool value() \{
{{ if item.readwrite- }}
return GetServerConfigurableFlag(
"{package}",
"{item.flag_name}",
"{item.default_value}") == "true";
{{ -else- }}
return {item.default_value};
{{ -endif }}
}
}
{{ endfor }}
}
#endif