cbs/CbsServer/ServerInc/CCbsTopicMessages.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 CCbsTopicMessages class
       
    15 *    
       
    16 *                This class represents the server-side topic messages subsession class.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #ifndef     CCBSTOPICMESSAGES_H
       
    23 #define     CCBSTOPICMESSAGES_H
       
    24 
       
    25 // INCLUDES
       
    26 #include "CCbsObject.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CCbsDbImpTopicMessages;
       
    30 class CCbsRecEtel;
       
    31 
       
    32 // CLASS DECLARATION 
       
    33 /**
       
    34     It represents the server side topic messages subsession.
       
    35 */
       
    36 class CCbsTopicMessages : public CCbsObject
       
    37     {
       
    38     public:     // New functions
       
    39         /**
       
    40         *   Creates a new instance of the class.
       
    41         *
       
    42         *   @param  aSession    Pointer to the session.
       
    43         *   @param  aMessages   Pointer to the topic messages.
       
    44         *   @param  aReceiver   Receiver.
       
    45         *   @return             Pointer to a new instance of 
       
    46         *                       CCbsTopicMessages.
       
    47         */
       
    48         static CCbsTopicMessages* NewL( CCbsSession& aSession, 
       
    49                                         CCbsDbImpTopicMessages& aMessages,
       
    50                                         CCbsRecEtel& aReceiver );
       
    51 
       
    52         /**
       
    53         *   Destructor.
       
    54         */
       
    55         ~CCbsTopicMessages();
       
    56 
       
    57     public:     // From CCbsObject      
       
    58         /**
       
    59         *   Handle the requests for the object.
       
    60         *
       
    61         *   @param aMessage Message to be handled.
       
    62         *   @return         It indicates whether the message was handled.
       
    63         */
       
    64         TBool HandleRequestsL( const RMessage2& aMessage );
       
    65 
       
    66     private:
       
    67         /**
       
    68         *   Constructor.
       
    69         *
       
    70         *   @param  aSession    Pointer to the session.
       
    71         *   @param  aMessages   Pointer to the topic messages.
       
    72         *   @param  aReceiver   Receiver
       
    73         */
       
    74         CCbsTopicMessages( CCbsSession& aSession, 
       
    75                            CCbsDbImpTopicMessages& aMessages,
       
    76                            CCbsRecEtel& aReceiver );
       
    77 
       
    78         /**
       
    79         *   Finalizes construction.
       
    80         */
       
    81         void ConstructL();
       
    82 
       
    83         /**
       
    84         *   Closes the subsession.
       
    85         */
       
    86         void CloseTopicMessages();
       
    87 
       
    88         /**
       
    89         *   Returns the total amount of messages to the client.
       
    90         */
       
    91         void GetMessageCountL();
       
    92 
       
    93         /**
       
    94         *   Returns the requested message to the client.
       
    95         */
       
    96         void GetMessageL();
       
    97 
       
    98         /**
       
    99         *   Finds a message by its handle.
       
   100         */
       
   101         void FindMessageByHandleL();
       
   102 
       
   103         /**
       
   104         *   Returns message index in topic by message handle.
       
   105         */
       
   106         void GetMessageIndexByHandleL();
       
   107 
       
   108         /**
       
   109         *   Deletes a message.
       
   110         *
       
   111         *   @param  aReceiver   Receiver.
       
   112         */    
       
   113         void DeleteMessageL( const CCbsRecEtel& aReceiver );
       
   114 
       
   115         /**
       
   116         *   Saves a message.
       
   117         *
       
   118         *   @param  aReceiver   Receiver.
       
   119         */
       
   120         void SaveMessageL( const CCbsRecEtel& aReceiver );
       
   121 
       
   122         /**
       
   123         *   Locks a message.
       
   124         */
       
   125         void LockMessageL();
       
   126 
       
   127         /**
       
   128         *   Reads a message.
       
   129         *
       
   130         *   @param  aReceiver   Receiver.
       
   131         */
       
   132         void ReadMessageL( const CCbsRecEtel& aReceiver );
       
   133 
       
   134         /**
       
   135         *   Returns the content of the message to the client.
       
   136         */
       
   137         void GetMessageContentsL();
       
   138 
       
   139         /**
       
   140         *   Retrieves and returns the handles of messages that
       
   141         *   precede and succeed the given message in topic.
       
   142         *   
       
   143         *   Also returns two flags indicating whether the
       
   144         *   given message is the first and/or the last message in topic.
       
   145         */
       
   146         void GetNextAndPrevMsgHandleL();
       
   147 
       
   148     private:    // Prohibited operators and functions
       
   149 
       
   150         // Copy constructor
       
   151         CCbsTopicMessages( const CCbsTopicMessages& );
       
   152 
       
   153         // Assignment operator
       
   154         CCbsTopicMessages& operator=( const CCbsTopicMessages& );
       
   155 
       
   156     private:    // Data
       
   157 
       
   158         // Pointer to the topic messages manager
       
   159         CCbsDbImpTopicMessages& iMessages;
       
   160         
       
   161         // It is the locked message handle, or null message handle
       
   162         // in case no message is locked.        
       
   163         TCbsDbMessageHandle iLocked;
       
   164         
       
   165         // Receiver reference        
       
   166         CCbsRecEtel& iReceiver;
       
   167     };
       
   168 
       
   169 #endif      //  CCBSTOPICMESSAGES_H   
       
   170             
       
   171 // End of File
       
   172 
       
   173