| 1989 | } |
| 1990 | |
| 1991 | static status_t writeSymbolClass( |
| 1992 | FILE* fp, const sp<AaptAssets>& assets, bool includePrivate, |
| 1993 | const sp<AaptSymbols>& symbols, const String8& className, int indent, |
| 1994 | bool nonConstantId) |
| 1995 | { |
| 1996 | fprintf(fp, "%spublic %sfinal class %s {\n", |
| 1997 | getIndentSpace(indent), |
| 1998 | indent != 0 ? "static " : "", className.string()); |
| 1999 | indent++; |
| 2000 | |
| 2001 | size_t i; |
| 2002 | status_t err = NO_ERROR; |
| 2003 | |
| 2004 | const char * id_format = nonConstantId ? |
| 2005 | "%spublic static int %s=0x%08x;\n" : |
| 2006 | "%spublic static final int %s=0x%08x;\n"; |
| 2007 | |
| 2008 | size_t N = symbols->getSymbols().size(); |
| 2009 | for (i=0; i<N; i++) { |
| 2010 | const AaptSymbolEntry& sym = symbols->getSymbols().valueAt(i); |
| 2011 | if (sym.typeCode != AaptSymbolEntry::TYPE_INT32) { |
| 2012 | continue; |
| 2013 | } |
| 2014 | if (!assets->isJavaSymbol(sym, includePrivate)) { |
| 2015 | continue; |
| 2016 | } |
| 2017 | String8 name8(sym.name); |
| 2018 | String16 comment(sym.comment); |
| 2019 | bool haveComment = false; |
| 2020 | bool deprecated = false; |
| 2021 | if (comment.size() > 0) { |
| 2022 | haveComment = true; |
| 2023 | String8 cmt(comment); |
| 2024 | fprintf(fp, |
| 2025 | "%s/** %s\n", |
| 2026 | getIndentSpace(indent), cmt.string()); |
| 2027 | if (strstr(cmt.string(), "@deprecated") != NULL) { |
| 2028 | deprecated = true; |
| 2029 | } |
| 2030 | } else if (sym.isPublic && !includePrivate) { |
| 2031 | sym.sourcePos.warning("No comment for public symbol %s:%s/%s", |
| 2032 | assets->getPackage().string(), className.string(), |
| 2033 | String8(sym.name).string()); |
| 2034 | } |
| 2035 | String16 typeComment(sym.typeComment); |
| 2036 | if (typeComment.size() > 0) { |
| 2037 | String8 cmt(typeComment); |
| 2038 | if (!haveComment) { |
| 2039 | haveComment = true; |
| 2040 | fprintf(fp, |
| 2041 | "%s/** %s\n", getIndentSpace(indent), cmt.string()); |
| 2042 | } else { |
| 2043 | fprintf(fp, |
| 2044 | "%s %s\n", getIndentSpace(indent), cmt.string()); |
| 2045 | } |
| 2046 | if (strstr(cmt.string(), "@deprecated") != NULL) { |
| 2047 | deprecated = true; |
| 2048 | } |
no test coverage detected