cbs/CbsServer/ClientInc/RCbsTopicCollection.h
changeset 0 ff3b6d0fd310
equal deleted inserted replaced
-1:000000000000 0:ff3b6d0fd310
       
     1 /*
       
     2 * Copyright (c) 2003 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:  This file contains the header file of the RCbsTopicCollection class.
       
    15 *                This is the client-side subsession which handles requests regarding
       
    16 *                topic identities stored on CBS Server.
       
    17 *
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 #ifndef     RCBSTOPICCOLLECTION_H
       
    24 #define     RCBSTOPICCOLLECTION_H
       
    25 
       
    26 //  INCLUDES
       
    27 
       
    28 #include <e32base.h>
       
    29 #include "CbsCommon.h"
       
    30 
       
    31 //  FORWARD DECLARATIONS
       
    32 class RCbs;
       
    33 
       
    34 //  CLASS DECLARATION 
       
    35 
       
    36 /**
       
    37 *   This represents the client-side subsession to retrieve information 
       
    38 *   from topic collections.
       
    39 */
       
    40 class RCbsTopicCollection 
       
    41         : public RSubSessionBase
       
    42     {
       
    43     public:     // New functions
       
    44         /**
       
    45         *   Constructor.
       
    46         */
       
    47         RCbsTopicCollection();
       
    48 
       
    49         /**
       
    50         *   Creates a subsession to the server.
       
    51         *
       
    52         *   Note that the method must be called before any other method 
       
    53         *   can be used.
       
    54         *
       
    55         *   @param  aServer             The base session.
       
    56         *   @return                     Error code.
       
    57         */
       
    58         TInt Open( RCbs& aServer );
       
    59 
       
    60         /**
       
    61         *   Closes the subsession.
       
    62         *
       
    63         *   @return                     Error code.
       
    64         */
       
    65         TInt Close();
       
    66 
       
    67         /**
       
    68         *   Returns the total amount of topic information the topic collection
       
    69         *   contains.
       
    70         *
       
    71         *   @param  aCount              It will contain the amount.
       
    72         */
       
    73         void GetTopicCount( TInt& aCount );
       
    74 
       
    75         /**
       
    76         *   Returns a topic information structure.
       
    77         *
       
    78         *   @param  aIndex              It is index to the topic info.
       
    79         *   @param  aInfo               It will contain the information.
       
    80         *   @return                     Error code.
       
    81         */
       
    82         TInt GetTopicInfo( TInt aIndex, TCbsTopicInfo& aInfo );
       
    83 
       
    84         /**
       
    85         *   Notifies the client next time when topic collection changes.
       
    86         *   
       
    87         *   @param  aStatus             It will be changed when topic collection
       
    88         *                               changes.
       
    89         */
       
    90         void NotifyOnChange( TRequestStatus& aStatus );
       
    91 
       
    92         /**
       
    93         *   Cancels the pending request to notify.
       
    94         */
       
    95         void NotifyOnChangeCancel();
       
    96 
       
    97         /**
       
    98         *   Resets the iterator. Must be called prior any call to HasNextTopic() 
       
    99         *   or NextTopic()!
       
   100         */
       
   101         void Start();
       
   102 
       
   103         /**
       
   104         *   Returns ETrue, if there is a topic not accessed with NextTopic()
       
   105         *   
       
   106         *   @return     ETrue, if there is a topic. EFalse if the end of the
       
   107         *               collection has been reached.
       
   108         */
       
   109         TBool HasNextTopic();                          
       
   110 
       
   111         /**
       
   112         *   Returns the next topic in the topic collection skipping all topics with 
       
   113         *   a topic number matching a topic already listed in the current topic list.
       
   114         *   This function will return KErrNotFound if the collection is tried to 
       
   115         *   access beyond the end of the list. Otherwise the error code will be 
       
   116         *   the same returned by GetTopicInfo().
       
   117         *
       
   118         *   @param aInfo        The topic information will be stored here.
       
   119         *   @return             The error code. KErrNotFound if there are no topics
       
   120         *                       left.
       
   121         */
       
   122         TInt NextTopic( TCbsTopicInfo& aInfo );
       
   123 
       
   124     private:
       
   125         
       
   126         /**
       
   127         *   Returns information whether the topic was in topic list.
       
   128         *   
       
   129         *   @param 	aIndex      Topic index
       
   130         *   @param  aInList     Was the topic in the list
       
   131         *   @return             Error code. KErrNotFound, if topic
       
   132         *                       didn't exist.
       
   133         */
       
   134         TInt TopicInList( TInt aIndex, TBool& aInList );
       
   135 
       
   136     private:// prohibited functions
       
   137         // Prohibited copy constructor
       
   138         RCbsTopicCollection( const RCbsTopicCollection& );
       
   139 
       
   140         // Prohibited assignment operator
       
   141         RCbsTopicCollection& operator=( const RCbsTopicCollection& );
       
   142 
       
   143     private:    // Data
       
   144         //Iterator is used to point to the next unlisted topic in topic collection. 
       
   145         //Unlisted topic is a topic which is not listed in the current topic list but 
       
   146         //is awailable in the topic collection
       
   147         TInt iIterator;     
       
   148     };
       
   149 
       
   150 #endif      //  RCBSTOPICCOLLECTION_H
       
   151             
       
   152 // End of File
       
   153 
       
   154