homescreenplugins/videochplugin/inc/videochpublishabledataitem.h
branchRCL_3
changeset 10 112a725ff2c2
parent 9 5294c000a26d
child 11 8970fbd719ec
equal deleted inserted replaced
9:5294c000a26d 10:112a725ff2c2
     1 /*
       
     2 * Copyright (c) 2008 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 the License "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:    CVcxNsPublishableDataItem class declaration*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 #ifndef _VCXNSCHPUBLISHABLEDATAITEM_H
       
    21 #define _VCXNSCHPUBLISHABLEDATAITEM_H 
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32std.h>
       
    25 #include <e32cmn.h>
       
    26 #include "videochpublishabledata.h"
       
    27 
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CLiwDefaultMap;
       
    31 template <class T, class K> class RHashMap;
       
    32 
       
    33 
       
    34 // CLASS DECLARATION
       
    35 /**
       
    36  * Class contains data and services for handling data of
       
    37  * single item in the tvvideo menu suite 
       
    38  */
       
    39 
       
    40 class CVcxNsPublishableDataItem: public CBase
       
    41     {
       
    42     
       
    43 public:
       
    44 
       
    45     /**
       
    46      * Two-phased constructor. Provided content type
       
    47      * should not be locally defined. The object does not
       
    48      * own the actual string. 
       
    49      * 
       
    50      * @param aContentType Desc pointer to contentype of this item
       
    51      * 
       
    52      * @return  CVcxNsPublishableDataItem*
       
    53      */
       
    54     static CVcxNsPublishableDataItem* NewL( TPtrC aContentType );
       
    55     
       
    56     /**
       
    57      * Two-phased constructor. Provided content type
       
    58      * should not be locally defined. The object does not
       
    59      * own the actual string. 
       
    60      * 
       
    61      * @param aContentType Desc pointer to contentype of this item
       
    62      * 
       
    63      * @return  CVcxNsPublishableDataItem*
       
    64      */
       
    65     static CVcxNsPublishableDataItem* NewLC( TPtrC aContentType );
       
    66     
       
    67     /**
       
    68      * Destructor
       
    69      * 
       
    70      */
       
    71     virtual ~CVcxNsPublishableDataItem();
       
    72 
       
    73 
       
    74 private:
       
    75     
       
    76     /**
       
    77      * Symbian 2nd phase constructor
       
    78      * 
       
    79      */
       
    80     void ConstructL();
       
    81 
       
    82     /**
       
    83      * C++ constructor
       
    84      * 
       
    85      */
       
    86     CVcxNsPublishableDataItem( TPtrC aContentType );
       
    87     
       
    88 public:
       
    89     
       
    90     /**
       
    91      * returns a desc pointer to content type desc 
       
    92      * 
       
    93      * @return  TPtrC
       
    94      */
       
    95     TPtrC ContentType() const;
       
    96     
       
    97     /**
       
    98      * Method sets integer type data into  iIntData map
       
    99      * 
       
   100      * @param aValueKey& value's key name where to save
       
   101      * @param aValue value to save
       
   102      * 
       
   103      * @leave KErrNotFound: if item with provided content type or value data 
       
   104      *                      item with provided key not found.
       
   105      * @leave KErrNoMemory: if memory could not be allocated to store the 
       
   106      *                       copies of aKey and aValue
       
   107      */
       
   108     void SetDataL( TPtrC8 aKey, TInt aValue );
       
   109       
       
   110     /**
       
   111      * Method sets integer type data into iDescData map
       
   112      * 
       
   113      * @param aValueKey& value's key name where to save
       
   114      * @param aValue value to save
       
   115      * 
       
   116      * @leave KErrNotFound: if item with provided content type or value data 
       
   117      *                      item with provided key not found.
       
   118      * @leave KErrNoMemory: if memory could not be allocated to store the 
       
   119      *                       copies of aKey and aValue
       
   120      */
       
   121     void SetDataL( TPtrC8 aKey, const TDesC& aData );
       
   122     
       
   123     /**
       
   124      * Method returns integer -type data from local map.   
       
   125      * 
       
   126      * @param aValueKey& value's key name  from where to get
       
   127      * 
       
   128      * @return TInt 
       
   129      * 
       
   130      * @leave KErrNotFound: if item with provided content type or value data 
       
   131      *                      item with provided key not found.
       
   132      * 
       
   133      */
       
   134     TInt GetIntDataL( TPtrC8 aKey ) const;
       
   135     
       
   136     /**
       
   137      * Method returns descriptor -type data from local map.   
       
   138      * 
       
   139      * @param aValueKey& value's key name  from where to get
       
   140      * 
       
   141      * @return TInt 
       
   142      * 
       
   143      * @leave KErrNotFound: if item with provided content type or value data 
       
   144      *                      item with provided key not found.
       
   145      * 
       
   146      */
       
   147     const TDesC& GetDesCDataL( TPtrC8 aKey ) const;
       
   148     
       
   149     /**
       
   150      * Method copies key-value pairs from the local maps into 
       
   151      * provided reference map.   
       
   152      * 
       
   153      * @param aDataMap  map where to save data
       
   154      * 
       
   155      */
       
   156     void FillCPDataMapL( CLiwDefaultMap& aDataMap );
       
   157    
       
   158     /**
       
   159      * Method reads key-value pairs from provided reference map
       
   160      * and saves them to local maps.    
       
   161      * 
       
   162      * @param aDataMap  map where to copy data
       
   163      *  
       
   164      */
       
   165     void ReadCPDataMapL( CLiwDefaultMap& aDataMap );
       
   166     
       
   167     /**
       
   168      * Method clears data. All descs sizes are set to zero and integers
       
   169      * set to 0.     
       
   170      *  
       
   171      */
       
   172     void ClearData();
       
   173     
       
   174 private:
       
   175     
       
   176     /**
       
   177      * Internal helper method to extract data to liwvariant from the liwmap.
       
   178      * 
       
   179      * Method leaves if data provided by the key is not found
       
   180      * 
       
   181      * @param aKey key of data item
       
   182      * @param aDataMap a map where to search data
       
   183      * @param aVariant variant item from where to fetch tha actual data
       
   184      * 
       
   185      */
       
   186     TInt ExtractVariant( const TDesC8& aKey,  
       
   187                          CLiwDefaultMap& aDataMap, 
       
   188                          TLiwVariant& aVariant );
       
   189        
       
   190         
       
   191 private: // DATA
       
   192      
       
   193     /**
       
   194      * Desc pointer to external string containing content type txt.
       
   195      * Not Owned.
       
   196      */
       
   197     TPtrC iContentType;
       
   198     
       
   199     /**
       
   200      * Map containing integer type data.
       
   201      */
       
   202     RHashMap< TBuf8< KTvVideoMaxValueKeyLen >, TInt >*   iIntData;
       
   203       
       
   204     /**
       
   205      * Map containing desc type data.
       
   206      */
       
   207     RHashMap< TBuf8< KTvVideoMaxValueKeyLen >, HBufC* >* iDescData;
       
   208             
       
   209     };
       
   210 
       
   211 #endif // _VCXNSCHPUBLISHABLEDATAITEM_H