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