Google OR-Tools
v9.12
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
parse_test_proto.h
Go to the documentation of this file.
1
// Copyright 2010-2025 Google LLC
2
// Licensed under the Apache License, Version 2.0 (the "License");
3
// you may not use this file except in compliance with the License.
4
// You may obtain a copy of the License at
5
//
6
// http://www.apache.org/licenses/LICENSE-2.0
7
//
8
// Unless required by applicable law or agreed to in writing, software
9
// distributed under the License is distributed on an "AS IS" BASIS,
10
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
// See the License for the specific language governing permissions and
12
// limitations under the License.
13
14
#ifndef OR_TOOLS_BASE_PARSE_TEST_PROTO_H_
15
#define OR_TOOLS_BASE_PARSE_TEST_PROTO_H_
16
17
#include <memory>
18
#include <ostream>
19
#include <string>
20
21
#include "google/protobuf/message.h"
22
#include "google/protobuf/text_format.h"
23
#include "gtest/gtest.h"
24
25
namespace
google::protobuf::contrib::parse_proto
{
26
27
namespace
parse_proto_internal
{
28
29
class
ParseProtoHelper
{
30
public
:
31
explicit
ParseProtoHelper
(std::string_view asciipb) : asciipb_(asciipb) {}
32
template
<
class
T>
33
operator
T() {
// NOLINT(runtime/explicit)
34
T result;
35
const
bool
ok = ::google::protobuf::TextFormat::TextFormat::ParseFromString(
36
asciipb_, &result);
37
EXPECT_TRUE(ok) <<
"Failed to parse text proto: "
<< asciipb_;
38
return
result;
39
}
40
41
private
:
42
const
std::string asciipb_;
43
};
44
45
}
// namespace parse_proto_internal
46
47
parse_proto_internal::ParseProtoHelper
ParseTestProto
(std::string_view
input
) {
48
return
parse_proto_internal::ParseProtoHelper
(
input
);
49
}
50
51
}
// namespace google::protobuf::contrib::parse_proto
52
53
#endif
// OR_TOOLS_BASE_PARSE_TEST_PROTO_H_
google::protobuf::contrib::parse_proto::parse_proto_internal::ParseProtoHelper
Definition
parse_test_proto.h:29
google::protobuf::contrib::parse_proto::parse_proto_internal::ParseProtoHelper::ParseProtoHelper
ParseProtoHelper(std::string_view asciipb)
Definition
parse_test_proto.h:31
google::protobuf::contrib::parse_proto::parse_proto_internal
Definition
parse_test_proto.h:27
google::protobuf::contrib::parse_proto
Definition
parse_test_proto.h:25
google::protobuf::contrib::parse_proto::ParseTestProto
parse_proto_internal::ParseProtoHelper ParseTestProto(std::string_view input)
Definition
parse_test_proto.h:47
input
static int input(yyscan_t yyscanner)
ortools
base
parse_test_proto.h
Generated by
1.13.2