Skip to content

Commit a1da784

Browse files
committed
Formatting issues
Signed-off-by: TymianekPL <tymi@tymi.org>
1 parent f53a074 commit a1da784

File tree

3 files changed

+17
-21
lines changed

3 files changed

+17
-21
lines changed

cppjson/include/cppjson/cppjson.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#pragma once
22

3-
#include "object.hpp"
43
#include "formatter.hpp"
4+
#include "object.hpp"

cppjson/include/cppjson/formatter.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#include "object.hpp"
21
#include <format>
2+
#include "object.hpp"
33

44
template <>
55
struct std::formatter<cppjson::JsonObject>

cppjson/src/object.cpp

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "cppjson/object.hpp"
2+
#include <cstring>
23
#include <new>
34
#include <stdexcept>
4-
#include <cstring>
55
#include <utility>
66

77
constexpr std::size_t DataStorageSize = std::max({sizeof(std::string), sizeof(cppjson::Object), sizeof(double), sizeof(bool)});
@@ -11,34 +11,34 @@ cppjson::JsonObject::JsonObject() : _dataStorage(static_cast<std::byte*>(::opera
1111
cppjson::JsonObject::JsonObject(const cppjson::JsonObject& other)
1212
{
1313
if (other._dataStorage == nullptr) return;
14-
14+
1515
this->_dataType = other._dataType;
1616
this->_dataStorage = static_cast<std::byte*>(::operator new(DataStorageSize));
1717
std::memcpy(this->_dataStorage, other._dataStorage, DataStorageSize);
1818
}
1919
cppjson::JsonObject::JsonObject(JsonObject&& other) noexcept
2020
{
21-
this->_dataType = std::exchange(other._dataType, cppjson::JsonType::Null);
22-
this->_dataStorage = std::exchange(other._dataStorage, static_cast<std::byte*>(::operator new(DataStorageSize)));
21+
this->_dataType = std::exchange(other._dataType, cppjson::JsonType::Null);
22+
this->_dataStorage = std::exchange(other._dataStorage, static_cast<std::byte*>(::operator new(DataStorageSize)));
2323
}
2424
cppjson::JsonObject& cppjson::JsonObject::operator=(const cppjson::JsonObject& other)
2525
{
26-
if (&other != this)
27-
{
26+
if (&other != this)
27+
{
2828
this->_dataType = other._dataType;
2929
this->_dataStorage = static_cast<std::byte*>(::operator new(DataStorageSize));
30-
std::memcpy(this->_dataStorage, other._dataStorage, DataStorageSize);
30+
std::memcpy(this->_dataStorage, other._dataStorage, DataStorageSize);
3131
}
32-
return *this;
32+
return *this;
3333
}
3434
cppjson::JsonObject& cppjson::JsonObject::operator=(cppjson::JsonObject&& other) noexcept
3535
{
36-
if (&other != this)
37-
{
36+
if (&other != this)
37+
{
3838
this->_dataType = std::exchange(other._dataType, cppjson::JsonType::Null);
3939
this->_dataStorage = std::exchange(other._dataStorage, static_cast<std::byte*>(::operator new(DataStorageSize)));
4040
}
41-
return *this;
41+
return *this;
4242
}
4343
cppjson::JsonObject::~JsonObject()
4444
{
@@ -48,9 +48,9 @@ cppjson::JsonObject::~JsonObject()
4848

4949
void cppjson::JsonObject::Destroy(void)
5050
{
51-
using std::string;
52-
using cppjson::Object;
5351
using cppjson::Array;
52+
using cppjson::Object;
53+
using std::string;
5454

5555
switch (std::exchange(this->_dataType, JsonType::Null))
5656
{
@@ -179,13 +179,9 @@ const std::nullptr_t& cppjson::JsonObject::As<std::nullptr_t>() const noexcept(f
179179
return DangerousAs<std::nullptr_t>();
180180
}
181181

182-
cppjson::Object::ObjectProxy cppjson::Object::ObjectProxy::operator[](const std::string& key)
183-
{
184-
return ObjectProxy{ this->_object.get().As<Object>()[key] };
185-
}
186-
182+
cppjson::Object::ObjectProxy cppjson::Object::ObjectProxy::operator[](const std::string& key) { return ObjectProxy{this->_object.get().As<Object>()[key]}; }
187183

188184
cppjson::Object::ConstObjectProxy cppjson::Object::ConstObjectProxy::operator[](const std::string& key) const
189185
{
190-
return ConstObjectProxy{ this->_object.get().As<Object>()[key] };
186+
return ConstObjectProxy{this->_object.get().As<Object>()[key]};
191187
}

0 commit comments

Comments
 (0)