summaryrefslogtreecommitdiff
path: root/tools/aapt2/java/JavaClassGenerator.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/aapt2/java/JavaClassGenerator.h')
-rw-r--r--tools/aapt2/java/JavaClassGenerator.h23
1 files changed, 13 insertions, 10 deletions
diff --git a/tools/aapt2/java/JavaClassGenerator.h b/tools/aapt2/java/JavaClassGenerator.h
index 18746ffc5a0a..4992f077c566 100644
--- a/tools/aapt2/java/JavaClassGenerator.h
+++ b/tools/aapt2/java/JavaClassGenerator.h
@@ -17,15 +17,16 @@
#ifndef AAPT_JAVA_CLASS_GENERATOR_H
#define AAPT_JAVA_CLASS_GENERATOR_H
-#include <ostream>
#include <string>
#include "androidfw/StringPiece.h"
#include "ResourceTable.h"
#include "ResourceValues.h"
+#include "io/Io.h"
#include "process/IResourceTableConsumer.h"
#include "process/SymbolTable.h"
+#include "text/Printer.h"
namespace aapt {
@@ -69,14 +70,16 @@ class JavaClassGenerator {
// All symbols technically belong to a single package, but linked libraries will
// have their names mangled, denoting that they came from a different package.
// We need to generate these symbols in a separate file. Returns true on success.
- bool Generate(const android::StringPiece& package_name_to_generate, std::ostream* out,
- std::ostream* out_r_txt = nullptr);
+ bool Generate(const android::StringPiece& package_name_to_generate, io::OutputStream* out,
+ io::OutputStream* out_r_txt = nullptr);
bool Generate(const android::StringPiece& package_name_to_generate,
- const android::StringPiece& output_package_name, std::ostream* out,
- std::ostream* out_r_txt = nullptr);
+ const android::StringPiece& output_package_name, io::OutputStream* out,
+ io::OutputStream* out_r_txt = nullptr);
- const std::string& getError() const;
+ const std::string& GetError() const;
+
+ static std::string TransformToFieldName(const android::StringPiece& symbol);
private:
bool SkipSymbol(SymbolState state);
@@ -91,13 +94,13 @@ class JavaClassGenerator {
bool ProcessType(const android::StringPiece& package_name_to_generate,
const ResourceTablePackage& package, const ResourceTableType& type,
ClassDefinition* out_type_class_def, MethodDefinition* out_rewrite_method_def,
- std::ostream* out_r_txt);
+ text::Printer* r_txt_printer);
// Writes a resource to the R.java file, optionally writing out a rewrite rule for its package
// ID if `out_rewrite_method` is not nullptr.
void ProcessResource(const ResourceNameRef& name, const ResourceId& id,
const ResourceEntry& entry, ClassDefinition* out_class_def,
- MethodDefinition* out_rewrite_method, std::ostream* out_r_txt);
+ MethodDefinition* out_rewrite_method, text::Printer* r_txt_printer);
// Writes a styleable resource to the R.java file, optionally writing out a rewrite rule for
// its package ID if `out_rewrite_method` is not nullptr.
@@ -106,7 +109,7 @@ class JavaClassGenerator {
const Styleable& styleable,
const android::StringPiece& package_name_to_generate,
ClassDefinition* out_class_def, MethodDefinition* out_rewrite_method,
- std::ostream* out_r_txt);
+ text::Printer* r_txt_printer);
IAaptContext* context_;
ResourceTable* table_;
@@ -114,7 +117,7 @@ class JavaClassGenerator {
std::string error_;
};
-inline const std::string& JavaClassGenerator::getError() const {
+inline const std::string& JavaClassGenerator::GetError() const {
return error_;
}