blob: 2cc8d9ff5096701a4e50ecd6b6b231af9b577273 [file] [log] [blame]
Adam Lesinski1ab598f2015-08-14 14:26:04 -07001/*
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_LINKER_LINKERS_H
18#define AAPT_LINKER_LINKERS_H
19
20#include "process/IResourceTableConsumer.h"
21
22#include <set>
23
24namespace aapt {
25
26class ResourceTable;
27struct ResourceEntry;
28struct ConfigDescription;
29
30/**
31 * Determines whether a versioned resource should be created. If a versioned resource already
32 * exists, it takes precedence.
33 */
34bool shouldGenerateVersionedResource(const ResourceEntry* entry, const ConfigDescription& config,
35 const int sdkVersionToGenerate);
36
37struct AutoVersioner : public IResourceTableConsumer {
38 bool consume(IAaptContext* context, ResourceTable* table) override;
39};
40
41struct PrivateAttributeMover : public IResourceTableConsumer {
42 bool consume(IAaptContext* context, ResourceTable* table) override;
43};
44
45struct XmlAutoVersioner : public IXmlResourceConsumer {
46 bool consume(IAaptContext* context, XmlResource* resource) override;
47};
48
49struct ReferenceLinker : public IResourceTableConsumer {
50 bool consume(IAaptContext* context, ResourceTable* table) override;
51};
52
53class XmlReferenceLinker : IXmlResourceConsumer {
54private:
55 std::set<int> mSdkLevelsFound;
56
57public:
58 bool consume(IAaptContext* context, XmlResource* resource) override;
59
60 const std::set<int>& getSdkLevels() const {
61 return mSdkLevelsFound;
62 }
63};
64
65} // namespace aapt
66
67#endif /* AAPT_LINKER_LINKERS_H */