os/security/cryptoservices/certificateandkeymgmt/asn1/sequenceenc.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/cryptoservices/certificateandkeymgmt/asn1/sequenceenc.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,113 @@
     1.4 +/*
     1.5 +* Copyright (c) 2001-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 +* Code for the sequence-encoding class
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +#include "panic.h"
    1.24 +
    1.25 +#include <asn1enc.h>
    1.26 +
    1.27 +const TInt KArrayGranularity = 5;
    1.28 +
    1.29 +
    1.30 +EXPORT_C CASN1EncSequence* CASN1EncSequence::NewLC()
    1.31 +	{
    1.32 +	CASN1EncSequence* self = new (ELeave) CASN1EncSequence();
    1.33 +	CleanupStack::PushL(self);
    1.34 +	self->ConstructL();
    1.35 +	return self;
    1.36 +	}
    1.37 +
    1.38 +EXPORT_C CASN1EncSequence* CASN1EncSequence::NewL()
    1.39 +	{
    1.40 +	CASN1EncSequence* self = NewLC();
    1.41 +	CleanupStack::Pop(self);
    1.42 +	return self;
    1.43 +	}
    1.44 +
    1.45 +EXPORT_C CASN1EncSequence::~CASN1EncSequence()
    1.46 +	{
    1.47 +	iChildren.ResetAndDestroy();
    1.48 +	}
    1.49 +
    1.50 +
    1.51 +CASN1EncSequence::CASN1EncSequence()
    1.52 +: CASN1EncContainer(EASN1Sequence), iChildren(KArrayGranularity)
    1.53 +	{
    1.54 +	}
    1.55 +
    1.56 +
    1.57 +void CASN1EncSequence::AddChildIntL(const CASN1EncBase* aChild)
    1.58 +	{
    1.59 +	User::LeaveIfError(iChildren.Append(aChild));
    1.60 +	}
    1.61 +
    1.62 +
    1.63 +TUint CASN1EncSequence::NumChildren() const
    1.64 +	{
    1.65 +	return iChildren.Count();
    1.66 +	}
    1.67 +
    1.68 +
    1.69 +const CASN1EncBase& CASN1EncSequence::Child(const TUint aIndex) const
    1.70 +	{
    1.71 +	return *iChildren[aIndex];
    1.72 +	}
    1.73 +
    1.74 +EXPORT_C CASN1EncSet* CASN1EncSet::NewLC()
    1.75 +	{
    1.76 +	CASN1EncSet* self = new (ELeave) CASN1EncSet();
    1.77 +	CleanupStack::PushL(self);
    1.78 +	self->ConstructL();
    1.79 +	return self;
    1.80 +	}
    1.81 +
    1.82 +EXPORT_C CASN1EncSet* CASN1EncSet::NewL()
    1.83 +	{
    1.84 +	CASN1EncSet* self = NewLC();
    1.85 +	CleanupStack::Pop(self);
    1.86 +	return self;
    1.87 +	}
    1.88 +
    1.89 +EXPORT_C CASN1EncSet::~CASN1EncSet()
    1.90 +	{
    1.91 +	iChildren.ResetAndDestroy();
    1.92 +	}
    1.93 +
    1.94 +
    1.95 +CASN1EncSet::CASN1EncSet()
    1.96 +: CASN1EncContainer(EASN1Set), iChildren(KArrayGranularity)
    1.97 +	{
    1.98 +	}
    1.99 +
   1.100 +
   1.101 +void CASN1EncSet::AddChildIntL(const CASN1EncBase* aChild)
   1.102 +	{
   1.103 +	User::LeaveIfError(iChildren.Append(aChild));
   1.104 +	}
   1.105 +
   1.106 +
   1.107 +TUint CASN1EncSet::NumChildren() const
   1.108 +	{
   1.109 +	return iChildren.Count();
   1.110 +	}
   1.111 +
   1.112 +
   1.113 +const CASN1EncBase& CASN1EncSet::Child(const TUint aIndex) const
   1.114 +	{
   1.115 +	return *iChildren[aIndex];
   1.116 +	}