upnpavcontroller/upnpavcontrollerhelper/inc/upnpresourceselector.h
changeset 0 7f85d04be362
equal deleted inserted replaced
-1:000000000000 0:7f85d04be362
       
     1 /*
       
     2 * Copyright (c) 2005-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:      Interface for selecting a resource within an item
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 #ifndef UPNPRESOURCESELECTOR_H
       
    24 #define UPNPRESOURCESELECTOR_H
       
    25 
       
    26 //  INCLUDES
       
    27 #include <e32base.h>
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CUpnpItem;
       
    31 class CUpnpElement;
       
    32 
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 
       
    37 /**
       
    38 * An interface for a component that selects a resource from an item.
       
    39 * In upnp items have multiple resources, and it is not necessarily
       
    40 * clear which one of them the client wants to display. This interface
       
    41 * provides a client a clear option to choose whichever resource seems
       
    42 * best.
       
    43 *
       
    44 * @lib upnpavcontrollerhelper.lib
       
    45 * @since S60 3.2
       
    46 */
       
    47 class MUPnPResourceSelector
       
    48     {
       
    49 public: // the interface
       
    50 
       
    51     /**
       
    52      * Selects the resource from given item. The implementing class
       
    53      * should return a reference to one of the elements within the
       
    54      * given item. If there is some problem in selecting a resource
       
    55      * (for instance there are NO resources in the item) the method
       
    56      * should leave
       
    57      *
       
    58      * @since S60 3.2
       
    59      * @param aItem the item where to seek resources
       
    60      * @return reference to selected resource
       
    61      */
       
    62     virtual const CUpnpElement& SelectResourceL(
       
    63         const CUpnpItem& aItem ) = 0;
       
    64 
       
    65     };
       
    66 
       
    67 
       
    68 
       
    69 
       
    70 /**
       
    71  * A helper selector that will select the original or most likely
       
    72  * resource from an item, using UPnPItemUtility::ResourceFromItem.
       
    73  * Most clients will find this practical.
       
    74  * This class could be thought as a DEFAULT implementation for
       
    75  * MUPnPResourceSelector.
       
    76  */
       
    77 class TUPnPSelectDefaultResource
       
    78     : public MUPnPResourceSelector
       
    79     {
       
    80 
       
    81 public:
       
    82 
       
    83     /**
       
    84      * see MUPnPResourceSelector
       
    85      */
       
    86     IMPORT_C const CUpnpElement& SelectResourceL(
       
    87         const CUpnpItem& aItem );
       
    88 
       
    89     };
       
    90 
       
    91 /**
       
    92  * A helper selector that will select the first resource available.
       
    93  * This selector is handy if it is certain that there is only one
       
    94  * resource available or if the first resource is always the proper
       
    95  * one. (as is when sharing a local item)
       
    96  *
       
    97  * @since S60 3.2
       
    98  */
       
    99 class TUPnPSelectFirstResource
       
   100     : public MUPnPResourceSelector
       
   101     {
       
   102 
       
   103 public:
       
   104 
       
   105     /**
       
   106      * see MUPnPResourceSelector
       
   107      */
       
   108     IMPORT_C const CUpnpElement& SelectResourceL(
       
   109         const CUpnpItem& aItem );
       
   110 
       
   111     };
       
   112 
       
   113 
       
   114 #endif  // UPNPRESOURCESELECTOR_H
       
   115 
       
   116 // End of File