xref: /aosp_15_r20/external/libprotobuf-mutator/src/text_format.h (revision fd525a9c096e28cf6f8d8719388df0568a611e7b)
1*fd525a9cSAndroid Build Coastguard Worker // Copyright 2017 Google Inc. All rights reserved.
2*fd525a9cSAndroid Build Coastguard Worker //
3*fd525a9cSAndroid Build Coastguard Worker // Licensed under the Apache License, Version 2.0 (the "License");
4*fd525a9cSAndroid Build Coastguard Worker // you may not use this file except in compliance with the License.
5*fd525a9cSAndroid Build Coastguard Worker // You may obtain a copy of the License at
6*fd525a9cSAndroid Build Coastguard Worker //
7*fd525a9cSAndroid Build Coastguard Worker //     http://www.apache.org/licenses/LICENSE-2.0
8*fd525a9cSAndroid Build Coastguard Worker //
9*fd525a9cSAndroid Build Coastguard Worker // Unless required by applicable law or agreed to in writing, software
10*fd525a9cSAndroid Build Coastguard Worker // distributed under the License is distributed on an "AS IS" BASIS,
11*fd525a9cSAndroid Build Coastguard Worker // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*fd525a9cSAndroid Build Coastguard Worker // See the License for the specific language governing permissions and
13*fd525a9cSAndroid Build Coastguard Worker // limitations under the License.
14*fd525a9cSAndroid Build Coastguard Worker 
15*fd525a9cSAndroid Build Coastguard Worker #ifndef SRC_TEXT_FORMAT_H_
16*fd525a9cSAndroid Build Coastguard Worker #define SRC_TEXT_FORMAT_H_
17*fd525a9cSAndroid Build Coastguard Worker 
18*fd525a9cSAndroid Build Coastguard Worker #include <string>
19*fd525a9cSAndroid Build Coastguard Worker 
20*fd525a9cSAndroid Build Coastguard Worker #include "port/protobuf.h"
21*fd525a9cSAndroid Build Coastguard Worker 
22*fd525a9cSAndroid Build Coastguard Worker namespace protobuf_mutator {
23*fd525a9cSAndroid Build Coastguard Worker 
24*fd525a9cSAndroid Build Coastguard Worker // Text serialization of protos.
25*fd525a9cSAndroid Build Coastguard Worker bool ParseTextMessage(const uint8_t* data, size_t size,
26*fd525a9cSAndroid Build Coastguard Worker                       protobuf::Message* output);
27*fd525a9cSAndroid Build Coastguard Worker bool ParseTextMessage(const std::string& data, protobuf::Message* output);
28*fd525a9cSAndroid Build Coastguard Worker size_t SaveMessageAsText(const protobuf::Message& message, uint8_t* data,
29*fd525a9cSAndroid Build Coastguard Worker                          size_t max_size);
30*fd525a9cSAndroid Build Coastguard Worker std::string SaveMessageAsText(const protobuf::Message& message);
31*fd525a9cSAndroid Build Coastguard Worker 
32*fd525a9cSAndroid Build Coastguard Worker }  // namespace protobuf_mutator
33*fd525a9cSAndroid Build Coastguard Worker 
34*fd525a9cSAndroid Build Coastguard Worker #endif  // SRC_TEXT_FORMAT_H_
35