]> git.saurik.com Git - android/aapt.git/blobdiff - ResourceTable.h
Allow overlays to add resources.
[android/aapt.git] / ResourceTable.h
index fff4f49795b0105361cde03322eab897dbfe68ec..caa01b3f472f04250360fa255f5c00573d526dc2 100644 (file)
@@ -15,6 +15,7 @@
 
 using namespace std;
 
+class XMLNode;
 class ResourceTable;
 
 enum {
@@ -34,10 +35,17 @@ status_t compileXmlFile(const sp<AaptAssets>& assets,
                         ResourceTable* table,
                         int options = XML_COMPILE_STANDARD_RESOURCE);
 
+status_t compileXmlFile(const sp<AaptAssets>& assets,
+                        const sp<XMLNode>& xmlTree,
+                        const sp<AaptFile>& target,
+                        ResourceTable* table,
+                        int options = XML_COMPILE_STANDARD_RESOURCE);
+
 status_t compileResourceFile(Bundle* bundle,
                              const sp<AaptAssets>& assets,
                              const sp<AaptFile>& in,
                              const ResTable_config& defParams,
+                             const bool overwrite,
                              ResourceTable* outTable);
 
 struct AccessorCookie
@@ -79,7 +87,8 @@ public:
                       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,
@@ -87,6 +96,7 @@ public:
                     const String16& name,
                     const String16& bagParent,
                     const ResTable_config* params = NULL,
+                    bool overlay = false,
                     bool replace = false,
                     bool isId = false);
     
@@ -122,6 +132,9 @@ public:
                            const String16& name,
                            const String16& comment);
     
+    void canAddEntry(const SourcePos& pos,
+        const String16& package, const String16& type, const String16& name);
+        
     size_t size() const;
     size_t numLocalResources() const;
     bool hasResources() const;
@@ -252,11 +265,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<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,
@@ -400,12 +416,15 @@ public:
         status_t addPublic(const SourcePos& pos,
                            const String16& name,
                            const uint32_t ident);
-
+                           
+        void canAddEntry(const String16& name);
+        
         String16 getName() const { return mName; }
         sp<Entry> 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; }
 
@@ -421,6 +440,8 @@ public:
         const DefaultKeyedVector<String16, sp<ConfigList> >& getConfigs() const { return mConfigs; }
         const Vector<sp<ConfigList> >& getOrderedConfigs() const { return mOrderedConfigs; }
 
+        const SortedVector<String16>& getCanAddEntries() const { return mCanAddEntries; }
+        
         const SourcePos& getPos() const { return mPos; }
     private:
         String16 mName;
@@ -429,6 +450,7 @@ public:
         SortedVector<ConfigDescription> mUniqueConfigs;
         DefaultKeyedVector<String16, sp<ConfigList> > mConfigs;
         Vector<sp<ConfigList> > mOrderedConfigs;
+        SortedVector<String16> mCanAddEntries;
         int32_t mPublicIndex;
         int32_t mIndex;
         SourcePos mPos;
@@ -489,6 +511,7 @@ private:
                        const String16& type,
                        const String16& name,
                        const SourcePos& pos,
+                       bool overlay,
                        const ResTable_config* config = NULL,
                        bool doSetIndex = false);
     sp<const Entry> getEntry(uint32_t resID,