Merge "Fix clang-tidy warnings in aapt and aapt2."
This commit is contained in:
@ -32,7 +32,7 @@ class AaptFile;
|
||||
|
||||
class ApkBuilder : public android::RefBase {
|
||||
public:
|
||||
ApkBuilder(const sp<WeakResourceFilter>& configFilter);
|
||||
explicit ApkBuilder(const sp<WeakResourceFilter>& configFilter);
|
||||
|
||||
/**
|
||||
* Tells the builder to generate a separate APK for resources that
|
||||
|
@ -51,7 +51,7 @@ private:
|
||||
class SystemCacheUpdater : public CacheUpdater {
|
||||
public:
|
||||
// Constructor to set bundle to pass to preProcessImage
|
||||
SystemCacheUpdater (Bundle* b)
|
||||
explicit SystemCacheUpdater (Bundle* b)
|
||||
: bundle(b) { };
|
||||
|
||||
// Make sure all the directories along this path exist
|
||||
|
@ -248,7 +248,7 @@ bail:
|
||||
}
|
||||
|
||||
static void printResolvedResourceAttribute(const ResTable& resTable, const ResXMLTree& tree,
|
||||
uint32_t attrRes, String8 attrLabel, String8* outError)
|
||||
uint32_t attrRes, const String8& attrLabel, String8* outError)
|
||||
{
|
||||
Res_value value;
|
||||
AaptXml::getResolvedResourceAttribute(resTable, tree, attrRes, &value, outError);
|
||||
@ -399,7 +399,7 @@ static void printUsesImpliedPermission(const String8& name, const String8& reaso
|
||||
ResTable::normalizeForOutput(reason.string()).string());
|
||||
}
|
||||
|
||||
Vector<String8> getNfcAidCategories(AssetManager& assets, String8 xmlPath, bool offHost,
|
||||
Vector<String8> getNfcAidCategories(AssetManager& assets, const String8& xmlPath, bool offHost,
|
||||
String8 *outError = NULL)
|
||||
{
|
||||
Asset* aidAsset = assets.openNonAsset(xmlPath, Asset::ACCESS_BUFFER);
|
||||
|
@ -29,7 +29,7 @@ struct ConfigDescription : public android::ResTable_config {
|
||||
size = sizeof(android::ResTable_config);
|
||||
}
|
||||
|
||||
ConfigDescription(const android::ResTable_config&o) {
|
||||
ConfigDescription(const android::ResTable_config&o) { // NOLINT(implicit)
|
||||
*static_cast<android::ResTable_config*>(this) = o;
|
||||
size = sizeof(android::ResTable_config);
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ void CrunchCache::loadFiles()
|
||||
delete dw;
|
||||
}
|
||||
|
||||
bool CrunchCache::needsUpdating(String8 relativePath) const
|
||||
bool CrunchCache::needsUpdating(const String8& relativePath) const
|
||||
{
|
||||
// Retrieve modification dates for this file entry under the source and
|
||||
// cache directory trees. The vectors will return a modification date of 0
|
||||
|
@ -81,7 +81,7 @@ private:
|
||||
* // Recrunch sourceFile out to destFile.
|
||||
*
|
||||
*/
|
||||
bool needsUpdating(String8 relativePath) const;
|
||||
bool needsUpdating(const String8& relativePath) const;
|
||||
|
||||
// DATA MEMBERS ====================================================
|
||||
|
||||
|
@ -77,7 +77,7 @@ bool SystemFileFinder::findFiles(String8 basePath, Vector<String8>& extensions,
|
||||
return true;
|
||||
}
|
||||
|
||||
void SystemFileFinder::checkAndAddFile(String8 path, const struct stat* stats,
|
||||
void SystemFileFinder::checkAndAddFile(const String8& path, const struct stat* stats,
|
||||
Vector<String8>& extensions,
|
||||
KeyedVector<String8,time_t>& fileStore)
|
||||
{
|
||||
|
@ -72,7 +72,7 @@ private:
|
||||
* time as the value.
|
||||
*
|
||||
*/
|
||||
static void checkAndAddFile(String8 path, const struct stat* stats,
|
||||
static void checkAndAddFile(const String8& path, const struct stat* stats,
|
||||
Vector<String8>& extensions,
|
||||
KeyedVector<String8,time_t>& fileStore);
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
class IndentPrinter {
|
||||
public:
|
||||
IndentPrinter(FILE* stream, int indentSize=2)
|
||||
explicit IndentPrinter(FILE* stream, int indentSize=2)
|
||||
: mStream(stream)
|
||||
, mIndentSize(indentSize)
|
||||
, mIndent(0)
|
||||
|
@ -394,7 +394,7 @@ static void collect_files(const sp<AaptDir>& dir,
|
||||
const DefaultKeyedVector<String8, sp<AaptGroup> >& groups = dir->getFiles();
|
||||
int N = groups.size();
|
||||
for (int i=0; i<N; i++) {
|
||||
String8 leafName = groups.keyAt(i);
|
||||
const String8& leafName = groups.keyAt(i);
|
||||
const sp<AaptGroup>& group = groups.valueAt(i);
|
||||
|
||||
const DefaultKeyedVector<AaptGroupEntry, sp<AaptFile> >& files
|
||||
@ -417,7 +417,7 @@ static void collect_files(const sp<AaptDir>& dir,
|
||||
set->add(leafName, group);
|
||||
resources->add(resType, set);
|
||||
} else {
|
||||
sp<ResourceTypeSet> set = resources->valueAt(index);
|
||||
const sp<ResourceTypeSet>& set = resources->valueAt(index);
|
||||
index = set->indexOfKey(leafName);
|
||||
if (index < 0) {
|
||||
if (kIsDebug) {
|
||||
@ -452,7 +452,7 @@ static void collect_files(const sp<AaptAssets>& ass,
|
||||
int N = dirs.size();
|
||||
|
||||
for (int i=0; i<N; i++) {
|
||||
sp<AaptDir> d = dirs.itemAt(i);
|
||||
const sp<AaptDir>& d = dirs.itemAt(i);
|
||||
if (kIsDebug) {
|
||||
printf("Collecting dir #%d %p: %s, leaf %s\n", i, d.get(), d->getPath().string(),
|
||||
d->getLeaf().string());
|
||||
@ -610,7 +610,7 @@ static bool applyFileOverlay(Bundle *bundle,
|
||||
// get the overlay resources of the requested type
|
||||
ssize_t index = overlayRes->indexOfKey(resTypeString);
|
||||
if (index >= 0) {
|
||||
sp<ResourceTypeSet> overlaySet = overlayRes->valueAt(index);
|
||||
const sp<ResourceTypeSet>& overlaySet = overlayRes->valueAt(index);
|
||||
|
||||
// for each of the resources, check for a match in the previously built
|
||||
// non-overlay "baseset".
|
||||
@ -760,7 +760,7 @@ bool addTagAttribute(const sp<XMLNode>& node, const char* ns8,
|
||||
return addTagAttribute(node, ns8, attr8, value, errorOnFailedInsert, false);
|
||||
}
|
||||
|
||||
static void fullyQualifyClassName(const String8& package, sp<XMLNode> node,
|
||||
static void fullyQualifyClassName(const String8& package, const sp<XMLNode>& node,
|
||||
const String16& attrName) {
|
||||
XMLNode::attribute_entry* attr = node->editAttribute(
|
||||
String16("http://schemas.android.com/apk/res/android"), attrName);
|
||||
@ -1339,7 +1339,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil
|
||||
ResourceDirIterator it(resources->valueAt(index), String8("values"));
|
||||
ssize_t res;
|
||||
while ((res=it.next()) == NO_ERROR) {
|
||||
sp<AaptFile> file = it.getFile();
|
||||
const sp<AaptFile>& file = it.getFile();
|
||||
res = compileResourceFile(bundle, assets, file, it.getParams(),
|
||||
(current!=assets), &table);
|
||||
if (res != NO_ERROR) {
|
||||
@ -2674,7 +2674,7 @@ status_t writeResourceSymbols(Bundle* bundle, const sp<AaptAssets>& assets,
|
||||
String8 dest(bundle->getRClassDir());
|
||||
|
||||
if (bundle->getMakePackageDirs()) {
|
||||
String8 pkg(package);
|
||||
const String8& pkg(package);
|
||||
const char* last = pkg.string();
|
||||
const char* s = last-1;
|
||||
do {
|
||||
|
@ -78,7 +78,7 @@ private:
|
||||
class StrongResourceFilter : public ResourceFilter {
|
||||
public:
|
||||
StrongResourceFilter() {}
|
||||
StrongResourceFilter(const std::set<ConfigDescription>& configs)
|
||||
explicit StrongResourceFilter(const std::set<ConfigDescription>& configs)
|
||||
: mConfigs(configs) {}
|
||||
|
||||
android::status_t parse(const android::String8& str);
|
||||
@ -106,7 +106,7 @@ private:
|
||||
*/
|
||||
class InverseResourceFilter : public ResourceFilter {
|
||||
public:
|
||||
InverseResourceFilter(const android::sp<ResourceFilter>& filter)
|
||||
explicit InverseResourceFilter(const android::sp<ResourceFilter>& filter)
|
||||
: mFilter(filter) {}
|
||||
|
||||
bool match(const android::ResTable_config& config) const {
|
||||
|
@ -4023,7 +4023,7 @@ status_t ResourceTable::Type::applyPublicEntryOrder()
|
||||
|
||||
j = 0;
|
||||
for (i=0; i<N; i++) {
|
||||
sp<ConfigList> e = origOrder.itemAt(i);
|
||||
const sp<ConfigList>& e = origOrder.itemAt(i);
|
||||
// There will always be enough room for the remaining entries.
|
||||
while (mOrderedConfigs.itemAt(j) != NULL) {
|
||||
j++;
|
||||
@ -4145,7 +4145,7 @@ status_t ResourceTable::Package::applyPublicTypeOrder()
|
||||
|
||||
size_t j=0;
|
||||
for (i=0; i<N; i++) {
|
||||
sp<Type> t = origOrder.itemAt(i);
|
||||
const sp<Type>& t = origOrder.itemAt(i);
|
||||
// There will always be enough room for the remaining types.
|
||||
while (mOrderedTypes.itemAt(j) != NULL) {
|
||||
j++;
|
||||
@ -4577,7 +4577,7 @@ status_t ResourceTable::modifyForCompat(const Bundle* bundle) {
|
||||
c->getEntries();
|
||||
const size_t entryCount = entries.size();
|
||||
for (size_t ei = 0; ei < entryCount; ei++) {
|
||||
sp<Entry> e = entries.valueAt(ei);
|
||||
const sp<Entry>& e = entries.valueAt(ei);
|
||||
if (e == NULL || e->getType() != Entry::TYPE_BAG) {
|
||||
continue;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ class StringPool
|
||||
public:
|
||||
struct entry {
|
||||
entry() : offset(0) { }
|
||||
entry(const String16& _value) : value(_value), offset(0), hasStyles(false) { }
|
||||
explicit entry(const String16& _value) : value(_value), offset(0), hasStyles(false) { }
|
||||
entry(const entry& o) : value(o.value), offset(o.offset),
|
||||
hasStyles(o.hasStyles), indices(o.indices),
|
||||
configTypeName(o.configTypeName), configs(o.configs) { }
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
};
|
||||
|
||||
/* Creates a work queue with the specified maximum number of work threads. */
|
||||
WorkQueue(size_t maxThreads, bool canCallJava = true);
|
||||
explicit WorkQueue(size_t maxThreads, bool canCallJava = true);
|
||||
|
||||
/* Destroys the work queue.
|
||||
* Cancels pending work and waits for all remaining threads to complete.
|
||||
|
@ -67,7 +67,7 @@ static const String16 RESOURCES_PREFIX_AUTO_PACKAGE(RESOURCES_AUTO_PACKAGE_NAMES
|
||||
static const String16 RESOURCES_PRV_PREFIX(RESOURCES_ROOT_PRV_NAMESPACE);
|
||||
static const String16 RESOURCES_TOOLS_NAMESPACE("http://schemas.android.com/tools");
|
||||
|
||||
String16 getNamespaceResourcePackage(String16 appPackage, String16 namespaceUri, bool* outIsPublic)
|
||||
String16 getNamespaceResourcePackage(const String16& appPackage, const String16& namespaceUri, bool* outIsPublic)
|
||||
{
|
||||
//printf("%s starts with %s?\n", String8(namespaceUri).string(),
|
||||
// String8(RESOURCES_PREFIX).string());
|
||||
@ -98,7 +98,7 @@ String16 getNamespaceResourcePackage(String16 appPackage, String16 namespaceUri,
|
||||
|
||||
status_t hasSubstitutionErrors(const char* fileName,
|
||||
ResXMLTree* inXml,
|
||||
String16 str16)
|
||||
const String16& str16)
|
||||
{
|
||||
const char16_t* str = str16.string();
|
||||
const char16_t* p = str;
|
||||
|
@ -176,7 +176,7 @@ private:
|
||||
XMLNode(const String8& filename, const String16& s1, const String16& s2, bool isNamespace);
|
||||
|
||||
// Creating a CDATA node.
|
||||
XMLNode(const String8& filename);
|
||||
explicit XMLNode(const String8& filename);
|
||||
|
||||
status_t collect_strings(StringPool* dest, Vector<uint32_t>* outResIds,
|
||||
bool stripComments, bool stripRawValues) const;
|
||||
|
@ -43,7 +43,7 @@ class PseudoMethodAccent : public PseudoMethodImpl {
|
||||
|
||||
class Pseudolocalizer {
|
||||
public:
|
||||
Pseudolocalizer(PseudolocalizationMethod m);
|
||||
explicit Pseudolocalizer(PseudolocalizationMethod m);
|
||||
~Pseudolocalizer() { if (mImpl) delete mImpl; }
|
||||
void setMethod(PseudolocalizationMethod m);
|
||||
String16 start() { return mImpl->start(); }
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
* Create a BigBuffer with block allocation sizes
|
||||
* of blockSize.
|
||||
*/
|
||||
BigBuffer(size_t blockSize);
|
||||
explicit BigBuffer(size_t blockSize);
|
||||
|
||||
BigBuffer(const BigBuffer&) = delete; // No copying.
|
||||
|
||||
|
@ -27,7 +27,7 @@ namespace aapt {
|
||||
|
||||
class BindingXmlPullParser : public XmlPullParser {
|
||||
public:
|
||||
BindingXmlPullParser(const std::shared_ptr<XmlPullParser>& parser);
|
||||
explicit BindingXmlPullParser(const std::shared_ptr<XmlPullParser>& parser);
|
||||
BindingXmlPullParser(const BindingXmlPullParser& rhs) = delete;
|
||||
|
||||
Event getEvent() const override;
|
||||
|
@ -46,7 +46,7 @@ struct ConfigDescription : public android::ResTable_config {
|
||||
static void applyVersionForCompatibility(ConfigDescription* config);
|
||||
|
||||
ConfigDescription();
|
||||
ConfigDescription(const android::ResTable_config& o);
|
||||
ConfigDescription(const android::ResTable_config& o); // NOLINT(implicit)
|
||||
ConfigDescription(const ConfigDescription& o);
|
||||
ConfigDescription(ConfigDescription&& o);
|
||||
|
||||
|
@ -32,20 +32,20 @@ static std::function<bool(const StringPiece&, std::string*)> wrap(
|
||||
}
|
||||
|
||||
void optionalFlag(const StringPiece& name, const StringPiece& description,
|
||||
std::function<void(const StringPiece&)> action) {
|
||||
const std::function<void(const StringPiece&)>& action) {
|
||||
sFlags.push_back(Flag{
|
||||
name.toString(), description.toString(), wrap(action),
|
||||
false, nullptr, false, false });
|
||||
}
|
||||
|
||||
void requiredFlag(const StringPiece& name, const StringPiece& description,
|
||||
std::function<void(const StringPiece&)> action) {
|
||||
const std::function<void(const StringPiece&)>& action) {
|
||||
sFlags.push_back(Flag{ name.toString(), description.toString(), wrap(action),
|
||||
true, nullptr, false, false });
|
||||
}
|
||||
|
||||
void requiredFlag(const StringPiece& name, const StringPiece& description,
|
||||
std::function<bool(const StringPiece&, std::string*)> action) {
|
||||
const std::function<bool(const StringPiece&, std::string*)>& action) {
|
||||
sFlags.push_back(Flag{ name.toString(), description.toString(), action,
|
||||
true, nullptr, false, false });
|
||||
}
|
||||
|
@ -11,13 +11,13 @@ namespace aapt {
|
||||
namespace flag {
|
||||
|
||||
void requiredFlag(const StringPiece& name, const StringPiece& description,
|
||||
std::function<void(const StringPiece&)> action);
|
||||
const std::function<void(const StringPiece&)>& action);
|
||||
|
||||
void requiredFlag(const StringPiece& name, const StringPiece& description,
|
||||
std::function<bool(const StringPiece&, std::string*)> action);
|
||||
const std::function<bool(const StringPiece&, std::string*)>& action);
|
||||
|
||||
void optionalFlag(const StringPiece& name, const StringPiece& description,
|
||||
std::function<void(const StringPiece&)> action);
|
||||
const std::function<void(const StringPiece&)>& action);
|
||||
|
||||
void optionalSwitch(const StringPiece& name, const StringPiece& description, bool resultWhenSet,
|
||||
bool* result);
|
||||
|
@ -35,7 +35,7 @@ struct JavaClassGeneratorTest : public ::testing::Test {
|
||||
mTable->setPackageId(0x01);
|
||||
}
|
||||
|
||||
bool addResource(const ResourceNameRef& name, ResourceId id) {
|
||||
bool addResource(const ResourceNameRef& name, const ResourceId& id) {
|
||||
return mTable->addResource(name, id, {}, SourceLine{ "test.xml", 21 },
|
||||
util::make_unique<Id>());
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ private:
|
||||
|
||||
class SourceLogger {
|
||||
public:
|
||||
SourceLogger(const Source& source);
|
||||
SourceLogger(const Source& source); // NOLINT(implicit)
|
||||
|
||||
std::ostream& error();
|
||||
std::ostream& error(size_t line);
|
||||
|
@ -15,7 +15,7 @@ public:
|
||||
struct Options {
|
||||
};
|
||||
|
||||
ManifestMerger(const Options& options);
|
||||
explicit ManifestMerger(const Options& options);
|
||||
|
||||
bool setAppManifest(const Source& source, const std::u16string& package,
|
||||
std::unique_ptr<xml::Node> root);
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
namespace aapt {
|
||||
|
||||
bool ManifestParser::parse(const Source& source, std::shared_ptr<XmlPullParser> parser,
|
||||
bool ManifestParser::parse(const Source& source, const std::shared_ptr<XmlPullParser>& parser,
|
||||
AppInfo* outInfo) {
|
||||
SourceLogger logger = { source };
|
||||
|
||||
@ -70,7 +70,7 @@ bool ManifestParser::parse(const Source& source, std::shared_ptr<XmlPullParser>
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ManifestParser::parseManifest(SourceLogger& logger, std::shared_ptr<XmlPullParser> parser,
|
||||
bool ManifestParser::parseManifest(SourceLogger& logger, const std::shared_ptr<XmlPullParser>& parser,
|
||||
AppInfo* outInfo) {
|
||||
auto attrIter = parser->findAttribute(u"", u"package");
|
||||
if (attrIter == parser->endAttributes() || attrIter->value.empty()) {
|
||||
|
@ -33,10 +33,10 @@ public:
|
||||
ManifestParser() = default;
|
||||
ManifestParser(const ManifestParser&) = delete;
|
||||
|
||||
bool parse(const Source& source, std::shared_ptr<XmlPullParser> parser, AppInfo* outInfo);
|
||||
bool parse(const Source& source, const std::shared_ptr<XmlPullParser>& parser, AppInfo* outInfo);
|
||||
|
||||
private:
|
||||
bool parseManifest(SourceLogger& logger, std::shared_ptr<XmlPullParser> parser,
|
||||
bool parseManifest(SourceLogger& logger, const std::shared_ptr<XmlPullParser>& parser,
|
||||
AppInfo* outInfo);
|
||||
};
|
||||
|
||||
|
@ -28,7 +28,7 @@ namespace aapt {
|
||||
|
||||
class ManifestValidator {
|
||||
public:
|
||||
ManifestValidator(const android::ResTable& table);
|
||||
explicit ManifestValidator(const android::ResTable& table);
|
||||
ManifestValidator(const ManifestValidator&) = delete;
|
||||
|
||||
bool validate(const Source& source, android::ResXMLParser* parser);
|
||||
|
@ -41,12 +41,12 @@ public:
|
||||
Maybe(const Maybe& rhs);
|
||||
|
||||
template <typename U>
|
||||
Maybe(const Maybe<U>& rhs);
|
||||
Maybe(const Maybe<U>& rhs); // NOLINT(implicit)
|
||||
|
||||
Maybe(Maybe&& rhs);
|
||||
|
||||
template <typename U>
|
||||
Maybe(Maybe<U>&& rhs);
|
||||
Maybe(Maybe<U>&& rhs); // NOLINT(implicit)
|
||||
|
||||
Maybe& operator=(const Maybe& rhs);
|
||||
|
||||
@ -61,12 +61,12 @@ public:
|
||||
/**
|
||||
* Construct a Maybe holding a value.
|
||||
*/
|
||||
Maybe(const T& value);
|
||||
Maybe(const T& value); // NOLINT(implicit)
|
||||
|
||||
/**
|
||||
* Construct a Maybe holding a value.
|
||||
*/
|
||||
Maybe(T&& value);
|
||||
Maybe(T&& value); // NOLINT(implicit)
|
||||
|
||||
/**
|
||||
* True if this holds a value, false if
|
||||
|
@ -94,7 +94,7 @@ struct ResourceNameRef {
|
||||
ResourceNameRef() = default;
|
||||
ResourceNameRef(const ResourceNameRef&) = default;
|
||||
ResourceNameRef(ResourceNameRef&&) = default;
|
||||
ResourceNameRef(const ResourceName& rhs);
|
||||
ResourceNameRef(const ResourceName& rhs); // NOLINT(implicit)
|
||||
ResourceNameRef(const StringPiece16& p, ResourceType t, const StringPiece16& e);
|
||||
ResourceNameRef& operator=(const ResourceNameRef& rhs) = default;
|
||||
ResourceNameRef& operator=(ResourceNameRef&& rhs) = default;
|
||||
@ -124,7 +124,7 @@ struct ResourceId {
|
||||
|
||||
ResourceId();
|
||||
ResourceId(const ResourceId& rhs);
|
||||
ResourceId(uint32_t resId);
|
||||
ResourceId(uint32_t resId); // NOLINT(implicit)
|
||||
ResourceId(size_t p, size_t t, size_t e);
|
||||
|
||||
bool isValid() const;
|
||||
|
@ -391,7 +391,7 @@ uint32_t ResourceParser::androidTypeToAttributeTypeMask(uint16_t type) {
|
||||
|
||||
std::unique_ptr<Item> ResourceParser::parseItemForAttribute(
|
||||
const StringPiece16& value, uint32_t typeMask,
|
||||
std::function<void(const ResourceName&)> onCreateReference) {
|
||||
const std::function<void(const ResourceName&)>& onCreateReference) {
|
||||
std::unique_ptr<BinaryPrimitive> nullOrEmpty = tryParseNullOrEmpty(value);
|
||||
if (nullOrEmpty) {
|
||||
return std::move(nullOrEmpty);
|
||||
@ -451,7 +451,7 @@ std::unique_ptr<Item> ResourceParser::parseItemForAttribute(
|
||||
*/
|
||||
std::unique_ptr<Item> ResourceParser::parseItemForAttribute(
|
||||
const StringPiece16& str, const Attribute& attr,
|
||||
std::function<void(const ResourceName&)> onCreateReference) {
|
||||
const std::function<void(const ResourceName&)>& onCreateReference) {
|
||||
const uint32_t typeMask = attr.typeMask;
|
||||
std::unique_ptr<Item> value = parseItemForAttribute(str, typeMask, onCreateReference);
|
||||
if (value) {
|
||||
|
@ -133,11 +133,11 @@ public:
|
||||
*/
|
||||
static std::unique_ptr<Item> parseItemForAttribute(
|
||||
const StringPiece16& value, const Attribute& attr,
|
||||
std::function<void(const ResourceName&)> onCreateReference = {});
|
||||
const std::function<void(const ResourceName&)>& onCreateReference = {});
|
||||
|
||||
static std::unique_ptr<Item> parseItemForAttribute(
|
||||
const StringPiece16& value, uint32_t typeMask,
|
||||
std::function<void(const ResourceName&)> onCreateReference = {});
|
||||
const std::function<void(const ResourceName&)>& onCreateReference = {});
|
||||
|
||||
static uint32_t androidTypeToAttributeTypeMask(uint16_t type);
|
||||
|
||||
|
@ -151,7 +151,7 @@ bool ResourceTable::addResource(const ResourceNameRef& name, const ConfigDescrip
|
||||
return addResourceImpl(name, ResourceId{}, config, source, std::move(value), kValidNameChars);
|
||||
}
|
||||
|
||||
bool ResourceTable::addResource(const ResourceNameRef& name, const ResourceId resId,
|
||||
bool ResourceTable::addResource(const ResourceNameRef& name, const ResourceId& resId,
|
||||
const ConfigDescription& config, const SourceLine& source,
|
||||
std::unique_ptr<Value> value) {
|
||||
return addResourceImpl(name, resId, config, source, std::move(value), kValidNameChars);
|
||||
@ -165,7 +165,7 @@ bool ResourceTable::addResourceAllowMangled(const ResourceNameRef& name,
|
||||
kValidNameMangledChars);
|
||||
}
|
||||
|
||||
bool ResourceTable::addResourceImpl(const ResourceNameRef& name, const ResourceId resId,
|
||||
bool ResourceTable::addResourceImpl(const ResourceNameRef& name, const ResourceId& resId,
|
||||
const ConfigDescription& config, const SourceLine& source,
|
||||
std::unique_ptr<Value> value, const char16_t* validChars) {
|
||||
if (!name.package.empty() && name.package != mPackage) {
|
||||
@ -255,17 +255,17 @@ bool ResourceTable::addResourceImpl(const ResourceNameRef& name, const ResourceI
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ResourceTable::markPublic(const ResourceNameRef& name, const ResourceId resId,
|
||||
bool ResourceTable::markPublic(const ResourceNameRef& name, const ResourceId& resId,
|
||||
const SourceLine& source) {
|
||||
return markPublicImpl(name, resId, source, kValidNameChars);
|
||||
}
|
||||
|
||||
bool ResourceTable::markPublicAllowMangled(const ResourceNameRef& name, const ResourceId resId,
|
||||
bool ResourceTable::markPublicAllowMangled(const ResourceNameRef& name, const ResourceId& resId,
|
||||
const SourceLine& source) {
|
||||
return markPublicImpl(name, resId, source, kValidNameMangledChars);
|
||||
}
|
||||
|
||||
bool ResourceTable::markPublicImpl(const ResourceNameRef& name, const ResourceId resId,
|
||||
bool ResourceTable::markPublicImpl(const ResourceNameRef& name, const ResourceId& resId,
|
||||
const SourceLine& source, const char16_t* validChars) {
|
||||
if (!name.package.empty() && name.package != mPackage) {
|
||||
Logger::error(source)
|
||||
|
@ -81,8 +81,8 @@ struct ResourceEntry {
|
||||
*/
|
||||
std::vector<ResourceConfigValue> values;
|
||||
|
||||
inline ResourceEntry(const StringPiece16& _name);
|
||||
inline ResourceEntry(const ResourceEntry* rhs);
|
||||
inline explicit ResourceEntry(const StringPiece16& _name);
|
||||
inline explicit ResourceEntry(const ResourceEntry* rhs);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -115,8 +115,8 @@ struct ResourceTableType {
|
||||
*/
|
||||
std::vector<std::unique_ptr<ResourceEntry>> entries;
|
||||
|
||||
ResourceTableType(const ResourceType _type);
|
||||
ResourceTableType(const ResourceTableType* rhs);
|
||||
explicit ResourceTableType(const ResourceType _type);
|
||||
explicit ResourceTableType(const ResourceTableType* rhs);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -151,12 +151,12 @@ public:
|
||||
bool addResourceAllowMangled(const ResourceNameRef& name, const ConfigDescription& config,
|
||||
const SourceLine& source, std::unique_ptr<Value> value);
|
||||
|
||||
bool addResource(const ResourceNameRef& name, const ResourceId resId,
|
||||
bool addResource(const ResourceNameRef& name, const ResourceId& resId,
|
||||
const ConfigDescription& config, const SourceLine& source,
|
||||
std::unique_ptr<Value> value);
|
||||
|
||||
bool markPublic(const ResourceNameRef& name, const ResourceId resId, const SourceLine& source);
|
||||
bool markPublicAllowMangled(const ResourceNameRef& name, const ResourceId resId,
|
||||
bool markPublic(const ResourceNameRef& name, const ResourceId& resId, const SourceLine& source);
|
||||
bool markPublicAllowMangled(const ResourceNameRef& name, const ResourceId& resId,
|
||||
const SourceLine& source);
|
||||
|
||||
/*
|
||||
@ -186,10 +186,10 @@ private:
|
||||
std::unique_ptr<ResourceEntry>& findOrCreateEntry(std::unique_ptr<ResourceTableType>& type,
|
||||
const StringPiece16& name);
|
||||
|
||||
bool addResourceImpl(const ResourceNameRef& name, const ResourceId resId,
|
||||
bool addResourceImpl(const ResourceNameRef& name, const ResourceId& resId,
|
||||
const ConfigDescription& config, const SourceLine& source,
|
||||
std::unique_ptr<Value> value, const char16_t* validChars);
|
||||
bool markPublicImpl(const ResourceNameRef& name, const ResourceId resId,
|
||||
bool markPublicImpl(const ResourceNameRef& name, const ResourceId& resId,
|
||||
const SourceLine& source, const char16_t* validChars);
|
||||
|
||||
std::u16string mPackage;
|
||||
|
@ -128,8 +128,8 @@ struct Reference : public BaseItem<Reference> {
|
||||
bool privateReference = false;
|
||||
|
||||
Reference();
|
||||
Reference(const ResourceNameRef& n, Type type = Type::kResource);
|
||||
Reference(const ResourceId& i, Type type = Type::kResource);
|
||||
Reference(const ResourceNameRef& n, Type type = Type::kResource); // NOLINT(implicit)
|
||||
explicit Reference(const ResourceId& i, Type type = Type::kResource);
|
||||
|
||||
bool flatten(android::Res_value& outValue) const override;
|
||||
Reference* clone(StringPool* newPool) const override;
|
||||
@ -154,7 +154,7 @@ struct Id : public BaseItem<Id> {
|
||||
struct RawString : public BaseItem<RawString> {
|
||||
StringPool::Ref value;
|
||||
|
||||
RawString(const StringPool::Ref& ref);
|
||||
explicit RawString(const StringPool::Ref& ref);
|
||||
|
||||
bool flatten(android::Res_value& outValue) const override;
|
||||
RawString* clone(StringPool* newPool) const override;
|
||||
@ -164,7 +164,7 @@ struct RawString : public BaseItem<RawString> {
|
||||
struct String : public BaseItem<String> {
|
||||
StringPool::Ref value;
|
||||
|
||||
String(const StringPool::Ref& ref);
|
||||
explicit String(const StringPool::Ref& ref);
|
||||
|
||||
bool flatten(android::Res_value& outValue) const override;
|
||||
String* clone(StringPool* newPool) const override;
|
||||
@ -174,7 +174,7 @@ struct String : public BaseItem<String> {
|
||||
struct StyledString : public BaseItem<StyledString> {
|
||||
StringPool::StyleRef value;
|
||||
|
||||
StyledString(const StringPool::StyleRef& ref);
|
||||
explicit StyledString(const StringPool::StyleRef& ref);
|
||||
|
||||
bool flatten(android::Res_value& outValue) const override;
|
||||
StyledString* clone(StringPool* newPool) const override;
|
||||
@ -185,7 +185,7 @@ struct FileReference : public BaseItem<FileReference> {
|
||||
StringPool::Ref path;
|
||||
|
||||
FileReference() = default;
|
||||
FileReference(const StringPool::Ref& path);
|
||||
explicit FileReference(const StringPool::Ref& path);
|
||||
|
||||
bool flatten(android::Res_value& outValue) const override;
|
||||
FileReference* clone(StringPool* newPool) const override;
|
||||
@ -199,7 +199,7 @@ struct BinaryPrimitive : public BaseItem<BinaryPrimitive> {
|
||||
android::Res_value value;
|
||||
|
||||
BinaryPrimitive() = default;
|
||||
BinaryPrimitive(const android::Res_value& val);
|
||||
explicit BinaryPrimitive(const android::Res_value& val);
|
||||
|
||||
bool flatten(android::Res_value& outValue) const override;
|
||||
BinaryPrimitive* clone(StringPool* newPool) const override;
|
||||
@ -218,7 +218,7 @@ struct Attribute : public BaseValue<Attribute> {
|
||||
uint32_t maxInt;
|
||||
std::vector<Symbol> symbols;
|
||||
|
||||
Attribute(bool w, uint32_t t = 0u);
|
||||
explicit Attribute(bool w, uint32_t t = 0u);
|
||||
|
||||
bool isWeak() const override;
|
||||
virtual Attribute* clone(StringPool* newPool) const override;
|
||||
@ -388,7 +388,7 @@ template <typename T, typename TFunc>
|
||||
struct ValueVisitorFunc : ValueVisitor {
|
||||
TFunc func;
|
||||
|
||||
ValueVisitorFunc(TFunc f) : func(f) {
|
||||
explicit ValueVisitorFunc(TFunc f) : func(f) {
|
||||
}
|
||||
|
||||
void visit(T& value, ValueVisitorArgs&) override {
|
||||
@ -403,7 +403,7 @@ template <typename T, typename TFunc>
|
||||
struct ConstValueVisitorFunc : ConstValueVisitor {
|
||||
TFunc func;
|
||||
|
||||
ConstValueVisitorFunc(TFunc f) : func(f) {
|
||||
explicit ConstValueVisitorFunc(TFunc f) : func(f) {
|
||||
}
|
||||
|
||||
void visit(const T& value, ValueVisitorArgs&) override {
|
||||
|
@ -47,7 +47,7 @@ namespace aapt {
|
||||
*/
|
||||
class ScopedXmlPullParser : public XmlPullParser {
|
||||
public:
|
||||
ScopedXmlPullParser(XmlPullParser* parser);
|
||||
explicit ScopedXmlPullParser(XmlPullParser* parser);
|
||||
ScopedXmlPullParser(const ScopedXmlPullParser&) = delete;
|
||||
ScopedXmlPullParser& operator=(const ScopedXmlPullParser&) = delete;
|
||||
~ScopedXmlPullParser();
|
||||
|
@ -48,7 +48,7 @@ static bool lessEntryId(const std::pair<uint16_t, size_t>& p, uint16_t entryId)
|
||||
return p.first < entryId;
|
||||
}
|
||||
|
||||
size_t findAttributeSdkLevel(ResourceId id) {
|
||||
size_t findAttributeSdkLevel(const ResourceId& id) {
|
||||
if (id.packageId() != 0x01 && id.typeId() != 0x01) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ enum {
|
||||
SDK_LOLLIPOP_MR1 = 22,
|
||||
};
|
||||
|
||||
size_t findAttributeSdkLevel(ResourceId id);
|
||||
size_t findAttributeSdkLevel(const ResourceId& id);
|
||||
size_t findAttributeSdkLevel(const ResourceName& name);
|
||||
|
||||
} // namespace aapt
|
||||
|
@ -30,7 +30,7 @@ namespace aapt {
|
||||
|
||||
class SourceXmlPullParser : public XmlPullParser {
|
||||
public:
|
||||
SourceXmlPullParser(std::istream& in);
|
||||
explicit SourceXmlPullParser(std::istream& in);
|
||||
SourceXmlPullParser(const SourceXmlPullParser& rhs) = delete;
|
||||
~SourceXmlPullParser();
|
||||
|
||||
|
@ -39,8 +39,8 @@ public:
|
||||
|
||||
BasicStringPiece();
|
||||
BasicStringPiece(const BasicStringPiece<TChar>& str);
|
||||
BasicStringPiece(const std::basic_string<TChar>& str);
|
||||
BasicStringPiece(const TChar* str);
|
||||
BasicStringPiece(const std::basic_string<TChar>& str); // NOLINT(implicit)
|
||||
BasicStringPiece(const TChar* str); // NOLINT(implicit)
|
||||
BasicStringPiece(const TChar* str, size_t len);
|
||||
|
||||
BasicStringPiece<TChar>& operator=(const BasicStringPiece<TChar>& rhs);
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
private:
|
||||
friend class StringPool;
|
||||
|
||||
Ref(Entry* entry);
|
||||
explicit Ref(Entry* entry);
|
||||
|
||||
Entry* mEntry;
|
||||
};
|
||||
@ -88,7 +88,7 @@ public:
|
||||
private:
|
||||
friend class StringPool;
|
||||
|
||||
StyleRef(StyleEntry* entry);
|
||||
explicit StyleRef(StyleEntry* entry);
|
||||
|
||||
StyleEntry* mEntry;
|
||||
};
|
||||
|
@ -46,7 +46,7 @@ struct TableFlattener {
|
||||
bool useExtendedChunks = true;
|
||||
};
|
||||
|
||||
TableFlattener(Options options);
|
||||
explicit TableFlattener(Options options);
|
||||
|
||||
bool flatten(BigBuffer* out, const ResourceTable& table);
|
||||
|
||||
|
@ -311,7 +311,7 @@ Maybe<std::u16string> extractPackageFromNamespace(const std::u16string& namespac
|
||||
* In the aapt namespace for lookup.
|
||||
*/
|
||||
inline ::std::ostream& operator<<(::std::ostream& out,
|
||||
::std::function<::std::ostream&(::std::ostream&)> f) {
|
||||
const ::std::function<::std::ostream&(::std::ostream&)>& f) {
|
||||
return f(out);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace aapt {
|
||||
*/
|
||||
class XliffXmlPullParser : public XmlPullParser {
|
||||
public:
|
||||
XliffXmlPullParser(const std::shared_ptr<XmlPullParser>& parser);
|
||||
explicit XliffXmlPullParser(const std::shared_ptr<XmlPullParser>& parser);
|
||||
XliffXmlPullParser(const XliffXmlPullParser& rhs) = delete;
|
||||
|
||||
Event getEvent() const override;
|
||||
|
@ -52,7 +52,7 @@ struct Node {
|
||||
std::u16string comment;
|
||||
std::vector<std::unique_ptr<Node>> children;
|
||||
|
||||
Node(NodeType type);
|
||||
explicit Node(NodeType type);
|
||||
void addChild(std::unique_ptr<Node> child);
|
||||
virtual std::unique_ptr<Node> clone() const = 0;
|
||||
virtual void accept(Visitor* visitor) = 0;
|
||||
@ -65,7 +65,7 @@ struct Node {
|
||||
*/
|
||||
template <typename Derived>
|
||||
struct BaseNode : public Node {
|
||||
BaseNode(NodeType t);
|
||||
explicit BaseNode(NodeType t);
|
||||
virtual void accept(Visitor* visitor) override;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user