Added WriteString to jsonfile which takes an std::string
This commit is contained in:
parent
04b79ff3f8
commit
2bf16179ad
@ -156,13 +156,20 @@ namespace base
|
|||||||
writer.String(value);
|
writer.String(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonWriterFile::WriteString(const char* name, const char* value, std::int32_t length)
|
void JsonWriterFile::WriteString(const char* name, const char* value, std::size_t length)
|
||||||
{
|
{
|
||||||
auto& writer = m_writer;
|
auto& writer = m_writer;
|
||||||
writer.String(name);
|
writer.String(name);
|
||||||
writer.String(value, length);
|
writer.String(value, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void JsonWriterFile::WriteString(const char* name, const std::string& value)
|
||||||
|
{
|
||||||
|
auto& writer = m_writer;
|
||||||
|
writer.String(name);
|
||||||
|
writer.String(value.c_str(), value.length());
|
||||||
|
}
|
||||||
|
|
||||||
void JsonWriterFile::WriteFloat(const char* name, const double value)
|
void JsonWriterFile::WriteFloat(const char* name, const double value)
|
||||||
{
|
{
|
||||||
auto& writer = m_writer;
|
auto& writer = m_writer;
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace base
|
namespace base
|
||||||
{
|
{
|
||||||
@ -36,7 +37,8 @@ namespace base
|
|||||||
void WriteUInt32(const char* name, std::uint32_t value, bool writeCondition);
|
void WriteUInt32(const char* name, std::uint32_t value, bool writeCondition);
|
||||||
void WriteUint64(const char* name, std::uint64_t value);
|
void WriteUint64(const char* name, std::uint64_t value);
|
||||||
void WriteString(const char* name, const char* value);
|
void WriteString(const char* name, const char* value);
|
||||||
void WriteString(const char* name, const char* value, std::int32_t length);
|
void WriteString(const char* name, const char* value, std::size_t length);
|
||||||
|
void WriteString(const char* name, const std::string& value);
|
||||||
void WriteFloat(const char* name, const double value);
|
void WriteFloat(const char* name, const double value);
|
||||||
|
|
||||||
void WriteBits(const char* name, const unsigned char* data, std::size_t numBits);
|
void WriteBits(const char* name, const unsigned char* data, std::size_t numBits);
|
||||||
|
@ -27,7 +27,7 @@ namespace DemHandlers
|
|||||||
|
|
||||||
bool Dem_ConsoleCmd_JsonWrite_Internal(JsonWrite& jsonbuf, DemMsg::Dem_ConsoleCmd* data)
|
bool Dem_ConsoleCmd_JsonWrite_Internal(JsonWrite& jsonbuf, DemMsg::Dem_ConsoleCmd* data)
|
||||||
{
|
{
|
||||||
jsonbuf.WriteString("command", data->command.c_str(), data->command.length());
|
jsonbuf.WriteString("command", data->command);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user