blob: 0ae798c54f13697f7d43facfc931300c60bc1d95 [file] [log] [blame]
Adam Lesinski6f6ceb72014-11-14 14:48:12 -08001/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef AAPT_TABLE_FLATTENER_H
18#define AAPT_TABLE_FLATTENER_H
19
20#include "BigBuffer.h"
21#include "ResourceTable.h"
22
23namespace aapt {
24
25struct FlatEntry;
26
27/**
28 * Flattens a ResourceTable into a binary format suitable
29 * for loading into a ResTable on the host or device.
30 */
31struct TableFlattener {
32 /**
33 * A set of options for this TableFlattener.
34 */
35 struct Options {
36 /**
37 * Specifies whether to output extended chunks, like
38 * source information and mising symbol entries. Default
39 * is true.
40 *
41 * Set this to false when emitting the final table to be used
42 * on device.
43 */
44 bool useExtendedChunks = true;
45 };
46
47 TableFlattener(Options options);
48
49 bool flatten(BigBuffer* out, const ResourceTable& table);
50
51private:
52 bool flattenValue(BigBuffer* out, const FlatEntry& flatEntry,
53 std::vector<std::pair<ResourceNameRef, uint32_t>>& symbolEntries);
54
55 Options mOptions;
56};
57
58} // namespace aapt
59
60#endif // AAPT_TABLE_FLATTENER_H