epoc32/include/crulemarkedstack.inl
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 0 061f57f2323e
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
     1 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 
    17 // note: MergeToMark is not atomic - a leave means that data has been removed
    18 template <TBool StackOwnsEntry>
    19 inline void CRuleMarkedStack<StackOwnsEntry>::MergeToMarkL(TInt aMarkType)
    20 	{
    21 	const TInt lastMark=this->RemoveMark(aMarkType);
    22 	if (this->Count()>lastMark)
    23 		{
    24 		CBNFNode* currentRule=this->Pop();
    25 		if (StackOwnsEntry)
    26 			CleanupStack::PushL(currentRule);
    27 			
    28 		while (this->Count()>lastMark)
    29 			{
    30 			CBNFNode* nextRule=this->Pop();
    31 			if (StackOwnsEntry)
    32 				CleanupStack::PushL(nextRule);
    33 			currentRule->ReparentL(nextRule);
    34 			if (StackOwnsEntry)
    35 				{
    36 				CleanupStack::Pop(2); // nextRule, currentRule
    37 				CleanupStack::PushL(nextRule); // nextRule
    38 				}
    39 			
    40 			currentRule=nextRule;
    41 			}
    42 
    43 		if (StackOwnsEntry)
    44 			CleanupStack::Pop(); // currentRule
    45 		this->PushL(currentRule);
    46 		}
    47 	}