Archive

The common template for all archives. Each archive format is implemented as a Policy class which supplies necessary types and methods specific to that format. Reference this class to find the methods available to all archives, but use the docs for your specific format to find methods/members available for your specific format.

Constructors

this
this(void[] data)

Constructor for archives which initializes the archive with the contents of the serialized archive stored in data.

this
this()

Constructor for read/write archives which does not require serialized data to create.

Members

Aliases

Directory
alias Directory = T.DirectoryImpl

Alias to allow for easy referencing the proper archive Directory member type for Policy.

File
alias File = T.FileImpl

Alias to allow for easy referencing the proper archive File member type for Policy.

Properties
alias Properties = T.Properties

(Optional) Alias to allow for easy referencing the proper archive Properties type for Policy. e.g. Tar archives do not have any archive-wide properties, while zip files have an archive comment.

Functions

addDirectory
Directory addDirectory(string path)

Adds a directory to the archive. If the path to the directory contains directories that are not in the archive, they are added. If the directory already exists it is not replaced with an empty directory.

addFile
void addFile(File member)

Adds a file to the archive. If the path to the file contains directories that are not in the archive, they are added.

getDirectory
Directory getDirectory(string path)
getFile
File getFile(string path)
numDirectories
size_t numDirectories(size_t n)
numFiles
size_t numFiles(size_t n)
numMembers
size_t numMembers(size_t n)
removeDirectory
bool removeDirectory(string path)

Removes a directory (and all contained files and directories) from the archive.

removeEmptyDirectories
void removeEmptyDirectories()

Removes all directories in the archive with no direct files or files in subdirectories.

removeFile
bool removeFile(string path)

Removes a file from the archive.

serialize
void[] serialize()

Serializes the archive.

Properties

directories
int delegate(int delegate(ref Directory)) directories [@property getter]

Provides access to all directories in the archive via a delegate method. This allows use in foreach loops.

files
int delegate(int delegate(ref File)) files [@property getter]

Provides access to all files in the archive via a delegate method. This allows use in foreach loops.

members
int delegate(int delegate(ref ArchiveMember)) members [@property getter]

Provides access to all files and directories in the archive via a delegate method. This allows use in foreach loops.

Variables

properties
Properties properties;

(Optional) Archive-wide properties for the format associated with Policy. e.g. Tar archives do not have any archive-wide properties, while zip files have an archive comment.

root
Directory root;

The root directory of the archive. Public here to allow for manual recursive algorithms.

Meta