• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 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_PROTO_PROTOHELPERS_H
18 #define AAPT_PROTO_PROTOHELPERS_H
19 
20 #include "androidfw/ResourceTypes.h"
21 
22 #include "ConfigDescription.h"
23 #include "ResourceTable.h"
24 #include "Source.h"
25 #include "StringPool.h"
26 #include "Format.pb.h"
27 
28 namespace aapt {
29 
30 void SerializeStringPoolToPb(const StringPool& pool,
31                              pb::StringPool* out_pb_pool);
32 
33 void SerializeSourceToPb(const Source& source, StringPool* src_pool,
34                          pb::Source* out_pb_source);
35 
36 void DeserializeSourceFromPb(const pb::Source& pb_source,
37                              const android::ResStringPool& src_pool,
38                              Source* out_source);
39 
40 pb::SymbolStatus_Visibility SerializeVisibilityToPb(SymbolState state);
41 
42 SymbolState DeserializeVisibilityFromPb(
43     pb::SymbolStatus_Visibility pb_visibility);
44 
45 void SerializeConfig(const ConfigDescription& config,
46                      pb::ConfigDescription* out_pb_config);
47 
48 bool DeserializeConfigDescriptionFromPb(const pb::ConfigDescription& pb_config,
49                                         ConfigDescription* out_config);
50 
51 pb::Reference_Type SerializeReferenceTypeToPb(Reference::Type type);
52 
53 Reference::Type DeserializeReferenceTypeFromPb(pb::Reference_Type pb_type);
54 
55 pb::Plural_Arity SerializePluralEnumToPb(size_t plural_idx);
56 
57 size_t DeserializePluralEnumFromPb(pb::Plural_Arity arity);
58 
59 }  // namespace aapt
60 
61 #endif /* AAPT_PROTO_PROTOHELPERS_H */
62