aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/aesxx/utils/helpers
diff options
context:
space:
mode:
authorEgor Tensin <egor@tensin.name>2026-06-22 17:57:37 +0200
committerEgor Tensin <egor@tensin.name>2026-06-22 17:57:37 +0200
commit05691f614baa782801c4b22efa2ee9a73de4b3b3 (patch)
tree99a1af51ac882a2b1bb7db3e95c5d462b7879118 /aesxx/utils/helpers
parentMerge pull request #7 from egor-tensin/dependabot/github_actions/actions/chec... (diff)
downloadaes-tools-05691f614baa782801c4b22efa2ee9a73de4b3b3.tar.gz
aes-tools-05691f614baa782801c4b22efa2ee9a73de4b3b3.zip
aesxx/utils: refactoring
Diffstat (limited to 'aesxx/utils/helpers')
-rw-r--r--aesxx/utils/helpers/bmp.hpp4
-rw-r--r--aesxx/utils/helpers/command_line.hpp4
-rw-r--r--aesxx/utils/helpers/file.hpp12
3 files changed, 6 insertions, 14 deletions
diff --git a/aesxx/utils/helpers/bmp.hpp b/aesxx/utils/helpers/bmp.hpp
index c256a7a..086be00 100644
--- a/aesxx/utils/helpers/bmp.hpp
+++ b/aesxx/utils/helpers/bmp.hpp
@@ -11,8 +11,6 @@
#include <utility>
#include <vector>
-namespace bmp {
-
class BmpFile {
public:
BmpFile(std::vector<char>&& buffer)
@@ -52,5 +50,3 @@ private:
std::vector<char> buffer;
std::size_t header_size;
};
-
-} // namespace bmp
diff --git a/aesxx/utils/helpers/command_line.hpp b/aesxx/utils/helpers/command_line.hpp
index c68d739..607253c 100644
--- a/aesxx/utils/helpers/command_line.hpp
+++ b/aesxx/utils/helpers/command_line.hpp
@@ -15,8 +15,6 @@
#include <string>
#include <string_view>
-namespace command_line {
-
class SettingsParser {
public:
explicit SettingsParser(std::string_view argv0) : prog_name{extract_filename(argv0)} {
@@ -76,5 +74,3 @@ private:
return os;
}
};
-
-} // namespace command_line
diff --git a/aesxx/utils/helpers/file.hpp b/aesxx/utils/helpers/file.hpp
index 76e3e96..085d78c 100644
--- a/aesxx/utils/helpers/file.hpp
+++ b/aesxx/utils/helpers/file.hpp
@@ -23,15 +23,15 @@ inline std::size_t cast_to_size_t(std::streamoff size) {
return static_cast<std::size_t>(size);
}
-inline std::size_t get_file_size(const std::string& path) {
+inline std::size_t get_size(const std::string& path) {
std::ifstream ifs;
ifs.exceptions(std::ifstream::badbit | std::ifstream::failbit);
ifs.open(path, std::ifstream::binary | std::ifstream::ate);
return cast_to_size_t(ifs.tellg());
}
-inline std::vector<char> read_file(const std::string& path) {
- const auto size = get_file_size(path);
+inline std::vector<char> read(const std::string& path) {
+ const auto size = get_size(path);
std::ifstream ifs;
ifs.exceptions(std::ifstream::badbit | std::ifstream::failbit);
@@ -43,15 +43,15 @@ inline std::vector<char> read_file(const std::string& path) {
return src_buf;
}
-inline void write_file(const std::string& path, const void* buffer, const std::size_t size) {
+inline void write(const std::string& path, const void* buffer, const std::size_t size) {
std::ofstream ofs;
ofs.exceptions(std::ofstream::badbit | std::ofstream::failbit);
ofs.open(path, std::ofstream::binary);
ofs.write(reinterpret_cast<const char*>(buffer), size);
}
-inline void write_file(const std::string& path, const std::vector<unsigned char>& src) {
- write_file(path, src.data(), src.size());
+inline void write(const std::string& path, const std::vector<unsigned char>& src) {
+ write(path, src.data(), src.size());
}
} // namespace file