1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/authorisation/userpromptservice/policies/source/fingerprint.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,106 @@
1.4 +/*
1.5 +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +#include <ups/fingerprint.h>
1.23 +#include <ups/upsconst.h>
1.24 +#include <ups/upserr.h>
1.25 +
1.26 +using namespace UserPromptService;
1.27 +
1.28 +
1.29 +EXPORT_C CFingerprint* CFingerprint::NewL(const TDesC8& aFingerprint, const TDesC& aDescription)
1.30 +/**
1.31 +Creates a new fingerprint object.
1.32 +@param aFingerprint An 8-bit descriptor containing the raw fingerprint data.
1.33 +@param aDescription A human readable description of the fingerprint.
1.34 +@return A pointer to the new fingerprint object.
1.35 +@leave KErrUpsBadFingerprintLength if the fingerprint is empty or exceeds
1.36 + KUpsMaxFingerprintLength bytes in length.
1.37 +*/
1.38 + {
1.39 + CFingerprint* self = CFingerprint::NewLC(aFingerprint, aDescription);
1.40 + CleanupStack::Pop(self);
1.41 + return self;
1.42 + }
1.43 +
1.44 +EXPORT_C CFingerprint* CFingerprint::NewLC(const TDesC8& aFingerprint, const TDesC& aDescription)
1.45 +/**
1.46 +Creates a new fingerprint object.
1.47 +@param aFingerprint An 8-bit descriptor containing the raw fingerprint data.
1.48 +@param aDescription A human readable description of the fingerprint.
1.49 +@return A pointer to the new fingerprint object.
1.50 +@leave KErrUpsBadFingerprintLength if the fingerprint is empty or exceeds
1.51 + KUpsMaxFingerprintLength bytes in length.
1.52 +*/
1.53 + {
1.54 + CFingerprint* self = new(ELeave) CFingerprint();
1.55 + CleanupStack::PushL(self);
1.56 + self->ConstructL(aFingerprint, aDescription);
1.57 + return self;
1.58 + }
1.59 +
1.60 +void CFingerprint::ConstructL(const TDesC8& aFingerprint, const TDesC& aDescription)
1.61 +/**
1.62 +Second phase constructor
1.63 +@param aFingerprint The raw fingerprint data.
1.64 +@param aDescription A description of the fingerprint data.
1.65 +@leave KErrUpsBadFingerprintLength if the fingerprint exceeds
1.66 + KUpsMaxFingerprintLength bytes in length.
1.67 +*/
1.68 + {
1.69 + if (aFingerprint.Length() > KUpsMaxFingerprintLength)
1.70 + {
1.71 + User::Leave(KErrUpsBadFingerprintLength);
1.72 + }
1.73 + iFingerprint = aFingerprint.AllocL();
1.74 + iDescription = aDescription.AllocL();
1.75 + }
1.76 +
1.77 +EXPORT_C const TDesC8& CFingerprint::Fingerprint() const
1.78 +/**
1.79 +Gets the raw fingerprint data.
1.80 +@return An 8-bit descriptor containing the raw fingerprint data.
1.81 +*/
1.82 + {
1.83 + return *iFingerprint;
1.84 + }
1.85 +
1.86 +EXPORT_C const TDesC& CFingerprint::Description() const
1.87 +/**
1.88 +Gets the description of the fingerprint.
1.89 +@return A 16-bit description containing the description of the fingerprint.
1.90 +*/
1.91 + {
1.92 + return *iDescription;
1.93 + }
1.94 +
1.95 +CFingerprint::CFingerprint()
1.96 +/**
1.97 +Constructor
1.98 +*/
1.99 + {
1.100 + }
1.101 +
1.102 +CFingerprint::~CFingerprint()
1.103 +/**
1.104 +Destructor
1.105 +*/
1.106 + {
1.107 + delete iFingerprint;
1.108 + delete iDescription;
1.109 + }