Add StringChecksumAccessor

A ChecksumAccessor implementation for an already known checksum.
This commit is contained in:
Ingo Weinhold 2013-04-20 21:16:17 +02:00
parent 4ea7f45bc5
commit e14b247176
2 changed files with 41 additions and 1 deletions

View File

@ -49,6 +49,17 @@ private:
};
class StringChecksumAccessor : public ChecksumAccessor {
public:
StringChecksumAccessor(const BString& checksum);
virtual status_t GetChecksum(BString& _checksum) const;
private:
BString fChecksum;
};
} // namespace BPrivate
} // namespace BPackageKit

View File

@ -1,9 +1,10 @@
/*
* Copyright 2011, Haiku, Inc. All Rights Reserved.
* Copyright 2011-2013, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Oliver Tappe <zooey@hirschkaefer.de>
* Ingo Weinhold <ingo_weinhold@gmx.de>
*/
@ -24,11 +25,17 @@ namespace BPrivate {
(nibble >= 10 ? 'a' + nibble - 10 : '0' + nibble)
// #pragma mark - ChecksumAccessor
ChecksumAccessor::~ChecksumAccessor()
{
}
// #pragma mark - ChecksumFileChecksumAccessor
ChecksumFileChecksumAccessor::ChecksumFileChecksumAccessor(
const BEntry& checksumFileEntry)
:
@ -62,6 +69,9 @@ ChecksumFileChecksumAccessor::GetChecksum(BString& checksum) const
}
// #pragma mark - GeneralFileChecksumAccessor
GeneralFileChecksumAccessor::GeneralFileChecksumAccessor(
const BEntry& fileEntry, bool skipMissingFile)
:
@ -127,6 +137,25 @@ GeneralFileChecksumAccessor::GetChecksum(BString& checksum) const
}
// #pragma mark - StringChecksumAccessor
StringChecksumAccessor::StringChecksumAccessor(const BString& checksum)
:
fChecksum(checksum)
{
}
status_t
StringChecksumAccessor::GetChecksum(BString& _checksum) const
{
_checksum = fChecksum;
return B_OK;
}
} // namespace BPrivate
} // namespace BPackageKit