|
Class for writing a zip file. More...
#include <zipFile.h>
Public Member Functions | |
USD_API | UsdZipFileWriter () |
Create an invalid UsdZipFileWriter object. | |
USD_API | ~UsdZipFileWriter () |
Calls Save() | |
UsdZipFileWriter (const UsdZipFileWriter &)=delete | |
UsdZipFileWriter & | operator= (const UsdZipFileWriter &)=delete |
USD_API | UsdZipFileWriter (UsdZipFileWriter &&rhs) |
USD_API UsdZipFileWriter & | operator= (UsdZipFileWriter &&rhs) |
USD_API | operator bool () const |
Returns true if this is a valid object, false otherwise. | |
USD_API std::string | AddFile (const std::string &filePath, const std::string &filePathInArchive=std::string()) |
Adds the file at filePath to the zip archive with no compression applied. | |
USD_API bool | Save () |
Finalizes the zip archive and saves it to the destination file path. | |
USD_API void | Discard () |
Discards the zip archive so that it is not saved to the destination file path. | |
Static Public Member Functions | |
static USD_API UsdZipFileWriter | CreateNew (const std::string &filePath) |
Create a new file writer with filePath as the destination file path where the zip archive will be written. | |
Class for writing a zip file.
This class is primarily intended to support the .usdz file format. It is not a general-purpose zip writer, as it does not implement the full zip file specification. However, all files written by this class should be valid zip files and readable by external zip libraries and utilities.
USD_API UsdZipFileWriter | ( | ) |
Create an invalid UsdZipFileWriter object.
USD_API ~UsdZipFileWriter | ( | ) |
Calls Save()
USD_API std::string AddFile | ( | const std::string & | filePath, |
const std::string & | filePathInArchive = std::string() |
||
) |
Adds the file at filePath
to the zip archive with no compression applied.
If filePathInArchive
is non-empty, the file will be added at that path in the archive. Otherwise, it will be added at filePath
.
Returns the file path used to identify the file in the zip archive on success. This path conforms to the zip file specification and may not be the same as filePath
or filePathInArchive
. Returns an empty string on failure.
|
static |
Create a new file writer with filePath
as the destination file path where the zip archive will be written.
The zip file will not be written to filePath
until the writer is destroyed or Save() is called.
Returns an invalid object on error.
USD_API void Discard | ( | ) |
Discards the zip archive so that it is not saved to the destination file path.
Once discarded, the file writer is invalid and may not be reused.
|
inlineexplicit |
USD_API bool Save | ( | ) |
Finalizes the zip archive and saves it to the destination file path.
Once saved, the file writer is invalid and may not be reused. Returns true on success, false otherwise.