xref: /haiku/src/apps/haikudepot/tar/TarArchiveHeader.h (revision 1a76488fc88584bf66b9751d7fb9b6527ac20d87)
1 /*
2  * Copyright 2017-2020, Andrew Lindesay <apl@lindesay.co.nz>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 #ifndef TAR_ARCHIVE_HEADER_H
6 #define TAR_ARCHIVE_HEADER_H
7 
8 #include <String.h>
9 
10 
11 enum tar_file_type {
12 	TAR_FILE_TYPE_NORMAL,
13 	TAR_FILE_TYPE_OTHER
14 };
15 
16 
17 /* Each file in a tar-archive has a header on it describing the next entry in
18  * the stream.  This class models the data in the header.
19  */
20 
21 class TarArchiveHeader {
22 public:
23 									TarArchiveHeader();
24 	virtual							~TarArchiveHeader();
25 
26 	const	BString&				FileName() const;
27 			size_t					Length() const;
28 			tar_file_type			FileType() const;
29 
30 			void					SetFileName(const BString& value);
31 			void					SetLength(size_t value);
32 			void					SetFileType(tar_file_type value);
33 private:
34 			BString					fFileName;
35 			uint64					fLength;
36 			tar_file_type			fFileType;
37 };
38 
39 #endif // TAR_ARCHIVE_HEADER_H
40