///////////////////////////////////////////////////////////////////////////////
// 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 _DAI_DISK_FOLDER_H
#define _DAI_DISK_FOLDER_H
#include "RxObject.h"
#include "OdString.h"
#include "OdArray.h"
#include "MemoryStream.h"
#define STL_USING_MAP
#include "OdaSTL.h"
#include "daiBuildOptions.h"
#include "TD_PackPush.h"
/** \details
Contains declarations related to working with Zip files content.
*/
namespace OdDAI {
/** \details
A class that provides functionality for working with archive folder.
*/
class DAI_EXPORT DiskFolder : public OdRxObject
{
public:
/** \details
A class that provides structure for working with files in memory.
*/
class File
{
public:
OdString m_fileName;
OdMemoryStreamPtr m_pMemoryStream;
};
/** \details
Enumeration for unzip modes.
*/
enum class UnzipToMemory
{
/**Do not unzip to memory*/
No = 0,
/**Try unzip to memory if file size is less than set maximum size*/
Auto,
/**Force unzip to memory*/
Force
};
//DOM-IGNORE-BEGIN
ODRX_DECLARE_MEMBERS(DiskFolder);
//DOM-IGNORE-END
/** \details
Creates a new archive folder object.
\param folder [in] A string containing path to archive working folder.
\returns Returns a smart pointer to the created instance.
*/
static OdSmartPtr createObject(const OdString &folder);
/** \details
Destroys archive folder.
*/
~DiskFolder();
/** \details
Gets a path to an archive folder.
\returns a string that contains path to an archive folder.
*/
const OdString& getFolder() const;
/** \details
Sets a new unzip mode value.
\param unzipMode [in] An unzip mode to be assigned.
*/
void setUnzipMode(UnzipToMemory unzipMode);
/** \details
Retrieves the unzip mode value.
\returns An unzip mode flag value.
*/
const UnzipToMemory getUnzipMode() const;
/** \details
Sets a new maximum unzip memory buffer size.
\param maxMemoryBufferSize [in] A maximum memory buffer size to be assigned.
*/
void setMaxMemoryBufferSize(OdUInt64 maxMemoryBufferSize);
/** \details
Retrieves the maximum unzip memory buffer size.
\returns A maximum memory buffer size.
*/
const OdUInt64 getMaxMemoryBufferSize() const;
/** \details
Adds a new object to the disk folder.
\param file [in] A object to be added.
*/
void addFile(File& file);
/** \details
Retrieves the collection of objects associated with this instance.
\returns Collection of objects.
\remarks
Retrieved collection can be modified.
*/
OdArray& getFiles();
/** \details
Retrieves the collection of objects associated with this instance.
\returns Collection of objects.
\remarks
Retrieved collection can't be modified.
*/
const OdArray& getFiles() const;
//DOM-IGNORE-BEGIN
protected:
OdString m_folder;
UnzipToMemory m_unzipMode;
OdUInt64 m_maxMemoryBufferSize;
OdArray m_files;
//DOM-IGNORE-END
};
/** \details
A data type that represents a smart pointer to an object.
*/
typedef OdSmartPtr DiskFolderPtr;
/** \details
A data type that represents an STD map of pairs consisting of OdGUID and a pointer to an objects.
*/
typedef std::map DiskFolderMap;
} //namespace OdDAI
#include "TD_PackPop.h"
#endif // _DAI_DISK_FOLDER_H