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 class StringChecksumAccessor : public ChecksumAccessor { 53 public: 54 StringChecksumAccessor(const BString& checksum); 55 56 virtual status_t GetChecksum(BString& _checksum) const; 57 58 private: 59 BString fChecksum; 60 }; 61 62 63 } // namespace BPrivate 64 65 } // namespace BPackageKit 66 67 68 #endif // _PACKAGE__PRIVATE__CHECKSUM_ACCESSORS_H_ 69