internetradio2.0/streamsourceinc/irmetadata.h
changeset 14 896e9dbc5f19
parent 12 608f67c22514
child 15 065198191975
equal deleted inserted replaced
12:608f67c22514 14:896e9dbc5f19
     1 /*
       
     2 * Copyright (c) 2007-2007 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:  Meta data wrapper class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CIRMETADATA_H
       
    20 #define C_CIRMETADATA_H
       
    21 
       
    22 #include <s32mem.h>
       
    23 
       
    24 /**
       
    25  * Station meta data information wrapper.
       
    26  *
       
    27  * Supports all ICY protocol specified meta data information and provides
       
    28  * internalization and externalization for passing the meta data via binary
       
    29  * APIs, such as Publish & Subscribe.
       
    30  */
       
    31 NONSHARABLE_CLASS( CIRMetaData ) : public CBase
       
    32     {
       
    33 
       
    34 public:
       
    35 
       
    36     /**
       
    37      * Default two-phased constructor.
       
    38      *
       
    39      * Initializes the object to default values.
       
    40      *
       
    41      * @return  The created object. Ownership is transferred.
       
    42      */
       
    43     inline static CIRMetaData* NewL();
       
    44 
       
    45     /**
       
    46      * Two-phased constructor for direct internalization.
       
    47      *
       
    48      * Initializes the object by internalizing it from the supplied data.
       
    49      *
       
    50      * @param   aData   Binary data to be used for internalization.
       
    51      * @return  The created object. Ownership is transferred.
       
    52      */
       
    53     inline static CIRMetaData* NewL( const TDesC8& aData );
       
    54 
       
    55     /**
       
    56      * Destructor.
       
    57      *
       
    58      * Frees all allocated resources.
       
    59      */
       
    60     inline ~CIRMetaData();
       
    61 
       
    62     /**
       
    63      * Copies values from the supplied meta data object.
       
    64      *
       
    65      * Resulting object is identical to the supplied one after the call
       
    66      * has been successfully completed.
       
    67      *
       
    68      * @param   aMetaData   Meta data to copy information from.
       
    69      */
       
    70     inline void SetL( const CIRMetaData& aMetaData );
       
    71 
       
    72     /**
       
    73      * Sets the artist name.
       
    74      *
       
    75      * @param   aArtist     The artist name to set.
       
    76      */
       
    77     inline void SetArtistL( const TDesC& aArtist );
       
    78 
       
    79     /**
       
    80      * Sets the song name.
       
    81      *
       
    82      * @param   aSong       The song name to set.
       
    83      */
       
    84     inline void SetSongL( const TDesC& aSong );
       
    85 
       
    86     /**
       
    87      * Sets the stream URL.
       
    88      *
       
    89      * @param   aStreamUrl  The stream URL to set.
       
    90      */
       
    91     inline void SetStreamUrlL( const TDesC& aStreamUrl );
       
    92 
       
    93     /**
       
    94      * Returns the artist name.
       
    95      *
       
    96      * @return  The artist name.
       
    97      */
       
    98     inline const TDesC& Artist() const;
       
    99 
       
   100     /**
       
   101      * Returns the song name.
       
   102      *
       
   103      * @return  The song name.
       
   104      */
       
   105     inline const TDesC& Song() const;
       
   106 
       
   107     /**
       
   108      * Returns the stream URL.
       
   109      *
       
   110      * @return  The stream URL.
       
   111      */
       
   112     inline const TDesC& StreamUrl() const;
       
   113 
       
   114     /**
       
   115      * Internalizes the object from the supplied stream.
       
   116      *
       
   117      * @param   aStream     Stream to internalize the object from.
       
   118      */
       
   119     inline void InternalizeL( RReadStream& aStream );
       
   120 
       
   121     /**
       
   122      * Externalizes the object to the supplied stream.
       
   123      *
       
   124      * @param   aStream     Stream to externalize the object to.
       
   125      */
       
   126     inline void ExternalizeL( RWriteStream& aStream ) const;
       
   127 
       
   128     /**
       
   129      * Equality comparison operator.
       
   130      *
       
   131      * Compares two meta data objects and returns whether or not they are identical.
       
   132      *
       
   133      * @param   aMetaData   Meta data to be used for comparison.
       
   134      * @return  <code>ETrue</code> if the objects are identical, <code>EFalse</code> otherwise.
       
   135      */
       
   136     inline TBool operator==( const CIRMetaData& aMetaData ) const;
       
   137 
       
   138     /**
       
   139      * Inequality comparison operator.
       
   140      *
       
   141      * Compares two meta data objects and returns whether or not they are not identical.
       
   142      *
       
   143      * @param   aMetaData   Meta data to be used for comparison.
       
   144      * @return  <code>ETrue</code> if the objects are not identical, <code>EFalse</code> otherwise.
       
   145      */
       
   146     inline TBool operator!=( const CIRMetaData& aMetaData ) const;
       
   147 
       
   148 private:
       
   149 
       
   150     /**
       
   151      * Default constructor.
       
   152      */
       
   153     inline CIRMetaData();
       
   154 
       
   155     /**
       
   156      * Second-phase constructor.
       
   157      */
       
   158     inline void ConstructL();
       
   159 
       
   160     /**
       
   161      * Second-phase constructor from binary data.
       
   162      *
       
   163      * @param   aData   Binary data to internalize the object from.
       
   164      */
       
   165     inline void ConstructL( const TDesC8& aData );
       
   166 
       
   167 private:
       
   168 
       
   169     /**
       
   170      * The name of the artist.
       
   171      * Owned.
       
   172      */
       
   173     RBuf iArtist;
       
   174 
       
   175     /**
       
   176      * The name of the song.
       
   177      * Owned.
       
   178      */
       
   179     RBuf iSong;
       
   180 
       
   181     /**
       
   182      * The stream URL.
       
   183      * Owned.
       
   184      */
       
   185     RBuf iStreamUrl;
       
   186 
       
   187     };
       
   188 
       
   189 #include "irmetadata.inl"
       
   190 
       
   191 #endif // C_CIRMETADATA_H