• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 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_FORMAT_PROTO_PROTODESERIALIZE_H
18 #define AAPT_FORMAT_PROTO_PROTODESERIALIZE_H
19 
20 #include "Configuration.pb.h"
21 #include "ResourceTable.h"
22 #include "ResourceValues.h"
23 #include "Resources.pb.h"
24 #include "ResourcesInternal.pb.h"
25 #include "android-base/macros.h"
26 #include "androidfw/ConfigDescription.h"
27 #include "androidfw/ResourceTypes.h"
28 #include "androidfw/StringPool.h"
29 #include "io/File.h"
30 #include "xml/XmlDom.h"
31 
32 namespace aapt {
33 
34 std::unique_ptr<Value> DeserializeValueFromPb(const pb::Value& pb_value,
35                                               const android::ResStringPool& src_pool,
36                                               const android::ConfigDescription& config,
37                                               android::StringPool* value_pool,
38                                               io::IFileCollection* files, std::string* out_error);
39 
40 std::unique_ptr<Item> DeserializeItemFromPb(const pb::Item& pb_item,
41                                             const android::ResStringPool& src_pool,
42                                             const android::ConfigDescription& config,
43                                             android::StringPool* value_pool,
44                                             io::IFileCollection* files, std::string* out_error);
45 
46 std::unique_ptr<xml::XmlResource> DeserializeXmlResourceFromPb(const pb::XmlNode& pb_node,
47                                                                std::string* out_error);
48 
49 bool DeserializeXmlFromPb(const pb::XmlNode& pb_node, xml::Element* out_el,
50                           android::StringPool* value_pool, std::string* out_error);
51 
52 bool DeserializeConfigFromPb(const pb::Configuration& pb_config,
53                              android::ConfigDescription* out_config, std::string* out_error);
54 
55 // Optional io::IFileCollection used to lookup references to files in the ResourceTable.
56 bool DeserializeTableFromPb(const pb::ResourceTable& pb_table, io::IFileCollection* files,
57                             ResourceTable* out_table, std::string* out_error);
58 
59 bool DeserializeCompiledFileFromPb(const pb::internal::CompiledFile& pb_file,
60                                    ResourceFile* out_file, std::string* out_error);
61 
62 }  // namespace aapt
63 
64 #endif /* AAPT_FORMAT_PROTO_PROTODESERIALIZE_H */
65