xref: /haiku/headers/private/package/ChecksumAccessors.h (revision 8d2bf6953e851d431fc67de1bc970c40afa79e9f)
1 /*
2  * Copyright 2011, Oliver Tappe <zooey@hirschkaefer.de>
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _PACKAGE__PRIVATE__CHECKSUM_ACCESSORS_H_
6 #define _PACKAGE__PRIVATE__CHECKSUM_ACCESSORS_H_
7 
8 
9 #include <Entry.h>
10 #include <String.h>
11 
12 
13 namespace BPackageKit {
14 
15 namespace BPrivate {
16 
17 
18 class ChecksumAccessor {
19 public:
20 	virtual						~ChecksumAccessor();
21 
22 	virtual	status_t			GetChecksum(BString& checksum) const = 0;
23 };
24 
25 
26 class ChecksumFileChecksumAccessor : public ChecksumAccessor {
27 public:
28 								ChecksumFileChecksumAccessor(
29 									const BEntry& checksumFileEntry);
30 
31 	virtual	status_t			GetChecksum(BString& checksum) const;
32 
33 private:
34 			BEntry				fChecksumFileEntry;
35 };
36 
37 
38 class GeneralFileChecksumAccessor : public ChecksumAccessor {
39 public:
40 								GeneralFileChecksumAccessor(
41 									const BEntry& fileEntry,
42 									bool skipMissingFile = false);
43 
44 	virtual	status_t			GetChecksum(BString& checksum) const;
45 
46 private:
47 			BEntry				fFileEntry;
48 			bool				fSkipMissingFile;
49 };
50 
51 
52 }	// namespace BPrivate
53 
54 }	// namespace BPackageKit
55 
56 
57 #endif // _PACKAGE__PRIVATE__CHECKSUM_ACCESSORS_H_
58