Logo ROOT  
Reference Guide
No Matches
Go to the documentation of this file.
1// @(#)root/io:$Id$
2// Author: Fons Rademakers 30/6/04
5 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
12#ifndef ROOT_TArchiveFile
13#define ROOT_TArchiveFile
15#include "TObject.h"
16#include "TString.h"
17#include "TDatime.h"
19class TFile;
20class TArchiveMember;
21class TObjArray;
24class TArchiveFile : public TObject {
27 TArchiveFile(const TArchiveFile&) = delete; ///< Not implemented because TArchiveFile can not be copied.
28 TArchiveFile& operator=(const TArchiveFile&) = delete; ///< Not implemented because TArchiveFile can not be copied.
31 TString fArchiveName; ///< Archive file name
32 TString fMemberName; ///< Sub-file name
33 Int_t fMemberIndex; ///< Index of sub-file in archive
34 TFile *fFile; ///< File stream used to access the archive
35 TObjArray *fMembers; ///< Members in this archive
36 TArchiveMember *fCurMember; ///< Current archive member
38 static Bool_t ParseUrl(const char *url, TString &archive, TString &member, TString &type);
41 TArchiveFile() : fArchiveName(""), fMemberName(""), fMemberIndex(-1), fFile(nullptr), fMembers(nullptr), fCurMember(nullptr) { }
42 TArchiveFile(const char *archive, const char *member, TFile *file);
43 ~TArchiveFile() override;
45 virtual Int_t OpenArchive() = 0;
46 virtual Int_t SetCurrentMember() = 0;
47 virtual Int_t SetMember(const char *member);
48 virtual Int_t SetMember(Int_t idx);
51 TArchiveMember *GetMember() const { return fCurMember; }
52 TObjArray *GetMembers() const { return fMembers; }
55 const char *GetArchiveName() const { return fArchiveName; }
56 const char *GetMemberName() const { return fMemberName; }
57 Int_t GetMemberIndex() const { return fMemberIndex; }
59 static TArchiveFile *Open(const char *url, TFile *file);
61 ClassDefOverride(TArchiveFile,1) //An archive file containing multiple sub-files (like a ZIP archive)
65class TArchiveMember : public TObject {
67friend class TArchiveFile;
70 TString fName; ///< Name of member
71 TString fComment; ///< Comment field
72 TDatime fModTime; ///< Modification time
73 Long64_t fPosition; ///< Byte position in archive
74 Long64_t fFilePosition; ///< Byte position in archive where member data starts
75 Long64_t fCsize; ///< Compressed size
76 Long64_t fDsize; ///< Decompressed size
77 Bool_t fDirectory; ///< Flag indicating this is a directory
81 TArchiveMember(const char *name);
82 TArchiveMember(const TArchiveMember &member);
84 ~TArchiveMember() override { }
86 const char *GetName() const override { return fName; }
87 const char *GetComment() const { return fComment; }
88 TDatime GetModTime() const { return fModTime; }
89 Long64_t GetPosition() const { return fPosition; }
91 Long64_t GetCompressedSize() const { return fCsize; }
93 Bool_t IsDirectory() const { return fDirectory; }
95 ClassDefOverride(TArchiveMember,1) //An archive member file
int Int_t
Definition RtypesCore.h:45
long long Long64_t
Definition RtypesCore.h:80
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char name[80]
Definition TGX11.cxx:110
Class describing an archive file containing multiple sub-files, like a ZIP or TAR archive.
Int_t GetMemberIndex() const
const char * GetMemberName() const
virtual Int_t SetCurrentMember()=0
~TArchiveFile() override
TArchiveFile & operator=(const TArchiveFile &)=delete
Not implemented because TArchiveFile can not be copied.
TArchiveMember * fCurMember
Current archive member.
const char * GetArchiveName() const
TArchiveMember * GetMember() const
TString fMemberName
Sub-file name.
static TArchiveFile * Open(const char *url, TFile *file)
Return proper archive file handler depending on passed url.
TString fArchiveName
Archive file name.
static Bool_t ParseUrl(const char *url, TString &archive, TString &member, TString &type)
Try to determine if url contains an anchor specifying an archive member.
TObjArray * GetMembers() const
Int_t fMemberIndex
Index of sub-file in archive.
Long64_t GetMemberFilePosition() const
Return position in archive of current member.
virtual Int_t SetMember(const char *member)
Explicitely make the specified member the current member.
virtual Int_t OpenArchive()=0
Int_t GetNumberOfMembers() const
Returns number of members in archive.
TObjArray * fMembers
Members in this archive.
TArchiveFile(const TArchiveFile &)=delete
Not implemented because TArchiveFile can not be copied.
TFile * fFile
File stream used to access the archive.
~TArchiveMember() override
TString fComment
Comment field.
TDatime fModTime
Modification time.
Long64_t GetDecompressedSize() const
Long64_t fCsize
Compressed size.
TDatime GetModTime() const
Long64_t fPosition
Byte position in archive.
Long64_t fFilePosition
Byte position in archive where member data starts.
const char * GetComment() const
TArchiveMember & operator=(const TArchiveMember &rhs)
Assignment operator.
TString fName
Name of member.
const char * GetName() const override
Returns name of object.
Default ctor.
Bool_t fDirectory
Flag indicating this is a directory.
Long64_t GetPosition() const
Bool_t IsDirectory() const
Long64_t fDsize
Decompressed size.
Long64_t GetFilePosition() const
Long64_t GetCompressedSize() const
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
Definition TDatime.h:37
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
Definition TFile.h:53
An array of TObjects.
Definition TObjArray.h:31
Mother of all ROOT objects.
Definition TObject.h:41
Basic string class.
Definition TString.h:139