connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconxmlstack.inl
branchRCL_3
changeset 20 4a793f564d72
parent 0 d0791faffa3f
equal deleted inserted replaced
19:0aa8cc770c8a 20:4a793f564d72
       
     1 /*
       
     2 * Copyright (c) 2002 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 "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:  ConML parser/generator
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __SCONXMLSTACK_INL__
       
    20 #define __SCONXMLSTACK_INL__
       
    21 
       
    22 
       
    23 // ------------------------------------------------------------------------------------------------
       
    24 // CXMLStack
       
    25 // ------------------------------------------------------------------------------------------------
       
    26 template<class T>
       
    27 inline CXMLStack<T>::CXMLStack()
       
    28 	{
       
    29 	}
       
    30 
       
    31 // ------------------------------------------------------------------------------------------------
       
    32 template<class T>
       
    33 inline CXMLStack<T>::~CXMLStack()
       
    34 	{
       
    35 	iStack->ResetAndDestroy();
       
    36 	delete iStack;
       
    37 	}
       
    38 
       
    39 // ------------------------------------------------------------------------------------------------
       
    40 template<class T>
       
    41 inline CXMLStack<T>* CXMLStack<T>::NewL()
       
    42 	{
       
    43 	CXMLStack<T>* self = new (ELeave) CXMLStack<T>();
       
    44 	CleanupStack::PushL(self);
       
    45 	self->iStack = new (ELeave) RPointerArray<T>();
       
    46 	CleanupStack::Pop(); // self
       
    47 	return self;
       
    48 	}
       
    49 
       
    50 // ------------------------------------------------------------------------------------------------
       
    51 template<class T>
       
    52 inline T* CXMLStack<T>::Pop()
       
    53 	{
       
    54 	T* temp = iStack->operator[](iStack->Count() - 1);
       
    55 	iStack->Remove(iStack->Count() - 1);
       
    56 	return temp;
       
    57 	}
       
    58 
       
    59 // ------------------------------------------------------------------------------------------------
       
    60 template<class T>
       
    61 inline T* CXMLStack<T>::Top()
       
    62 	{
       
    63 	if( Count() > 0 )
       
    64 		{
       
    65 		return iStack->operator[](iStack->Count() - 1);
       
    66 		}
       
    67 	return 0;
       
    68 	}
       
    69 
       
    70 // ------------------------------------------------------------------------------------------------
       
    71 template<class T>
       
    72 inline void CXMLStack<T>::Push( T* aItem )
       
    73 	{
       
    74 	iStack->Append(aItem);
       
    75 	}
       
    76 
       
    77 // ------------------------------------------------------------------------------------------------
       
    78 template<class T>
       
    79 inline TInt CXMLStack<T>::Count()
       
    80 	{
       
    81 	return iStack->Count();
       
    82 	}
       
    83 
       
    84 // ------------------------------------------------------------------------------------------------
       
    85 template<class T>
       
    86 inline void CXMLStack<T>::Reset()
       
    87 	{
       
    88 	iStack->Reset();
       
    89 	}
       
    90 
       
    91 // ------------------------------------------------------------------------------------------------
       
    92 template<class T>
       
    93 inline void CXMLStack<T>::ResetAndDestroy()
       
    94 	{
       
    95 	iStack->ResetAndDestroy();
       
    96 	}
       
    97 
       
    98 #endif  // __SCONXMLSTACK_INL__
       
    99