diff options
Diffstat (limited to 'tools/aapt2/xml/XmlUtil.h')
-rw-r--r-- | tools/aapt2/xml/XmlUtil.h | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/tools/aapt2/xml/XmlUtil.h b/tools/aapt2/xml/XmlUtil.h index 98e5520a6ea2..f0d59b7346b2 100644 --- a/tools/aapt2/xml/XmlUtil.h +++ b/tools/aapt2/xml/XmlUtil.h @@ -25,10 +25,10 @@ namespace aapt { namespace xml { -constexpr const char16_t* kSchemaAuto = u"http://schemas.android.com/apk/res-auto"; -constexpr const char16_t* kSchemaPublicPrefix = u"http://schemas.android.com/apk/res/"; -constexpr const char16_t* kSchemaPrivatePrefix = u"http://schemas.android.com/apk/prv/res/"; -constexpr const char16_t* kSchemaAndroid = u"http://schemas.android.com/apk/res/android"; +constexpr const char* kSchemaAuto = "http://schemas.android.com/apk/res-auto"; +constexpr const char* kSchemaPublicPrefix = "http://schemas.android.com/apk/res/"; +constexpr const char* kSchemaPrivatePrefix = "http://schemas.android.com/apk/prv/res/"; +constexpr const char* kSchemaAndroid = "http://schemas.android.com/apk/res/android"; /** * Result of extracting a package name from a namespace URI declaration. @@ -38,7 +38,7 @@ struct ExtractedPackage { * The name of the package. This can be the empty string, which means that the package * should be assumed to be the package being compiled. */ - std::u16string package; + std::string package; /** * True if the package's private namespace was declared. This means that private resources @@ -55,7 +55,14 @@ struct ExtractedPackage { * Special case: if namespaceUri is http://schemas.android.com/apk/res-auto, * returns an empty package name. */ -Maybe<ExtractedPackage> extractPackageFromNamespace(const std::u16string& namespaceUri); +Maybe<ExtractedPackage> extractPackageFromNamespace(const std::string& namespaceUri); + +/** + * Returns an XML Android namespace for the given package of the form: + * + * http://schemas.android.com/apk/res/<package> + */ +std::string buildPackageNamespace(const StringPiece& package); /** * Interface representing a stack of XML namespace declarations. When looking up the package @@ -68,7 +75,7 @@ struct IPackageDeclStack { * Returns an ExtractedPackage struct if the alias given corresponds with a package declaration. */ virtual Maybe<ExtractedPackage> transformPackageAlias( - const StringPiece16& alias, const StringPiece16& localPackage) const = 0; + const StringPiece& alias, const StringPiece& localPackage) const = 0; }; /** @@ -77,7 +84,7 @@ struct IPackageDeclStack { * the package declaration was private. */ void transformReferenceFromNamespace(IPackageDeclStack* declStack, - const StringPiece16& localPackage, Reference* inRef); + const StringPiece& localPackage, Reference* inRef); } // namespace xml } // namespace aapt |