NCBI C++ ToolKit
archive.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef UTIL_COMPRESS__ARCHIVE__HPP
2 #define UTIL_COMPRESS__ARCHIVE__HPP
3 
4 /* $Id: archive.hpp 94317 2021-07-20 16:45:02Z ivanov $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors: Vladimir Ivanov
30  *
31  * File Description:
32  * Compression archive API.
33  *
34  */
35 
36 /// @file archive.hpp
37 /// Archive API.
38 
40 
41 
42 /** @addtogroup Compression
43  *
44  * @{
45  */
46 
48 
49 
50 // Forward declarations
51 class CArchiveZip;
52 
53 
54 //////////////////////////////////////////////////////////////////////////////
55 ///
56 /// CArchive - base class for file- or memory-based archives.
57 ///
58 /// Do not use it directly, use CArchiveFile or CArchiveMemory instead.
59 /// Throws exceptions on errors.
60 
62 {
63 public:
64  // Type definitions
66 
67  /// Archive formats
68  enum EFormat {
69  eZip
70  };
71 
72  /// General flags
73  enum EFlags {
74  // --- Extract --- (fUpdate also applies to Update)
75  /// Allow to overwrite destinations with entries from the archive
76  fOverwrite = (1<<3),
77  /// Only update entries that are older than those already existing
78  fUpdate = (1<<4) | fOverwrite,
79  /// Backup destinations if they exist (all entries including dirs)
80  fBackup = (1<<5) | fOverwrite,
81  /// If destination entry exists, it must have the same type as source
82  fEqualTypes = (1<<6),
83  /// Create extracted files with the original ownership
84  fPreserveOwner = (1<<7),
85  /// Create extracted files with the original permissions
86  fPreserveMode = (1<<8),
87  /// Preserve date/times for extracted files
88  /// Note, that some formats, as zip for example, store modification
89  /// time only, so creation and last access time will be the same as
90  /// modification time. And even it can be a little bit off due a
91  /// rounding errors.
92  fPreserveTime = (1<<9),
93  /// Preserve all file attributes
94  fPreserveAll = fPreserveOwner | fPreserveMode | fPreserveTime,
95  // --- Extract/Append/Update ---
96  /// Follow symbolic links (instead of storing/extracting them)
97  fFollowLinks = (1<<2),
98  // --- Extract/List/Append/Update ---
99  /// Skip unsupported entries rather than making files out of them
100  /// when extracting (the latter is the default POSIX requirement).
101  /// On adding entry of unsupported type to the archive it will be
102  /// skipping also.
103  fSkipUnsupported = (1<<15),
104  // --- Miscellaneous ---
105  /// Default flags
106  fDefault = fOverwrite | fPreserveAll
107  };
108  typedef unsigned int TFlags; ///< Bitwise OR of EFlags
109 
110  /// Define a list of entries.
111  typedef list<CArchiveEntryInfo> TEntries;
112 
113 
114  //------------------------------------------------------------------------
115  // Constructors
116  //------------------------------------------------------------------------
117 
118 protected:
119  /// Construct an archive object of specified format.
120  ///
121  /// Declared as protected to avoid direct usage.
122  /// Use derived classes CArchiveFile or CArchiveMemory instead.
123  /// @param format
124  /// Archive format
125  /// @sa
126  /// CArchiveFile, CArchiveMemory
128 
129 public:
130  /// Destructor
131  ///
132  /// Close the archive if currently open.
133  /// @sa
134  /// Close
135  virtual ~CArchive(void);
136 
137  //------------------------------------------------------------------------
138  // Main functions
139  //------------------------------------------------------------------------
140 
141  /// Create a new empty archive.
142  ///
143  /// @sa
144  /// Append
145  virtual void Create(void);
146 
147  /// Close the archive making sure all pending output is flushed.
148  ///
149  /// @sa
150  /// ~CArchive
151  virtual void Close(void);
152 
153  /// Get information about archive entries.
154  ///
155  /// @return
156  /// An array containing information on those archive entries, whose
157  /// names match the preset mask if any, or all entries otherwise.
158  /// @sa
159  /// SetMask
160  virtual unique_ptr<TEntries> List(void);
161 
162  /// Verify archive integrity.
163  ///
164  /// Read through the archive without actually extracting anything from it.
165  /// Test all archive entries, whose names match the preset mask.
166  /// @return
167  /// An array containing information on those archive entries, whose
168  /// names match the preset mask if any, or all entries otherwise.
169  /// @sa
170  /// SetMask
171  virtual unique_ptr<TEntries> Test(void);
172 
173  /// Extract the entire archive.
174  ///
175  /// Extract all archive entries, whose names match the preset mask.
176  /// Entries will be extracted into either current directory or
177  /// a directory otherwise specified by SetBaseDir().
178  /// @return
179  /// A list of entries that have been actually extracted.
180  /// @sa
181  /// SetMask, SetBaseDir
182  virtual unique_ptr<TEntries> Extract(void);
183 
184  /// Extract single file entry to a memory buffer.
185  ///
186  /// @param info
187  /// [in] Entry to extract.
188  /// @param buf
189  /// [in] Memory buffer for extracted data.
190  /// @param buf_size
191  /// [in] Size of memory buffer.
192  /// @param out_size
193  /// [out] Size of extracted data in the buffer.
194  /// @note
195  /// The buffer size should be big enough to fit whole extracted file.
196  /// @sa
197  /// ExtractFileToHeap, EctractFileToCallback, CArchiveEntryInfo::GetSize, List
198  virtual void ExtractFileToMemory(const CArchiveEntryInfo& info,
199  void* buf, size_t buf_size,
200  size_t* /*out*/ out_size);
201 
202  /// Extract single file entry to a dynamically allocated memory buffer.
203  ///
204  /// @param info
205  /// [in] Entry to extract.
206  /// @param buf_ptr
207  /// [out] Pointer to an allocated memory buffer.
208  /// @param buf_size_ptr
209  /// [out] Size of allocated memory buffer, it is equal to the size of extracted data.
210  /// @note
211  /// Do not forget to deallocate memory buffer after usage.
212  /// Use free() or AutoPtr<char, CDeleter<char>>.
213  /// @sa
214  /// ExtractFileToMemory, EctractFileToCallback, CArchiveEntryInfo::GetSize, List
215  virtual void ExtractFileToHeap(const CArchiveEntryInfo& info,
216  void** buf_ptr, size_t* buf_size_ptr);
217 
218  /// Extract single file entry using user-defined callback.
219  ///
220  /// @param info
221  /// [in] Entry to extract.
222  /// @param callback
223  /// [in] User callback for processing extracted data on the fly.
224  /// @sa
225  /// ExtractFileToMemory, EctractFileToHeap, CArchiveEntryInfo::GetSize, List
226  virtual void ExtractFileToCallback(const CArchiveEntryInfo& info,
227  IArchive::Callback_Write callback);
228 
229  /// Append an entry to the archive.
230  ///
231  /// Appended entry can be either a file, directory, symbolic link or etc.
232  /// Each archive format have its own list of supported entry types.
233  /// The name is taken with respect to the base directory, if any set.
234  /// Adding a directory results in all its files and subdirectories to
235  /// get added (examine the return value to find out what has been added).
236  /// The names of all appended entries will be converted to Unix format
237  /// (only forward slashes in the paths, and drive letter, if any on
238  /// MS-Windows, stripped).
239  /// @param path
240  /// Path to appended entry.
241  /// @param level
242  /// Compression level (if selected format support it, or default).
243  /// @param comment
244  /// Optional comment for the appended entry (if selected format support it).
245  /// For directories the comment will be added to upper directory only.
246  /// @return
247  /// A list of entries appended.
248  /// @note
249  /// On the current moment you can use this method to add files to newly
250  /// created archive only, modifying existed archive is not allowed.
251  /// @sa
252  /// Create, AppendFileFromMemory, SetBaseDir, HaveSupport, Update
253  virtual unique_ptr<TEntries> Append(const string& path,
255  const string& comment = kEmptyStr);
256 
257  /// Append a single file entry to the created archive using data from memory buffer.
258  ///
259  /// These function assign the current local time to added entry.
260  /// @param name_in_archive
261  /// Name of the file entry in the archive. You can use any symbols,
262  /// that allowed for file names. Also, you can use relative path here,
263  /// if you want to create some structure in the archive and put the data
264  /// to a file in the subdirectory.
265  /// @param buf
266  /// Buffer with data to add.
267  /// @param buf_size
268  /// Size of data in the buffer.
269  /// @param level
270  /// Compression level (if selected format support it, or default).
271  /// @param comment
272  /// Optional comment for the appended entry (if selected format support it).
273  /// @return
274  /// An information about added entry.
275  /// @note
276  /// On the current moment you can use this method to add files to newly
277  /// created archive only, modification existing archive is not allowed.
278  /// @sa
279  /// Create, Append
280  virtual unique_ptr<CArchive::TEntries>
281  AppendFileFromMemory(const string& name_in_archive,
282  void* buf, size_t buf_size,
284  const string& comment = kEmptyStr);
285 
286  //------------------------------------------------------------------------
287  // Utility functions
288  //------------------------------------------------------------------------
289 
290  /// Get flags.
291  virtual TFlags GetFlags(void) const { return m_Flags; }
292  /// Set flags.
293  virtual void SetFlags(TFlags flags) { m_Flags = flags; }
294 
295  /// Get base directory to use for files while extracting from/adding to
296  /// the archive, and in the latter case used only for relative paths.
297  /// @sa
298  /// SetBaseDir
299  virtual const string& GetBaseDir(void) const { return m_BaseDir; }
300 
301  /// Set base directory to use for files while extracting from/adding to
302  /// the archive, and in the latter case used only for relative paths.
303  /// @sa
304  /// GetBaseDir
305  virtual void SetBaseDir(const string& dirname);
306 
307  /// Mask type enumerator.
308  /// @enum eFullPathMask
309  /// CMask can select both inclusions and exclusions (in this order) of
310  /// fully-qualified archive entries. Whole entry name will be matched.
311  /// It always use Unix format for path matching, so please use forward
312  /// slash "/" as directory delimiter in the masks.
313  /// @enum ePatternMask
314  /// CMask can select both inclusions and exclusions (in this order) of
315  /// patterns of archive entries. If eFullMask use the full path
316  /// to match mask, that ePatternMask allow to match each path component,
317  /// including names for each subdirectory and/or file name. This type
318  /// of mask is used only if eFullMask matches or not specified.
319  enum EMaskType {
321  ePatternMask
322  };
323 
324  /// Set name mask for processing.
325  ///
326  /// The set of masks is used to process existing entries in the archive,
327  /// and apply to list, extract and append operations.
328  /// If masks are not defined then all archive entries will be processed.
329  /// Each "mask" is a set of inclusion and exclusion patterns, each of them
330  /// can be a wildcard file mask or regular expression.
331  /// @param mask
332  /// Set of masks (NULL unset the current set without setting a new one).
333  /// @param own
334  /// Whether to take ownership on the mask (delete upon CArchive destruction).
335  /// @param type
336  /// Type of the mask. You can set two types of masks at the same time.
337  /// The mask with type eFullPathMask applies to whole path name.
338  /// The mask with type ePatternMask applies to each path component, to all
339  /// subdirectories or file name, and if one of them matches, the entry
340  /// will be processed. If masks for both types are set, the entry will
341  /// be processed if it matches for each of them.
342  /// @sa
343  /// UnsetMask, CMaskFileName, CMaskRegexp
344  /// @note
345  /// Unset mask means wildcard processing (all entries match).
346  void SetMask(CMask* mask,
347  EOwnership own = eNoOwnership,
348  EMaskType type = eFullPathMask,
349  NStr::ECase acase = NStr::eNocase);
350 
351  /// Unset name mask for processing.
352  ///
353  /// @sa
354  /// SetMask
355  /// @note
356  /// Unset mask means wildcard processing (all entries match).
357  void UnsetMask(EMaskType type);
358  void UnsetMask(void);
359 
360  /// Support check enumerator.
361  ///
362  /// Use HaveSupport() to check that current archive format have support for
363  /// specific feature.
364  /// @enum eType
365  /// Check that archive can store entries with specific directory entry type,
366  /// specified by 'param'.
367  /// @enum eAbsolutePath
368  /// Archive can store full absolute path entries. Otherwise they will
369  /// be converted to relative path from root directory.
370  /// @sa HaveSupport
374  eFeature_FileStream
375  };
376 
377  /// Check that current archive format have support for specific features.
378  ///
379  /// @param feature
380  /// Name of the feature to check.
381  /// @param param
382  /// Additional parameter (for eType only).
383  /// @sa ESupport
384  bool HaveSupport(ESupportFeature feature, int param = 0);
385 
386 protected:
387  /// Archive open mode
388  enum EOpenMode {
389  eNone = 0,
390  eRO = 1,
391  eWO = 2,
392  eRW = eRO | eWO
393  };
394 
395  /// Action, performed on the archive
396  enum EAction {
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
404  };
405 
406  /// Mask storage
407  struct SMask {
411  SMask(void)
412  : mask(0), acase(NStr::eNocase), owned(eNoOwnership)
413  {}
414  };
415 
416 protected:
417  //------------------------------------------------------------------------
418  // User-redefinable callback
419  //------------------------------------------------------------------------
420 
421  /// Return false to skip the current entry when processing.
422  ///
423  /// Note that the callback can encounter multiple entries of the same file
424  /// in case the archive has been updated (so only the last occurrence is
425  /// the actual copy of the file when extracted).
426  virtual bool Checkpoint(const CArchiveEntryInfo& /*current*/, EAction /*action*/)
427  { return true; }
428 
429 protected:
430  //------------------------------------------------------------------------
431  // Redefinable methods for inherited classes
432  //------------------------------------------------------------------------
433 
434  /// Open archive.
435  virtual void Open(EAction action) = 0;
436  /// Process current entry (List/Test/Extract/Append)
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);
441 
442 protected:
443  //------------------------------------------------------------------------
444  // Internal processing methods
445  //------------------------------------------------------------------------
446 
447  // Open archive.
448  // Wrapper around Open() that perform all necessary checks and processing.
449  void x_Open(EAction action);
450 
451  // Read the archive and do the requested "action" on current entry.
452  unique_ptr<TEntries> x_ReadAndProcess(EAction action);
453 
454  // Append an entry from the file system to the archive.
455  unique_ptr<TEntries> x_Append(const string& path,
456  ELevel level,
457  const string& comment,
458  const TEntries* toc = NULL);
459  // Append a single entry from the file system to the archive.
460  // Wrapper around AppendEntry().
461  // Return FALSE if entry should be skipped (via user Checkpoint()).
462  bool x_AppendEntry(const string& path, ELevel level = CCompression::eLevel_Default);
463 
464  // Extract current entry.
465  // Wrapper around ExtractEntry() that perform all necessary checks and
466  // flags processing.
467  void x_ExtractEntry(const TEntries* prev_entries);
468 
469  // Restore attributes of an entry in the file system.
470  // If "dst" is not specified, then the destination path will be
471  // constructed from "info", and the base directory (if any). Otherwise,
472  // "dst" will be used "as is", assuming it corresponds to "info".
473  void x_RestoreAttrs(const CArchiveEntryInfo& info,
474  const CDirEntry* dst = NULL) const;
475 
476 protected:
477  unique_ptr<IArchive> m_Archive; ///< Pointer to interface to EFormat-specific archive support
478  EFormat m_Format; ///< Archive format
479  IArchive::ELocation m_Location; ///< Archive location (file/memory)
480  TFlags m_Flags; ///< Bitwise OR of flags
481  string m_BaseDir; ///< Base directory for relative paths
482  CArchiveEntryInfo m_Current; ///< Information about current entry being processed
483  SMask m_MaskFullPath; ///< Set of masks for operations (full path)
484  SMask m_MaskPattern; ///< Set of masks for operations (path components)
485  EOpenMode m_OpenMode; ///< What was it opened for
486  bool m_Modified; ///< True after at least one write
487 
488 protected:
489  // Prohibit assignment and copy
492 };
493 
494 
495 
496 //////////////////////////////////////////////////////////////////////////////
497 ///
498 /// CArchiveFile -- file-based archive.
499 ///
500 /// Throws exceptions on errors.
501 
503 {
504 public:
505  /// Constructor for file-based archive.
506  ///
507  /// @param format
508  /// Archive format.
509  /// @param filename
510  /// Path to archive file name.
511  /// Note, that directory in that archive file will be create should exists.
512  /// @sa
513  /// Create, Extract, List, Test, Append
514  CArchiveFile(EFormat format, const string& filename);
515 
516 protected:
517  /// Open the archive for specified action.
518  virtual void Open(EAction action);
519 
520 protected:
521  string m_FileName; ///< Archive file name
522 
523 private:
524  // Prohibit assignment and copy
527 };
528 
529 
530 
531 //////////////////////////////////////////////////////////////////////////////
532 ///
533 /// CArchiveMemory -- memory-based archive.
534 ///
535 /// Throws exceptions on errors.
536 
538 {
539 public:
540  /// Constructor for memory-based archive.
541  ///
542  /// @param format
543  /// Archive format.
544  /// @param buf
545  /// Pointer to an archive located in memory. Used only to open already
546  /// existed archive for reading. Never used if you would like to create
547  /// new archive, see Create().
548  /// @param buf_size
549  /// Size of the archive.
550  /// @sa
551  /// Create, Extract, List, Test, Append
552  CArchiveMemory(EFormat format, const void* buf = NULL, size_t buf_size = 0);
553 
554  /// Create a new empty archive in memory.
555  ///
556  /// @param initial_allocation_size
557  /// Estimated size of the archive, if known.
558  /// Bigger size allow to avoid extra memory reallocations.
559  /// @sa
560  /// Append, Finalize
561  virtual void Create(size_t initial_allocation_size);
562  virtual void Create(void);
563 
564  /// Save current opened/created archive to file.
565  ///
566  /// @param filename
567  /// Path to the archive file name. The directory in that archive
568  /// file will be create should exists. If destination file
569  /// already exists, it will be overwritten.
570  /// @note
571  /// Newly created archive should be finalized first.
572  /// @sa
573  /// Create, Finalize, Load
574  void Save(const string& filename);
575 
576  /// Load existing archive from file system to memory.
577  ///
578  /// @param filename
579  /// Path to the existing archive.
580  /// @note
581  /// If you have opened or created archive, it will be automatically closed.
582  /// @sa
583  /// Open, Save
584  void Load(const string& filename);
585 
586  /// Finalize the archive created in memory.
587  ///
588  /// Return pointer to a buffer with created archive and its size.
589  /// After this call you cannot write to archive anymore, but you can
590  /// read from it. Returning pointer to buffer and its size also
591  /// will be saved internally and used for opening archive for reading
592  /// (see constructor).
593  /// @param buf_ptr
594  /// Pointer to an archive located in memory.
595  /// @param buf_size_ptr
596  /// Size of the newly created archive.
597  /// @note
598  /// Do not forget to deallocate memory buffer after usage.
599  /// Use free() or AutoPtr<char, CDeleter<char>>.
600  /// @sa
601  /// Create, Close
602  virtual void Finalize(void** buf_ptr, size_t* buf_size_ptr);
603 
604 protected:
605  /// Open the archive for specified action.
606  virtual void Open(EAction action);
607 
608 protected:
609  // Open
610  const void* m_Buf; ///< Buffer where the opening archive is located
611  size_t m_BufSize; ///< Size of m_Buf
612  /// Holder for the pointer to memory buffer that will be automatically
613  /// deallocated if we own it (used for Load() only).
614  /// m_Buf will have the same pointer value.
616  // Create
617  ///< Initial allocation size for created archive
619 
620 private:
621  // Prohibit assignment and copy
624 };
625 
626 
627 
628 //////////////////////////////////////////////////////////////////////////////
629 ///
630 /// CArchiveCompressionFileStream -- file stream/descriptor based compression stream archive.
631 ///
632 /// Allow to stream compressed data to specified already opened FILE*-based
633 /// file stream or file/socket descriptor. Only allowed operations are:
634 /// - Create() - optional, used by default in the constructor
635 /// - Append()
636 /// - AppendFileFromMemory()
637 /// - Close()
638 /// All other archive operations are prohibited.
639 ///
640 /// Throws exceptions on errors.
641 
643 {
644 public:
645  /// Constructor for stream-based archive.
646  ///
647  /// @param format
648  /// Archive format.
649  /// @param fd
650  /// File/socket descriptor to write archive to.
651  /// Socket descriptor should be already connected and file descriptor
652  /// should be opened for writing before creating an archive.
653  /// @sa
654  /// Append, AppendFileFromMemory, Close
656 
657  /// Create new archive on a base of already opened FILE* stream,
658  /// beginning at the current FILE* position.
659  ///
660  /// @param format
661  /// Archive format.
662  /// @param filestream
663  /// File stream that can be used for archive operations.
664  /// It should be opened for writing binary data.
665  /// @sa
666  /// Append, AppendFileFromMemory, Close
667  CArchiveCompressionFileStream(EFormat format, FILE* filestream);
668 
669  /// Destructor
670  ///
671  /// Close the archive if currently open.
672  /// @sa
673  /// Close
674  virtual ~CArchiveCompressionFileStream(void);
675 
676  /// Create a new empty archive.
677  /// Calling this method is optional, new archive is created by default in the constructor.
678  /// But if you want to add another archive using current CArchiveCompressionFileStream object,
679  /// you can use Create() after Close().
680  /// @sa
681  /// Append, Close
682  virtual void Create(void);
683 
684  /// Close archive.
685  ///
686  /// Writes all remaining data into the file descriptor/stream.
687  /// CArchiveCompressionFileStream object cannot be used for any archive
688  /// operation after this call.
689  /// The file stream/descriptor will not be closed.
690  virtual void Close(void);
691 
692 protected:
693  /// Open the archive for specified action.
694  virtual void Open(EAction action);
695 
696 protected:
697  FILE* m_FileStream; ///< File stream, can be based on m_fd
698  int m_fd; ///< File/socket descriptor
699 
700 private:
701  // Prohibit assignment and copy
704 };
705 
706 
708 
709 
710 /* @} */
711 
712 
713 #endif /* UTIL_COMPRESS__ARCHIVE__HPP */
Archive API.
ncbi::TMaskedQueryRegions mask
CArchiveCompressionFileStream – file stream/descriptor based compression stream archive.
Definition: archive.hpp:643
CArchiveEntryInfo class.
Definition: archive_.hpp:112
CArchiveFile – file-based archive.
Definition: archive.hpp:503
CArchiveMemory – memory-based archive.
Definition: archive.hpp:538
CArchiveZip – implementation of IArchive interface for ZIP-archives.
Definition: archive_zip.hpp:67
CArchive - base class for file- or memory-based archives.
Definition: archive.hpp:62
CDirEntry –.
Definition: ncbifile.hpp:262
EFormat
The formats are checked in the same order as declared here.
CMask –.
Definition: ncbi_mask.hpp:59
NStr –.
Definition: ncbistr.hpp:243
static uch flags
static void Test(const char *bind1, SQLSMALLINT type1, const char *bind2, SQLSMALLINT type2)
Definition: convert_error.c:15
@ eNoOwnership
No ownership is assumed.
Definition: ncbi_types.h:135
#define NULL
Definition: ncbistd.hpp:225
virtual bool Checkpoint(const CArchiveEntryInfo &, EAction)
Return false to skip the current entry when processing.
Definition: archive.hpp:426
CArchiveCompressionFileStream & operator=(const CArchiveCompressionFileStream &)
CArchiveMemory(const CArchiveMemory &)
int m_fd
File/socket descriptor.
Definition: archive.hpp:698
CArchiveFile(const CArchiveFile &)
CArchiveMemory & operator=(const CArchiveMemory &)
size_t m_InitialAllocationSize
< Initial allocation size for created archive
Definition: archive.hpp:618
EOpenMode
Archive open mode.
Definition: archive.hpp:388
IArchive::ELocation m_Location
Archive location (file/memory)
Definition: archive.hpp:479
ELevel
Compression level.
Definition: compress.hpp:142
EFormat m_Format
Archive format.
Definition: archive.hpp:478
unsigned int TFlags
Bitwise OR of EFlags.
Definition: archive.hpp:108
unique_ptr< IArchive > m_Archive
Pointer to interface to EFormat-specific archive support.
Definition: archive.hpp:477
NStr::ECase acase
Definition: archive.hpp:409
string m_BaseDir
Base directory for relative paths.
Definition: archive.hpp:481
CArchiveCompressionFileStream(const CArchiveCompressionFileStream &)
ELocation
Archive location.
Definition: archive_.hpp:197
const void * m_Buf
Buffer where the opening archive is located.
Definition: archive.hpp:610
size_t m_BufSize
Size of m_Buf.
Definition: archive.hpp:611
bool m_Modified
True after at least one write.
Definition: archive.hpp:486
EFormat
Archive formats.
Definition: archive.hpp:68
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...
Definition: archive.hpp:299
virtual TFlags GetFlags(void) const
Get flags.
Definition: archive.hpp:291
string m_FileName
Archive file name.
Definition: archive.hpp:521
list< CArchiveEntryInfo > TEntries
Define a list of entries.
Definition: archive.hpp:111
EOwnership owned
Definition: archive.hpp:410
size_t(* Callback_Write)(const CArchiveEntryInfo &info, const void *buf, size_t n)
Type of user-defined callback for extraction from archive.
Definition: archive_.hpp:216
CArchiveEntryInfo m_Current
Information about current entry being processed.
Definition: archive.hpp:482
CMask * mask
Definition: archive.hpp:408
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...
Definition: archive.hpp:615
TFlags m_Flags
Bitwise OR of flags.
Definition: archive.hpp:480
CArchive & operator=(const CArchive &)
SMask m_MaskFullPath
Set of masks for operations (full path)
Definition: archive.hpp:483
ESupportFeature
Definition: archive.hpp:371
CArchiveFile & operator=(const CArchiveFile &)
EOpenMode m_OpenMode
What was it opened for.
Definition: archive.hpp:485
EAction
Action, performed on the archive.
Definition: archive.hpp:396
virtual void SetFlags(TFlags flags)
Set flags.
Definition: archive.hpp:293
SMask m_MaskPattern
Set of masks for operations (path components)
Definition: archive.hpp:484
EFlags
General flags.
Definition: archive.hpp:73
FILE * m_FileStream
File stream, can be based on m_fd.
Definition: archive.hpp:697
virtual void Open(EAction action)=0
Open archive.
CCompression::ELevel ELevel
Definition: archive.hpp:65
@ eFullPathMask
Definition: archive.hpp:320
@ eFeature_Type
Definition: archive.hpp:372
@ eFeature_AbsolutePath
Definition: archive.hpp:373
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define kEmptyStr
Definition: ncbistr.hpp:123
ECase
Which type of string comparison.
Definition: ncbistr.hpp:1204
@ eNocase
Case insensitive compare.
Definition: ncbistr.hpp:1206
enum ENcbiOwnership EOwnership
Ownership relations between objects.
char * buf
static MDB_envinfo info
Definition: mdb_load.c:37
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)
Definition: ncbi_service.c:253
static Format format
Definition: njn_ioutil.cpp:53
NCBI_XUTIL_EXPORT
Parameter to control printing diagnostic message about conversion of static array data from a differe...
Definition: static_set.hpp:72
Mask storage.
Definition: archive.hpp:407
Definition: type.c:6
Modified on Thu May 30 12:24:12 2024 by modify_doxy.py rev. 669887