From 6cbfb1de493e42d937158ed57495c9656864ccba Mon Sep 17 00:00:00 2001
From: Adam Lesinski May be a reference to another resource, in the form\n"
- "\" May be a string value, using '\\\\;' to escape characters such as\n"
- "'\\\\n' or '\\\\uxxxx' for a unicode character;");
+ "'\\\\n' or '\\\\uxxxx' for a unicode character;");
}
if (typeMask & android::ResTable_map::TYPE_INTEGER) {
@@ -128,14 +118,14 @@ static void addAttributeFormatDoc(AnnotationProcessor* processor, Attribute* att
if (typeMask & android::ResTable_map::TYPE_BOOLEAN) {
processor->appendComment(
" May be a boolean value, such as \" May be a color value, in the form of \" May be a dimension value, which is a floating point number appended with a\n"
- "unit such as \" May be a fractional value, which is a floating point number appended with\n"
- "either % or %p, such as \" Must be one or more (separated by '|') of the following "
- "constant values.@[+][package:]type/name
\" or a theme\n"
- "attribute in the form\n"
- "\"?[package:]type/name
\".");
+ "\"@[+][package:]type/name
\" or a theme\n"
+ "attribute in the form\n"
+ "\"?[package:]type/name
\".");
}
if (typeMask & android::ResTable_map::TYPE_STRING) {
processor->appendComment(
"true
\" or\n"
- "\"false
\".");
+ "\"false
\".");
}
if (typeMask & android::ResTable_map::TYPE_COLOR) {
processor->appendComment(
"#rgb
\",\n"
- "\"#argb
\", \"#rrggbb
#aarrggbb\".");
+ "\"#argb
\", \"#rrggbb
#aarrggbb\".");
}
if (typeMask & android::ResTable_map::TYPE_FLOAT) {
@@ -146,33 +136,33 @@ static void addAttributeFormatDoc(AnnotationProcessor* processor, Attribute* att
if (typeMask & android::ResTable_map::TYPE_DIMENSION) {
processor->appendComment(
"14.5sp
\".\n"
- "Available units are: px (pixels), dp (density-independent pixels),\n"
- "sp (scaled pixels based on preferred font size), in (inches), and\n"
- "mm (millimeters).");
+ "unit such as \"14.5sp
\".\n"
+ "Available units are: px (pixels), dp (density-independent pixels),\n"
+ "sp (scaled pixels based on preferred font size), in (inches), and\n"
+ "mm (millimeters).");
}
if (typeMask & android::ResTable_map::TYPE_FRACTION) {
processor->appendComment(
"14.5%
\".\n"
- "The % suffix always means a percentage of the base size;\n"
- "the optional %p suffix provides a size relative to some parent container.");
+ "either % or %p, such as \"14.5%
\".\n"
+ "The % suffix always means a percentage of the base size;\n"
+ "the optional %p suffix provides a size relative to some parent container.");
}
if (typeMask & (android::ResTable_map::TYPE_FLAGS | android::ResTable_map::TYPE_ENUM)) {
if (typeMask & android::ResTable_map::TYPE_FLAGS) {
processor->appendComment(
"
Must be one of the following constant values.
"); } processor->appendComment("Constant | Value | Description | |
---|---|---|---|
Constant | Value | Description | |
" << symbol.symbol.name.value().entry << " | " @@ -214,13 +204,15 @@ static bool lessStyleableAttr(const StyleableAttr& lhs, const StyleableAttr& rhs } } -void JavaClassGenerator::writeStyleableEntryForClass(ClassDefinitionWriter* outClassDef, - AnnotationProcessor* processor, - const StringPiece16& packageNameToGenerate, - const std::u16string& entryName, - const Styleable* styleable) { +void JavaClassGenerator::addMembersToStyleableClass(const StringPiece16& packageNameToGenerate, + const std::u16string& entryName, + const Styleable* styleable, + ClassDefinition* outStyleableClassDef) { const std::string className = transform(entryName); + std::unique_ptr
Attribute | Description |
---|---|
";
styleableComment << "{@link #"
@@ -292,21 +290,22 @@ void JavaClassGenerator::writeStyleableEntryForClass(ClassDefinitionWriter* outC
styleableComment << " |
\n@attr description"); - attrProcessor.appendComment(comment); + attrProcessor->appendComment("
\n@attr description");
+ attrProcessor->appendComment(comment);
} else {
std::stringstream defaultComment;
defaultComment
@@ -335,27 +337,29 @@ void JavaClassGenerator::writeStyleableEntryForClass(ClassDefinitionWriter* outC
<< "{@link " << packageName << ".R.attr#" << transform(attrName.entry) << "}\n"
<< "attribute's value can be found in the "
<< "{@link #" << className << "} array.";
- attrProcessor.appendComment(defaultComment.str());
+ attrProcessor->appendComment(defaultComment.str());
}
- attrProcessor.appendNewLine();
+ attrProcessor->appendNewLine();
if (styleableAttr.attribute) {
- addAttributeFormatDoc(&attrProcessor, styleableAttr.attribute.get());
- attrProcessor.appendNewLine();
+ addAttributeFormatDoc(attrProcessor, styleableAttr.attribute.get());
+ attrProcessor->appendNewLine();
}
std::stringstream doclavaName;
doclavaName << "@attr name " << packageName << ":" << attrName.entry;;
- attrProcessor.appendComment(doclavaName.str());
- outClassDef->addIntMember(sortedAttributes[i].fieldName, &attrProcessor, i);
+ attrProcessor->appendComment(doclavaName.str());
+
+ outStyleableClassDef->addMember(std::move(indexMember));
}
}
-bool JavaClassGenerator::writeEntriesForClass(ClassDefinitionWriter* outClassDef,
- const StringPiece16& packageNameToGenerate,
- const ResourceTablePackage* package,
- const ResourceTableType* type) {
+bool JavaClassGenerator::addMembersToTypeClass(const StringPiece16& packageNameToGenerate,
+ const ResourceTablePackage* package,
+ const ResourceTableType* type,
+ ClassDefinition* outTypeClassDef) {
+
for (const auto& entry : type->entries) {
if (skipSymbol(entry->symbolStatus.state)) {
continue;
@@ -389,33 +393,41 @@ bool JavaClassGenerator::writeEntriesForClass(ClassDefinitionWriter* outClassDef
return false;
}
- // Build the comments and annotations for this entry.
-
- AnnotationProcessor processor;
- if (entry->symbolStatus.state != SymbolState::kUndefined) {
- processor.appendComment(entry->symbolStatus.comment);
- }
-
- for (const auto& configValue : entry->values) {
- processor.appendComment(configValue->value->getComment());
- }
-
- // If this is an Attribute, append the format Javadoc.
- if (!entry->values.empty()) {
- if (Attribute* attr = valueCast