1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Texture cache -> Media cache WIP

This commit is contained in:
Perttu Ahola 2012-03-25 11:50:29 +03:00
parent 4bf5065a9c
commit f801e16b78
8 changed files with 235 additions and 241 deletions

View file

@ -52,28 +52,21 @@ public:
Loads a file based on a check sum, which may be any kind of
rather unique byte sequence. Returns true, if the file could
be written into os, false otherwise.
A file name is required to give the disk file a name that
has the right file name extension (e.g. ".png").
*/
bool loadByChecksum(const std::string &name, std::ostream &os,
const std::string &checksum);
bool loadByChecksum(const std::string &checksum, std::ostream &os);
/*
Stores a file in the cache based on its checksum.
Returns true on success, false otherwise.
*/
bool updateByChecksum(const std::string &name, const std::string &data,
const std::string &checksum);
bool updateByChecksum(const std::string &checksum, const std::string &data);
private:
std::string m_dir;
bool loadByPath(const std::string &name, std::ostream &os,
const std::string &path);
bool updateByPath(const std::string &name, const std::string &data,
const std::string &path);
std::string getPathFromChecksum(const std::string &name,
const std::string &checksum);
bool loadByPath(const std::string &path, std::ostream &os);
bool updateByPath(const std::string &path, const std::string &data);
std::string getPathFromChecksum(const std::string &checksum);
};
#endif