29 #ifndef PT_SYSTEM_TAR_ENTRY_H
30 #define PT_SYSTEM_TAR_ENTRY_H
32 #include <Pt/System/Api.h>
33 #include <Pt/System/FileInfo.h>
34 #include <Pt/System/Path.h>
35 #include <Pt/DateTime.h>
102 {
return _avail == _remaining; }
117 {
return _remaining; }
140 {
return _linkTarget; }
145 {
return _permissions; }
180 { _linkTarget = target; }
185 { _permissions = p; }
199 std::size_t _size = 0;
200 std::size_t _remaining = 0;
201 std::size_t _avail = 0;
202 const char* _data = 0;
213 #endif // include guard
Core module.
Definition: Allocator.h:33
void setPermissions(Pt::System::FileInfo::Perms p)
Sets the POSIX permission bits.
Definition: TarEntry.h:184
void setSize(std::size_t size)
Sets the total content size in bytes.
Definition: TarEntry.h:159
const char * data() const
Pointer to the current content chunk of avail() bytes.
Definition: TarEntry.h:129
@ Directory
Directory.
Definition: TarEntry.h:70
void setRemaining(std::size_t remaining)
Sets the number of content bytes not yet delivered.
Definition: TarEntry.h:164
TarEntry()=default
Default constructor.
const Pt::DateTime & mtime() const
Last modification time of this entry.
Definition: TarEntry.h:149
Pt::System::FileInfo::Perms permissions() const
POSIX permission bits for this entry.
Definition: TarEntry.h:144
Perms
File permission flags.
Definition: FileInfo.h:117
Type
Entry type in the tar archive.
Definition: TarEntry.h:67
void setPath(const Pt::System::Path &path)
Sets the archive path.
Definition: TarEntry.h:154
bool isEnd() const
Returns true when the entire content has been delivered.
Definition: TarEntry.h:101
void setData(const char *data, std::size_t avail)
Sets the current data chunk pointer and the number of available bytes.
Definition: TarEntry.h:169
void setMtime(const Pt::DateTime &mtime)
Sets the modification time.
Definition: TarEntry.h:189
const Pt::System::Path & linkTarget() const
Target path for symbolic and hard links (UTF-8 encoded).
Definition: TarEntry.h:139
void setType(Type type)
Sets the entry type.
Definition: TarEntry.h:174
Represents a path in the file-system.
Definition: Path.h:48
const Pt::System::Path & path() const
Archive path of this entry (UTF-8 encoded).
Definition: TarEntry.h:106
@ Link
Symbolic link.
Definition: TarEntry.h:71
TarEntry & operator=(TarEntry &&)=default
Move assignment.
void setLinkTarget(const Pt::System::Path &target)
Sets the link target path.
Definition: TarEntry.h:179
TarEntry(TarEntry &&)=default
Move constructor.
std::size_t avail() const
Number of bytes readable at the current data() pointer.
Definition: TarEntry.h:121
Type type() const
Type of this archive entry (file, directory, link, or hard link).
Definition: TarEntry.h:134
std::size_t size() const
Total content size in bytes as stored in the archive header.
Definition: TarEntry.h:111
@ Invalid
Not yet set.
Definition: TarEntry.h:68
@ File
Regular file.
Definition: TarEntry.h:69
~TarEntry()=default
Destructor.
void clear()
Resets all fields to their default values.
Definition: TarEntry.h:93
@ Hardlink
Hard link.
Definition: TarEntry.h:72
Represents a single entry returned by TarReader.
Definition: TarEntry.h:62
Combined Date and Time value.
Definition: DateTime.h:66
std::size_t remaining() const
Content bytes not yet delivered by TarReader::advance().
Definition: TarEntry.h:116