summaryrefslogtreecommitdiffstats
path: root/generate_cpp.cpp
diff options
context:
space:
mode:
authorCasey Dahlin <sadmac@google.com>2015-10-07 18:49:10 -0700
committerCasey Dahlin <sadmac@google.com>2015-10-09 17:08:30 -0700
commit1ae2bc56d20fe0e19262f2721abc338662fa6e30 (patch)
tree4072b94d3e6c9683b4455239504952249a8c9e75 /generate_cpp.cpp
parent0edf34239909bbc16e884ea2517e5f3398185d0f (diff)
downloadandroid_system_tools_aidl-1ae2bc56d20fe0e19262f2721abc338662fa6e30.tar.gz
android_system_tools_aidl-1ae2bc56d20fe0e19262f2721abc338662fa6e30.tar.bz2
android_system_tools_aidl-1ae2bc56d20fe0e19262f2721abc338662fa6e30.zip
Convert document item structs to classes
This is the least-complete first run for any of these structs, but this shift is going to be particularly gnarly, so we need to be extra-incremental about it. Change-Id: I7295add8b9a1291f229743f8c36d941569a16ab6 Test: unit tests Bug: 24410295 Signed-off-by: Casey Dahlin <sadmac@google.com>
Diffstat (limited to 'generate_cpp.cpp')
-rw-r--r--generate_cpp.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/generate_cpp.cpp b/generate_cpp.cpp
index e9a3aaa..1ce0868 100644
--- a/generate_cpp.cpp
+++ b/generate_cpp.cpp
@@ -103,7 +103,7 @@ unique_ptr<CppNamespace> NestInNamespaces(unique_ptr<Declaration> decl) {
enum class ClassNames { BASE, CLIENT, SERVER, INTERFACE };
-string ClassName(const interface_type& interface, ClassNames type) {
+string ClassName(const AidlInterface& interface, ClassNames type) {
string c_name = interface.name.Literal();
if (c_name.length() >= 2 && c_name[0] == 'I' && isupper(c_name[1]))
@@ -126,19 +126,19 @@ string ClassName(const interface_type& interface, ClassNames type) {
}
unique_ptr<Document> BuildClientSource(const TypeNamespace& types,
- const interface_type& parsed_doc) {
+ const AidlInterface& parsed_doc) {
unique_ptr<CppNamespace> ns{new CppNamespace{"android"}};
return unique_ptr<Document>{new CppSource{ {}, std::move(ns)}};
}
unique_ptr<Document> BuildServerSource(const TypeNamespace& types,
- const interface_type& parsed_doc) {
+ const AidlInterface& parsed_doc) {
unique_ptr<CppNamespace> ns{new CppNamespace{"android"}};
return unique_ptr<Document>{new CppSource{ {}, std::move(ns)}};
}
unique_ptr<Document> BuildInterfaceSource(const TypeNamespace& types,
- const interface_type& parsed_doc) {
+ const AidlInterface& parsed_doc) {
const string i_name = ClassName(parsed_doc, ClassNames::INTERFACE);
const string bp_name = ClassName(parsed_doc, ClassNames::CLIENT);
vector<string> include_list{i_name + ".h", bp_name + ".h"};
@@ -159,7 +159,7 @@ unique_ptr<Document> BuildInterfaceSource(const TypeNamespace& types,
}
unique_ptr<Document> BuildClientHeader(const TypeNamespace& types,
- const interface_type& parsed_doc) {
+ const AidlInterface& parsed_doc) {
const string i_name = ClassName(parsed_doc, ClassNames::INTERFACE);
const string bp_name = ClassName(parsed_doc, ClassNames::CLIENT);
@@ -192,7 +192,7 @@ unique_ptr<Document> BuildClientHeader(const TypeNamespace& types,
}
unique_ptr<Document> BuildServerHeader(const TypeNamespace& types,
- const interface_type& parsed_doc) {
+ const AidlInterface& parsed_doc) {
const string i_name = ClassName(parsed_doc, ClassNames::INTERFACE);
const string bn_name = ClassName(parsed_doc, ClassNames::SERVER);
@@ -222,7 +222,7 @@ unique_ptr<Document> BuildServerHeader(const TypeNamespace& types,
}
unique_ptr<Document> BuildInterfaceHeader(const TypeNamespace& types,
- const interface_type& parsed_doc) {
+ const AidlInterface& parsed_doc) {
unique_ptr<ClassDecl> if_class{
new ClassDecl{ClassName(parsed_doc, ClassNames::INTERFACE),
"public android::IInterface"}};
@@ -262,7 +262,7 @@ using namespace internals;
bool GenerateCpp(const CppOptions& options,
const TypeNamespace& types,
- const interface_type& parsed_doc) {
+ const AidlInterface& parsed_doc) {
bool success = true;
success &= GenerateCppForFile(options.ClientCppFileName(),