Add StringChecksumAccessor

A ChecksumAccessor implementation for an already known checksum.
This commit is contained in:
Ingo Weinhold
2013-04-20 21:40:09 +02:00
parent 4ea7f45bc5
commit e14b247176
2 changed files with 41 additions and 1 deletions
@@ -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 BPrivate
} // namespace BPackageKit } // namespace BPackageKit
+30 -1
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. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Oliver Tappe <[email protected]> * Oliver Tappe <[email protected]>
* Ingo Weinhold <[email protected]>
*/ */
@@ -24,11 +25,17 @@ namespace BPrivate {
(nibble >= 10 ? 'a' + nibble - 10 : '0' + nibble) (nibble >= 10 ? 'a' + nibble - 10 : '0' + nibble)
// #pragma mark - ChecksumAccessor
ChecksumAccessor::~ChecksumAccessor() ChecksumAccessor::~ChecksumAccessor()
{ {
} }
// #pragma mark - ChecksumFileChecksumAccessor
ChecksumFileChecksumAccessor::ChecksumFileChecksumAccessor( ChecksumFileChecksumAccessor::ChecksumFileChecksumAccessor(
const BEntry& checksumFileEntry) const BEntry& checksumFileEntry)
: :
@@ -62,6 +69,9 @@ ChecksumFileChecksumAccessor::GetChecksum(BString& checksum) const
} }
// #pragma mark - GeneralFileChecksumAccessor
GeneralFileChecksumAccessor::GeneralFileChecksumAccessor( GeneralFileChecksumAccessor::GeneralFileChecksumAccessor(
const BEntry& fileEntry, bool skipMissingFile) 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 BPrivate
} // namespace BPackageKit } // namespace BPackageKit