diff options
author | Casey Dahlin <sadmac@google.com> | 2015-11-24 14:06:52 -0800 |
---|---|---|
committer | Casey Dahlin <sadmac@google.com> | 2015-11-30 13:04:15 -0800 |
commit | d40e2fed2c19850d53f1620322ac5cbca2c0e245 (patch) | |
tree | 920b7d2a06b48e1a42ee9bb5860319e9631c0d3b /generate_cpp.cpp | |
parent | b8d9e8898c34da45027e56be88d5c9238ea88203 (diff) | |
download | android_system_tools_aidl-d40e2fed2c19850d53f1620322ac5cbca2c0e245.tar.gz android_system_tools_aidl-d40e2fed2c19850d53f1620322ac5cbca2c0e245.tar.bz2 android_system_tools_aidl-d40e2fed2c19850d53f1620322ac5cbca2c0e245.zip |
Introduce integer constants
We can now declare a "const int" variable in an AIDL interface, in
addition to methods. These constants will become static members of the
interface/base class in the generated code.
Change-Id: I6b690ecbbe2acae37abb106510e42283f0753f26
Test: Unit and integration tests updated and pass
Bug: 23600061
Signed-off-by: Casey Dahlin <sadmac@google.com>
Diffstat (limited to 'generate_cpp.cpp')
-rw-r--r-- | generate_cpp.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/generate_cpp.cpp b/generate_cpp.cpp index 9307c28..001ea44 100644 --- a/generate_cpp.cpp +++ b/generate_cpp.cpp @@ -697,6 +697,12 @@ unique_ptr<Document> BuildInterfaceHeader(const TypeNamespace& types, "DECLARE_META_INTERFACE", ArgList{vector<string>{ClassName(interface, ClassNames::BASE)}}}}); + for (const auto& constant : interface.GetConstants()) { + unique_ptr<ConstDecl> declaration{ + new ConstDecl(constant->GetName(), constant->GetValue())}; + if_class->AddPublic(std::move(declaration)); + } + unique_ptr<Enum> call_enum{new Enum{"Call"}}; for (const auto& method : interface.GetMethods()) { // Each method gets an enum entry and pure virtual declaration. |