1 #ifndef UTIL_COMPRESS__ARCHIVE__HPP
2 #define UTIL_COMPRESS__ARCHIVE__HPP
78 fUpdate = (1<<4) | fOverwrite,
80 fBackup = (1<<5) | fOverwrite,
84 fPreserveOwner = (1<<7),
86 fPreserveMode = (1<<8),
92 fPreserveTime = (1<<9),
94 fPreserveAll = fPreserveOwner | fPreserveMode | fPreserveTime,
97 fFollowLinks = (1<<2),
103 fSkipUnsupported = (1<<15),
106 fDefault = fOverwrite | fPreserveAll
145 virtual void Create(
void);
151 virtual void Close(
void);
160 virtual unique_ptr<TEntries> List(
void);
171 virtual unique_ptr<TEntries>
Test(
void);
182 virtual unique_ptr<TEntries> Extract(
void);
199 void*
buf,
size_t buf_size,
216 void** buf_ptr,
size_t* buf_size_ptr);
253 virtual unique_ptr<TEntries> Append(
const string& path,
280 virtual unique_ptr<CArchive::TEntries>
281 AppendFileFromMemory(
const string& name_in_archive,
282 void*
buf,
size_t buf_size,
299 virtual const string&
GetBaseDir(
void)
const {
return m_BaseDir; }
305 virtual void SetBaseDir(
const string& dirname);
348 EMaskType
type = eFullPathMask,
357 void UnsetMask(EMaskType
type);
358 void UnsetMask(
void);
384 bool HaveSupport(ESupportFeature feature,
int param = 0);
398 eCreate = (1 << 8) | eWO,
399 eAppend = (1 << 9) | eWO,
400 eList = (1 << 10) | eRO,
401 eUpdate = eList | eAppend,
402 eExtract = (1 << 11) | eRO,
403 eTest = eList | eExtract
437 virtual void SkipEntry (
void);
438 virtual void TestEntry (
void);
439 virtual void ExtractEntry(
const CDirEntry& dst);
440 virtual void AppendEntry (
const string& path,
ELevel level);
452 unique_ptr<TEntries> x_ReadAndProcess(
EAction action);
455 unique_ptr<TEntries> x_Append(
const string& path,
457 const string& comment,
467 void x_ExtractEntry(
const TEntries* prev_entries);
518 virtual void Open(
EAction action);
561 virtual void Create(
size_t initial_allocation_size);
562 virtual void Create(
void);
574 void Save(
const string& filename);
584 void Load(
const string& filename);
602 virtual void Finalize(
void** buf_ptr,
size_t* buf_size_ptr);
606 virtual void Open(
EAction action);
682 virtual void Create(
void);
690 virtual void Close(
void);
694 virtual void Open(
EAction action);
CArchiveCompressionFileStream – file stream/descriptor based compression stream archive.
CArchiveFile – file-based archive.
CArchiveMemory – memory-based archive.
CArchiveZip – implementation of IArchive interface for ZIP-archives.
CArchive - base class for file- or memory-based archives.
static void Test(const char *bind1, SQLSMALLINT type1, const char *bind2, SQLSMALLINT type2)
@ eNoOwnership
No ownership is assumed.
virtual bool Checkpoint(const CArchiveEntryInfo &, EAction)
Return false to skip the current entry when processing.
CArchiveCompressionFileStream & operator=(const CArchiveCompressionFileStream &)
CArchiveMemory(const CArchiveMemory &)
int m_fd
File/socket descriptor.
CArchiveFile(const CArchiveFile &)
CArchiveMemory & operator=(const CArchiveMemory &)
size_t m_InitialAllocationSize
< Initial allocation size for created archive
EOpenMode
Archive open mode.
IArchive::ELocation m_Location
Archive location (file/memory)
EFormat m_Format
Archive format.
unsigned int TFlags
Bitwise OR of EFlags.
unique_ptr< IArchive > m_Archive
Pointer to interface to EFormat-specific archive support.
string m_BaseDir
Base directory for relative paths.
CArchiveCompressionFileStream(const CArchiveCompressionFileStream &)
ELocation
Archive location.
const void * m_Buf
Buffer where the opening archive is located.
size_t m_BufSize
Size of m_Buf.
bool m_Modified
True after at least one write.
virtual const string & GetBaseDir(void) const
Get base directory to use for files while extracting from/adding to the archive, and in the latter ca...
virtual TFlags GetFlags(void) const
Get flags.
string m_FileName
Archive file name.
list< CArchiveEntryInfo > TEntries
Define a list of entries.
size_t(* Callback_Write)(const CArchiveEntryInfo &info, const void *buf, size_t n)
Type of user-defined callback for extraction from archive.
CArchiveEntryInfo m_Current
Information about current entry being processed.
CArchive(const CArchive &)
AutoArray< char > m_OwnBuf
Holder for the pointer to memory buffer that will be automatically deallocated if we own it (used for...
TFlags m_Flags
Bitwise OR of flags.
CArchive & operator=(const CArchive &)
SMask m_MaskFullPath
Set of masks for operations (full path)
CArchiveFile & operator=(const CArchiveFile &)
EOpenMode m_OpenMode
What was it opened for.
EAction
Action, performed on the archive.
virtual void SetFlags(TFlags flags)
Set flags.
SMask m_MaskPattern
Set of masks for operations (path components)
FILE * m_FileStream
File stream, can be based on m_fd.
virtual void Open(EAction action)=0
Open archive.
CCompression::ELevel ELevel
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
ECase
Which type of string comparison.
@ eNocase
Case insensitive compare.
enum ENcbiOwnership EOwnership
Ownership relations between objects.
static SERV_ITER x_Open(const char *service, int ismask, TSERV_Type types, unsigned int preferred_host, unsigned short preferred_port, double preference, const SConnNetInfo *net_info, SSERV_InfoCPtr skip[], size_t n_skip, int external, const char *arg, const char *val, SSERV_Info **info, HOST_INFO *host_info)
NCBI_XUTIL_EXPORT
Parameter to control printing diagnostic message about conversion of static array data from a differe...