ncdengine/provider/server/inc/ncdnodedisclaimer.h
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2006 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:   Contains CNcdNodeDisclaimer class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef NCD_NODE_DISCLAIMER_H
       
    20 #define NCD_NODE_DISCLAIMER_H
       
    21 
       
    22 
       
    23 // For streams
       
    24 #include <s32mem.h>
       
    25 
       
    26 #include "ncdcommunicable.h"
       
    27 #include "ncdstoragedataitem.h"
       
    28 #include "ncdnodeclassids.h"
       
    29 #include "ncdprotocoltypes.h"
       
    30 #include "ncd_cp_query.h"
       
    31 
       
    32 
       
    33 /**
       
    34  *  This server side class contains the data and the functionality
       
    35  *  that the proxy objects will use to internalize itself.
       
    36  *
       
    37  *  This object should be added to the session. So, it will be usable
       
    38  *  in the proxy side by using the handle gotten during addition. 
       
    39  *  The handle is used to identify to what object the proxy directs 
       
    40  *  the function call.  When objects are added to sessions, 
       
    41  *  multiple handles may be gotten for the same object if addition is 
       
    42  *  done multiple times.
       
    43  *
       
    44  *  @lib ?library
       
    45  *  @since S60 ?S60_version *** for example, S60 v3.0
       
    46  */
       
    47 class CNcdNodeDisclaimer : public CNcdCommunicable,
       
    48                            public MNcdStorageDataItem
       
    49     {
       
    50 
       
    51 public:
       
    52     /**
       
    53      * NewL
       
    54      *
       
    55      * @return CNcdNodeDisclaimer* Pointer to the created object 
       
    56      * of this class.
       
    57      */
       
    58     static CNcdNodeDisclaimer* NewL();
       
    59 
       
    60     /**
       
    61      * NewLC
       
    62      *
       
    63      * @return CNcdNodeDisclaimer* Pointer to the created object 
       
    64      * of this class.
       
    65      */
       
    66     static CNcdNodeDisclaimer* NewLC();
       
    67     
       
    68     /**
       
    69      * NewL.
       
    70      *
       
    71      * Copies the given disclaimer. Note, base class variables are not copied.
       
    72      *
       
    73      * @param aDisclaimer The disclaimer to copy.
       
    74      */
       
    75     static CNcdNodeDisclaimer* NewL( const CNcdNodeDisclaimer& aDisclaimer );
       
    76 
       
    77     /**
       
    78      * NewLC.
       
    79      *
       
    80      * Copies the given disclaimer. Note, base class variables are not copied.
       
    81      *
       
    82      * @param aDisclaimer The disclaimer to copy.
       
    83      */
       
    84     static CNcdNodeDisclaimer* NewLC( const CNcdNodeDisclaimer& aDisclaimer );
       
    85 
       
    86 
       
    87     /**
       
    88      * Destructor
       
    89      *
       
    90      * @note Because this is CCatalogsCommunicable function the
       
    91      * session that owns this object should delete this class object.
       
    92      * So, instead of directly deleting this object from some other
       
    93      * class. Close-method should be used instead.
       
    94      */
       
    95     virtual ~CNcdNodeDisclaimer();
       
    96 
       
    97 
       
    98     /**
       
    99      * Retrieves the data type that informs what class the data is for.
       
   100      * By checking the data type information, an InternalizeL function
       
   101      * of a right class can be called when the object data is set
       
   102      * from the storage.
       
   103      * The data type may be decided and set in a object that creates this 
       
   104      * class object.
       
   105      *
       
   106      * @return NcdNodeClassIds::TNcdNodeClassId Describes the data type. 
       
   107      */
       
   108     NcdNodeClassIds::TNcdNodeClassId ClassId() const;
       
   109 
       
   110 
       
   111     /**
       
   112      * This function is called when the owner of this object
       
   113      * wants to internalize the content according to the data
       
   114      * that has been received from the parser.
       
   115      * 
       
   116      * @param aData The data is set in the protocol parser and can
       
   117      * be used to initialize this class object.
       
   118      */
       
   119     void InternalizeL( const MNcdConfigurationProtocolQuery& aData );
       
   120    
       
   121     
       
   122 public: // MNcdStorageDataItem 
       
   123 
       
   124     // These functions are used to get the data from and to insert the data
       
   125     // into the database using by the given stream.
       
   126 
       
   127     /**
       
   128      * @see MNcdStorageDataItem::ExternalizeL
       
   129      */
       
   130     virtual void ExternalizeL( RWriteStream& aStream );
       
   131 
       
   132 
       
   133     /**
       
   134      * @see MNcdStorageDataItem::InternalizeL
       
   135      */
       
   136     virtual void InternalizeL( RReadStream& aStream );
       
   137 
       
   138 
       
   139 public: // CCatalogsCommunicable
       
   140 
       
   141     /**
       
   142      * @see CCatalogsCommunicable::ReceiveMessage
       
   143      */
       
   144     virtual void ReceiveMessage( MCatalogsBaseMessage* aMessage,
       
   145                                  TInt aFunctionNumber );
       
   146 
       
   147     /**
       
   148      * @see CCatalogsCommunicable::CounterPartLost
       
   149      */
       
   150     virtual void CounterPartLost( const MCatalogsSession& aSession );
       
   151 
       
   152 
       
   153 protected:
       
   154 
       
   155     /**
       
   156      * Constructor
       
   157      * @param aClassId Identifies this class. 
       
   158      * Is set in the NewLC function 
       
   159      */
       
   160     CNcdNodeDisclaimer( NcdNodeClassIds::TNcdNodeClassId aClassId );
       
   161 
       
   162     /**
       
   163      * ConstructL
       
   164      */
       
   165     virtual void ConstructL();
       
   166     
       
   167     /**
       
   168      * ConstructL
       
   169      */
       
   170     virtual void ConstructL( const CNcdNodeDisclaimer& aDisclaimer );
       
   171     
       
   172 
       
   173     // These functions are called from the ReceiveMessage when
       
   174     // the given function id has matched to the function.
       
   175 
       
   176     /**
       
   177      * This function is called when the proxy wants to get the
       
   178      * data from the serverside. This function calls the
       
   179      * InternalizeDataForRequestL which may be overloaded in the
       
   180      * child classes
       
   181      * @param aMessage Contains data from the proxy and can be used
       
   182      * to send data back to proxy
       
   183      */
       
   184     void InternalizeRequestL( MCatalogsBaseMessage& aMessage );
       
   185         
       
   186     /**
       
   187      * This function writes the object data to the stream. 
       
   188      * The stream content will be sent to the proxy that requested the data.
       
   189      * Child classes should add their own data after this parent data.
       
   190      * @param aStream The data content of this class object will be written
       
   191      * into this stream.
       
   192      */
       
   193     virtual void ExternalizeDataForRequestL( RWriteStream& aStream );
       
   194 
       
   195     /**
       
   196      * This function is called from the proxy side. When the proxy
       
   197      * is deleted.
       
   198      * @param aMessage Contains data from the proxy and can be used
       
   199      * to send data back to proxy
       
   200      */
       
   201     void ReleaseRequest( MCatalogsBaseMessage& aMessage ) const;
       
   202 
       
   203 
       
   204 private:
       
   205 
       
   206     // Prevent these two if they are not implemented
       
   207     CNcdNodeDisclaimer( const CNcdNodeDisclaimer& aObject );
       
   208     CNcdNodeDisclaimer& operator =( const CNcdNodeDisclaimer& aObject );
       
   209 
       
   210 
       
   211 private: // data
       
   212     
       
   213     // The class id is identifies this class. The id may be used to
       
   214     // identify what kind of class object is created when data is gotten
       
   215     // from the db.
       
   216     NcdNodeClassIds::TNcdNodeClassId iClassId;
       
   217 
       
   218     // The message is set when ReceiveMessage is called. The message
       
   219     // is used in the CounterPartLost-function that informs the message
       
   220     // if the session has been lost.
       
   221     MCatalogsBaseMessage* iMessage;
       
   222 
       
   223 
       
   224     // Disclaimer content
       
   225     HBufC* iTitle;
       
   226     HBufC* iBodyText;
       
   227     TBool iOptional;
       
   228     MNcdQuery::TSemantics iSemantics;    
       
   229         
       
   230     };
       
   231     
       
   232 #endif // NCD_NODE_DISCLAIMER_H