| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
#ifndef H_AAPT_UTIL |
| 18 |
#define H_AAPT_UTIL |
| 19 |
|
| 20 |
#include <utils/KeyedVector.h> |
| 21 |
#include <utils/SortedVector.h> |
| 22 |
#include <utils/String8.h> |
| 23 |
#include <utils/Vector.h> |
| 24 |
|
| 25 |
namespace AaptUtil { |
| 26 |
|
| 27 |
android::Vector<android::String8> split(const android::String8& str, const char sep); |
| 28 |
android::Vector<android::String8> splitAndLowerCase(const android::String8& str, const char sep); |
| 29 |
|
| 30 |
template <typename KEY, typename VALUE> |
| 31 |
void appendValue(android::KeyedVector<KEY, android::Vector<VALUE> >& keyedVector, |
| 32 |
const KEY& key, const VALUE& value); |
| 33 |
|
| 34 |
template <typename KEY, typename VALUE> |
| 35 |
void appendValue(android::KeyedVector<KEY, android::SortedVector<VALUE> >& keyedVector, |
| 36 |
const KEY& key, const VALUE& value); |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
template <typename KEY, typename VALUE> |
| 43 |
void appendValue(android::KeyedVector<KEY, android::Vector<VALUE> >& keyedVector, |
| 44 |
const KEY& key, const VALUE& value) { |
| 45 |
ssize_t idx = keyedVector.indexOfKey(key); |
| 46 |
if (idx < 0) { |
| 47 |
idx = keyedVector.add(key, android::Vector<VALUE>()); |
| 48 |
} |
| 49 |
keyedVector.editValueAt(idx).add(value); |
| 50 |
} |
| 51 |
|
| 52 |
template <typename KEY, typename VALUE> |
| 53 |
void appendValue(android::KeyedVector<KEY, android::SortedVector<VALUE> >& keyedVector, |
| 54 |
const KEY& key, const VALUE& value) { |
| 55 |
ssize_t idx = keyedVector.indexOfKey(key); |
| 56 |
if (idx < 0) { |
| 57 |
idx = keyedVector.add(key, android::SortedVector<VALUE>()); |
| 58 |
} |
| 59 |
keyedVector.editValueAt(idx).add(value); |
| 60 |
} |
| 61 |
|
| 62 |
} |
| 63 |
|
| 64 |
#endif |