From f8c4fe1614cc79df9f97c8a7754cf2a5aaf5063d Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Tue, 9 Jul 2024 18:58:56 +0200 Subject: Use libreichwein, and googletest from Debian --- file.cpp | 44 -------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 file.cpp (limited to 'file.cpp') diff --git a/file.cpp b/file.cpp deleted file mode 100644 index 72522b3..0000000 --- a/file.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "file.h" - -#include "minicc.h" - -#include - -std::vector File::getFile(const fs::path& filename) -{ - std::ifstream file(filename.string(), std::ios::in | std::ios::binary | std::ios::ate); - - if (file.is_open()) { - std::ifstream::pos_type fileSize = file.tellg(); - file.seekg(0, std::ios::beg); - - std::vector bytes(fileSize, 0); - file.read(reinterpret_cast(bytes.data()), fileSize); - - return bytes; - - } else { - throw std::runtime_error("Opening "s + filename.string() + " for reading"); - } -} - -void File::setFile(const fs::path& filename, const std::string& s) -{ - File::setFile(filename, s.data(), s.size()); -} - -void File::setFile(const fs::path& filename, const char* data, size_t size) -{ - std::ofstream file(filename.string(), std::ios::out | std::ios::binary); - if (file.is_open()) { - file.write(data, size); - } else { - throw std::runtime_error("Opening "s + filename.string() + " for writing"); - } -} - -void File::setFile(const fs::path& filename, const std::vector& data) -{ - File::setFile(filename, reinterpret_cast(data.data()), data.size()); -} - -- cgit v1.2.3