mmappcomponents/harvester/filehandler/inc/mpxplaylistscanner.h
changeset 0 a2952bb97e68
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     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:  Class to handle playlist parsing
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CMPXPLAYLISTSCANNER_H
       
    20 #define CMPXPLAYLISTSCANNER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <mpxplaylistengineobserver.h>
       
    24 
       
    25 // FOWARD DECLARATIONS
       
    26 class MMPXPlaylistScanObserver;
       
    27 class MMPXFileScanStateObserver;
       
    28 class CMPXMedia;
       
    29 class CMPXMediaArray;
       
    30 class CMPXPlaylistEngine;
       
    31 class CMPXCollectionType; 
       
    32 
       
    33 /**
       
    34  *  CMPXPlaylistScanner
       
    35  *  Playlist extraction class
       
    36  *
       
    37  *  @lib mpxfilehandler.lib
       
    38  *  @since S60 v3.0
       
    39  */
       
    40 NONSHARABLE_CLASS( CMPXPlaylistScanner ): public CBase,
       
    41                                           public MMPXPlaylistEngineObserver
       
    42     {
       
    43 
       
    44 public:
       
    45 
       
    46     /**
       
    47     * Two-phase constructor
       
    48     * @param aObs observer to the playlist scan
       
    49     * @param aStateObs observer to state changes in scanning
       
    50     * @param aTypes supported collection files
       
    51     */
       
    52     static CMPXPlaylistScanner* NewL( MMPXPlaylistScanObserver& aObs,
       
    53                                       MMPXFileScanStateObserver& aStateObs,
       
    54                                       RPointerArray<CMPXCollectionType>& aTypes );
       
    55 
       
    56     /**
       
    57     * Destructor
       
    58     */
       
    59     virtual ~CMPXPlaylistScanner();
       
    60 
       
    61 public: 
       
    62     
       
    63     /**
       
    64     * Initiates the scanning of the list of playlists 
       
    65     */
       
    66     void ScanL(); 
       
    67     
       
    68     /**
       
    69     * Cancels scanning
       
    70     */
       
    71     void Cancel();
       
    72     
       
    73     /**
       
    74     * Resets any internal variables
       
    75     */
       
    76     void Reset();
       
    77     
       
    78     /**
       
    79     * Add a file to the list for scanning
       
    80     * @param aFile file to add to the new scan list
       
    81     */
       
    82     void AddPlaylistToScanL( const TDesC& aFile );
       
    83     
       
    84     /**
       
    85     * Add a file to the list for update
       
    86     * @param aFile file to add to the update scan list
       
    87     */
       
    88     void AddUpdatedPlaylistToScanL( const TDesC& aFile );
       
    89     
       
    90     /**
       
    91     * Is aFile a playlist file?
       
    92     * @param aFile, file to check
       
    93     * @return ETrue if the file is a playlist, EFalse otherwise
       
    94     */
       
    95     TBool IsPlaylistFileL( const TDesC& aFile );
       
    96      
       
    97 protected:
       
    98 
       
    99     /**
       
   100     * From MMPXPlaylistEngineObserver
       
   101     */
       
   102     void HandlePlaylistL(CMPXMedia* aPlaylist,
       
   103                          const TInt aError,
       
   104                          const TBool aCompleted );
       
   105 
       
   106     /**
       
   107     * From MMPXPlaylistEngineObserver
       
   108     */
       
   109     void HandlePlaylistL(const TDesC& aPlaylistUri,
       
   110                          const TInt aError);    
       
   111 
       
   112 private:
       
   113 
       
   114     /**
       
   115     * Adds/Updates files to the collection
       
   116     */
       
   117     void CompleteFilesL();
       
   118         
       
   119 private:
       
   120 
       
   121     /**
       
   122     * Constructor
       
   123     * @param aObs observer to the playlist scan
       
   124     * @param aStateObs observer to state changes in scanning
       
   125     * @param aTypes supported collection files
       
   126     */
       
   127     CMPXPlaylistScanner( MMPXPlaylistScanObserver& aObs,
       
   128                          MMPXFileScanStateObserver& aStateObs,
       
   129                          RPointerArray<CMPXCollectionType>& aTypes );
       
   130     
       
   131     /**
       
   132     * 2nd Phase constructor
       
   133     */
       
   134     void ConstructL();
       
   135 
       
   136 private: // data
       
   137     MMPXPlaylistScanObserver&  iObserver;
       
   138     MMPXFileScanStateObserver& iStateObserver; 
       
   139     TBool                      iExtracting;            // is this object busy?
       
   140     TInt                       iNewPlPending;
       
   141     TInt                       iUpdatePlPending;
       
   142     
       
   143     CDesCArray*                iPlList;  // list of playlist files to scan
       
   144     CDesCArray*                iPlUpdateList; // list of updated playlists;
       
   145     
       
   146     CMPXMediaArray* iPropArray;
       
   147     CMPXMediaArray* iUpdatePropArray;
       
   148     
       
   149     CMPXPlaylistEngine*        iPlEngine;
       
   150     RPointerArray<CMPXCollectionType>& iSupportedTypes;  // not owned
       
   151     };
       
   152 
       
   153 
       
   154 #endif // CMPXPLAYLISTSCANNER_H