ar-cpp
|
This is an automatically generated API documentation for the ar-cpp library.
We start by giving you some general information concerning the library. Then, we describe how you can use library.
The library uses the following naming conventions:
snake_case
, e.g. extract.h
. camelCase
, e.g. extract()
. CamelCase
, e.g. File
. The easiest way to use the library is to include the general header file ar.h
that includes all the necessary header files:
However, if you use only specific parts of the library, you can include just the used header files:
All the classes, functions, and constants the library provides are in the ar
namespace.
For simplicity, in this API documentation, this namespace is omitted, e.g. it uses just File
instead of ar::File
.
The library uses exceptions to signal errors. The base class of all custom exceptions thrown by the library is Error. Currently, the following Error subclasses may be thrown:
The present section describes how to use the library to work with archives.
To extract an archive, call extract() and pass it your archive:
Also, if you need, you can create an archive from a given content and file name, both given as a std::string:
The above call creates a virtual file in memory that does not correspond to any real file on your filesystem.
The extract() function returns a vector-like container of the extracted files. Each file is a subclass of File. You can iterate over the files, obtain info about them, and store them to the filesystem. For example, the following snippet prints the name of each file to the standard output and saves the extracted files to the current working directory:
See the File class for a complete list of member functions it provides.
The following example extracts the given archive to the current working directory and prints the name of each extracted file.
If you have any remarks or questions concerning the library, feel free to contact me.