Adam Lesinski | 59e04c6 | 2016-02-04 15:59:23 -0800 | [diff] [blame] | 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 | |
Adam Lesinski | ce5e56e | 2016-10-21 17:56:45 -0700 | [diff] [blame] | 20 | #include "androidfw/ResourceTypes.h" |
| 21 | |
Adam Lesinski | 59e04c6 | 2016-02-04 15:59:23 -0800 | [diff] [blame] | 22 | #include "ConfigDescription.h" |
| 23 | #include "ResourceTable.h" |
| 24 | #include "Source.h" |
| 25 | #include "StringPool.h" |
Adam Lesinski | 4ffea04 | 2017-08-10 15:37:28 -0700 | [diff] [blame] | 26 | #include "Resources.pb.h" |
| 27 | #include "ResourcesInternal.pb.h" |
Adam Lesinski | 59e04c6 | 2016-02-04 15:59:23 -0800 | [diff] [blame] | 28 | |
Adam Lesinski | 59e04c6 | 2016-02-04 15:59:23 -0800 | [diff] [blame] | 29 | namespace aapt { |
| 30 | |
Adam Lesinski | 6b37299 | 2017-08-09 10:54:23 -0700 | [diff] [blame] | 31 | void SerializeStringPoolToPb(const StringPool& pool, pb::StringPool* out_pb_pool); |
Adam Lesinski | 59e04c6 | 2016-02-04 15:59:23 -0800 | [diff] [blame] | 32 | |
Adam Lesinski | 6b37299 | 2017-08-09 10:54:23 -0700 | [diff] [blame] | 33 | void SerializeSourceToPb(const Source& source, StringPool* src_pool, pb::Source* out_pb_source); |
Adam Lesinski | 59e04c6 | 2016-02-04 15:59:23 -0800 | [diff] [blame] | 34 | |
Adam Lesinski | 6b37299 | 2017-08-09 10:54:23 -0700 | [diff] [blame] | 35 | void DeserializeSourceFromPb(const pb::Source& pb_source, const android::ResStringPool& src_pool, |
Adam Lesinski | ce5e56e | 2016-10-21 17:56:45 -0700 | [diff] [blame] | 36 | Source* out_source); |
Adam Lesinski | 59e04c6 | 2016-02-04 15:59:23 -0800 | [diff] [blame] | 37 | |
Adam Lesinski | ce5e56e | 2016-10-21 17:56:45 -0700 | [diff] [blame] | 38 | pb::SymbolStatus_Visibility SerializeVisibilityToPb(SymbolState state); |
Adam Lesinski | 59e04c6 | 2016-02-04 15:59:23 -0800 | [diff] [blame] | 39 | |
Adam Lesinski | 6b37299 | 2017-08-09 10:54:23 -0700 | [diff] [blame] | 40 | SymbolState DeserializeVisibilityFromPb(pb::SymbolStatus_Visibility pb_visibility); |
Adam Lesinski | 59e04c6 | 2016-02-04 15:59:23 -0800 | [diff] [blame] | 41 | |
Adam Lesinski | 6b37299 | 2017-08-09 10:54:23 -0700 | [diff] [blame] | 42 | void SerializeConfig(const ConfigDescription& config, pb::ConfigDescription* out_pb_config); |
Adam Lesinski | ce5e56e | 2016-10-21 17:56:45 -0700 | [diff] [blame] | 43 | |
| 44 | bool DeserializeConfigDescriptionFromPb(const pb::ConfigDescription& pb_config, |
| 45 | ConfigDescription* out_config); |
| 46 | |
| 47 | pb::Reference_Type SerializeReferenceTypeToPb(Reference::Type type); |
| 48 | |
| 49 | Reference::Type DeserializeReferenceTypeFromPb(pb::Reference_Type pb_type); |
| 50 | |
| 51 | pb::Plural_Arity SerializePluralEnumToPb(size_t plural_idx); |
| 52 | |
| 53 | size_t DeserializePluralEnumFromPb(pb::Plural_Arity arity); |
Adam Lesinski | 59e04c6 | 2016-02-04 15:59:23 -0800 | [diff] [blame] | 54 | |
Adam Lesinski | cacb28f | 2016-10-19 12:18:14 -0700 | [diff] [blame] | 55 | } // namespace aapt |
Adam Lesinski | 59e04c6 | 2016-02-04 15:59:23 -0800 | [diff] [blame] | 56 | |
| 57 | #endif /* AAPT_PROTO_PROTOHELPERS_H */ |