cbs/CbsServer/ServerInc/CCbsTopicCollection.h
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     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 CCbsTopicCollection class.
       
    15 *    
       
    16 *                The server-side topic collection subsession class.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #ifndef     CCBSTOPICCOLLECTION_H
       
    23 #define     CCBSTOPICCOLLECTION_H
       
    24 
       
    25 //  INCLUDES
       
    26 
       
    27 #include "CCbsObject.h"
       
    28 #include "MCbsDbTopicCollectionObserver.H"
       
    29 
       
    30 //  FORWARD DECLARATIONS
       
    31 
       
    32 class CCbsSession;
       
    33 class CCbsDbImpTopicCollection;
       
    34 class CCbsDbImpTopicList;
       
    35 
       
    36 //  CLASS DECLARATION 
       
    37 
       
    38 /**
       
    39 *   CCbsTopicCollection is the server-side subsession object for handling
       
    40 *   CbsClient requests on topic identities of index messages.
       
    41 */
       
    42 class CCbsTopicCollection : public CCbsObject, 
       
    43     public MCbsDbTopicCollectionObserver
       
    44     {
       
    45     public:     // New functions
       
    46 
       
    47         /**
       
    48         *   Creates a new instance of the class.
       
    49         *
       
    50         *   @param  aSession        Session.
       
    51         *   @param  aCollection     Topic collection manager.
       
    52         *   @param  aList           Current topic list.
       
    53         *   @return                 The new instance of the class.
       
    54         */
       
    55         static CCbsTopicCollection* NewL( CCbsSession& aSession, 
       
    56             CCbsDbImpTopicCollection& aCollection, 
       
    57             CCbsDbImpTopicList& aList );
       
    58 
       
    59         /**
       
    60         *   Destructor.
       
    61         */
       
    62         ~CCbsTopicCollection();
       
    63 
       
    64     public:     // From CCbsObject
       
    65         
       
    66         /**
       
    67         *   Handles the requests for the subsession.
       
    68         *
       
    69         *   @param  aMessage        Message of the client
       
    70         *   @return                 ETrue, if the request was handled here
       
    71         */
       
    72         TBool HandleRequestsL( const RMessage2& aMessage );
       
    73 
       
    74     private:        // From MCbsDbTopicCollectionObserver
       
    75 
       
    76         /**
       
    77         *   Called whenever topic collection contents are changed.
       
    78         */
       
    79         void TopicCollectionContentsChangedInd();
       
    80 
       
    81     private:
       
    82 
       
    83         /**
       
    84         *   Constructor.
       
    85         *
       
    86         *   @param  aSession        Session
       
    87         *   @param  aCollection     Topic collection
       
    88         *   @param aList            Current topic list
       
    89         */
       
    90         CCbsTopicCollection( CCbsSession& aSession, 
       
    91             CCbsDbImpTopicCollection& aCollection, 
       
    92             CCbsDbImpTopicList& aList );
       
    93 
       
    94         /**
       
    95         *   Finalizes the construction.
       
    96         */
       
    97         void ConstructL();
       
    98 
       
    99         /**
       
   100         *   Closes the subsession.
       
   101         */
       
   102         void CloseCollection();
       
   103 
       
   104         /**
       
   105         *   Returns the total amount of topic info records.
       
   106         */
       
   107         void GetTopicCountL();
       
   108 
       
   109         /**
       
   110         *   Returns a topic info structure to the client.
       
   111         */
       
   112         void GetTopicInfoL();
       
   113 
       
   114         /**
       
   115         *   Returns a truth value determining if the given topic already 
       
   116         *   exists in the current topic list.
       
   117         */
       
   118         void TopicInListL();
       
   119 
       
   120         /**
       
   121         *   Sets up a notification so that the client will be notified when 
       
   122         *   the collecton is changed.
       
   123         */
       
   124         void NotifyOnChange();
       
   125 
       
   126         /**
       
   127         *   Cancels the pending request.
       
   128         */
       
   129         void NotifyOnChangeCancel();
       
   130 
       
   131         /**
       
   132         *   Notifies the client
       
   133         */
       
   134         void Notify();
       
   135 
       
   136     private:    // Prohibited operators and functions
       
   137 
       
   138         // Copy constructor
       
   139         CCbsTopicCollection( const CCbsTopicCollection& );
       
   140 
       
   141         // Assignment operator
       
   142         CCbsTopicCollection& operator=( const CCbsTopicCollection& );
       
   143 
       
   144     private:    // Data
       
   145 
       
   146         // Topic collection manager.
       
   147         CCbsDbImpTopicCollection& iCollection;
       
   148 
       
   149         /**
       
   150         *   The current topic list which is needed to tell client
       
   151         *   only of topics not included in the topic list.
       
   152         */
       
   153         CCbsDbImpTopicList& iTopicList;
       
   154         
       
   155         // Indicates whether there is a pending notify request.
       
   156         TBool iIsMessage;
       
   157 
       
   158         // In case there is a pending notify request, this is the request.
       
   159         RMessage2 iMessage;
       
   160 
       
   161     };
       
   162 
       
   163 #endif      //  CCBSTOPICCOLLECTION_H
       
   164             
       
   165 // End of File
       
   166 
       
   167