sl@0: /* sl@0: * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: using namespace UserPromptService; sl@0: sl@0: sl@0: EXPORT_C CFingerprint* CFingerprint::NewL(const TDesC8& aFingerprint, const TDesC& aDescription) sl@0: /** sl@0: Creates a new fingerprint object. sl@0: @param aFingerprint An 8-bit descriptor containing the raw fingerprint data. sl@0: @param aDescription A human readable description of the fingerprint. sl@0: @return A pointer to the new fingerprint object. sl@0: @leave KErrUpsBadFingerprintLength if the fingerprint is empty or exceeds sl@0: KUpsMaxFingerprintLength bytes in length. sl@0: */ sl@0: { sl@0: CFingerprint* self = CFingerprint::NewLC(aFingerprint, aDescription); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: EXPORT_C CFingerprint* CFingerprint::NewLC(const TDesC8& aFingerprint, const TDesC& aDescription) sl@0: /** sl@0: Creates a new fingerprint object. sl@0: @param aFingerprint An 8-bit descriptor containing the raw fingerprint data. sl@0: @param aDescription A human readable description of the fingerprint. sl@0: @return A pointer to the new fingerprint object. sl@0: @leave KErrUpsBadFingerprintLength if the fingerprint is empty or exceeds sl@0: KUpsMaxFingerprintLength bytes in length. sl@0: */ sl@0: { sl@0: CFingerprint* self = new(ELeave) CFingerprint(); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(aFingerprint, aDescription); sl@0: return self; sl@0: } sl@0: sl@0: void CFingerprint::ConstructL(const TDesC8& aFingerprint, const TDesC& aDescription) sl@0: /** sl@0: Second phase constructor sl@0: @param aFingerprint The raw fingerprint data. sl@0: @param aDescription A description of the fingerprint data. sl@0: @leave KErrUpsBadFingerprintLength if the fingerprint exceeds sl@0: KUpsMaxFingerprintLength bytes in length. sl@0: */ sl@0: { sl@0: if (aFingerprint.Length() > KUpsMaxFingerprintLength) sl@0: { sl@0: User::Leave(KErrUpsBadFingerprintLength); sl@0: } sl@0: iFingerprint = aFingerprint.AllocL(); sl@0: iDescription = aDescription.AllocL(); sl@0: } sl@0: sl@0: EXPORT_C const TDesC8& CFingerprint::Fingerprint() const sl@0: /** sl@0: Gets the raw fingerprint data. sl@0: @return An 8-bit descriptor containing the raw fingerprint data. sl@0: */ sl@0: { sl@0: return *iFingerprint; sl@0: } sl@0: sl@0: EXPORT_C const TDesC& CFingerprint::Description() const sl@0: /** sl@0: Gets the description of the fingerprint. sl@0: @return A 16-bit description containing the description of the fingerprint. sl@0: */ sl@0: { sl@0: return *iDescription; sl@0: } sl@0: sl@0: CFingerprint::CFingerprint() sl@0: /** sl@0: Constructor sl@0: */ sl@0: { sl@0: } sl@0: sl@0: CFingerprint::~CFingerprint() sl@0: /** sl@0: Destructor sl@0: */ sl@0: { sl@0: delete iFingerprint; sl@0: delete iDescription; sl@0: }