Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
FileCache Class Reference

#include <filecache.h>

+ Collaboration diagram for FileCache:

Public Member Functions

 FileCache (const std::string &dir)
 
bool update (const std::string &name, std::string_view data)
 
bool load (const std::string &name, std::ostream &os)
 
bool exists (const std::string &name)
 
bool updateCopyFile (const std::string &name, const std::string &src_path)
 

Private Member Functions

void createDir ()
 
bool loadByPath (const std::string &path, std::ostream &os)
 
bool updateByPath (const std::string &path, std::string_view data)
 

Private Attributes

std::string m_dir
 

Constructor & Destructor Documentation

◆ FileCache()

FileCache::FileCache ( const std::string & dir)
inline

Member Function Documentation

◆ createDir()

void FileCache::createDir ( )
private

References fs::CreateAllDirs(), errorstream, and m_dir.

Referenced by updateByPath(), and updateCopyFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exists()

bool FileCache::exists ( const std::string & name)

References DIR_DELIM, m_dir, and fs::PathExists().

Referenced by clientMediaUpdateCache(), and clientMediaUpdateCacheCopy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load()

bool FileCache::load ( const std::string & name,
std::ostream & os )

References DIR_DELIM, loadByPath(), and m_dir.

Referenced by IClientMediaDownloader::tryLoadFromCache().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadByPath()

bool FileCache::loadByPath ( const std::string & path,
std::ostream & os )
private

References errorstream, and open_ifstream().

Referenced by load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

bool FileCache::update ( const std::string & name,
std::string_view data )

References DIR_DELIM, m_dir, and updateByPath().

Referenced by IClientMediaDownloader::checkAndLoad(), and clientMediaUpdateCache().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateByPath()

bool FileCache::updateByPath ( const std::string & path,
std::string_view data )
private

References createDir(), and open_ofstream().

Referenced by update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateCopyFile()

bool FileCache::updateCopyFile ( const std::string & name,
const std::string & src_path )

References fs::CopyFileContents(), createDir(), DIR_DELIM, and m_dir.

Referenced by clientMediaUpdateCacheCopy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_dir

std::string FileCache::m_dir
private

The documentation for this class was generated from the following files: