blob: 7271e8bd723837a29734a857d6a0ab6bf57a3567 [file] [log] [blame]
Adam Lesinski59e04c62016-02-04 15:59:23 -08001/*
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
Adam Lesinskicacb28f2016-10-19 12:18:14 -070033void serializeSourceToPb(const Source& source, StringPool* srcPool,
34 pb::Source* outPbSource);
35void deserializeSourceFromPb(const pb::Source& pbSource,
36 const android::ResStringPool& srcPool,
Adam Lesinski59e04c62016-02-04 15:59:23 -080037 Source* outSource);
38
39pb::SymbolStatus_Visibility serializeVisibilityToPb(SymbolState state);
Adam Lesinskicacb28f2016-10-19 12:18:14 -070040SymbolState deserializeVisibilityFromPb(
41 pb::SymbolStatus_Visibility pbVisibility);
Adam Lesinski59e04c62016-02-04 15:59:23 -080042
Adam Lesinskicacb28f2016-10-19 12:18:14 -070043void serializeConfig(const ConfigDescription& config,
44 pb::ConfigDescription* outPbConfig);
Adam Lesinski59e04c62016-02-04 15:59:23 -080045bool deserializeConfigDescriptionFromPb(const pb::ConfigDescription& pbConfig,
46 ConfigDescription* outConfig);
47
48pb::Reference_Type serializeReferenceTypeToPb(Reference::Type type);
49Reference::Type deserializeReferenceTypeFromPb(pb::Reference_Type pbType);
50
51pb::Plural_Arity serializePluralEnumToPb(size_t pluralIdx);
52size_t deserializePluralEnumFromPb(pb::Plural_Arity arity);
53
Adam Lesinskicacb28f2016-10-19 12:18:14 -070054} // namespace aapt
Adam Lesinski59e04c62016-02-04 15:59:23 -080055
56#endif /* AAPT_PROTO_PROTOHELPERS_H */