commonappservices/alarmserver/Server/Source/ASSrvIteratorByStatus.cpp
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 // Copyright (c) 1999-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 "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "ASSrvIteratorByStatus.h"
       
    17 
       
    18 // System includes
       
    19 
       
    20 // User includes
       
    21 
       
    22 // Type definitions
       
    23 
       
    24 // Constants
       
    25 
       
    26 // Enumerations
       
    27 
       
    28 // Classes referenced
       
    29 
       
    30 
       
    31 //
       
    32 // ----> RASSrvIteratorByStatus (source)
       
    33 //
       
    34 
       
    35 //*************************************************************************************
       
    36 RASSrvIteratorByStatus::RASSrvIteratorByStatus(CASSrvAlarmQueue& aQueue, TAlarmStatus aStatus, TStatusMatchType aMatchType)
       
    37 :	RASSrvIteratorBase(aQueue), iMatchType(aMatchType)
       
    38 	{
       
    39 	SetStatus(aStatus);
       
    40 	}
       
    41 
       
    42 
       
    43 //
       
    44 //
       
    45 //
       
    46 
       
    47 
       
    48 //*************************************************************************************
       
    49 /**
       
    50  * Change the category for this iterator. Resets the iterator back to the start
       
    51  * of the queue
       
    52  */
       
    53 void RASSrvIteratorByStatus::SetStatus(TAlarmStatus aStatus, TStatusMatchType aMatchType)
       
    54 	{
       
    55 	iStatus = aStatus;
       
    56 	iMatchType = aMatchType;
       
    57 	}
       
    58 
       
    59 
       
    60 //
       
    61 //
       
    62 //
       
    63 
       
    64 
       
    65 //*************************************************************************************
       
    66 /**
       
    67  * @see RASSrvIteratorBase
       
    68  */
       
    69 TBool RASSrvIteratorByStatus::Matches(const TASSrvAlarm& aAlarm) const
       
    70 	{
       
    71 	// Check with other iterator - returns ETrue if there is no attached
       
    72 	// iterator to check with.
       
    73 	TBool matches = RASSrvIteratorBase::Matches(aAlarm);
       
    74 
       
    75 	// Now check this iterator
       
    76 	if	(matches)
       
    77 		{
       
    78 		switch(iMatchType)
       
    79 			{
       
    80 		default:
       
    81 		case EStatusMustMatch:
       
    82 			matches = aAlarm.Status() == iStatus;
       
    83 			break;
       
    84 		case EStatusMustNotMatch:
       
    85 			matches = aAlarm.Status() != iStatus;
       
    86 			break;
       
    87 			}
       
    88 		}
       
    89 	//
       
    90 	return matches;
       
    91 	}