| 19 | namespace |
| 20 | { |
| 21 | std::pair<bool, std::vector<uint8_t>> load(const std::string& path) |
| 22 | { |
| 23 | std::vector<uint8_t> memblock; |
| 24 | |
| 25 | std::ifstream file(path); |
| 26 | if (!file.is_open()) return std::make_pair(false, memblock); |
| 27 | |
| 28 | file.seekg(0, file.end); |
| 29 | std::streamoff size = file.tellg(); |
| 30 | file.seekg(0, file.beg); |
| 31 | |
| 32 | memblock.resize((size_t) size); |
| 33 | file.read((char*) &memblock.front(), static_cast<std::streamsize>(size)); |
| 34 | |
| 35 | return std::make_pair(true, memblock); |
| 36 | } |
| 37 | |
| 38 | std::pair<bool, std::string> readAsString(const std::string& path) |
| 39 | { |
no test coverage detected