karazeh
A cross-platform software updating library.
kzh::file_manager Class Reference

#include <file_manager.hpp>

+ Inheritance diagram for kzh::file_manager:
+ Collaboration diagram for kzh::file_manager:

Public Member Functions

 file_manager ()
 
virtual ~file_manager ()
 
virtual bool create_directory (path_t const &path) const
 
virtual bool ensure_directory (path_t const &path) const
 
virtual bool exists (path_t const &) const
 
virtual bool is_directory (path_t const &) const
 
virtual bool is_empty (path_t const &) const
 
virtual bool is_readable (path_t const &path) const
 
virtual bool is_readable (string_t const &path) const
 
virtual bool is_writable (path_t const &path) const
 
virtual bool is_writable (string_t const &path) const
 
virtual bool load_file (std::ifstream &fs, string_t &out_buf) const
 
virtual bool load_file (string_t const &path, string_t &out_buf) const
 
virtual bool load_file (path_t const &path, string_t &out_buf) const
 
virtual bool make_executable (path_t const &) const
 
virtual bool move (path_t const &, path_t const &) const
 
virtual bool remove_directory (path_t const &) const
 
virtual bool remove_file (path_t const &) const
 
virtual uint64_t stat_filesize (path_t const &) const
 
virtual uint64_t stat_filesize (std::ifstream &) const
 
- Public Member Functions inherited from kzh::logger
 logger (string_t context)
 
virtual ~logger ()
 
logstream alert () const
 
logstream crit () const
 
logstream debug () const
 
logstream error () const
 
logstream info () const
 
logstream notice () const
 
logstream plain () const
 
void set_uuid_prefix (string_t const &)
 
string_t const & uuid_prefix () const
 
logstream warn () const
 

Additional Inherited Members

- Static Public Member Functions inherited from kzh::logger
static void deindent ()
 
static void enable_timestamps (bool on_or_off)
 
static void indent ()
 
static void mute ()
 
static void set_app_name (string_t const &app_name)
 
static void set_stream (std::ostream *)
 
static void set_threshold (char level)
 
static void unmute ()
 
- Protected Member Functions inherited from kzh::logger
void rename_context (string_t const &)
 

Constructor & Destructor Documentation

kzh::file_manager::file_manager ( )
kzh::file_manager::~file_manager ( )
virtual

Member Function Documentation

bool kzh::file_manager::create_directory ( path_t const &  path) const
virtual

Creates a directory indicated by the given path, while creating all necessary ancestor directories (similar to mkdir -p)

Returns false if the directories couldn't be created, and the cause will be logged.

References kzh::logger::error().

Referenced by kzh::patcher::apply_update(), ensure_directory(), kzh::delete_operation::stage(), kzh::update_operation::stage(), kzh::create_operation::stage(), and TEST_CASE().

bool kzh::file_manager::ensure_directory ( path_t const &  path) const
virtual
bool kzh::file_manager::is_directory ( path_t const &  path) const
virtual
bool kzh::file_manager::is_empty ( path_t const &  path) const
virtual
bool kzh::file_manager::is_readable ( string_t const &  path) const
virtual
bool kzh::file_manager::is_writable ( path_t const &  path) const
virtual
bool kzh::file_manager::is_writable ( string_t const &  path) const
virtual
bool kzh::file_manager::load_file ( std::ifstream &  fs,
string_t out_buf 
) const
virtual

Loads the content of a file stream into memory

Referenced by kzh::downloader::fetch(), load_file(), and TEST_CASE().

bool kzh::file_manager::load_file ( string_t const &  path,
string_t out_buf 
) const
virtual

Loads the content of a file found at into memory

References load_file().

bool kzh::file_manager::load_file ( path_t const &  path,
string_t out_buf 
) const
virtual

References load_file().

bool kzh::file_manager::make_executable ( path_t const &  p) const
virtual

Enables the executable permission flag for systems that support it.

The file will have a permission mask equal to 0711

Returns false if the permissions couldn't be modified.

References kzh::logger::error().

Referenced by kzh::create_operation::deploy().

bool kzh::file_manager::remove_directory ( path_t const &  path) const
virtual
bool kzh::file_manager::remove_file ( path_t const &  path) const
virtual
uint64_t kzh::file_manager::stat_filesize ( path_t const &  p) const
virtual
uint64_t kzh::file_manager::stat_filesize ( std::ifstream &  in) const
virtual

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