Skip to content

Commit 7035e13

Browse files
committed
Formatting
1 parent 2cbd90a commit 7035e13

11 files changed

Lines changed: 66 additions & 64 deletions

File tree

include/CppUtils/System/Compiler.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
#endif
1212

1313
#if defined(COMPILER_MSVC)
14-
# pragma warning(disable: 4251)
14+
# pragma warning(disable: 4'251)
1515
#endif

modules/Language/Mapping.mpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ export namespace CppUtils::Language::Mapping
1515
using AttributeType = Property;
1616

1717
String::Token token;
18-
AttributeType StructType::*address;
18+
AttributeType StructType::* address;
1919
bool optional = false;
2020
AttributeType defaultValue = AttributeType{};
2121
std::function<AttributeType(std::string_view)> parsingFunction = {};
2222
};
2323

2424
template<class Object, class Property>
25-
Attribute(String::Token token, Property Object::*address, bool optional = false, Property defaultValue = Property{}, Property (*parsingFunction)(std::string_view) = {}) -> Attribute<Object, Property>;
25+
Attribute(String::Token token, Property Object::* address, bool optional = false, Property defaultValue = Property{}, Property (*parsingFunction)(std::string_view) = {}) -> Attribute<Object, Property>;
2626

2727
template<class>
2828
struct StructSchema;

modules/Memory/Memory.mpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ export namespace CppUtils::Memory
4949

5050
using namespace Literals;
5151

