upnpavcontroller/upnpxmlparser/inc/upnpobjectlite.h
changeset 0 7f85d04be362
equal deleted inserted replaced
-1:000000000000 0:7f85d04be362
       
     1 /*
       
     2 * Copyright (c) 2006-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:     UpnpObjectLite for fast browsing 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 #ifndef C_UPNPOBJECTLITE_H_
       
    24 #define C_UPNPOBJECTLITE_H_
       
    25 
       
    26 // INCLUDES
       
    27 #include <e32base.h>
       
    28 
       
    29 /**
       
    30  * CUpnpObjectLite for fast browsing. Contains a minimum set of properties
       
    31  * and memory consumption is kept low
       
    32  *
       
    33  * @since Series 60 3.1
       
    34  * @lib upnpxmlparser.lib
       
    35  */
       
    36 NONSHARABLE_CLASS( CUpnpObjectLite ) : public CBase
       
    37     {
       
    38 
       
    39 public:
       
    40 
       
    41     /**
       
    42      * Enumeration to determine object class
       
    43      */
       
    44     enum TObjectType
       
    45         {    
       
    46         EItem       = 0,
       
    47         EContainer,
       
    48         EMusicItem,
       
    49         EImageItem,
       
    50         EVideoItem,
       
    51         };
       
    52 
       
    53 protected:
       
    54 
       
    55     /**
       
    56      * Enumeration to determine base type
       
    57      */
       
    58     enum TObjectTypeBase
       
    59         {
       
    60         EBaseUnknown        = 0x00000000,
       
    61         EBaseItem           = 0x01000000,
       
    62         EBaseContainer      = 0x02000000
       
    63         };
       
    64     
       
    65     /**
       
    66      * Enumeration to determine sophisticated item type
       
    67      */
       
    68     enum TItemTypeBase
       
    69         {
       
    70         EBaseMusicItem      = 0x00010000,
       
    71         EBaseImageItem      = 0x00020000,
       
    72         EBaseVideoItem      = 0x00040000,
       
    73         EBasePlaylistItem   = 0x00080000,
       
    74         
       
    75         EMusicTrack         = 0x00000100,
       
    76         EPhoto              = 0x00000200,
       
    77         EMovie              = 0x00000400
       
    78         };
       
    79         
       
    80     /**
       
    81      * Enumeration to determine sophisticated container type
       
    82      */
       
    83     enum TContainerTypeBase
       
    84         {
       
    85         EStorageFolder      = 0x00010000,
       
    86         EPlaylistContainer  = 0x00020000,
       
    87         //EAlbum              = 0x00040000,
       
    88         //EGenre              = 0x00080000,
       
    89         
       
    90         EMusicAlbum         = 0x00000100             
       
    91         };        
       
    92     
       
    93 public:
       
    94 
       
    95     /**
       
    96      * 2-phased constructor.
       
    97      */
       
    98     IMPORT_C static CUpnpObjectLite* NewL();
       
    99     
       
   100     /**
       
   101      * Destructor.
       
   102      */
       
   103     IMPORT_C virtual ~CUpnpObjectLite();
       
   104 
       
   105 public:
       
   106 
       
   107     /**
       
   108      * Setter for object id
       
   109      *
       
   110      * @param aObjectId object id
       
   111      */
       
   112     IMPORT_C void SetObjectIdL( const TDesC8& aObjectId );
       
   113     
       
   114     /**
       
   115      * Setter for object id
       
   116      *
       
   117      * @param aObjectId object id (ownership of aObjectId is transferred)
       
   118      */
       
   119     IMPORT_C void SetObjectIdL( HBufC8* aObjectId );
       
   120     
       
   121     /**
       
   122      * Getter for object id
       
   123      *
       
   124      * @return object id
       
   125      */
       
   126     IMPORT_C const TDesC8& ObjectId() const;    
       
   127 
       
   128     /**
       
   129      * Setter for title
       
   130      *
       
   131      * @param aTitle title
       
   132      */
       
   133     IMPORT_C void SetTitleL( const TDesC& aTitle );
       
   134     
       
   135     /**
       
   136      * Setter for title
       
   137      *
       
   138      * @param aTitle title (ownership of aTitle is transferred)
       
   139      */
       
   140     IMPORT_C void SetTitleL( HBufC* aTitle );
       
   141     
       
   142     /**
       
   143      * Getter for title
       
   144      *
       
   145      * @return title
       
   146      */
       
   147     IMPORT_C const TDesC& Title() const;
       
   148     
       
   149     /**
       
   150      * Setter for object id. Does not store objectid as a string, but as a
       
   151      * bitfield to save memory
       
   152      *
       
   153      * @param aTitle title (ownership of aTitle is transferred)
       
   154      */
       
   155     IMPORT_C void SetObjectClass( const TDesC8& aObjectClass );
       
   156     
       
   157     /**
       
   158      * Can be used to chech type of the object
       
   159      *
       
   160      * @return ETrue if the type (part of object class) matches
       
   161      */
       
   162     IMPORT_C TBool IsTypeOf( TObjectType aType ) const;
       
   163     
       
   164 protected:
       
   165 
       
   166     /**
       
   167      * Constructor.
       
   168      */
       
   169     CUpnpObjectLite();
       
   170 
       
   171     /**
       
   172      * 2nd phase constructor.
       
   173      */
       
   174     void ConstructL();
       
   175 
       
   176 protected:
       
   177 
       
   178     void ParseToDelimeter( TLex8& aLex, TChar aDelimeter ) const;
       
   179     
       
   180     void HandleRound( TInt aRound, TPtrC8 aString );
       
   181     
       
   182     void Round1( TPtrC8 aString );
       
   183     
       
   184     void Round2( TPtrC8 aString );
       
   185     
       
   186     void Round3( TPtrC8 aString );
       
   187     
       
   188     void Round4( TPtrC8 aString );
       
   189 
       
   190 protected:
       
   191 
       
   192     HBufC8* iObjectId;
       
   193         
       
   194     HBufC* iTitle;
       
   195     
       
   196     TInt    iObjectClass;    
       
   197         
       
   198 
       
   199     };
       
   200 
       
   201 #endif // C_UPNPOBJECTLITE_H_