summaryrefslogtreecommitdiffstats
path: root/tools/aapt
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2014-11-03 23:38:55 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-11-03 23:38:56 +0000
commitf7ffcaa7a478eaafc121e84b14dcaf2503dd5457 (patch)
tree360be2dca990e9d244fc92529ec8d53266ed6d7f /tools/aapt
parent668f0a356cba44c22d8ca0c9f4711613885d46a9 (diff)
parentc3dc0b57b8d0b3875f868788e110aa67fb032b4a (diff)
downloadframeworks_base-f7ffcaa7a478eaafc121e84b14dcaf2503dd5457.zip
frameworks_base-f7ffcaa7a478eaafc121e84b14dcaf2503dd5457.tar.gz
frameworks_base-f7ffcaa7a478eaafc121e84b14dcaf2503dd5457.tar.bz2
Merge "Build the split-select tool without C++11 support" into lmp-mr1-dev
Diffstat (limited to 'tools/aapt')
-rw-r--r--tools/aapt/AaptUtil.h40
1 files changed, 37 insertions, 3 deletions
diff --git a/tools/aapt/AaptUtil.h b/tools/aapt/AaptUtil.h
index 47a704a..89e1ee8 100644
--- a/tools/aapt/AaptUtil.h
+++ b/tools/aapt/AaptUtil.h
@@ -14,9 +14,11 @@
* limitations under the License.
*/
-#ifndef __AAPT_UTIL_H
-#define __AAPT_UTIL_H
+#ifndef H_AAPT_UTIL
+#define H_AAPT_UTIL
+#include <utils/KeyedVector.h>
+#include <utils/SortedVector.h>
#include <utils/String8.h>
#include <utils/Vector.h>
@@ -25,6 +27,38 @@ namespace AaptUtil {
android::Vector<android::String8> split(const android::String8& str, const char sep);
android::Vector<android::String8> splitAndLowerCase(const android::String8& str, const char sep);
+template <typename KEY, typename VALUE>
+void appendValue(android::KeyedVector<KEY, android::Vector<VALUE> >& keyedVector,
+ const KEY& key, const VALUE& value);
+
+template <typename KEY, typename VALUE>
+void appendValue(android::KeyedVector<KEY, android::SortedVector<VALUE> >& keyedVector,
+ const KEY& key, const VALUE& value);
+
+//
+// Implementations
+//
+
+template <typename KEY, typename VALUE>
+void appendValue(android::KeyedVector<KEY, android::Vector<VALUE> >& keyedVector,
+ const KEY& key, const VALUE& value) {
+ ssize_t idx = keyedVector.indexOfKey(key);
+ if (idx < 0) {
+ idx = keyedVector.add(key, android::Vector<VALUE>());
+ }
+ keyedVector.editValueAt(idx).add(value);
+}
+
+template <typename KEY, typename VALUE>
+void appendValue(android::KeyedVector<KEY, android::SortedVector<VALUE> >& keyedVector,
+ const KEY& key, const VALUE& value) {
+ ssize_t idx = keyedVector.indexOfKey(key);
+ if (idx < 0) {
+ idx = keyedVector.add(key, android::SortedVector<VALUE>());
+ }
+ keyedVector.editValueAt(idx).add(value);
+}
+
} // namespace AaptUtil
-#endif // __AAPT_UTIL_H
+#endif // H_AAPT_UTIL