summaryrefslogtreecommitdiff
path: root/tools/aapt2/java/AnnotationProcessor.h
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2015-11-06 15:14:35 -0800
committerAdam Lesinski <adamlesinski@google.com>2015-11-06 16:37:57 -0800
commitb274e35abfbbd09e0fce983a215c11522c56cce2 (patch)
treea30ba5aac504bbdfde8ac6931cb8471a46f6e284 /tools/aapt2/java/AnnotationProcessor.h
parent557b64abad9915f92a9d35c748766e873f3a29fd (diff)
AAPT2: Fix inclusion of comments in R.java javadoc
Comments weren't being copied when merged from the various resource tables. Also refactored the JavaClassGenerator to omit a class if no entries exist for it. Change-Id: I6eaa89b7b3715bc05403635a2baf0d1db3efd142
Diffstat (limited to 'tools/aapt2/java/AnnotationProcessor.h')
-rw-r--r--tools/aapt2/java/AnnotationProcessor.h33
1 files changed, 12 insertions, 21 deletions
diff --git a/tools/aapt2/java/AnnotationProcessor.h b/tools/aapt2/java/AnnotationProcessor.h
index 81a6f6e42759..e7f2be0dc12b 100644
--- a/tools/aapt2/java/AnnotationProcessor.h
+++ b/tools/aapt2/java/AnnotationProcessor.h
@@ -19,6 +19,7 @@
#include "util/StringPiece.h"
+#include <sstream>
#include <string>
namespace aapt {
@@ -54,13 +55,6 @@ namespace aapt {
class AnnotationProcessor {
public:
/**
- * Creates an AnnotationProcessor with a given prefix for each line generated.
- * This is usually a set of spaces for indentation.
- */
- AnnotationProcessor(const StringPiece& prefix) : mPrefix(prefix.toString()) {
- }
-
- /**
* Adds more comments. Since resources can have various values with different configurations,
* we need to collect all the comments.
*/
@@ -68,23 +62,20 @@ public:
void appendComment(const StringPiece& comment);
/**
- * Finishes the comment and moves it to the caller. Subsequent calls to buildComment() have
- * undefined results.
+ * Writes the comments and annotations to the stream, with the given prefix before each line.
*/
- std::string buildComment();
-
- /**
- * Finishes the annotation and moves it to the caller. Subsequent calls to buildAnnotations()
- * have undefined results.
- */
- std::string buildAnnotations();
+ void writeToStream(std::ostream* out, const StringPiece& prefix);
private:
- std::string mPrefix;
- std::string mComment;
- std::string mAnnotations;
- bool mDeprecated = false;
- bool mSystemApi = false;
+ enum : uint32_t {
+ kDeprecated = 0x01,
+ kSystemApi = 0x02,
+ };
+
+ std::stringstream mComment;
+ std::stringstream mAnnotations;
+ bool mHasComments = false;
+ uint32_t mAnnotationBitMask = 0;
void appendCommentLine(const std::string& line);
};