tbx
0.7.6
|
Class to hold the catalogue information for a file. More...
#include <path.h>
Classes | |
class | Iterator |
Iterator used to iterate through a directory. More... | |
Public Types | |
enum | ObjectType { NOT_FOUND, FILE, DIRECTORY, IMAGE_FILE } |
enum | Attribute { OWNER_READ = 0x1, OWNER_WRITE = 0x2, OWNER_LOCKED = 0x8, OTHER_READ = 0x10, OTHER_WRITE = 0x20, OTHER_LOCKED = 0x80 } |
Public Member Functions | |
PathInfo () | |
Construct and empty PathInfo not referring to any file. | |
PathInfo (const PathInfo &other) | |
Copy constructor. More... | |
PathInfo & | operator= (const PathInfo &other) |
Assign to the value of another PathInfo. More... | |
bool | operator== (const PathInfo &other) |
Checks if this path info is identical to another. More... | |
bool | operator!= (const PathInfo &other) |
Checks if this path info is different to another. More... | |
bool | read (const Path &path) |
Read catalogue information for the given path. More... | |
bool | read_raw (const Path &path, bool calc_file_type) |
Read catalogue information for the given path always returning the raw load/exec address. More... | |
const std::string & | name () const |
Get the leaf name of the object the information if for. More... | |
ObjectType | object_type () const |
Return the object type read for this path. More... | |
bool | exists () const |
bool | file () const |
bool | directory () const |
bool | image_file () const |
bool | has_file_type () const |
Check if this path info has file type information. More... | |
int | file_type () const |
Get the file type of the object. More... | |
int | raw_file_type () const |
Return the file type from the load/exec address. More... | |
UTCTime | modified_time () const |
Return the modification time of the file if it has it. More... | |
bool | has_load_address () const |
Check if path info has a load address and executable address. More... | |
unsigned int | load_address () const |
Get the load address for this PathInfo. More... | |
unsigned int | exec_address () const |
Get the executable address for this PathInfo. More... | |
int | length () const |
Get the length of this object on the file system. More... | |
int | attributes () const |
Return the objects file attributes. More... | |
Static Public Member Functions | |
static PathInfo::Iterator | begin (const Path &path, const std::string &wildCard) |
Returns an iterator for the given path that will return the PathInfo information for each object matched. More... | |
static PathInfo::Iterator | begin (const Path &path) |
Returns an iterator for the given path that will return the PathInfo information for all objects in the directory. More... | |
static PathInfo::Iterator | end () |
Get iterator for checking end of iteration of a path. More... | |
Protected Attributes | |
std::string | _name |
ObjectType | _object_type |
unsigned int | _load_address |
unsigned int | _exec_address |
int | _length |
int | _attributes |
int | _file_type |
Friends | |
class | Iterator::IterBlock |
Class to hold the catalogue information for a file.
Attributes of an object. 0 or more of these will be combined using the | operation.
Enumerator | |
---|---|
OWNER_WRITE | Read access for owner |
OWNER_LOCKED | Write access for owner |
OTHER_READ | Object locked against owner deletion |
OTHER_WRITE | Read access for others |
OTHER_LOCKED | Write access for others |
int PathInfo::attributes | ( | ) | const |
Return the objects file attributes.
The lower byte of the attributes are 0 or more of the values in the PathInfo::Attribute enum ored together.
|
static |
Returns an iterator for the given path that will return the PathInfo information for all objects in the directory.
path | directory to iterate |
|
static |
Returns an iterator for the given path that will return the PathInfo information for each object matched.
path | directory to iterate |
wildCard | wild carded string for iteration |
|
inline |
Returns true if object is a directory on the file system
|
static |
Get iterator for checking end of iteration of a path.
unsigned int PathInfo::exec_address | ( | ) | const |
Get the executable address for this PathInfo.
This value only refers to a real executable address if has_load_address is true
|
inline |
Returns true if object exists on the file system
|
inline |
Returns true if object is a file on the file system
int PathInfo::file_type | ( | ) | const |
Get the file type of the object.
bool PathInfo::has_file_type | ( | ) | const |
Check if this path info has file type information.
bool PathInfo::has_load_address | ( | ) | const |
Check if path info has a load address and executable address.
|
inline |
Returns true if object is am image file on the file system
int PathInfo::length | ( | ) | const |
Get the length of this object on the file system.
unsigned int PathInfo::load_address | ( | ) | const |
Get the load address for this PathInfo.
This value only refers to a real load address if has_load_address is true
UTCTime PathInfo::modified_time | ( | ) | const |
Return the modification time of the file if it has it.
|
inline |
Get the leaf name of the object the information if for.
PathInfo::ObjectType PathInfo::object_type | ( | ) | const |
Return the object type read for this path.
bool PathInfo::operator!= | ( | const PathInfo & | other | ) |
Checks if this path info is different to another.
Note: name check is case-sensitive
other | PathInfo to check |
bool PathInfo::operator== | ( | const PathInfo & | other | ) |
Checks if this path info is identical to another.
Note: name check is case-sensitive
other | PathInfo to check |
int PathInfo::raw_file_type | ( | ) | const |
Return the file type from the load/exec address.
For image FS files it will return the actual file type of the image file whereas file_type returns 0x1000 (directory).
The return value is undefined for directories/applications or files that do not have file types.
The file_type() must be -1 or the PathInfo read with the read_raw functions for this to give the correct results.
bool PathInfo::read | ( | const Path & | path | ) |
Read catalogue information for the given path.
path | Path referring to a location on a file system |
bool PathInfo::read_raw | ( | const Path & | path, |
bool | calc_file_type | ||
) |
Read catalogue information for the given path always returning the raw load/exec address.
This can be used to get the actual file type for an ImageFS directory.
path | Path referring to a location on a file system |
calc_file_type | true to calculate file type from the returned catalogue information, if false file_type -1 will always be returned. |
|
protected |
object attributes
|
protected |
Executable address
|
protected |
object file type
|
protected |
Length of object
|
protected |
Load address
|
protected |
Name of the file system object
|
protected |
Object type