• 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 "ConfigDescription.h"
21 #include "ResourceTable.h"
22 #include "Source.h"
23 #include "StringPool.h"
24 
25 #include "proto/frameworks/base/tools/aapt2/Format.pb.h"
26 
27 #include <androidfw/ResourceTypes.h>
28 
29 namespace aapt {
30 
31 void serializeStringPoolToPb(const StringPool& pool, pb::StringPool* outPbPool);
32 
33 void serializeSourceToPb(const Source& source, StringPool* srcPool, pb::Source* outPbSource);
34 void deserializeSourceFromPb(const pb::Source& pbSource, const android::ResStringPool& srcPool,
35                              Source* outSource);
36 
37 pb::SymbolStatus_Visibility serializeVisibilityToPb(SymbolState state);
38 SymbolState deserializeVisibilityFromPb(pb::SymbolStatus_Visibility pbVisibility);
39 
40 void serializeConfig(const ConfigDescription& config, pb::ConfigDescription* outPbConfig);
41 bool deserializeConfigDescriptionFromPb(const pb::ConfigDescription& pbConfig,
42                                         ConfigDescription* outConfig);
43 
44 pb::Reference_Type serializeReferenceTypeToPb(Reference::Type type);
45 Reference::Type deserializeReferenceTypeFromPb(pb::Reference_Type pbType);
46 
47 pb::Plural_Arity serializePluralEnumToPb(size_t pluralIdx);
48 size_t deserializePluralEnumFromPb(pb::Plural_Arity arity);
49 
50 } // namespace aapt
51 
52 #endif /* AAPT_PROTO_PROTOHELPERS_H */
53