diff -r 000000000000 -r b497e44ab2fc syncmlfw/common/wbxml/inc/nsmlstack.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/syncmlfw/common/wbxml/inc/nsmlstack.inl Thu Dec 17 09:07:52 2009 +0200 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Inline methods for WBXML CNSmlStack. +* +*/ + + +#ifndef __NSMLSTACK_INL__ +#define __NSMLSTACK_INL__ + + +// ------------------------------------------------------------------------------------------------ +// CNSmlStack +// ------------------------------------------------------------------------------------------------ +template +inline CNSmlStack::CNSmlStack() + { + } + +// ------------------------------------------------------------------------------------------------ +template +inline CNSmlStack::~CNSmlStack() + { + iStack->ResetAndDestroy(); + delete iStack; + } + +// ------------------------------------------------------------------------------------------------ +template +inline CNSmlStack* CNSmlStack::NewL() + { + CNSmlStack* self = new (ELeave) CNSmlStack(); + CleanupStack::PushL(self); + self->iStack = new (ELeave) RPointerArray(); + CleanupStack::Pop(); // self + return self; + } + +// ------------------------------------------------------------------------------------------------ +template +inline T* CNSmlStack::Pop() + { + T* temp = iStack->operator[](iStack->Count() - 1); + iStack->Remove(iStack->Count() - 1); + return temp; + } + +// ------------------------------------------------------------------------------------------------ +template +inline T* CNSmlStack::Top() + { + if( Count() > 0 ) + { + return iStack->operator[](iStack->Count() - 1); + } + return 0; + } + +// ------------------------------------------------------------------------------------------------ +template +inline void CNSmlStack::Push( T* aItem ) + { + iStack->Append(aItem); + } + +// ------------------------------------------------------------------------------------------------ +template +inline TInt CNSmlStack::Count() + { + return iStack->Count(); + } + +// ------------------------------------------------------------------------------------------------ +template +inline void CNSmlStack::Reset() + { + iStack->Reset(); + } + +// ------------------------------------------------------------------------------------------------ +template +inline void CNSmlStack::ResetAndDestroy() + { + iStack->ResetAndDestroy(); + } + +#endif // __NSMLSTACK_INL__ \ No newline at end of file