62 lines
907 B
C++
62 lines
907 B
C++
#include "json/JsonStr.h"
|
|
|
|
namespace ehs
|
|
{
|
|
JsonStr::JsonStr()
|
|
: JsonBase(JsonType::STR)
|
|
{
|
|
}
|
|
|
|
JsonStr::JsonStr(Str_8 value)
|
|
: JsonBase(JsonType::STR), value(std::move(value))
|
|
{
|
|
|
|
}
|
|
|
|
JsonStr::JsonStr(const Char_8* value, const UInt_64 size)
|
|
: JsonBase(JsonType::STR), value(value, size)
|
|
{
|
|
}
|
|
|
|
JsonStr::JsonStr(JsonStr&& js) noexcept
|
|
: JsonBase(js), value(std::move(js.value))
|
|
{
|
|
}
|
|
|
|
JsonStr& JsonStr::operator=(JsonStr&& js) noexcept
|
|
{
|
|
if (this == &js)
|
|
return *this;
|
|
|
|
JsonBase::operator=(js);
|
|
|
|
value = std::move(js.value);
|
|
|
|
return *this;
|
|
}
|
|
|
|
JsonStr::operator Str_8() const
|
|
{
|
|
return value;
|
|
}
|
|
|
|
JsonStr::operator Str_8&()
|
|
{
|
|
return value;
|
|
}
|
|
|
|
Str_8 JsonStr::ToStr(const UInt_64 level, const bool compact) const
|
|
{
|
|
Str_8 result;
|
|
|
|
if (!compact)
|
|
{
|
|
for (UInt_64 l = 0; l < level; ++l)
|
|
result += "\t";
|
|
}
|
|
|
|
result += "\"" + value + "\"";
|
|
|
|
return result;
|
|
}
|
|
} |