videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener/src/mediaobjectfactory.cpp
changeset 36 8aed59de29f9
child 38 ff53afa8ad05
equal deleted inserted replaced
35:3738fe97f027 36:8aed59de29f9
       
     1 
       
     2 /*
       
     3 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     4 * All rights reserved.
       
     5 * This component and the accompanying materials are made available
       
     6 * under the terms of "Eclipse Public License v1.0"
       
     7 * which accompanies this distribution, and is available
       
     8 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     9 *
       
    10 * Initial Contributors:
       
    11 * Nokia Corporation - initial contribution.
       
    12 *
       
    13 * Contributors:
       
    14 *
       
    15 * Description:  Helper class for creating mediaobjects for testing CVideoListDataModel class methods*
       
    16 */
       
    17 
       
    18 // INCLUDES
       
    19 #include <mpxmediacontainerdefs.h>
       
    20 #include <mpxmediageneraldefs.h>
       
    21 #include <mpxcollectioncommanddefs.h>
       
    22 #include <mpxmediaarray.h>
       
    23 #include <mpxmedia.h>
       
    24 #include <qdatetime.h>
       
    25 #include "vcxmyvideosdefs.h"
       
    26 #include "mediaobjectfactory.h"
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // MediaObjectFactory
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 MediaObjectFactory::MediaObjectFactory()
       
    33 {
       
    34     
       
    35 }
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // ~CMediaObjectFactory
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 MediaObjectFactory::~MediaObjectFactory()
       
    42 {
       
    43 }
       
    44  
       
    45 // -----------------------------------------------------------------------------
       
    46 // newMediaArray
       
    47 // -----------------------------------------------------------------------------
       
    48 //
       
    49 CMPXMediaArray* MediaObjectFactory::newMediaArray()
       
    50 {
       
    51     CMPXMediaArray *array = 0;
       
    52     TRAP_IGNORE(array = CMPXMediaArray::NewL());
       
    53     return array;
       
    54 }
       
    55 
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 // newMedia
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 CMPXMedia* MediaObjectFactory::newMedia(int id1, int id2  )
       
    62 {
       
    63     CMPXMedia *media = NULL;
       
    64     TRAP_IGNORE(media = CMPXMedia::NewL());
       
    65     if(!media)
       
    66     {
       
    67         return 0;
       
    68     }
       
    69     if(id1 == -1)
       
    70     {
       
    71         return media;
       
    72     }
       
    73     TMPXItemId itemId;
       
    74     
       
    75     itemId.iId1 = id1;
       
    76     itemId.iId2 = id2;
       
    77     TRAPD(error, media->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, itemId));
       
    78     if(error != KErrNone)
       
    79     {
       
    80         delete media;
       
    81         return 0;
       
    82     }
       
    83 
       
    84     return media;
       
    85     
       
    86 }
       
    87 
       
    88 // -----------------------------------------------------------------------------
       
    89 // addValuePtr
       
    90 // -----------------------------------------------------------------------------
       
    91 //
       
    92 void MediaObjectFactory::putArrayContent(CMPXMediaArray *whereToPut, CMPXMedia *mediaToPut)
       
    93 {
       
    94     TRAP_IGNORE(whereToPut->AppendL(mediaToPut));
       
    95 }
       
    96 
       
    97 
       
    98 // End of file
       
    99     
       
   100 
       
   101