wex v24.04.0
Public Member Functions | Static Public Attributes | List of all members
wex::file_status Class Reference

Adds several methods to get/update the file status, and sync to sync the status from disk. More...

#include <wex/core/file-status.h>

Public Member Functions

 file_status (const std::string &path=std::string())
 Default constructor. Calls sync.
 
time_t get_access_time () const
 Returns access time.
 
time_t get_creation_time () const
 Returns creation ctime.
 
const std::string get_creation_time_str (const std::string &format=TIME_FORMAT) const
 Returns the creation time as a string.
 
time_t get_modification_time () const
 Returns modification time.
 
const std::string get_modification_time_str (const std::string &format=TIME_FORMAT) const
 Returns the modification time as a string.
 
off_t get_size () const
 Returns size.
 
bool is_ok () const
 Returns true if the stat is okay (last sync was okay).
 
bool is_readonly () const
 Returns true if this stat is readonly.
 
bool sync ()
 Sets (syncs) this stat, returns result and keeps it in is_ok.
 
bool sync (const std::string &path)
 Sets the path member, then syncs.
 

Static Public Attributes

static const std::string TIME_FORMAT = "%Y-%m-%d %H:%M:%S"
 See also chrono, uses same format.
 

Detailed Description

Adds several methods to get/update the file status, and sync to sync the status from disk.

Member Function Documentation

◆ get_creation_time_str()

const std::string wex::file_status::get_creation_time_str ( const std::string & format = TIME_FORMAT) const

Returns the creation time as a string.

Parameters
formatthe format as used by std::put_time

◆ get_modification_time_str()

const std::string wex::file_status::get_modification_time_str ( const std::string & format = TIME_FORMAT) const

Returns the modification time as a string.

Parameters
formatthe format as used by std::put_time