libept
Classes | Namespaces | Functions
sys.h File Reference
#include <string>
#include <memory>
#include <iterator>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>

Go to the source code of this file.

Classes

class  ept::sys::MMap
 Wraps a mmapped memory area, unmapping it on destruction. More...
 
class  ept::sys::FileDescriptor
 Common operations on file descriptors. More...
 
class  ept::sys::NamedFileDescriptor
 File descriptor with a name. More...
 
struct  ept::sys::Path
 Wrap a path on the file system opened with O_PATH. More...
 
struct  ept::sys::Path::iterator
 Iterator for directory entries. More...
 
class  ept::sys::File
 open(2) file descriptors More...
 

Namespaces

 ept
 String functions.
 
 ept::sys
 

Functions

std::unique_ptr< struct stat > ept::sys::stat (const std::string &pathname)
 stat() the given file and return the struct stat with the results. More...
 
void ept::sys::stat (const std::string &pathname, struct stat &st)
 stat() the given file filling in the given structure. More...
 
bool ept::sys::isdir (const std::string &pathname)
 Returns true if the given pathname is a directory, else false. More...
 
bool ept::sys::isblk (const std::string &pathname)
 Same as isdir but checks for block devices. More...
 
bool ept::sys::ischr (const std::string &pathname)
 Same as isdir but checks for character devices. More...
 
bool ept::sys::isfifo (const std::string &pathname)
 Same as isdir but checks for FIFOs. More...
 
bool ept::sys::islnk (const std::string &pathname)
 Same as isdir but checks for symbolic links. More...
 
bool ept::sys::isreg (const std::string &pathname)
 Same as isdir but checks for regular files. More...
 
bool ept::sys::issock (const std::string &pathname)
 Same as isdir but checks for sockets. More...
 
time_t ept::sys::timestamp (const std::string &file)
 File mtime. More...
 
time_t ept::sys::timestamp (const std::string &file, time_t def)
 File mtime (or def if the file does not exist) More...
 
size_t ept::sys::size (const std::string &file)
 File size. More...
 
size_t ept::sys::size (const std::string &file, size_t def)
 File size (or def if the file does not exist) More...
 
ino_t ept::sys::inode (const std::string &file)
 File inode number. More...
 
ino_t ept::sys::inode (const std::string &file, ino_t def)
 File inode number (or 0 if the file does not exist) More...
 
bool ept::sys::access (const std::string &s, int m)
 access() a filename More...
 
bool ept::sys::exists (const std::string &s)
 Same as access(s, F_OK);. More...
 
std::string ept::sys::getcwd ()
 Get the absolute path of the current working directory. More...
 
std::string ept::sys::abspath (const std::string &pathname)
 Get the absolute path of a file. More...
 
std::string ept::sys::read_file (const std::string &file)
 Read whole file into memory. Throws exceptions on failure. More...
 
void ept::sys::write_file (const std::string &file, const std::string &data, mode_t mode=0777)
 Write data to file, replacing existing contents if it already exists. More...
 
void ept::sys::write_file_atomically (const std::string &file, const std::string &data, mode_t mode=0777)
 Write data to file, replacing existing contents if it already exists. More...
 
bool ept::sys::unlink_ifexists (const std::string &file)
 Delete a file if it exists. More...
 
bool ept::sys::rename_ifexists (const std::string &src, const std::string &dst)
 Move src to dst, without raising exception if src does not exist. More...
 
void ept::sys::mkdir_ifmissing (const char *pathname, mode_t mode=0777)
 Create the given directory, if it does not already exists. More...
 
void ept::sys::mkdir_ifmissing (const std::string &pathname, mode_t mode)
 
void ept::sys::makedirs (const std::string &pathname, mode_t=0777)
 Create all the component of the given directory, including the directory itself. More...
 
std::string ept::sys::which (const std::string &name)
 Compute the absolute path of an executable. More...
 
void ept::sys::unlink (const std::string &pathname)
 Delete the file using unlink() More...
 
void ept::sys::rmdir (const std::string &pathname)
 Remove the directory using rmdir(2) More...
 
void ept::sys::rmtree (const std::string &pathname)
 Delete the directory pathname and all its contents. More...