e14b247176
A ChecksumAccessor implementation for an already known checksum.
69 lines
1.3 KiB
C++
69 lines
1.3 KiB
C++
/*
|
|
* Copyright 2011, Oliver Tappe <zooey@hirschkaefer.de>
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
#ifndef _PACKAGE__PRIVATE__CHECKSUM_ACCESSORS_H_
|
|
#define _PACKAGE__PRIVATE__CHECKSUM_ACCESSORS_H_
|
|
|
|
|
|
#include <Entry.h>
|
|
#include <String.h>
|
|
|
|
|
|
namespace BPackageKit {
|
|
|
|
namespace BPrivate {
|
|
|
|
|
|
class ChecksumAccessor {
|
|
public:
|
|
virtual ~ChecksumAccessor();
|
|
|
|
virtual status_t GetChecksum(BString& checksum) const = 0;
|
|
};
|
|
|
|
|
|
class ChecksumFileChecksumAccessor : public ChecksumAccessor {
|
|
public:
|
|
ChecksumFileChecksumAccessor(
|
|
const BEntry& checksumFileEntry);
|
|
|
|
virtual status_t GetChecksum(BString& checksum) const;
|
|
|
|
private:
|
|
BEntry fChecksumFileEntry;
|
|
};
|
|
|
|
|
|
class GeneralFileChecksumAccessor : public ChecksumAccessor {
|
|
public:
|
|
GeneralFileChecksumAccessor(
|
|
const BEntry& fileEntry,
|
|
bool skipMissingFile = false);
|
|
|
|
virtual status_t GetChecksum(BString& checksum) const;
|
|
|
|
private:
|
|
BEntry fFileEntry;
|
|
bool fSkipMissingFile;
|
|
};
|
|
|
|
|
|
class StringChecksumAccessor : public ChecksumAccessor {
|
|
public:
|
|
StringChecksumAccessor(const BString& checksum);
|
|
|
|
virtual status_t GetChecksum(BString& _checksum) const;
|
|
|
|
private:
|
|
BString fChecksum;
|
|
};
|
|
|
|
|
|
} // namespace BPrivate
|
|
|
|
} // namespace BPackageKit
|
|
|
|
|
|
#endif // _PACKAGE__PRIVATE__CHECKSUM_ACCESSORS_H_
|