]> git.saurik.com Git - android/aapt.git/blobdiff - ResourceTable.h
auto import from //branches/cupcake/...@130745
[android/aapt.git] / ResourceTable.h
index b36234d37cc53b3317ad114dcd05fe68bfa13278..e8fbd9b7b7c75538e9d9f13d3e6cf8bdaaeb43c1 100644 (file)
 #include "StringPool.h"
 #include "SourcePos.h"
 
 #include "StringPool.h"
 #include "SourcePos.h"
 
+#include <set>
+#include <map>
+
+using namespace std;
+
 class ResourceTable;
 
 enum {
 class ResourceTable;
 
 enum {
@@ -33,6 +38,7 @@ status_t compileResourceFile(Bundle* bundle,
                              const sp<AaptAssets>& assets,
                              const sp<AaptFile>& in,
                              const ResTable_config& defParams,
                              const sp<AaptAssets>& assets,
                              const sp<AaptFile>& in,
                              const ResTable_config& defParams,
+                             const bool overwrite,
                              ResourceTable* outTable);
 
 struct AccessorCookie
                              ResourceTable* outTable);
 
 struct AccessorCookie
@@ -74,7 +80,8 @@ public:
                       const Vector<StringPool::entry_style_span>* style = NULL,
                       const ResTable_config* params = NULL,
                       const bool doSetIndex = false,
                       const Vector<StringPool::entry_style_span>* 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,
 
     status_t startBag(const SourcePos& pos,
                     const String16& package,
@@ -136,12 +143,14 @@ public:
 
     uint32_t getResId(const String16& package,
                       const String16& type,
 
     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,
 
     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);
     
 
     static bool isValidResourceName(const String16& s);
     
@@ -155,6 +164,8 @@ public:
 
     status_t assignResourceIds();
     status_t addSymbols(const sp<AaptSymbols>& outSymbols = NULL);
 
     status_t assignResourceIds();
     status_t addSymbols(const sp<AaptSymbols>& outSymbols = NULL);
+    void addLocalization(const String16& name, const String8& locale);
+    status_t validateLocalizations(void);
 
     status_t flatten(Bundle*, const sp<AaptFile>& dest);
 
 
     status_t flatten(Bundle*, const sp<AaptFile>& dest);
 
@@ -247,7 +258,8 @@ public:
         status_t setItem(const SourcePos& pos,
                          const String16& value,
                          const Vector<StringPool::entry_style_span>* style = NULL,
         status_t setItem(const SourcePos& pos,
                          const String16& value,
                          const Vector<StringPool::entry_style_span>* 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,
 
         status_t addToBag(const SourcePos& pos,
                           const String16& key, const String16& value,
@@ -491,7 +503,6 @@ private:
 
     String16 mAssetsPackage;
     sp<AaptAssets> mAssets;
 
     String16 mAssetsPackage;
     sp<AaptAssets> mAssets;
-    DefaultKeyedVector<String16, DefaultKeyedVector<String16, uint32_t> > mPublicNames;
     DefaultKeyedVector<String16, sp<Package> > mPackages;
     Vector<sp<Package> > mOrderedPackages;
     uint32_t mNextPackageId;
     DefaultKeyedVector<String16, sp<Package> > mPackages;
     Vector<sp<Package> > mOrderedPackages;
     uint32_t mNextPackageId;
@@ -500,6 +511,9 @@ private:
     size_t mNumLocal;
     SourcePos mCurrentXmlPos;
     Bundle* mBundle;
     size_t mNumLocal;
     SourcePos mCurrentXmlPos;
     Bundle* mBundle;
+    
+    // key = string resource name, value = set of locales in which that name is defined
+    map<String16, set<String8> > mLocalizations;
 };
 
 class ResourceFilter
 };
 
 class ResourceFilter