MCPcopy Create free account
hub / github.com/chenshuo/muduo / createMessage

Method createMessage

examples/protobuf/codec/codec.cc:169–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167}
168
169google::protobuf::Message* ProtobufCodec::createMessage(const std::string& typeName)
170{
171 google::protobuf::Message* message = NULL;
172 const google::protobuf::Descriptor* descriptor =
173 google::protobuf::DescriptorPool::generated_pool()->FindMessageTypeByName(typeName);
174 if (descriptor)
175 {
176 const google::protobuf::Message* prototype =
177 google::protobuf::MessageFactory::generated_factory()->GetPrototype(descriptor);
178 if (prototype)
179 {
180 message = prototype->New();
181 }
182 }
183 return message;
184}
185
186MessagePtr ProtobufCodec::parse(const char* buf, int len, ErrorCode* error)
187{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected