Adam Lesinski | 1ab598f | 2015-08-14 14:26:04 -0700 | [diff] [blame^] | 1 | /* |
| 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 | |
| 24 | namespace aapt { |
| 25 | |
| 26 | class ResourceTable; |
| 27 | struct ResourceEntry; |
| 28 | struct ConfigDescription; |
| 29 | |
| 30 | /** |
| 31 | * Determines whether a versioned resource should be created. If a versioned resource already |
| 32 | * exists, it takes precedence. |
| 33 | */ |
| 34 | bool shouldGenerateVersionedResource(const ResourceEntry* entry, const ConfigDescription& config, |
| 35 | const int sdkVersionToGenerate); |
| 36 | |
| 37 | struct AutoVersioner : public IResourceTableConsumer { |
| 38 | bool consume(IAaptContext* context, ResourceTable* table) override; |
| 39 | }; |
| 40 | |
| 41 | struct PrivateAttributeMover : public IResourceTableConsumer { |
| 42 | bool consume(IAaptContext* context, ResourceTable* table) override; |
| 43 | }; |
| 44 | |
| 45 | struct XmlAutoVersioner : public IXmlResourceConsumer { |
| 46 | bool consume(IAaptContext* context, XmlResource* resource) override; |
| 47 | }; |
| 48 | |
| 49 | struct ReferenceLinker : public IResourceTableConsumer { |
| 50 | bool consume(IAaptContext* context, ResourceTable* table) override; |
| 51 | }; |
| 52 | |
| 53 | class XmlReferenceLinker : IXmlResourceConsumer { |
| 54 | private: |
| 55 | std::set<int> mSdkLevelsFound; |
| 56 | |
| 57 | public: |
| 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 */ |