First commit.
This commit is contained in:
62
src/Json/JsonStr.cpp
Normal file
62
src/Json/JsonStr.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
#include "../../include/Json/JsonStr.h"
|
||||
|
||||
namespace lwe
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user