cryptoservices/certificateandkeymgmt/asn1/constructedenc.cpp
changeset 0 2c201484c85f
child 8 35751d3474b7
equal deleted inserted replaced
-1:000000000000 0:2c201484c85f
       
     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 * Methods common to all constructed-data-type encoding classes
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include <asn1enc.h>
       
    21 
       
    22 
       
    23 CASN1EncConstructed::CASN1EncConstructed(const TTagType aType, const TASN1Class aClass)
       
    24 : CASN1EncBase(aType, aClass)
       
    25 	{
       
    26 	}
       
    27 
       
    28 
       
    29 TBool CASN1EncConstructed::IsConstructed() const
       
    30 	{
       
    31 	return ETrue;
       
    32 	}
       
    33 
       
    34 
       
    35 void CASN1EncConstructed::CalculateContentsLengthDER()
       
    36 	{
       
    37 	iContentsLengthDER = 0;
       
    38 	TUint numChildren = NumChildren();
       
    39 	for (TUint index = 0; index < numChildren; ++index)
       
    40 		{
       
    41 		iContentsLengthDER += Child(index).LengthDER();
       
    42 		}
       
    43 	}
       
    44 
       
    45 
       
    46 void CASN1EncConstructed::WriteContentsDERL(TDes8& aBuf) const
       
    47 	{
       
    48 	TUint pos = 0;
       
    49 	TUint numChildren = NumChildren();
       
    50 	for (TUint index = 0; index < numChildren; ++index)
       
    51 		{
       
    52 		Child(index).WriteDERL(aBuf, pos);
       
    53 		}
       
    54 	}