videofeeds/clientapi/inc/CIptvServices.h
changeset 0 96612d01cf9f
child 12 5d288c4e5e38
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     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 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:    A class holding several CIptvService objects in a binary form.*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef CIPTVSERVICES_H
       
    22 #define CIPTVSERVICES_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32base.h>
       
    26 #include <s32mem.h>
       
    27 
       
    28 // CONSTANTS
       
    29 
       
    30 // MACROS
       
    31 
       
    32 // DATA TYPES
       
    33 
       
    34 // FUNCTION PROTOTYPES
       
    35 
       
    36 // FORWARD DECLARATIONS
       
    37 class CIptvService;
       
    38 
       
    39 // CLASS DECLARATION
       
    40 
       
    41 /**
       
    42 * Holds several CIptvService objects in a binary form. This class is good for handling
       
    43 * large number of CIptvService objects in a memory saving manner. Provides methods
       
    44 * for adding a new service and referencing to them.
       
    45 */
       
    46 class CIptvServices : public CBase
       
    47     {
       
    48     public:  // Constructors and destructor
       
    49         
       
    50         /**
       
    51         * Two-phased constructor.
       
    52         */
       
    53         IMPORT_C static CIptvServices* NewL();
       
    54         
       
    55         /**
       
    56         * Destructor.
       
    57         */
       
    58         IMPORT_C virtual ~CIptvServices();
       
    59 
       
    60     public: // New functions
       
    61         
       
    62         /**
       
    63          * Creates CIptvService instance from aIndex position.
       
    64          * Notice that CIptvService object is constructed from binary data
       
    65          * and is somewhat CPU extensive. On the other hand, CIptvService
       
    66          * class uses lots of memory, so it's recommended not to
       
    67          * have too many of them loaded at the same time.
       
    68          * Caller is responsible for freeing the returned CIptvService pointer.
       
    69          *
       
    70          * @param aIndex Position in CIptvServices private services array.
       
    71          * @return       Pointer to CIptvService class, If service is not found, NULL is returned.
       
    72          */
       
    73         IMPORT_C CIptvService* GetServiceL(TUint32 aIndex);
       
    74 
       
    75         /**
       
    76          * Gets reference to CIptvService instance from aIndex position.
       
    77          * Notice that CIptvService object is constructed from binary data
       
    78          * and is somewhat CPU extensive. Memory allocation is not performed, so
       
    79          * this is ligher operation than "CIptvService* GetServiceL(TUint32 aIndex)"
       
    80          * -method. This method is good for quick browsing through services.
       
    81          * Changing this reference will not change CIptvServices binary data.
       
    82          *
       
    83          * @param aIndex Position in CIptvServices private services array.
       
    84          * @return       Reference to CIptvService class, if service is not found, leave occurs.
       
    85          */
       
    86         IMPORT_C CIptvService& GetServiceRefL(TUint32 aIndex);
       
    87 
       
    88         /**
       
    89          * Returns reference to CIptvService instance from aIndex position.
       
    90          * Notice that CIptvService object is constructed from binary data
       
    91          * and is somewhat CPU extensive. Memory allocation is not performed, so
       
    92          * this is ligher operation than "CIptvService* GetServiceL(TUint32 aIndex)"
       
    93          * -method. This method is good for quick browsing through services.
       
    94          * Changing this reference will not change CIptvServices binary data.
       
    95          *
       
    96          * @param aIndex Position in CIptvServices private services array.
       
    97          * @param aError Will contain KErrNone if service found and returned
       
    98          *               successfully. If != KErrNone, then return reference
       
    99          *               does not contain valid data.
       
   100          * @return       Reference to CIptvService class.
       
   101          */
       
   102         IMPORT_C CIptvService& CIptvServices::Service( TUint32 aIndex, TInt& aError );        
       
   103         
       
   104         /**
       
   105          * Adds a service.
       
   106          *
       
   107          * @param aService Service to add.
       
   108          * @return         System-wide error code.
       
   109          */        
       
   110         IMPORT_C TInt AddL(CIptvService& aService);
       
   111 
       
   112         /**
       
   113          * Service count hold by this object.
       
   114          *
       
   115          * @return Service count.
       
   116          */        
       
   117         IMPORT_C TInt Count();
       
   118 
       
   119         /**
       
   120          * Serializes this object from aStream.
       
   121          *
       
   122          * @param aStream Stream to read from.
       
   123          */        
       
   124         IMPORT_C void InternalizeL(RDesReadStream& aStream);
       
   125 
       
   126         /**
       
   127          * Serializes this object to aStream.
       
   128          *
       
   129          * @param aStream Stream to write to.
       
   130          */        
       
   131         IMPORT_C void ExternalizeL(RDesWriteStream& aStream) const;
       
   132 
       
   133         /**
       
   134          * Returns the size of the memoryblock needed for ExternalizeL call.
       
   135          *
       
   136          * @param Memory block size in bytes.
       
   137          */        
       
   138         IMPORT_C TUint32 CountExternalizeSize();
       
   139         
       
   140     private:
       
   141 
       
   142         /**
       
   143         * C++ default constructor.
       
   144         */
       
   145         CIptvServices();
       
   146 
       
   147         /**
       
   148         * By default Symbian 2nd phase constructor is private.
       
   149         */
       
   150         void ConstructL();
       
   151 
       
   152     private:    // Data
       
   153     
       
   154         /**
       
   155         * CIptvService classes in binary form.
       
   156         */
       
   157         RArray<HBufC8*> iServices;
       
   158         
       
   159         /**
       
   160         * Used for offering references to iServices array.
       
   161         */
       
   162         CIptvService*   iService;
       
   163          
       
   164     };
       
   165 
       
   166 #endif      // CIPTVSERVICES_H
       
   167             
       
   168 // End of File