Added json reader utilities and implemented json reader functions to dem, net, and svc types

This commit is contained in:
Jordan Cristiano
2015-07-13 23:25:49 -04:00
parent 6be95005c5
commit 0033d3aeba
46 changed files with 1012 additions and 154 deletions

View File

@ -22,12 +22,21 @@ namespace DemHandlers
bool Dem_ConsoleCmd_JsonRead_Internal(JsonRead& jsonbuf, DemMsg::Dem_ConsoleCmd* data)
{
return true;
base::JsonReaderObject reader = jsonbuf.ParseObject();
assert(!reader.HasReadError());
char command[DemMsg::Dem_ConsoleCmd::COMMAND_MAX_LENGTH];
reader.ReadString("command", command, sizeof(command));
data->command.assign(command);
return !reader.HasReadError();
}
bool Dem_ConsoleCmd_JsonWrite_Internal(JsonWrite& jsonbuf, DemMsg::Dem_ConsoleCmd* data)
{
jsonbuf.Reset();
jsonbuf.StartObject();
jsonbuf.WriteString("command", data->command);
return true;
jsonbuf.EndObject();
return jsonbuf.IsComplete();
}
}