summaryrefslogtreecommitdiffstats
path: root/src/core/io
diff options
context:
space:
mode:
authoruntodesu <kirill@untode.su>2025-12-26 23:17:56 +0500
committeruntodesu <kirill@untode.su>2025-12-26 23:17:56 +0500
commit0f111cf51b00c4e884b7e53b4fd7ff6e38d8af5e (patch)
tree90ddefa28b40b6384dd9618bb7573704de2733a9 /src/core/io
parent6bb4233d5b2a1688e63c947542e92ec5d5a857a6 (diff)
downloadvoxelius-0f111cf51b00c4e884b7e53b4fd7ff6e38d8af5e.tar.bz2
voxelius-0f111cf51b00c4e884b7e53b4fd7ff6e38d8af5e.zip
Add include guards and header comments to sources
Diffstat (limited to 'src/core/io')
-rw-r--r--src/core/io/buffer.cc5
-rw-r--r--src/core/io/buffer.hh11
-rw-r--r--src/core/io/cmdline.cc5
-rw-r--r--src/core/io/cmdline.hh9
-rw-r--r--src/core/io/config_map.cc5
-rw-r--r--src/core/io/config_map.hh9
-rw-r--r--src/core/io/physfs.cc23
-rw-r--r--src/core/io/physfs.hh17
8 files changed, 74 insertions, 10 deletions
diff --git a/src/core/io/buffer.cc b/src/core/io/buffer.cc
index d0fda49..dffd9bc 100644
--- a/src/core/io/buffer.cc
+++ b/src/core/io/buffer.cc
@@ -1,3 +1,8 @@
+// SPDX-License-Identifier: BSD-2-Clause
+// Copyright (c) 2025 Kirill Dmitrievich
+// File: buffer.cc
+// Description: QDataStream-esque buffer
+
#include "core/pch.hh"
#include "core/io/buffer.hh"
diff --git a/src/core/io/buffer.hh b/src/core/io/buffer.hh
index 450a86f..100a933 100644
--- a/src/core/io/buffer.hh
+++ b/src/core/io/buffer.hh
@@ -1,3 +1,12 @@
+// SPDX-License-Identifier: BSD-2-Clause
+// Copyright (c) 2025 Kirill Dmitrievich
+// File: buffer.hh
+// Description: QDataStream-esque buffer
+
+#ifndef CORE_IO_BUFFER_HH
+#define CORE_IO_BUFFER_HH
+#pragma once
+
class ReadBuffer final {
public:
ReadBuffer(void) = default;
@@ -80,3 +89,5 @@ WriteBuffer& WriteBuffer::operator<<(const T value)
write<T>(value);
return *this;
}
+
+#endif
diff --git a/src/core/io/cmdline.cc b/src/core/io/cmdline.cc
index d206cb8..0d1206a 100644
--- a/src/core/io/cmdline.cc
+++ b/src/core/io/cmdline.cc
@@ -1,3 +1,8 @@
+// SPDX-License-Identifier: BSD-2-Clause
+// Copyright (c) 2025 Kirill Dmitrievich
+// File: cmdline.cc
+// Description: Command-line arguments parser
+
#include "core/pch.hh"
#include "core/io/cmdline.hh"
diff --git a/src/core/io/cmdline.hh b/src/core/io/cmdline.hh
index c0d6db2..452072f 100644
--- a/src/core/io/cmdline.hh
+++ b/src/core/io/cmdline.hh
@@ -1,3 +1,10 @@
+// SPDX-License-Identifier: BSD-2-Clause
+// Copyright (c) 2025 Kirill Dmitrievich
+// File: cmdline.hh
+// Description: Command-line arguments parser
+
+#ifndef CORE_IO_CMDLINE_HH
+#define CORE_IO_CMDLINE_HH
#pragma once
namespace cmdline
@@ -9,3 +16,5 @@ std::string_view get(std::string_view option, std::string_view fallback = "");
const char* get_cstr(std::string_view option, const char* fallback = nullptr);
bool contains(std::string_view option);
} // namespace cmdline
+
+#endif
diff --git a/src/core/io/config_map.cc b/src/core/io/config_map.cc
index 8634fd6..93fab2b 100644
--- a/src/core/io/config_map.cc
+++ b/src/core/io/config_map.cc
@@ -1,3 +1,8 @@
+// SPDX-License-Identifier: BSD-2-Clause
+// Copyright (c) 2025 Kirill Dmitrievich
+// File: config_map.cc
+// Description: Config parser
+
#include "core/pch.hh"
#include "core/io/config_map.hh"
diff --git a/src/core/io/config_map.hh b/src/core/io/config_map.hh
index 898103b..2e3f18f 100644
--- a/src/core/io/config_map.hh
+++ b/src/core/io/config_map.hh
@@ -1,3 +1,10 @@
+// SPDX-License-Identifier: BSD-2-Clause
+// Copyright (c) 2025 Kirill Dmitrievich
+// File: config_map.hh
+// Description: Config parser
+
+#ifndef CORE_IO_CONFIG_MAP_HH
+#define CORE_IO_CONFIG_MAP_HH
#pragma once
namespace config
@@ -24,3 +31,5 @@ public:
private:
std::unordered_map<std::string, config::IValue*> m_values;
};
+
+#endif
diff --git a/src/core/io/physfs.cc b/src/core/io/physfs.cc
index b9fe91e..04aaf64 100644
--- a/src/core/io/physfs.cc
+++ b/src/core/io/physfs.cc
@@ -1,13 +1,18 @@
+// SPDX-License-Identifier: BSD-2-Clause
+// Copyright (c) 2025 Kirill Dmitrievich
+// File: physfs.cc
+// Description: PhysFS utilities
+
#include "core/pch.hh"
#include "core/io/physfs.hh"
-bool read_file(std::string_view path, std::vector<std::byte>& buffer)
+bool physfs::read_file(std::string_view path, std::vector<std::byte>& buffer)
{
auto file = PHYSFS_openRead(std::string(path).c_str());
if(file == nullptr) {
- spdlog::error("physfs: {}: {}", path, physfs_error());
+ spdlog::error("physfs: {}: {}", path, physfs::last_error());
return false;
}
@@ -20,12 +25,12 @@ bool read_file(std::string_view path, std::vector<std::byte>& buffer)
return true;
}
-bool read_file(std::string_view path, std::string& buffer)
+bool physfs::read_file(std::string_view path, std::string& buffer)
{
auto file = PHYSFS_openRead(std::string(path).c_str());
if(file == nullptr) {
- spdlog::error("physfs: {}: {}", path, physfs_error());
+ spdlog::error("physfs: {}: {}", path, physfs::last_error());
return false;
}
@@ -38,12 +43,12 @@ bool read_file(std::string_view path, std::string& buffer)
return true;
}
-bool write_file(std::string_view path, const std::vector<std::byte>& buffer)
+bool physfs::write_file(std::string_view path, const std::vector<std::byte>& buffer)
{
auto file = PHYSFS_openWrite(std::string(path).c_str());
if(file == nullptr) {
- spdlog::error("physfs: {}: {}", path, physfs_error());
+ spdlog::error("physfs: {}: {}", path, physfs::last_error());
return false;
}
@@ -53,12 +58,12 @@ bool write_file(std::string_view path, const std::vector<std::byte>& buffer)
return true;
}
-bool write_file(std::string_view path, const std::string& buffer)
+bool physfs::write_file(std::string_view path, const std::string& buffer)
{
auto file = PHYSFS_openWrite(std::string(path).c_str());
if(file == nullptr) {
- spdlog::error("physfs: {}: {}", path, physfs_error());
+ spdlog::error("physfs: {}: {}", path, physfs::last_error());
return false;
}
@@ -68,7 +73,7 @@ bool write_file(std::string_view path, const std::string& buffer)
return true;
}
-std::string_view physfs_error(void)
+std::string_view physfs::last_error(void)
{
auto error_code = PHYSFS_getLastErrorCode();
auto error_string = PHYSFS_getErrorByCode(error_code);
diff --git a/src/core/io/physfs.hh b/src/core/io/physfs.hh
index 88f97de..8cf84be 100644
--- a/src/core/io/physfs.hh
+++ b/src/core/io/physfs.hh
@@ -1,8 +1,23 @@
+// SPDX-License-Identifier: BSD-2-Clause
+// Copyright (c) 2025 Kirill Dmitrievich
+// File: physfs.hh
+// Description: PhysFS utilities
+
+#ifndef CORE_IO_PHYSFS_HH
+#define CORE_IO_PHYSFS_HH
#pragma once
+namespace physfs
+{
bool read_file(std::string_view path, std::vector<std::byte>& buffer);
bool read_file(std::string_view path, std::string& buffer);
bool write_file(std::string_view path, const std::vector<std::byte>& buffer);
bool write_file(std::string_view path, const std::string& buffer);
+} // namespace physfs
+
+namespace physfs
+{
+std::string_view last_error(void);
+} // namespace physfs
-std::string_view physfs_error(void);
+#endif