diff options
author | Adam Lesinski <adamlesinski@google.com> | 2016-10-21 17:56:45 -0700 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2016-10-26 19:30:23 -0700 |
commit | ce5e56e243d262a9b65459c3bd0bb9eaadd40628 (patch) | |
tree | cf0ecea98883d090d8d2856fc6d32046c7e3d9e8 /tools/aapt2/java/AnnotationProcessor.cpp | |
parent | 0f7cc4dc2c49a30c072cbc7aa6c0c5d5c31496d4 (diff) |
AAPT2: Rename to match new style
Use Google3 naming style to match new
projects' and open source google projects' style.
Preferred to do this in a massive CL so as to avoid
style inconsistencies that plague legacy code bases.
This is a relatively NEW code base, may as well keep
it up to date.
Test: name/style refactor - existing tests pass
Change-Id: Ie80ecb78d46ec53efdfca2336bb57d96cbb7fb87
Diffstat (limited to 'tools/aapt2/java/AnnotationProcessor.cpp')
-rw-r--r-- | tools/aapt2/java/AnnotationProcessor.cpp | 92 |
1 files changed, 47 insertions, 45 deletions
diff --git a/tools/aapt2/java/AnnotationProcessor.cpp b/tools/aapt2/java/AnnotationProcessor.cpp index 23ff8abf8950..2951e5cff6d7 100644 --- a/tools/aapt2/java/AnnotationProcessor.cpp +++ b/tools/aapt2/java/AnnotationProcessor.cpp @@ -15,69 +15,71 @@ */ #include "java/AnnotationProcessor.h" -#include "util/Util.h" #include <algorithm> +#include "util/Util.h" + namespace aapt { -void AnnotationProcessor::appendCommentLine(std::string& comment) { - static const std::string sDeprecated = "@deprecated"; - static const std::string sSystemApi = "@SystemApi"; +void AnnotationProcessor::AppendCommentLine(std::string& comment) { + static const std::string sDeprecated = "@deprecated"; + static const std::string sSystemApi = "@SystemApi"; - if (comment.find(sDeprecated) != std::string::npos) { - mAnnotationBitMask |= kDeprecated; - } + if (comment.find(sDeprecated) != std::string::npos) { + annotation_bit_mask_ |= kDeprecated; + } - std::string::size_type idx = comment.find(sSystemApi); - if (idx != std::string::npos) { - mAnnotationBitMask |= kSystemApi; - comment.erase(comment.begin() + idx, comment.begin() + idx + sSystemApi.size()); - } + std::string::size_type idx = comment.find(sSystemApi); + if (idx != std::string::npos) { + annotation_bit_mask_ |= kSystemApi; + comment.erase(comment.begin() + idx, + comment.begin() + idx + sSystemApi.size()); + } - if (util::trimWhitespace(comment).empty()) { - return; - } + if (util::TrimWhitespace(comment).empty()) { + return; + } - if (!mHasComments) { - mHasComments = true; - mComment << "/**"; - } + if (!has_comments_) { + has_comments_ = true; + comment_ << "/**"; + } - mComment << "\n * " << std::move(comment); + comment_ << "\n * " << std::move(comment); } -void AnnotationProcessor::appendComment(const StringPiece& comment) { - // We need to process line by line to clean-up whitespace and append prefixes. - for (StringPiece line : util::tokenize(comment, '\n')) { - line = util::trimWhitespace(line); - if (!line.empty()) { - std::string lineCopy = line.toString(); - appendCommentLine(lineCopy); - } +void AnnotationProcessor::AppendComment(const StringPiece& comment) { + // We need to process line by line to clean-up whitespace and append prefixes. + for (StringPiece line : util::Tokenize(comment, '\n')) { + line = util::TrimWhitespace(line); + if (!line.empty()) { + std::string lineCopy = line.ToString(); + AppendCommentLine(lineCopy); } + } } -void AnnotationProcessor::appendNewLine() { - mComment << "\n *"; -} +void AnnotationProcessor::AppendNewLine() { comment_ << "\n *"; } -void AnnotationProcessor::writeToStream(std::ostream* out, const StringPiece& prefix) const { - if (mHasComments) { - std::string result = mComment.str(); - for (StringPiece line : util::tokenize(result, '\n')) { - *out << prefix << line << "\n"; - } - *out << prefix << " */" << "\n"; +void AnnotationProcessor::WriteToStream(std::ostream* out, + const StringPiece& prefix) const { + if (has_comments_) { + std::string result = comment_.str(); + for (StringPiece line : util::Tokenize(result, '\n')) { + *out << prefix << line << "\n"; } + *out << prefix << " */" + << "\n"; + } - if (mAnnotationBitMask & kDeprecated) { - *out << prefix << "@Deprecated\n"; - } + if (annotation_bit_mask_ & kDeprecated) { + *out << prefix << "@Deprecated\n"; + } - if (mAnnotationBitMask & kSystemApi) { - *out << prefix << "@android.annotation.SystemApi\n"; - } + if (annotation_bit_mask_ & kSystemApi) { + *out << prefix << "@android.annotation.SystemApi\n"; + } } -} // namespace aapt +} // namespace aapt |