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_PROCESS_IRESOURCETABLECONSUMER_H
18 #define AAPT_PROCESS_IRESOURCETABLECONSUMER_H
19 
20 #include <iostream>
21 #include <list>
22 #include <set>
23 #include <sstream>
24 
25 #include "Diagnostics.h"
26 #include "NameMangler.h"
27 #include "Resource.h"
28 #include "ResourceValues.h"
29 #include "Source.h"
30 
31 namespace aapt {
32 
33 class ResourceTable;
34 class SymbolTable;
35 
36 // The type of package to build.
37 enum class PackageType {
38   kApp,
39   kSharedLib,
40   kStaticLib,
41 };
42 
43 struct IAaptContext {
44   virtual ~IAaptContext() = default;
45 
46   virtual PackageType GetPackageType() = 0;
47   virtual SymbolTable* GetExternalSymbols() = 0;
48   virtual IDiagnostics* GetDiagnostics() = 0;
49   virtual const std::string& GetCompilationPackage() = 0;
50   virtual uint8_t GetPackageId() = 0;
51   virtual NameMangler* GetNameMangler() = 0;
52   virtual bool IsVerbose() = 0;
53   virtual int GetMinSdkVersion() = 0;
54   virtual const std::set<std::string>& GetSplitNameDependencies() = 0;
55 };
56 
57 struct IResourceTableConsumer {
58   virtual ~IResourceTableConsumer() = default;
59 
60   virtual bool Consume(IAaptContext* context, ResourceTable* table) = 0;
61 };
62 
63 namespace xml {
64 class XmlResource;
65 }
66 
67 struct IXmlResourceConsumer {
68   virtual ~IXmlResourceConsumer() = default;
69 
70   virtual bool Consume(IAaptContext* context, xml::XmlResource* resource) = 0;
71 };
72 
73 }  // namespace aapt
74 
75 #endif /* AAPT_PROCESS_IRESOURCETABLECONSUMER_H */
76