About
maxon::WriteArchiveInterface and maxon::ReadArchiveInterface are generic interfaces giving access to archive files. These interfaces are typically used to read and write ZIP files.
Writer
The maxon::WriteArchiveInterface allows to create archive files and to add virtual files to the archive.
Implementations of this interface are registered at the maxon::WriteArchiveClasses registry and are also accessible as published object:
- maxon::WriteArchiveClasses::Zip: Implementation to write ZIP archives.
 
  
 
  
  const maxon::WriteArchiveRef zipArchive = maxon::WriteArchiveClasses::Zip().Create() 
iferr_return;
 
 
  
 
  
 
  
 
  
  zipArchive.CreateFile(
"exampleFolder/text.txt"_s, time, 
method, attributes, 0) 
iferr_return;
 
 
  
Definition: datetime.h:231
 
static UniversalDateTime GetNow()
 
IOARCHIVESTOREMETHOD
Compression methods for files in archives.
Definition: ioarchivehandler.h:23
 
@ DEFLATE
Deflates the file in the archive.
 
IOATTRIBUTES
Attributes of Url.
Definition: ioenums.h:103
 
#define iferr_return
Definition: resultbase.h:1531
 
struct _Py_Identifier struct _Py_Identifier PyObject struct _Py_Identifier PyObject PyObject struct _Py_Identifier PyObject PyObject PyObject ** method
Definition: object.h:330
 
  
Reader
The maxon::ReadArchiveInterface allows to open and read archive files.
Implementations of this interface are registered at the maxon::ReadArchiveClasses registry and are also accessible as published object:
- maxon::ReadArchiveClasses::Zip: Implementation of read ZIP archives.
 
  
 
  
                            {
                              
                              return true;
                            };
 
  
  const maxon::ReadArchiveRef zipArchive = maxon::ReadArchiveClasses::Zip().Create() 
iferr_return;
 
 
  
 
  
 
  
PyCompilerFlags * flags
Definition: ast.h:14
 
Definition: resultbase.h:766
 
Definition: string.h:1287
 
IOARCHIVEEXTRACTFLAGS
Extract Flags used in ReadArchiveInterface::Extract() and ReadArchiveInterface::ExtractSingleFile().
Definition: ioarchivehandler.h:33
 
@ OVERWRITE_EXISTING_FILE
Overwrites the file silently if it already exists in the directory.
 
  
File Formats
These maxon::FileFormatHandler allow to browse an archive file or to easily read it:
- maxon::FileFormatHandlers::ZipDirectoryBrowser: Creates a maxon::IoBrowseRef to browse the virtual files of a ZIP file.
 
- maxon::FileFormatHandlers::GZipDirectoryBrowser: Creates a maxon::IoBrowseRef to browse the virtual files of a GZip file.
 
- maxon::FileFormatHandlers::ZipArchiveHandler: Creates a maxon::ReadArchiveRef to read file from a ZIP file.
 
  
 
  
  const maxon::FileFormatHandler& zipDirBrowser = maxon::FileFormatHandlers::ZipDirectoryBrowser();
  auto handler = zipDirBrowser.CreateHandler<maxon::IoBrowseRef>(zipFile);
 
  
  for (auto it : handler)
  {
    const maxon::IoBrowseRef& browseIterator = (it)
iferr_return;
 
  }
  
 
{
 
  
 
  const maxon::Url      currentFile = browseIterator.GetCurrentPath();
 
 
  
 
  
  {
 
    
    {
      const maxon::IoBrowseRef& subIterator = (subIt)
iferr_return;
 
    }
  }
}
return OK
Definition: apibase.h:2740
 
@ NONE
No flags specified.
 
#define DiagnosticOutput(formatString,...)
Definition: debugdiagnostics.h:170
 
IODETECT
Return value of IoDetect().
Definition: ioenums.h:40
 
@ DIRECTORY
Url is a directory, you can use GetBrowseIterator to iterate through the children.
 
PyObject ** type
Definition: pycore_pyerrors.h:34
 
#define iferr_scope
Definition: resultbase.h:1396
 
    
 
  
  const maxon::FileFormatHandler& handler = maxon::FileFormatHandlers::ZipArchiveHandler();
  const maxon::ReadArchiveRef     zipArchive = handler.CreateHandler<maxon::ReadArchiveRef>(
maxon::Url()) 
iferr_return;
 
 
  
 
  
 
  
  
Further Reading