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>
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 @@
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 @@
}
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> 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> 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> 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 @@
bool GenerateCpp(const CppOptions& options,
const TypeNamespace& types,
- const interface_type& parsed_doc) {
+ const AidlInterface& parsed_doc) {
bool success = true;
success &= GenerateCppForFile(options.ClientCppFileName(),