blob: cecec2d06c030b57ff84d8d9a3dd3bb7ee074049 [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
Adam Lesinskice5e56e2016-10-21 17:56:45 -070020#include "androidfw/ResourceTypes.h"
21
Adam Lesinski59e04c62016-02-04 15:59:23 -080022#include "ConfigDescription.h"
23#include "ResourceTable.h"
24#include "Source.h"
25#include "StringPool.h"
Fabien Sanglard19160202017-01-12 14:24:31 -050026#include "Format.pb.h"
Adam Lesinski59e04c62016-02-04 15:59:23 -080027
Adam Lesinski59e04c62016-02-04 15:59:23 -080028namespace aapt {
29
Adam Lesinski6b372992017-08-09 10:54:23 -070030void SerializeStringPoolToPb(const StringPool& pool, pb::StringPool* out_pb_pool);
Adam Lesinski59e04c62016-02-04 15:59:23 -080031
Adam Lesinski6b372992017-08-09 10:54:23 -070032void SerializeSourceToPb(const Source& source, StringPool* src_pool, pb::Source* out_pb_source);
Adam Lesinski59e04c62016-02-04 15:59:23 -080033
Adam Lesinski6b372992017-08-09 10:54:23 -070034void DeserializeSourceFromPb(const pb::Source& pb_source, const android::ResStringPool& src_pool,
Adam Lesinskice5e56e2016-10-21 17:56:45 -070035 Source* out_source);
Adam Lesinski59e04c62016-02-04 15:59:23 -080036
Adam Lesinskice5e56e2016-10-21 17:56:45 -070037pb::SymbolStatus_Visibility SerializeVisibilityToPb(SymbolState state);
Adam Lesinski59e04c62016-02-04 15:59:23 -080038
Adam Lesinski6b372992017-08-09 10:54:23 -070039SymbolState DeserializeVisibilityFromPb(pb::SymbolStatus_Visibility pb_visibility);
Adam Lesinski59e04c62016-02-04 15:59:23 -080040
Adam Lesinski6b372992017-08-09 10:54:23 -070041void SerializeConfig(const ConfigDescription& config, pb::ConfigDescription* out_pb_config);
Adam Lesinskice5e56e2016-10-21 17:56:45 -070042
43bool DeserializeConfigDescriptionFromPb(const pb::ConfigDescription& pb_config,
44 ConfigDescription* out_config);
45
46pb::Reference_Type SerializeReferenceTypeToPb(Reference::Type type);
47
48Reference::Type DeserializeReferenceTypeFromPb(pb::Reference_Type pb_type);
49
50pb::Plural_Arity SerializePluralEnumToPb(size_t plural_idx);
51
52size_t DeserializePluralEnumFromPb(pb::Plural_Arity arity);
Adam Lesinski59e04c62016-02-04 15:59:23 -080053
Adam Lesinskicacb28f2016-10-19 12:18:14 -070054} // namespace aapt
Adam Lesinski59e04c62016-02-04 15:59:23 -080055
56#endif /* AAPT_PROTO_PROTOHELPERS_H */