os/security/cryptoservices/certificateandkeymgmt/asn1/sequenceenc.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 /*
     2 * Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 * Code for the sequence-encoding class
    16 *
    17 */
    18 
    19 
    20 #include "panic.h"
    21 
    22 #include <asn1enc.h>
    23 
    24 const TInt KArrayGranularity = 5;
    25 
    26 
    27 EXPORT_C CASN1EncSequence* CASN1EncSequence::NewLC()
    28 	{
    29 	CASN1EncSequence* self = new (ELeave) CASN1EncSequence();
    30 	CleanupStack::PushL(self);
    31 	self->ConstructL();
    32 	return self;
    33 	}
    34 
    35 EXPORT_C CASN1EncSequence* CASN1EncSequence::NewL()
    36 	{
    37 	CASN1EncSequence* self = NewLC();
    38 	CleanupStack::Pop(self);
    39 	return self;
    40 	}
    41 
    42 EXPORT_C CASN1EncSequence::~CASN1EncSequence()
    43 	{
    44 	iChildren.ResetAndDestroy();
    45 	}
    46 
    47 
    48 CASN1EncSequence::CASN1EncSequence()
    49 : CASN1EncContainer(EASN1Sequence), iChildren(KArrayGranularity)
    50 	{
    51 	}
    52 
    53 
    54 void CASN1EncSequence::AddChildIntL(const CASN1EncBase* aChild)
    55 	{
    56 	User::LeaveIfError(iChildren.Append(aChild));
    57 	}
    58 
    59 
    60 TUint CASN1EncSequence::NumChildren() const
    61 	{
    62 	return iChildren.Count();
    63 	}
    64 
    65 
    66 const CASN1EncBase& CASN1EncSequence::Child(const TUint aIndex) const
    67 	{
    68 	return *iChildren[aIndex];
    69 	}
    70 
    71 EXPORT_C CASN1EncSet* CASN1EncSet::NewLC()
    72 	{
    73 	CASN1EncSet* self = new (ELeave) CASN1EncSet();
    74 	CleanupStack::PushL(self);
    75 	self->ConstructL();
    76 	return self;
    77 	}
    78 
    79 EXPORT_C CASN1EncSet* CASN1EncSet::NewL()
    80 	{
    81 	CASN1EncSet* self = NewLC();
    82 	CleanupStack::Pop(self);
    83 	return self;
    84 	}
    85 
    86 EXPORT_C CASN1EncSet::~CASN1EncSet()
    87 	{
    88 	iChildren.ResetAndDestroy();
    89 	}
    90 
    91 
    92 CASN1EncSet::CASN1EncSet()
    93 : CASN1EncContainer(EASN1Set), iChildren(KArrayGranularity)
    94 	{
    95 	}
    96 
    97 
    98 void CASN1EncSet::AddChildIntL(const CASN1EncBase* aChild)
    99 	{
   100 	User::LeaveIfError(iChildren.Append(aChild));
   101 	}
   102 
   103 
   104 TUint CASN1EncSet::NumChildren() const
   105 	{
   106 	return iChildren.Count();
   107 	}
   108 
   109 
   110 const CASN1EncBase& CASN1EncSet::Child(const TUint aIndex) const
   111 	{
   112 	return *iChildren[aIndex];
   113 	}