2020-07-15 16:55:09 +00:00
|
|
|
#include "webfuse/test_util/json_doc.hpp"
|
|
|
|
|
|
|
|
namespace webfuse_test
|
|
|
|
{
|
|
|
|
|
|
|
|
JsonDoc::JsonDoc(std::string const & text)
|
|
|
|
: contents(text)
|
|
|
|
{
|
|
|
|
doc = wf_impl_json_doc_loadb(const_cast<char*>(contents.data()), contents.size());
|
|
|
|
}
|
|
|
|
|
2020-07-18 21:16:18 +00:00
|
|
|
JsonDoc::JsonDoc(JsonDoc && other)
|
|
|
|
{
|
|
|
|
contents = std::move(other.contents);
|
|
|
|
doc = other.doc;
|
|
|
|
other.doc = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
JsonDoc& JsonDoc::operator=(JsonDoc && other)
|
|
|
|
{
|
|
|
|
if (this != &other)
|
|
|
|
{
|
|
|
|
wf_impl_json_doc_dispose(doc);
|
|
|
|
contents = std::move(other.contents);
|
|
|
|
doc = other.doc;
|
|
|
|
other.doc = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2020-07-15 16:55:09 +00:00
|
|
|
JsonDoc::~JsonDoc()
|
|
|
|
{
|
2020-07-18 21:16:18 +00:00
|
|
|
if (nullptr != doc)
|
|
|
|
{
|
|
|
|
wf_impl_json_doc_dispose(doc);
|
|
|
|
}
|
2020-07-15 16:55:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
wf_json const * JsonDoc::root()
|
|
|
|
{
|
|
|
|
return wf_impl_json_doc_root(doc);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|