VideoTools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
G::File Class Reference

A simple static class for dealing with files. More...

#include <gfile.h>

Classes

class  NoThrow
 An overload discriminator class for File methods. More...
 

Static Public Member Functions

static bool remove (const Path &path, const NoThrow &)
 Deletes the file or directory. Returns false on error.
 
static void remove (const Path &path)
 Deletes the file or directory. Throws an exception on error.
 
static bool rename (const Path &from, const Path &to, const NoThrow &)
 Renames the file. Returns false on error.
 
static void rename (const Path &from, const Path &to)
 Renames the file.
 
static bool copy (const Path &from, const Path &to, const NoThrow &)
 Copies a file. Returns false on error.
 
static void copy (const Path &from, const Path &to)
 Copies a file.
 
static void copy (std::istream &from, std::ostream &to, std::streamsize limit=0U, std::string::size_type block=0U)
 Copies a stream with an optional size limit.
 
static bool mkdirs (const Path &dir, const NoThrow &, int=100)
 Creates a directory and all necessary parents. More...
 
static void mkdirs (const Path &dir, int=100)
 Creates a directory and all necessary parents. More...
 
static bool mkdir (const Path &dir, const NoThrow &)
 Creates a directory. Returns false on error.
 
static void mkdir (const Path &dir)
 Creates a directory.
 
static std::string sizeString (const Path &file)
 Returns the file's size in string format. More...
 
static bool exists (const Path &file)
 Returns true if the file (directory, device etc.) exists. More...
 
static bool exists (const Path &file, const NoThrow &)
 Returns true if the file (directory, device etc.) exists. More...
 
static bool isDirectory (const Path &path)
 Returns true if the path exists() and is a directory. More...
 
static EpochTime time (const Path &file)
 Returns the file's timestamp.
 
static EpochTime time (const Path &file, const NoThrow &)
 Returns the file's timestamp. More...
 
static void chmodx (const Path &file)
 Makes the file executable.
 
static bool chmodx (const Path &file, const NoThrow &)
 Makes the file executable.
 
static void link (const Path &target, const Path &new_link)
 Creates a symlink.
 
static bool link (const Path &target, const Path &new_link, const NoThrow &)
 Creates a symlink.
 
static bool executable (const Path &)
 Returns true if the path is probably executable. More...
 
static void create (const Path &)
 Creates an empty file. Throws on error.
 

Friends

class G::DirectoryIteratorImp
 

Detailed Description

A simple static class for dealing with files.

See Also
G::Path, G::FileSystem, G::Directory

Definition at line 40 of file gfile.h.

Member Function Documentation

bool G::File::executable ( const Path path)
static

Returns true if the path is probably executable.

Because of portability and implementation difficulties this does not return a definitive result so it should only used for generating warnings on a false return.

Definition at line 73 of file gfile_unix.cpp.

bool G::File::exists ( const Path file)
static

Returns true if the file (directory, device etc.) exists.

Symlinks are followed. Throws an exception if permission denied or too many symlinks etc.

Definition at line 132 of file gfile.cpp.

bool G::File::exists ( const Path file,
const NoThrow  
)
static

Returns true if the file (directory, device etc.) exists.

Symlinks are followed. Returns false on error.

Definition at line 137 of file gfile.cpp.

bool G::File::isDirectory ( const Path path)
static

Returns true if the path exists() and is a directory.

Symlinks are followed.

Definition at line 67 of file gfile_unix.cpp.

bool G::File::mkdirs ( const Path dir,
const NoThrow ,
int  limit = 100 
)
static

Creates a directory and all necessary parents.

Returns false on error. Does chmodx() on all created directories.

Definition at line 172 of file gfile.cpp.

void G::File::mkdirs ( const Path dir,
int  limit = 100 
)
static

Creates a directory and all necessary parents.

Does chmodx() on all created directories.

Definition at line 211 of file gfile.cpp.

std::string G::File::sizeString ( const Path file)
static

Returns the file's size in string format.

Returns the empty string on error.

Definition at line 90 of file gfile_unix.cpp.

G::EpochTime G::File::time ( const Path file,
const NoThrow  
)
static

Returns the file's timestamp.

Returns EpochTime(0) on error.

Definition at line 109 of file gfile_unix.cpp.


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