MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / load

Function load

Sources/Dependencies/ixwebsocket/IXHttpServer.cpp:21–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19namespace
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 {

Callers 3

readAsStringFunction · 0.85
loadFromFileMethod · 0.85
loadFromStreamMethod · 0.85

Calls 3

resizeMethod · 0.45
readMethod · 0.45
frontMethod · 0.45

Tested by

no test coverage detected