| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
#ifndef AAPT_SPLIT_TABLESPLITTER_H |
| 18 |
#define AAPT_SPLIT_TABLESPLITTER_H |
| 19 |
|
| 20 |
#include <set> |
| 21 |
#include <vector> |
| 22 |
#include "android-base/macros.h" |
| 23 |
#include "androidfw/ConfigDescription.h" |
| 24 |
|
| 25 |
#include "ResourceTable.h" |
| 26 |
#include "filter/ConfigFilter.h" |
| 27 |
#include "process/IResourceTableConsumer.h" |
| 28 |
|
| 29 |
namespace aapt { |
| 30 |
|
| 31 |
struct SplitConstraints { |
| 32 |
std::set<android::ConfigDescription> configs; |
| 33 |
std::string name; |
| 34 |
}; |
| 35 |
|
| 36 |
struct TableSplitterOptions { |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
std::vector<uint16_t> preferred_densities; |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
IConfigFilter* config_filter = nullptr; |
| 48 |
}; |
| 49 |
|
| 50 |
class TableSplitter { |
| 51 |
public: |
| 52 |
TableSplitter(const std::vector<SplitConstraints>& splits, |
| 53 |
const TableSplitterOptions& options) |
| 54 |
: split_constraints_(splits), options_(options) { |
| 55 |
for (size_t i = 0; i < split_constraints_.size(); i++) { |
| 56 |
splits_.push_back(util::make_unique<ResourceTable>()); |
| 57 |
} |
| 58 |
} |
| 59 |
|
| 60 |
bool VerifySplitConstraints(IAaptContext* context); |
| 61 |
|
| 62 |
void SplitTable(ResourceTable* original_table); |
| 63 |
|
| 64 |
std::vector<std::unique_ptr<ResourceTable>>& splits() { return splits_; } |
| 65 |
|
| 66 |
private: |
| 67 |
std::vector<SplitConstraints> split_constraints_; |
| 68 |
std::vector<std::unique_ptr<ResourceTable>> splits_; |
| 69 |
TableSplitterOptions options_; |
| 70 |
|
| 71 |
DISALLOW_COPY_AND_ASSIGN(TableSplitter); |
| 72 |
}; |
| 73 |
} |
| 74 |
|
| 75 |
#endif |