#include <cxxtools/fileinfo.h>
Public Types | |
| enum | Type { Invalid = 0, Directory = 1, File = 2 } |
| File-node type. | |
Public Member Functions | |
| FileInfo () | |
| Default constructor. | |
| FileInfo (const std::string &path) | |
| Constructs a FileInfo object from the path path. | |
| FileInfo (const FileInfo &fi) | |
| Copy constructor. | |
| ~FileInfo () | |
| Destructor. | |
| FileInfo & | operator= (const FileInfo &fi) |
| Assignment operator. | |
| Type | type () const |
| Returns the type of the file node. | |
| const std::string & | path () const |
| std::string | name () const |
| Returns the full path of node in the file-system. | |
| std::string | dirName () const |
| Returns the parent directory path. | |
| std::size_t | size () const |
| Returns the size of the file in bytes. | |
| bool | isDirectory () const |
| Returns true if the node is a directory. | |
| bool | isFile () const |
| Returns true if the node is a file. | |
| void | remove () |
| Removes the file node. | |
| void | move (const std::string &to) |
| Moves the file node to the location given by to. | |
Static Public Member Functions | |
| static bool | exists (const std::string &path) |
| Returns true if a file or directory exists at path. | |
| static Type | getType (const std::string &path) |
| Returns the type of file at path. | |
| std::string name | ( | ) | const |
This method may return a relative path, or a fully qualified one depending on how this object was constructed.
| std::string dirName | ( | ) | const |
This method might return an empty string if the node was created without a complete path. If the directory is located in the root directory of a unix file system, a slash ("/") is returned. A returned directory path always ends with a trailing path separator character. (A backslash in Windows and a slash in Unix, for example.)
| void remove | ( | ) |
This object will be invalid after calling this method.
| void move | ( | const std::string & | to | ) |
The object will stay valid after this method was called and point to the moved file node.