diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-23 21:54:28 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-23 21:54:28 +0200 |
commit | 9b7be419c9dcc6ebd1e504713c7b2676ca3d2fdf (patch) | |
tree | 97a2fc5ce1ec1345bd6f44889682ea9a2ffafd76 /mwe/resource-manager/resource_fabricator.cpp | |
parent | 080ad535e6fc6666b919b1a21b6986aaf9b678eb (diff) |
`clang-format`
Diffstat (limited to 'mwe/resource-manager/resource_fabricator.cpp')
-rw-r--r-- | mwe/resource-manager/resource_fabricator.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/mwe/resource-manager/resource_fabricator.cpp b/mwe/resource-manager/resource_fabricator.cpp index 0633a40..2b83e97 100644 --- a/mwe/resource-manager/resource_fabricator.cpp +++ b/mwe/resource-manager/resource_fabricator.cpp @@ -6,21 +6,18 @@ #include <string> #include <vector> +std::string ResourceFactory::convert_file_to_string(const std::string & path) { + std::ifstream file(path, std::ios::binary | std::ios::ate); + if (!file.is_open()) { + std::cerr << "Failed to open file: " << path << std::endl; + return ""; + } + std::ifstream::pos_type fileSize = file.tellg(); + file.seekg(0, std::ios::beg); + std::vector<char> bytes(fileSize); + file.read(bytes.data(), fileSize); -std::string ResourceFactory::convert_file_to_string(const std::string& path){ - std::ifstream file(path, std::ios::binary | std::ios::ate); - if (!file.is_open()) { - std::cerr << "Failed to open file: " << path << std::endl; - return ""; - } - - std::ifstream::pos_type fileSize = file.tellg(); - file.seekg(0, std::ios::beg); - - std::vector<char> bytes(fileSize); - file.read(bytes.data(), fileSize); - - return std::string(bytes.begin(), bytes.end()); + return std::string(bytes.begin(), bytes.end()); } |