X-Git-Url: https://git.saurik.com/android/aapt.git/blobdiff_plain/dadd9c1fc18bd05c84a357b56e945b5829b3bd95..762b8e593a088fc9d2a7a86c0e55ccdd44aaade6:/ResourceTable.h?ds=sidebyside diff --git a/ResourceTable.h b/ResourceTable.h index b36234d..ec4331a 100644 --- a/ResourceTable.h +++ b/ResourceTable.h @@ -10,6 +10,12 @@ #include "StringPool.h" #include "SourcePos.h" +#include +#include + +using namespace std; + +class XMLNode; class ResourceTable; enum { @@ -29,10 +35,17 @@ status_t compileXmlFile(const sp& assets, ResourceTable* table, int options = XML_COMPILE_STANDARD_RESOURCE); +status_t compileXmlFile(const sp& assets, + const sp& xmlTree, + const sp& target, + ResourceTable* table, + int options = XML_COMPILE_STANDARD_RESOURCE); + status_t compileResourceFile(Bundle* bundle, const sp& assets, const sp& in, const ResTable_config& defParams, + const bool overwrite, ResourceTable* outTable); struct AccessorCookie @@ -74,7 +87,8 @@ public: const Vector* style = NULL, const ResTable_config* params = NULL, const bool doSetIndex = false, - const int32_t format = ResTable_map::TYPE_ANY); + const int32_t format = ResTable_map::TYPE_ANY, + const bool overwrite = false); status_t startBag(const SourcePos& pos, const String16& package, @@ -82,6 +96,7 @@ public: const String16& name, const String16& bagParent, const ResTable_config* params = NULL, + bool overlay = false, bool replace = false, bool isId = false); @@ -136,12 +151,14 @@ public: uint32_t getResId(const String16& package, const String16& type, - const String16& name) const; + const String16& name, + bool onlyPublic = false) const; uint32_t getResId(const String16& ref, const String16* defType = NULL, const String16* defPackage = NULL, - const char** outErrorMsg = NULL) const; + const char** outErrorMsg = NULL, + bool onlyPublic = false) const; static bool isValidResourceName(const String16& s); @@ -155,6 +172,8 @@ public: status_t assignResourceIds(); status_t addSymbols(const sp& outSymbols = NULL); + void addLocalization(const String16& name, const String8& locale); + status_t validateLocalizations(void); status_t flatten(Bundle*, const sp& dest); @@ -243,11 +262,14 @@ public: String16 getParent() const { return mParent; } status_t makeItABag(const SourcePos& sourcePos); - + + status_t emptyBag(const SourcePos& sourcePos); + status_t setItem(const SourcePos& pos, const String16& value, const Vector* style = NULL, - int32_t format = ResTable_map::TYPE_ANY); + int32_t format = ResTable_map::TYPE_ANY, + const bool overwrite = false); status_t addToBag(const SourcePos& pos, const String16& key, const String16& value, @@ -396,7 +418,8 @@ public: sp getEntry(const String16& entry, const SourcePos& pos, const ResTable_config* config = NULL, - bool doSetIndex = false); + bool doSetIndex = false, + bool overlay = false); const SourcePos& getFirstPublicSourcePos() const { return *mFirstPublicSourcePos; } @@ -480,6 +503,7 @@ private: const String16& type, const String16& name, const SourcePos& pos, + bool overlay, const ResTable_config* config = NULL, bool doSetIndex = false); sp getEntry(uint32_t resID, @@ -491,7 +515,6 @@ private: String16 mAssetsPackage; sp mAssets; - DefaultKeyedVector > mPublicNames; DefaultKeyedVector > mPackages; Vector > mOrderedPackages; uint32_t mNextPackageId; @@ -500,6 +523,9 @@ private: size_t mNumLocal; SourcePos mCurrentXmlPos; Bundle* mBundle; + + // key = string resource name, value = set of locales in which that name is defined + map > mLocalizations; }; class ResourceFilter