52-
static_assert(1_Ko == 1000);
52+
static_assert(1_Ko == 1'000);
5353
static_assert(1_Mo == 1'000'000);
5454
static_assert(1_Go == 1'000'000'000);
55-
static_assert(1_Kio == 1024);
55+
static_assert(1_Kio == 1'024);
5656
static_assert(1_Mio == 1'048'576);
5757
static_assert(1_Gio == 1'073'741'824);
5858
}

modules/Network/Socket.mpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,9 @@ export namespace CppUtils::Network
213213
inline auto setSocketOption(NativeSocket socket, int level, int option, const void* value, std::size_t valueSize) const noexcept -> bool
214214
{
215215
#if defined(OS_WINDOWS)
216-
return not::setsockopt(socket, level, option, reinterpret_cast<const char*>(value), static_cast<int>(valueSize));
216+
return not ::setsockopt(socket, level, option, reinterpret_cast<const char*>(value), static_cast<int>(valueSize));
217217
#else
218-
return not::setsockopt(socket, level, option, value, static_cast<socklen_t>(valueSize));
218+
return not ::setsockopt(socket, level, option, value, static_cast<socklen_t>(valueSize));
219219
#endif
220220
}
221221

modules/Type/Callable.mpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export namespace CppUtils::Type
2828
{};
2929

3030
template<class Object, class Return, class... Args>
31-
struct CallableTrait<Return (Object::*)(Args...)&>: CallableTrait<Return(Args...)>
31+
struct CallableTrait<Return (Object::*)(Args...) &>: CallableTrait<Return(Args...)>
3232
{};
3333

3434
template<class Object, class Return, class... Args>

modules/UnitTest/DummyObject.mpp

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ export namespace CppUtils::UnitTest
1111

1212
public:
1313
inline DummyObject() = default;
14-
14+
1515
explicit inline DummyObject(std::string name, std::size_t indentationLevel = 0):
1616
m_name{std::move(name)},
1717
m_indentationLevel{indentationLevel}
1818
{
19-
Logger::print("{}{}()\n", std::string(m_indentationLevel, '\t'), m_name);
20-
}
19+
Logger::print("{}{}()\n", std::string(m_indentationLevel, '\t'), m_name);
20+
}
2121

2222
[[nodiscard]] inline auto getCopyCount() const -> std::size_t
2323
{
@@ -35,44 +35,44 @@ export namespace CppUtils::UnitTest
3535
}
3636

3737
inline DummyObject(const DummyObject& other):
38-
m_name{other.m_name},
39-
m_indentationLevel{other.m_indentationLevel},
40-
m_copyCount{other.m_copyCount.load() + 1},
41-
m_moveCount{other.m_moveCount.load()}
42-
{
43-
Logger::print("{}{}(const {}&)\n", std::string(m_indentationLevel, '\t'), m_name, m_name);
44-
}
38+
m_name{other.m_name},
39+
m_indentationLevel{other.m_indentationLevel},
40+
m_copyCount{other.m_copyCount.load() + 1},
41+
m_moveCount{other.m_moveCount.load()}
42+
{
43+
Logger::print("{}{}(const {}&)\n", std::string(m_indentationLevel, '\t'), m_name, m_name);
44+
}
4545

4646
inline DummyObject(DummyObject&& other) noexcept:
47-
m_name{std::move(other.m_name)},
48-
m_indentationLevel{other.m_indentationLevel},
49-
m_copyCount{other.m_copyCount.load()},
50-
m_moveCount{other.m_moveCount.load() + 1}
51-
{
52-
other.m_name += " [invalid object]";
53-
Logger::print("{}{}({}&&)\n", std::string(m_indentationLevel, '\t'), m_name, m_name);
54-
}
47+
m_name{std::move(other.m_name)},
48+
m_indentationLevel{other.m_indentationLevel},
49+
m_copyCount{other.m_copyCount.load()},
50+
m_moveCount{other.m_moveCount.load() + 1}
51+
{
52+
other.m_name += " [invalid object]";
53+
Logger::print("{}{}({}&&)\n", std::string(m_indentationLevel, '\t'), m_name, m_name);
54+
}
5555

5656
inline auto operator=(const DummyObject& rhs) -> DummyObject&
57-
{
58-
m_name = rhs.m_name;
59-
m_indentationLevel = rhs.m_indentationLevel;
60-
m_copyCount.store(rhs.m_copyCount.load() + 1);
61-
m_moveCount.store(rhs.m_moveCount.load());
62-
Logger::print("{}{}::operator=(const {}&)\n", std::string(m_indentationLevel, '\t'), m_name, m_name);
63-
return *this;
64-
}
57+
{
58+
m_name = rhs.m_name;
59+
m_indentationLevel = rhs.m_indentationLevel;
60+
m_copyCount.store(rhs.m_copyCount.load() + 1);
61+
m_moveCount.store(rhs.m_moveCount.load());
62+
Logger::print("{}{}::operator=(const {}&)\n", std::string(m_indentationLevel, '\t'), m_name, m_name);
63+
return *this;
64+
}
6565

6666
inline auto operator=(DummyObject&& rhs) noexcept -> DummyObject&
67-
{
68-
m_name = std::move(rhs.m_name);
69-
m_indentationLevel = rhs.m_indentationLevel;
70-
m_copyCount.store(rhs.m_copyCount.load());
71-
m_moveCount.store(rhs.m_moveCount.load() + 1);
72-
rhs.m_name += " [invalid object]";
73-
Logger::print("{}{}::operator=({}&&)\n", std::string(m_indentationLevel, '\t'), m_name, m_name);
74-
return *this;
75-
}
67+
{
68+
m_name = std::move(rhs.m_name);
69+
m_indentationLevel = rhs.m_indentationLevel;
70+
m_copyCount.store(rhs.m_copyCount.load());
71+
m_moveCount.store(rhs.m_moveCount.load() + 1);
72+
rhs.m_name += " [invalid object]";
73+
Logger::print("{}{}::operator=({}&&)\n", std::string(m_indentationLevel, '\t'), m_name, m_name);
74+
return *this;
75+
}
7676

7777
private:
7878
std::string m_name;

old/Sources/Language/ASM/Compiler/Compiler.old.hpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
11
#pragma once
22

3-
#include <CppUtils/Language/ASM/Lexer/Lexer.hpp>
43
#include <CppUtils/Language/ASM/Compiler/Bytecode.hpp>
5-
#include <CppUtils/Language/ASM/Compiler/Context.hpp>
64
#include <CppUtils/Language/ASM/Compiler/CompilationFunctions.hpp>
5+
#include <CppUtils/Language/ASM/Compiler/Context.hpp>
6+
#include <CppUtils/Language/ASM/Lexer/Lexer.hpp>
77
#include <CppUtils/Language/Compiler/Compiler.hpp>
88
#include <CppUtils/Language/VirtualMachine/VirtualMachine.hpp>
99

1010
namespace CppUtils::Language::ASM::Compiler
1111
{
1212
using namespace Type::Literals;
13-
13+
1414
class Compiler final
1515
{
1616
public:
17-
Compiler(): m_compiler{{
18-
{ "nop"_token, CompilationFunctions::compileNop },
19-
{ "halt"_token, CompilationFunctions::compileHalt },
20-
{ "number"_token, CompilationFunctions::compileNumber },
21-
{ "string"_token, CompilationFunctions::compileString },
22-
{ "move"_token, CompilationFunctions::compileMove },
23-
{ "add"_token, CompilationFunctions::compileAdd },
24-
{ "label"_token, CompilationFunctions::compileLabel }
25-
}}
17+
Compiler():
18+
m_compiler{{{"nop"_token, CompilationFunctions::compileNop},
19+
{"halt"_token, CompilationFunctions::compileHalt},
20+
{"number"_token, CompilationFunctions::compileNumber},
21+
{"string"_token, CompilationFunctions::compileString},
22+
{"move"_token, CompilationFunctions::compileMove},
23+
{"add"_token, CompilationFunctions::compileAdd},
24+
{"label"_token, CompilationFunctions::compileLabel}}}
2625
{}
2726

2827
void compile(const Lexer::ASTNode& astNode, Context& context) const

old/Sources/Language/ASM/Compiler/Context.old.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
#pragma once
22

3-
#include <memory>
43
#include <functional>
4+
#include <memory>
55
#include <unordered_map>
66

7-
#include <CppUtils/Language/ASM/Lexer/Lexer.hpp>
87
#include <CppUtils/Language/ASM/Compiler/Output.hpp>
8+
#include <CppUtils/Language/ASM/Lexer/Lexer.hpp>
99
#include <CppUtils/Language/Compiler/Compiler.hpp>
1010

1111
namespace CppUtils::Language::ASM::Compiler
1212
{
1313
struct Context final
1414
{
1515
using Compiler = Language::Compiler::Compiler<Lexer::ASTNode, Context>;
16-
16+
1717
std::reference_wrapper<const Compiler> compiler;
1818
std::reference_wrapper<Output> output;
1919
Bytecode::Instruction* lastInstruction = nullptr;

old/Sources/Language/ASM/VirtualMachine/Operations.old.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ namespace CppUtils::Language::ASM::VirtualMachine
8484
++cursor.position;
8585
}
8686
*/
87-
87+
8888
/*template<class... Types>
8989
inline void push(Parser::Cursor<Bytecode::Instruction<Types...>>& cursor, Context<Types...>& context)
9090
{

old/UnitTests/Language/ASM/VirtualMachine.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@ namespace CppUtils::UnitTests::Language::ASM::VirtualMachine
1313
auto context = CppUtils::Language::ASM::VirtualMachine::Context{};
1414
virtualMachine.run(R"(
1515
nop
16-
)"sv, context);
16+
)"sv,
17+
context);
1718
});
1819

1920
addTest("Halt", [] {
2021
static const auto virtualMachine = CppUtils::Language::ASM::VirtualMachine::VirtualMachine{};
2122
auto context = CppUtils::Language::ASM::VirtualMachine::Context{};
2223
virtualMachine.run(R"(
2324
hlt
24-
)"sv, context);
25+
)"sv,
26+
context);
2527
});
2628

2729
/*
@@ -32,7 +34,7 @@ namespace CppUtils::UnitTests::Language::ASM::VirtualMachine
3234
mov r0, 20
3335
)"sv, context);
3436
});
35-
37+
3638
addTest("Add", [] {
3739
static const auto virtualMachine = CppUtils::Language::ASM::VirtualMachine::VirtualMachine{};
3840
auto context = CppUtils::Language::ASM::VirtualMachine::Context{};

0 commit comments

Comments
 (0)