reflection_tester.h
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 #ifndef GOOGLE_PROTOBUF_REFLECTION_TESTER_H__
32 #define GOOGLE_PROTOBUF_REFLECTION_TESTER_H__
33 
34 #include <google/protobuf/message.h>
35 
36 // Must be included last.
37 #include <google/protobuf/port_def.inc>
38 
39 namespace google {
40 namespace protobuf {
41 
42 // Provides APIs to test protocol buffers reflectively.
43 class MapReflectionTester {
44  public:
45  // base_descriptor must be a descriptor for TestMap, which is used for
46  // MapReflectionTester to fetch the FieldDescriptors needed to use the
47  // reflection interface.
48  explicit MapReflectionTester(const Descriptor* base_descriptor);
49 
63  const std::string& field_name,
64  const MapKey& map_key, MapValueRef* map_val);
66  const std::string& field_name, int index);
67  MapIterator MapBegin(Message* message, const std::string& field_name);
68  MapIterator MapEnd(Message* message, const std::string& field_name);
69  int MapSize(const Message& message, const std::string& field_name);
70 
71  private:
72  const FieldDescriptor* F(const std::string& name);
73 
75 
79 
115 };
116 
117 } // namespace protobuf
118 } // namespace google
119 
120 #include <google/protobuf/port_undef.inc>
121 
122 #endif // GOOGLE_PROTOBUF_REFLECTION_TESTER_H__
google::protobuf::MapReflectionTester::map_int32_foreign_message_key_
const FieldDescriptor * map_int32_foreign_message_key_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:119
google::protobuf::MapReflectionTester::F
const FieldDescriptor * F(const std::string &name)
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:243
google::protobuf::MapReflectionTester::map_enum_bar_
const EnumValueDescriptor * map_enum_bar_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:82
google::protobuf::MapReflectionTester::map_bool_bool_val_
const FieldDescriptor * map_bool_bool_val_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:112
google::protobuf::MapReflectionTester::map_fixed64_fixed64_key_
const FieldDescriptor * map_fixed64_fixed64_key_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:101
google::protobuf::MapReflectionTester::map_sint64_sint64_val_
const FieldDescriptor * map_sint64_sint64_val_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:98
google::protobuf::MapReflectionTester::map_bool_bool_key_
const FieldDescriptor * map_bool_bool_key_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:111
google::protobuf::MapReflectionTester::map_int32_float_val_
const FieldDescriptor * map_int32_float_val_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:108
google::protobuf::MapReflectionTester::map_sfixed32_sfixed32_key_
const FieldDescriptor * map_sfixed32_sfixed32_key_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:103
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
google::protobuf
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:12
setup.name
name
Definition: setup.py:542
google::protobuf::MapReflectionTester::GetMapEntryViaReflection
Message * GetMapEntryViaReflection(Message *message, const std::string &field_name, int index)
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:643
google::protobuf::MapReflectionTester::map_enum_foo_
const EnumValueDescriptor * map_enum_foo_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:84
google::protobuf::MapReflectionTester::base_descriptor_
const Descriptor * base_descriptor_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:80
google::protobuf::MapReflectionTester::SetMapFieldsViaReflection
void SetMapFieldsViaReflection(Message *message)
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:250
google::protobuf::MapReflectionTester::map_sfixed64_sfixed64_key_
const FieldDescriptor * map_sfixed64_sfixed64_key_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:105
message
char * message
Definition: libuv/docs/code/tty-gravity/main.c:12
google::protobuf::MapReflectionTester::map_int32_double_key_
const FieldDescriptor * map_int32_double_key_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:109
Descriptor
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:121
google::protobuf::MapReflectionTester::SwapMapsViaReflection
void SwapMapsViaReflection(Message *message)
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:809
google::protobuf::MapReflectionTester::ExpectMapFieldsSetViaReflection
void ExpectMapFieldsSetViaReflection(const Message &message)
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:878
FieldDescriptor
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:133
google::protobuf::MapReflectionTester::map_string_string_key_
const FieldDescriptor * map_string_string_key_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:113
google::protobuf::MapReflectionTester::RemoveLastMapsViaReflection
void RemoveLastMapsViaReflection(Message *message)
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:779
google::protobuf::MapReflectionTester::MutableUnknownFieldsOfMapFieldsViaReflection
void MutableUnknownFieldsOfMapFieldsViaReflection(Message *message)
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:820
google::protobuf::MapReflectionTester::map_int32_bytes_key_
const FieldDescriptor * map_int32_bytes_key_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:115
google::protobuf::MapReflectionTester::ExpectMapFieldsSetViaReflectionIterator
void ExpectMapFieldsSetViaReflectionIterator(Message *message)
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:1218
google::protobuf::MapReflectionTester::ModifyMapFieldsViaReflection
void ModifyMapFieldsViaReflection(Message *message)
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:683
google::protobuf::MapReflectionTester::MapBegin
MapIterator MapBegin(Message *message, const std::string &field_name)
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:649
google::protobuf::MapReflectionTester::map_int32_foreign_message_val_
const FieldDescriptor * map_int32_foreign_message_val_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:120
google::protobuf::MapReflectionTester::SetMapFieldsViaMapReflection
void SetMapFieldsViaMapReflection(Message *message)
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:446
google::protobuf::MapReflectionTester::map_int32_int32_val_
const FieldDescriptor * map_int32_int32_val_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:88
google::protobuf::MapReflectionTester::ReleaseLastMapsViaReflection
void ReleaseLastMapsViaReflection(Message *message)
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:791
EnumValueDescriptor
Definition: protobuf/php/ext/google/protobuf/def.c:63
google::protobuf::MapReflectionTester::map_fixed64_fixed64_val_
const FieldDescriptor * map_fixed64_fixed64_val_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:102
google::protobuf::MapReflectionTester::map_int32_enum_key_
const FieldDescriptor * map_int32_enum_key_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:117
google::protobuf::MapReflectionTester::map_string_string_val_
const FieldDescriptor * map_string_string_val_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:114
google::protobuf::MapReflectionTester::map_enum_baz_
const EnumValueDescriptor * map_enum_baz_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:83
google::protobuf::MapReflectionTester::MapReflectionTester
MapReflectionTester(const Descriptor *base_descriptor)
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:123
google::protobuf::MapReflectionTester::map_uint64_uint64_key_
const FieldDescriptor * map_uint64_uint64_key_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:93
google::protobuf::MapReflectionTester::map_sfixed32_sfixed32_val_
const FieldDescriptor * map_sfixed32_sfixed32_val_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:104
google::protobuf::MapReflectionTester::MapSize
int MapSize(const Message &message, const std::string &field_name)
Definition: reflection_tester.cc:641
google::protobuf::MapReflectionTester::map_sfixed64_sfixed64_val_
const FieldDescriptor * map_sfixed64_sfixed64_val_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:106
google::protobuf::MapReflectionTester::map_int64_int64_val_
const FieldDescriptor * map_int64_int64_val_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:90
google::protobuf::MapReflectionTester::GetMapValueViaMapReflection
void GetMapValueViaMapReflection(Message *message, const std::string &field_name, const MapKey &map_key, MapValueRef *map_val)
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:635
google::protobuf::MapReflectionTester::ExpectClearViaReflection
void ExpectClearViaReflection(const Message &message)
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:1445
google::protobuf::MapReflectionTester::map_sint32_sint32_val_
const FieldDescriptor * map_sint32_sint32_val_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:96
google::protobuf::MapReflectionTester::map_fixed32_fixed32_key_
const FieldDescriptor * map_fixed32_fixed32_key_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:99
index
int index
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:1184
google::protobuf::MapReflectionTester::map_int64_int64_key_
const FieldDescriptor * map_int64_int64_key_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:89
google::protobuf::MapReflectionTester::map_int32_bytes_val_
const FieldDescriptor * map_int32_bytes_val_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:116
google::protobuf::MapReflectionTester::map_int32_int32_key_
const FieldDescriptor * map_int32_int32_key_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:87
google::protobuf::MapReflectionTester::map_sint64_sint64_key_
const FieldDescriptor * map_sint64_sint64_key_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:97
google::protobuf::MapReflectionTester::map_int32_float_key_
const FieldDescriptor * map_int32_float_key_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:107
google::protobuf::MapReflectionTester::MapEnd
MapIterator MapEnd(Message *message, const std::string &field_name)
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:655
google::protobuf::MapReflectionTester::map_sint32_sint32_key_
const FieldDescriptor * map_sint32_sint32_key_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:95
google::protobuf::MapReflectionTester::map_int32_double_val_
const FieldDescriptor * map_int32_double_val_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:110
google::protobuf::MapReflectionTester::foreign_c_
const FieldDescriptor * foreign_c_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:86
google::protobuf::MapReflectionTester::map_uint64_uint64_val_
const FieldDescriptor * map_uint64_uint64_val_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:94
google
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:11
google::protobuf::MapReflectionTester::ExpectClearViaReflectionIterator
void ExpectClearViaReflectionIterator(Message *message)
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:1470
Message
Definition: protobuf/php/ext/google/protobuf/message.c:53
google::protobuf::MapReflectionTester::map_uint32_uint32_key_
const FieldDescriptor * map_uint32_uint32_key_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:91
google::protobuf::MapReflectionTester::map_fixed32_fixed32_val_
const FieldDescriptor * map_fixed32_fixed32_val_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:100
google::protobuf::MapReflectionTester::map_int32_enum_val_
const FieldDescriptor * map_int32_enum_val_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:118
google::protobuf::MapReflectionTester::ClearMapFieldsViaReflection
void ClearMapFieldsViaReflection(Message *message)
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:661
google::protobuf::MapReflectionTester::map_uint32_uint32_val_
const FieldDescriptor * map_uint32_uint32_val_
Definition: bloaty/third_party/protobuf/src/google/protobuf/map_test_util.h:92


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:08