![]() |
|
Class for writing a zip file. More...
#include <zipFile.h>
Public Member Functions | |
| SDF_API | SdfZipFileWriter () |
| Create an invalid SdfZipFileWriter object. | |
| SDF_API | ~SdfZipFileWriter () |
| Calls Save() | |
| SdfZipFileWriter (const SdfZipFileWriter &)=delete | |
| SdfZipFileWriter & | operator= (const SdfZipFileWriter &)=delete |
| SDF_API | SdfZipFileWriter (SdfZipFileWriter &&rhs) |
| SDF_API SdfZipFileWriter & | operator= (SdfZipFileWriter &&rhs) |
| SDF_API | operator bool () const |
| Returns true if this is a valid object, false otherwise. | |
| SDF_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. | |
| SDF_API bool | Save () |
| Finalizes the zip archive and saves it to the destination file path. | |
| SDF_API void | Discard () |
| Discards the zip archive so that it is not saved to the destination file path. | |
Static Public Member Functions | |
| static SDF_API SdfZipFileWriter | 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.
| SDF_API SdfZipFileWriter | ( | ) |
Create an invalid SdfZipFileWriter object.
| SDF_API ~SdfZipFileWriter | ( | ) |
Calls Save()
| SDF_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.
| SDF_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 |
| SDF_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.