/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// #ifndef _ZIP_UTILS_H #define _ZIP_UTILS_H #include "OdPlatformSettings.h" #include "StringArray.h" #include "FormattingUtils.h" #include namespace OdDAI { /** \details A class that provides functionality for working with archive folder. */ class DiskFolder; /** \details A data type that represents a smart pointer to an object. */ typedef OdSmartPtr DiskFolderPtr; } /** \details Contains declarations related to working with Zip files content. */ namespace ZipUtils { /** \details Unzips file to directory. \param filePath [in] A string containing path to the zip file. \param targetDir [in] A string containing name of the target directory. \param overwriteTargetDir [in] Return error if false and target directory is not empty; otherwise, overwrite target directory. \returns Returns appropriate error code. */ OdResult unzipFile(const OdString &filePath, const OdString &targetDir, bool overwriteTargetDir = true); /** \details Unzips file to directory or memory. \param filePath [in] A string containing path to the zip file. \param targetFolder [in] An object containing name of the target directory. \param overwriteTargetDir [in] Instructs whether to overwrite target directory; If true, targetFolder must not be empty. \returns Returns appropriate error code. \remarks Depending on the targetFolder settings function may unpack files to memory instead of disk. * OdDAI::DiskFolder::UnzipToMemory::Force will force unzip to memory and fail if memory is not available; * OdDAI::DiskFolder::UnzipToMemory::Auto will unzip into memory only files below the certain size and unzip to disk if memory is not available; * OdDAI::DiskFolder::UnzipToMemory::No will unzip files to the disk. */ OdResult unzipFile(const OdString &filePath, OdDAI::DiskFolderPtr &targetFolder, bool overwriteTargetDir = true); /** \details Zips directory to file. \param targetFile [in] A string containing path to the target zip file. \param filesDir [in] A string containing name of the source directory. \param overwriteTargetFile [in] Return error if false and target file exists; otherwise, overwrite target file. \returns Returns appropriate error code. */ OdResult zipToFile(const OdString &targetFile, const OdString &filesDir, bool overwriteTargetFile = true); } //namespace ZipUtils #endif // _ZIP_UTILS_H