Describes a file in the file system. More...
#include <GUIDirInfo.h>
Classes | |
struct | GUIFileTime_t |
Timestamp of a file. More... | |
Public Types | |
typedef eC_TListDoubleLinked< CGUIDirInfo * > | DirInfoPtrList_t |
Type define for the CGUIDirInfo list. | |
Public Member Functions | |
CGUIDirInfo () | |
CGUIDirInfo (const CGUIDirInfo &kDirInfo) | |
CGUIDirInfo (const eC_String &kFileName, const eC_String &kCurrentWorkingDirPath) | |
virtual | ~CGUIDirInfo () |
void | ChangeFilePath (const eC_String &kNewFilePath) |
virtual eC_Bool | CheckExist () const =0 |
eC_String | GetAbsPath () const |
eC_String | GetAbsPath_File () const |
eC_String | GetFileBaseName () const |
eC_String | GetFileName () const |
eC_String | GetFileSuffix () const |
virtual eC_UInt | GetGroupID () const =0 |
virtual eC_String | GetGroupName () const =0 |
virtual eC_UInt | GetOwnerID () const =0 |
virtual eC_String | GetOwnerName () const =0 |
eC_String | GetPath () const |
eC_String | GetPath_File () const |
virtual long long int | GetSize () const =0 |
virtual GUIFileTime_t | GetTimeCreated () const =0 |
virtual GUIFileTime_t | GetTimeLatestModified () const =0 |
virtual GUIFileTime_t | GetTimeLatestRead () const =0 |
virtual eC_Bool | IsAbsPath () const |
virtual eC_Bool | IsDir () const =0 |
virtual eC_Bool | IsExecutable () const =0 |
virtual eC_Bool | IsFile () const =0 |
virtual eC_Bool | IsHidden () const =0 |
virtual eC_Bool | IsReadable () const =0 |
virtual eC_Bool | IsRoot () const =0 |
virtual eC_Bool | IsSymLink () const =0 |
virtual eC_Bool | IsSystem () const =0 |
virtual eC_Bool | IsWritable () const =0 |
void | MakePathAbs () |
CGUIDirInfo & | operator= (const CGUIDirInfo &kDirInfo) |
virtual eC_String | ReadLink () const =0 |
Static Public Attributes | |
static const eC_UInt | ID_UNKNOWN = static_cast<eC_UInt>(-1) |
Value used as "unknown" ID. | |
Protected Types | |
enum | FileTime_t { CreatedTime , ModifiedTime , ReadTime } |
Protected Member Functions | |
virtual GUIFileTime_t | GetTime (FileTime_t eFileTime) const =0 |
Protected Attributes | |
eC_String | m_kCurrentWorkingDirPath |
eC_String | m_kFilePath |
Describes a file in the file system.
Each object of this class stores the path of a file. It can be changed with ChangeFilePath(). The absolute path of the file can be obtained by the method GetAbsPath_File(). GetAbsPath() gets the path of the file without the file name. The corresponding non-absolute paths can be obtained with the methods GetPath_File() and GetPath(). Whether the given path is an absolute path or not is checked by the method IsAbsPath(). The path can be changed to be absolute by the method MakePathAbs(). Use GetFileName() to get the file name. The base name and suffix information are obtained by the methods GetFileBaseName() and GetFileSuffix().
The type of file is checked by the methods IsDir(), IsFile() and IsSymLink(). If the file is a symlink, you can get the file that the symlink points to by the method ReadLink(). The group name, group id, owner name and owner id are checked by the method GetGroupName(), GetGroupID(), GetOwnerName() and GetOwnerID().
Each object also provides information about the time when the file was created, latest modified, or accessed by the methods GetTimeCreated(), GetTimeLatestModified() and GetTimeLatestRead(). As long as the target platform provides time zones and daylight savings time handling, the time returned is UTC. The access permissions are checked by the methods IsExecutable(), IsReadable(), IsWritable(). Use GetSize() to determine the size of the file.
|
protected |
The file time enumeration used in GetTime private method to identify, which time to get.
CGUIDirInfo::CGUIDirInfo | ( | ) |
Default constructor. The file path is set to be empty string.
CGUIDirInfo::CGUIDirInfo | ( | const eC_String & | kFileName, |
const eC_String & | kCurrentWorkingDirPath | ||
) |
Constructor with the given file path name.
kFileName | The path of the given file. |
kCurrentWorkingDirPath | The path of the current working directory. |
CGUIDirInfo::CGUIDirInfo | ( | const CGUIDirInfo & | kDirInfo | ) |
Copy constructor.
kDirInfo | The source object to be copied. |
|
inlinevirtual |
Destructor.
void CGUIDirInfo::ChangeFilePath | ( | const eC_String & | kNewFilePath | ) |
Change old file path to new one.
kNewFilePath | New path to be set. |
|
pure virtual |
Check whether the file does exist in the file system.
Implemented in CGUIDirInfoPOSIX, and CGUIDirInfoWin.
eC_String CGUIDirInfo::GetAbsPath | ( | ) | const |
Get the absolute path excluding the file name. Example: for the construct new CGUIDirInfo("filename.ext", "path/subpath") GetAbsPath_File will return path/subpath
eC_String CGUIDirInfo::GetAbsPath_File | ( | ) | const |
Get the absolute file path including the path and file name. Example: for the construct new CGUIDirInfo("filename.ext", "path/subpath") GetAbsPath_File will return path/subpath/filename.ext
eC_String CGUIDirInfo::GetFileBaseName | ( | ) | const |
Get the base name of the file name until the last '.'. Example: path/subpath/filename.ext.ext2 will become filename.ext
eC_String CGUIDirInfo::GetFileName | ( | ) | const |
Get the file name excluding the path of this file. Example: path/subpath/filename.ext will become filename.ext
eC_String CGUIDirInfo::GetFileSuffix | ( | ) | const |
Get suffix of the file name from the last '.'. Example: path/subpath/filename.ext.ext2 will become ext2 If there is no suffix, an empty string is returned.
|
pure virtual |
Get the group id of this file. Returns ID_UNKNOWN if groups are not supported.
Implemented in CGUIDirInfoPOSIX, and CGUIDirInfoWin.
|
pure virtual |
Get the group name of this file. Returns an empty string if groups are not supported.
Implemented in CGUIDirInfoPOSIX, and CGUIDirInfoWin.
|
pure virtual |
Get the ID of the file's owner. Returns ID_UNKNOWN if owner IDs are not supported.
Implemented in CGUIDirInfoPOSIX, and CGUIDirInfoWin.
|
pure virtual |
Get the name of the file's owner. Returns an empty string if owner names are not supported.
Implemented in CGUIDirInfoPOSIX, and CGUIDirInfoWin.
eC_String CGUIDirInfo::GetPath | ( | ) | const |
Get the file path excluding the file's name. This may be a relative path or absolute path according to the path given in constructor or ChangeFilePath. If the file path is a drive or root path, it is returned.
eC_String CGUIDirInfo::GetPath_File | ( | ) | const |
Get the file path including the file's name. This may be a relative path or absolute path according to the path given in constructor or ChangeFilePath.
|
pure virtual |
Get the size of the file.
Implemented in CGUIDirInfoPOSIX, and CGUIDirInfoWin.
|
protectedpure virtual |
Get the time according to the given file time type.
eFileTime | The file time type, i.e. Created, LatestModifed or LatestRead. |
Implemented in CGUIDirInfoPOSIX, and CGUIDirInfoWin.
|
pure virtual |
Get the time when the file was created.
Implemented in CGUIDirInfoPOSIX, and CGUIDirInfoWin.
|
pure virtual |
Get the time when the file was modified last time.
Implemented in CGUIDirInfoPOSIX, and CGUIDirInfoWin.
|
pure virtual |
Get the time when the file is read last time.
Implemented in CGUIDirInfoPOSIX, and CGUIDirInfoWin.
|
virtual |
Check whether the given file path is an absolute path or not.
|
pure virtual |
Check whether the file is a directory.
Implemented in CGUIDirInfoPOSIX, and CGUIDirInfoWin.
|
pure virtual |
Check whether the file is executable or not.
Implemented in CGUIDirInfoPOSIX, and CGUIDirInfoWin.
|
pure virtual |
Check whether the file is a file (not a directory).
Implemented in CGUIDirInfoPOSIX, and CGUIDirInfoWin.
|
pure virtual |
Check whether the file is a hidden file.
Implemented in CGUIDirInfoPOSIX, and CGUIDirInfoWin.
|
pure virtual |
Check whether the file is readable or not.
Implemented in CGUIDirInfoPOSIX, and CGUIDirInfoWin.
|
pure virtual |
Check whether the given file is a root directory or not.
Implemented in CGUIDirInfoPOSIX, and CGUIDirInfoWin.
|
pure virtual |
Check whether the file is a symlink.
Implemented in CGUIDirInfoPOSIX, and CGUIDirInfoWin.
|
pure virtual |
Check whether the file is a system file.
Implemented in CGUIDirInfoPOSIX, and CGUIDirInfoWin.
|
pure virtual |
Check whether the file is writable or not.
Implemented in CGUIDirInfoPOSIX, and CGUIDirInfoWin.
void CGUIDirInfo::MakePathAbs | ( | ) |
Make the path to be absolute if it is a relative path. If the path is already absolute, do nothing.
CGUIDirInfo & CGUIDirInfo::operator= | ( | const CGUIDirInfo & | kDirInfo | ) |
Assignment operator.
kDirInfo | The source object to be copied. |
|
pure virtual |
Get the name a symlink points to, or an empty string if the object isn't a symbolic link.
Implemented in CGUIDirInfoPOSIX, and CGUIDirInfoWin.
|
protected |
Stores the path of the current working directory.
|
protected |
Stores the file path.