29 #ifndef Pt_System_FileInfo_h
30 #define Pt_System_FileInfo_h
32 #include <Pt/System/Api.h>
33 #include <Pt/System/Path.h>
34 #include <Pt/DateTime.h>
35 #include <Pt/String.h>
136 UnknownPerms = 0xFFFF
189 {
return FileInfo::isLink(_path); }
199 static bool isLink(
const Path& path);
222 {
return type(path) != Invalid; }
267 return static_cast<FileInfo::Perms>(
static_cast<int>(a) |
static_cast<int>(b));
276 return static_cast<FileInfo::Perms>(
static_cast<int>(a) &
static_cast<int>(b));
285 return static_cast<FileInfo::Perms>(
static_cast<int>(a) ^
static_cast<int>(b));
358 #endif // Pt_System_FileInfo_h
Type
File-node type.
Definition: FileInfo.h:108
Core module.
Definition: Allocator.h:33
static void remove(const Path &path)
Removes a file or directory.
bool operator==(const FileInfo &a, const FileInfo &b)
Compare two FileInfo objects.
Definition: FileInfo.h:340
static Pt::uint64_t size(const Path &path)
Returns the size of the file in bytes.
Provides information about a node in the file-system.
Definition: FileInfo.h:104
static void removeAll(const Pt::System::Path &path)
Removes a directory and its contents.
FileInfo::Perms operator|(FileInfo::Perms a, FileInfo::Perms b)
Bitwise OR for FileInfo permission flags.
Definition: FileInfo.h:265
Pt::uint64_t size() const
Returns the file size.
Definition: FileInfo.h:181
FileInfo::Perms & operator|=(FileInfo::Perms &a, FileInfo::Perms b)
Bitwise OR assignment for FileInfo permission flags.
Definition: FileInfo.h:301
FileInfo(const Pt::String &path)
Constructs from the path.
~FileInfo()
Destructor.
Definition: FileInfo.h:166
Perms permissions() const
Returns the file permissions.
Definition: FileInfo.h:192
uint_type uint64_t
Unsigned 64-bit integer type.
Definition: Api-Types.h:62
FileInfo(const Path &path)
Constructs from the path.
static void createDirectory(const Path &path)
Creates a new directory.
FileInfo::Perms operator^(FileInfo::Perms a, FileInfo::Perms b)
Bitwise XOR for FileInfo permission flags.
Definition: FileInfo.h:283
Type type() const
Returns the file type.
Definition: FileInfo.h:185
static Perms permissions(const Path &path)
Returns the permissions of the file at the path.
const Path & path() const
Returns the full path of node in the file-system.
Definition: FileInfo.h:177
FileInfo()
Default constructor.
Definition: FileInfo.h:150
FileInfo::Perms operator~(FileInfo::Perms a)
Bitwise NOT for FileInfo permission flags.
Definition: FileInfo.h:292
FileInfo::PermOptions operator|(FileInfo::PermOptions a, FileInfo::PermOptions b)
Bitwise OR for FileInfo permission options.
Definition: FileInfo.h:321
Perms
File permission flags.
Definition: FileInfo.h:117
static void move(const Path &path, const Path &to)
Moves a file or directory.
FileInfo(const char *path)
Constructs from the path.
static Type type(const Path &path)
Returns the type of file at the path.
static void resize(const Path &path, Pt::uint64_t n)
Resizes a file.
static void permissions(const Path &path, Perms prms, PermOptions opts=PermReplace)
Sets the permissions of the file at the path.
static void createHardlink(const Path &target, const Path &link)
Creates a hard link at link pointing to target.
Represents a path in the file-system.
Definition: Path.h:48
static void createFile(const Path &path)
Creates a new file.
static void createSymlink(const Path &target, const Path &link)
Creates a symbolic link at link pointing to target.
static DateTime lastModified(const Path &path)
Returns the time when last modified.
bool operator!=(const FileInfo &a, const FileInfo &b)
Compare two FileInfo objects.
Definition: FileInfo.h:349
Unicode capable basic_string.
Definition: Api-String.h:44
static bool exists(const Path &path)
Returns true if a file or directory exists at the path.
Definition: FileInfo.h:221
static void createDirectories(const Path &path)
Creates a new directory.
PermOptions
Options for modifying permissions.
Definition: FileInfo.h:141
void clear()
Clears the state.
FileInfo::Perms & operator&=(FileInfo::Perms &a, FileInfo::Perms b)
Bitwise AND assignment for FileInfo permission flags.
Definition: FileInfo.h:311
FileInfo::Perms operator&(FileInfo::Perms a, FileInfo::Perms b)
Bitwise AND for FileInfo permission flags.
Definition: FileInfo.h:274
Combined Date and Time value.
Definition: DateTime.h:66
bool operator<(const FileInfo &a, const FileInfo &b)
Compare two FileInfo objects.
Definition: FileInfo.h:331