ucommon
7.0.0
About: GNU uCommon C++ is a portable and optimized class framework for writing C++ applications that need to use threads and support concurrent synchronization, and that use sockets, XML parsing, object serialization, thread-optimized string and data structure classes, etc..
![]() ![]() |
#include <fsys.h>
Public Member Functions | |
dir (const char *path) | |
dir () | |
~dir () | |
void | open (const char *path) |
ssize_t | read (char *buffer, size_t count) |
void | close (void) |
int | err (void) const |
void | reset (void) |
operator bool () const | |
bool | operator! () const |
Static Public Member Functions | |
static int | create (const char *path, unsigned mode) |
static int | remove (const char *path) |
Private Attributes | |
void * | ptr |
![]() | |
fd_t | fd |
int | error |
Additional Inherited Members | |
![]() | |
enum | { OWNER_READONLY = 0400, GROUP_READONLY = 0440, PUBLIC_READONLY = 0444, OWNER_PRIVATE = 0600, OWNER_PUBLIC = 0644, GROUP_PRIVATE = 0660, GROUP_PUBLIC = 0664, EVERYONE = 0666, DIR_TEMPORARY = 01777 } |
enum | access_t { RDONLY, WRONLY, REWRITE, RDWR = REWRITE, APPEND, SHARED, EXCLUSIVE, DEVICE, STREAM, RANDOM } |
typedef struct stat | fileinfo_t |
typedef long | offset_t |
![]() | |
fsys () | |
fsys (fd_t handle) | |
fsys (const fsys &descriptor) | |
fsys (const char *path, access_t access) | |
fsys (const char *path, unsigned permission, access_t access) | |
~fsys () | |
fd_t | operator* () const |
operator fd_t () const | |
void | reset (void) |
operator bool () const | |
bool | operator! () const |
fsys & | operator= (const fsys &descriptor) |
fsys & | operator*= (fd_t &descriptor) |
fsys & | operator= (fd_t descriptor) |
fd_t | handle (void) const |
void | set (fd_t descriptor) |
fd_t | release (void) |
int | seek (offset_t offset) |
int | drop (offset_t size=0) |
bool | is_tty (void) const |
ssize_t | read (void *buffer, size_t count) |
ssize_t | write (const void *buffer, size_t count) |
int | info (fileinfo_t *buffer) |
int | trunc (offset_t offset) |
int | sync (void) |
void | open (const char *path, access_t access) |
void | assign (fd_t descriptor) |
void | open (const char *path, unsigned mode, access_t access) |
int | close (void) |
int | err (void) const |
![]() | |
static int | remapError (void) |
static bool | is_tty (fd_t fd) |
static int | prefix (const char *path) |
static int | prefix (char *path, size_t size) |
static stringref_t | prefix (void) |
static int | info (const char *path, fileinfo_t *buffer) |
static int | erase (const char *path) |
static int | copy (const char *source, const char *target, size_t size=1024) |
static int | rename (const char *oldpath, const char *newpath) |
static int | mode (const char *path, unsigned value) |
static bool | is_exists (const char *path) |
static bool | is_readable (const char *path) |
static bool | is_writable (const char *path) |
static bool | is_executable (const char *path) |
static bool | is_file (const char *path) |
static bool | is_dir (const char *path) |
static bool | is_link (const char *path) |
static bool | is_device (const char *path) |
static bool | is_hidden (const char *path) |
static void | assign (fsys &object, fd_t descriptor) |
static int | unlink (const char *path) |
static int | link (const char *path, const char *target) |
static int | hardlink (const char *path, const char *target) |
static int | linkinfo (const char *path, char *buffer, size_t size) |
static fd_t | input (const char *path) |
static fd_t | output (const char *path) |
static fd_t | append (const char *path) |
static void | release (fd_t descriptor) |
static int | pipe (fd_t &input, fd_t &output, size_t size=0) |
static int | inherit (fd_t &descriptor, bool enable) |
static fd_t | null (void) |
static int | load (const char *path) |
static int | exec (const char *path, char **argv, char **envp=NULL) |
static bool | is_file (struct stat *inode) |
static bool | is_dir (struct stat *inode) |
static bool | is_link (struct stat *inode) |
static bool | is_dev (struct stat *inode) |
static bool | is_char (struct stat *inode) |
static bool | is_disk (struct stat *inode) |
static bool | is_sys (struct stat *inode) |
![]() | |
static const offset_t | end = (offset_t)(-1) |
ucommon::dir::dir | ( | const char * | path | ) |
ucommon::dir::dir | ( | ) |
ucommon::dir::~dir | ( | ) |
void ucommon::dir::close | ( | void | ) |
Close and release directory object.
Definition at line 808 of file fsys.cpp.
References ucommon::fsys::error, ptr, and ucommon::fsys::remapError().
Referenced by ost::DirTree::close(), ost::DirTree::getPath(), ucommon::DirPager::load(), open(), and ~dir().
|
static |
Simple direct method to create a directory.
path | of directory to create. |
mode | of directory. |
Definition at line 895 of file fsys.cpp.
References ucommon::fsys::remapError().
Referenced by ucommon::shell::path(), and process().
|
inline |
Definition at line 804 of file fsys.h.
References ucommon::fsys::err().
void ucommon::dir::open | ( | const char * | path | ) |
Open a directory path for reading.
path | to open. |
Definition at line 909 of file fsys.cpp.
References close(), ucommon::fsys::error, ptr, and ucommon::fsys::remapError().
Referenced by dir(), ost::DirTree::getPath(), ucommon::DirPager::load(), and ost::DirTree::open().
|
inline |
|
inline |
ssize_t ucommon::dir::read | ( | char * | buffer, |
size_t | count | ||
) |
Read data from directory.
buffer | to read into. |
count | of bytes to read. |
Definition at line 736 of file fsys.cpp.
References ptr, and ucommon::String::set().
Referenced by dirpath(), ucommon::DirPager::load(), and scan().
|
static |
Remove an empty directory.
path | of directory. |
Definition at line 1351 of file fsys.cpp.
References ucommon::fsys::error, ucommon::fsys::is_device(), and ucommon::fsys::remapError().
Referenced by scrub().
|
inline |
Definition at line 808 of file fsys.h.
References ucommon::fsys::reset().
|
private |