TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
JSON Namespace Reference

Namespaces

 RealmList
 

Functions

TC_SHARED_API std::string Serialize (google::protobuf::Message const &message)
 
TC_SHARED_API bool Deserialize (std::string json, google::protobuf::Message *message)
 

Function Documentation

bool JSON::Deserialize ( std::string  json,
google::protobuf::Message message 
)
446 {
447  Deserializer deserializer;
448  if (!deserializer.ReadMessage(std::forward<std::string>(json), message))
449  {
450  for (std::size_t i = 0; i < deserializer.GetErrors().size(); ++i)
451  TC_LOG_ERROR("json", "%s", deserializer.GetErrors()[i].c_str());
452  return false;
453  }
454 
455  return true;
456 }
Definition: ProtobufJSON.cpp:185
bool ReadMessage(std::string json, google::protobuf::Message *message)
Definition: ProtobufJSON.cpp:215
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
std::vector< std::string > const & GetErrors() const
Definition: ProtobufJSON.cpp:204

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string JSON::Serialize ( google::protobuf::Message const message)
439 {
440  Serializer serializer;
441  serializer.WriteMessage(message);
442  return serializer.GetString();
443 }
void WriteMessage(google::protobuf::Message const &value)
Definition: ProtobufJSON.cpp:54
Definition: ProtobufJSON.cpp:27
std::string GetString() const
Definition: ProtobufJSON.cpp:43

+ Here is the call graph for this function:

+ Here is the caller graph for this function: