119c15fecSAndrew Lindesay /* 2*f0e491d3SAndrew Lindesay * Copyright 2017-2020, Andrew Lindesay <apl@lindesay.co.nz>. 319c15fecSAndrew Lindesay * All rights reserved. Distributed under the terms of the MIT License. 419c15fecSAndrew Lindesay */ 519c15fecSAndrew Lindesay #ifndef TAR_ARCHIVE_HEADER_H 619c15fecSAndrew Lindesay #define TAR_ARCHIVE_HEADER_H 719c15fecSAndrew Lindesay 819c15fecSAndrew Lindesay #include <String.h> 919c15fecSAndrew Lindesay 1019c15fecSAndrew Lindesay 1119c15fecSAndrew Lindesay enum tar_file_type { 1219c15fecSAndrew Lindesay TAR_FILE_TYPE_NORMAL, 1319c15fecSAndrew Lindesay TAR_FILE_TYPE_OTHER 1419c15fecSAndrew Lindesay }; 1519c15fecSAndrew Lindesay 1619c15fecSAndrew Lindesay 1719c15fecSAndrew Lindesay /* Each file in a tar-archive has a header on it describing the next entry in 1819c15fecSAndrew Lindesay * the stream. This class models the data in the header. 1919c15fecSAndrew Lindesay */ 2019c15fecSAndrew Lindesay 2119c15fecSAndrew Lindesay class TarArchiveHeader { 2219c15fecSAndrew Lindesay public: 23*f0e491d3SAndrew Lindesay TarArchiveHeader(); 24*f0e491d3SAndrew Lindesay virtual ~TarArchiveHeader(); 2519c15fecSAndrew Lindesay 26*f0e491d3SAndrew Lindesay const BString& FileName() const; 27*f0e491d3SAndrew Lindesay size_t Length() const; 28*f0e491d3SAndrew Lindesay tar_file_type FileType() const; 2919c15fecSAndrew Lindesay 30*f0e491d3SAndrew Lindesay void SetFileName(const BString& value); 31*f0e491d3SAndrew Lindesay void SetLength(size_t value); 32*f0e491d3SAndrew Lindesay void SetFileType(tar_file_type value); 3319c15fecSAndrew Lindesay private: 34*f0e491d3SAndrew Lindesay BString fFileName; 3519c15fecSAndrew Lindesay uint64 fLength; 3619c15fecSAndrew Lindesay tar_file_type fFileType; 3719c15fecSAndrew Lindesay }; 3819c15fecSAndrew Lindesay 3919c15fecSAndrew Lindesay #endif // TAR_ARCHIVE_HEADER_H 40