HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FS_Info Class Referencefinal

Class for retrieving file information. More...

#include <FS_Info.h>

Public Member Functions

 FS_Info (const char *source)
 
const UT_StringHolderpath () const
 Return the path parsed from the source. More...
 
const UT_StringHoldersection () const
 Return the section parsed from the source. More...
 
bool hasAccess (int mode=0) const
 
bool getIsDirectory () const
 Returns if the path is a directory. More...
 
time_t getModTime () const
 
time_t getRecursiveMaxModTime () const
 
int64 getFileDataSize () const
 Returns the file size. More...
 
UT_String getExtension () const
 Returns the file extension. More...
 
bool getContents (UT_StringArray &contents, UT_StringArray *dirs=0, UT_Array< FS_Stat > *stats=0, UT_Array< FS_Stat > *dir_stats=0)
 
bool glob (UT_StringArray &result, bool only_readable=false, bool support_special_tokens=false)
 
bool exists () const
 
bool fileExists () const
 
bool canReadFile () const
 
bool canWriteFile () const
 
bool canWriteDirectory () const
 
bool canDeleteFile () const
 

Static Public Member Functions

static char getNextSepChar (const char *source)
 
static char getPrevSepChar (const char *source)
 
static bool customNavigatePath (UT_String &path, const char *file)
 
static bool getPathOnDisk (UT_String &path, const char *file)
 
static bool isNativePath (const char *path)
 
static bool getContentsFromIndexFile (FS_IndexFile &index, UT_StringArray &contents, UT_StringArray *dirs)
 
static bool getContentsFromIndexFile (FS_IndexFile &index, UT_StringArray &contents, UT_StringArray *dirs, UT_Array< FS_Stat > *stats, UT_Array< FS_Stat > *dir_stats)
 
static bool getContentsFromDiskPath (const char *path, UT_StringArray &contents, UT_StringArray *dirs, UT_Array< FS_Stat > *stats=NULL, UT_Array< FS_Stat > *dir_stats=NULL)
 
static bool statFile (const char *source, const char *filename, FS_Stat *fstat)
 
static void addInfoHelper (FS_InfoHelper *helper)
 
static void removeInfoHelper (FS_InfoHelper *helper)
 

Detailed Description

Class for retrieving file information.

Examples:
FS/FS_HomeHelper.C.

Definition at line 99 of file FS_Info.h.

Constructor & Destructor Documentation

FS_Info::FS_Info ( const char *  source)

Use this constructor to create a new info object. The specified file is not actually opened or accessed until one of the information gathering methods is called.

Member Function Documentation

static void FS_Info::addInfoHelper ( FS_InfoHelper helper)
static
bool FS_Info::canDeleteFile ( ) const
bool FS_Info::canReadFile ( ) const
bool FS_Info::canWriteDirectory ( ) const
bool FS_Info::canWriteFile ( ) const
static bool FS_Info::customNavigatePath ( UT_String path,
const char *  file 
)
static
bool FS_Info::exists ( ) const
bool FS_Info::fileExists ( ) const
bool FS_Info::getContents ( UT_StringArray contents,
UT_StringArray dirs = 0,
UT_Array< FS_Stat > *  stats = 0,
UT_Array< FS_Stat > *  dir_stats = 0 
)

Does bulk load of files and directories from the source. If the source specified in the constructor is a directory rather than an individual file, this method will return a listing of all files and directories contained in that directory.

static bool FS_Info::getContentsFromDiskPath ( const char *  path,
UT_StringArray contents,
UT_StringArray dirs,
UT_Array< FS_Stat > *  stats = NULL,
UT_Array< FS_Stat > *  dir_stats = NULL 
)
static
static bool FS_Info::getContentsFromIndexFile ( FS_IndexFile index,
UT_StringArray contents,
UT_StringArray dirs 
)
static
static bool FS_Info::getContentsFromIndexFile ( FS_IndexFile index,
UT_StringArray contents,
UT_StringArray dirs,
UT_Array< FS_Stat > *  stats,
UT_Array< FS_Stat > *  dir_stats 
)
static
UT_String FS_Info::getExtension ( ) const

Returns the file extension.

int64 FS_Info::getFileDataSize ( ) const

Returns the file size.

bool FS_Info::getIsDirectory ( ) const

Returns if the path is a directory.

time_t FS_Info::getModTime ( ) const

Returns the modification time of the file. The returned value can be cast directly to a time_t value, as defined in the standard C library.

static char FS_Info::getNextSepChar ( const char *  source)
static
static bool FS_Info::getPathOnDisk ( UT_String path,
const char *  file 
)
static
static char FS_Info::getPrevSepChar ( const char *  source)
static
time_t FS_Info::getRecursiveMaxModTime ( ) const

Returns the latest modification time of the directory and all of its contents recursively. On a file it works like getModTime().

bool FS_Info::glob ( UT_StringArray result,
bool  only_readable = false,
bool  support_special_tokens = false 
)

Treats the source as a path glob pattern and expands it to the available files. Note that backslash escaping with [] is not supported. If support_special_tokens is true, the special token <LASTMATCH> can be used in the pattern. It will be replaced by the last matched path component using a wildcard character.

bool FS_Info::hasAccess ( int  mode = 0) const

This function returns whether or not the current user has rights to access the file in the given mode. The mode parameter can be any of FS_READ, FS_WRITE, or FS_EXECUTE. You can also or these values together to check multiple access types simultaneously. If the mode value is 0, the function returns true if the file exists.

static bool FS_Info::isNativePath ( const char *  path)
static
const UT_StringHolder& FS_Info::path ( ) const
inline

Return the path parsed from the source.

Definition at line 108 of file FS_Info.h.

static void FS_Info::removeInfoHelper ( FS_InfoHelper helper)
static
const UT_StringHolder& FS_Info::section ( ) const
inline

Return the section parsed from the source.

Definition at line 111 of file FS_Info.h.

static bool FS_Info::statFile ( const char *  source,
const char *  filename,
FS_Stat fstat 
)
static

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