pimappservices/calendar/client/src/calcalendariterator.cpp
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 // Copyright (c) 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 "calcalendariterator.h"
       
    17 #include "calcalendariteratorimpl.h"
       
    18 
       
    19 /** Two phase constructor for the calendar iterator.
       
    20 
       
    21 This class can be used to find all the calendar file names
       
    22 known by the calendar. 
       
    23 
       
    24 If calendar info has been set on the file then the CCalCalendarInfo
       
    25 will be valid and other properties on the CCalCalendarInfo class
       
    26 would have been set.
       
    27 
       
    28 The iterator is a snap shot of the files that exist when the iterator
       
    29 is created. If a file is created or deleted after the iterator was
       
    30 created then the iterator will be invlid and should be recreated.
       
    31 */
       
    32 EXPORT_C CCalCalendarIterator* CCalCalendarIterator::NewL(CCalSession& aSession)
       
    33     {
       
    34     CCalCalendarIterator* self = new(ELeave) CCalCalendarIterator();
       
    35     CleanupStack::PushL(self);
       
    36     self->ConstructL(aSession);
       
    37     CleanupStack::Pop(self);
       
    38     return self;
       
    39     }
       
    40 
       
    41 CCalCalendarIterator::CCalCalendarIterator()
       
    42     {
       
    43     }
       
    44 
       
    45 void CCalCalendarIterator::ConstructL(CCalSession& aSession)
       
    46     {
       
    47     iImpl = CCalCalendarIteratorImpl::NewL(aSession);
       
    48     }
       
    49 
       
    50 /** Destructor for the iterator.
       
    51 
       
    52 The iterator must be destroyed befre closing the session.
       
    53 */
       
    54 EXPORT_C CCalCalendarIterator::~CCalCalendarIterator()
       
    55     {
       
    56     delete iImpl;
       
    57     }
       
    58 
       
    59 /** Sets the iterator index to the first element and returns the calendar info.
       
    60 
       
    61 If there are no files to iterate through, this API will return NULL. 
       
    62 */
       
    63 EXPORT_C CCalCalendarInfo* CCalCalendarIterator::FirstL()
       
    64     {
       
    65     return iImpl->FirstL();
       
    66     }
       
    67 
       
    68 /** Increments the iterator index and then returns the calendar info
       
    69 
       
    70 If there are no more files to iterate through, this API will return NULL. 
       
    71 */
       
    72 EXPORT_C CCalCalendarInfo* CCalCalendarIterator::NextL()
       
    73     {
       
    74     return iImpl->NextL();
       
    75     }
       
    76 
       
    77 /** Returns the calendar info at the index the iterator is currently pointing to.
       
    78 */
       
    79 EXPORT_C CCalCalendarInfo* CCalCalendarIterator::CurrentL()
       
    80     {
       
    81     return iImpl->CurrentL();
       
    82     }
       
    83 
       
    84 /** Returns the number of files that there are to iterate through
       
    85 */
       
    86 EXPORT_C TInt CCalCalendarIterator::Count() const
       
    87     {
       
    88     return iImpl->Count();
       
    89     }
       
    90