messagingappbase/smilengine/xhtml/inc/xhtmlstack.inl
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2007 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:   Provides CXhtmlStack Class inline member functions.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef XHTMLSTACK_INL
       
    21 #define XHTMLSTACK_INL
       
    22 
       
    23 
       
    24 // ---------------------------------------------------------
       
    25 // CXhtmlStack::NewL
       
    26 // ---------------------------------------------------------
       
    27 //
       
    28 template <typename T> inline CXhtmlStack<T>* CXhtmlStack<T>::NewL()
       
    29 	{
       
    30 	CXhtmlStack<T>* self = new( ELeave ) CXhtmlStack<T>;
       
    31 	CleanupStack::PushL( self );
       
    32 	self->ConstructL();
       
    33 	CleanupStack::Pop(); 
       
    34 	return self;
       
    35 	}
       
    36 
       
    37 
       
    38 // ---------------------------------------------------------
       
    39 // CXhtmlStack::ConstructL
       
    40 // ---------------------------------------------------------
       
    41 //
       
    42 template <typename T> inline void CXhtmlStack<T>::ConstructL()
       
    43 	{
       
    44 	iStack = new (ELeave) RPointerArray<T>( 16 );
       
    45 	}
       
    46 
       
    47 // ---------------------------------------------------------
       
    48 // CXhtmlStack::~CXhtmlStack
       
    49 // ---------------------------------------------------------
       
    50 //
       
    51 template <typename T> CXhtmlStack<T>::~CXhtmlStack()
       
    52 	{
       
    53 	if( iStack )
       
    54 		{		
       
    55 		iStack->ResetAndDestroy();
       
    56 		}
       
    57 	delete iStack;
       
    58 	}
       
    59 
       
    60 // ---------------------------------------------------------
       
    61 // CXhtmlStack::CXhtmlStack
       
    62 // ---------------------------------------------------------
       
    63 //
       
    64 template <typename T> CXhtmlStack<T>::CXhtmlStack() 
       
    65 	{
       
    66 	}
       
    67 
       
    68 // ---------------------------------------------------------
       
    69 // CXhtmlStack::Top
       
    70 // ---------------------------------------------------------
       
    71 //
       
    72 template <typename T> inline T* CXhtmlStack<T>::Top()
       
    73 	{
       
    74 	TInt index = iStack->Count();
       
    75     if (index > 0)
       
    76         {
       
    77        	return (*iStack)[--index];
       
    78         }
       
    79     return 0; 
       
    80 	}
       
    81 
       
    82 // ---------------------------------------------------------
       
    83 // CXhtmlStack::Pop
       
    84 // ---------------------------------------------------------
       
    85 //
       
    86 template <typename T> inline void CXhtmlStack<T>::Pop()
       
    87 	{
       
    88 	TInt index = iStack->Count();
       
    89 	if( index > 0 )
       
    90 	    {
       
    91 		T* ptr = (*iStack)[--index];
       
    92 		iStack->Remove( index );
       
    93 		delete ptr;
       
    94 	    }
       
    95 	}
       
    96 
       
    97 // ---------------------------------------------------------
       
    98 // CXhtmlStack::Push
       
    99 // ---------------------------------------------------------
       
   100 //
       
   101 template <typename T> inline void CXhtmlStack<T>::PushL( T* aStyle )
       
   102 	{
       
   103 	iStack->InsertL( aStyle, iStack->Count());
       
   104 	}
       
   105 
       
   106 
       
   107 #endif
       
   108 
       
   109