bagetmodel/inc/ibagetprovider.h
changeset 66 32469d7d46ff
parent 61 8e5041d13c84
child 73 4bc7b118b3df
equal deleted inserted replaced
61:8e5041d13c84 66:32469d7d46ff
     1 /*
       
     2 * Copyright (c) 2009 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:  Baget provider interface.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef IBAGETPROVIDER_H
       
    19 #define IBAGETPROVIDER_H
       
    20 
       
    21 #include <QtPlugin>
       
    22 #include <QVariant>
       
    23 
       
    24 /*!
       
    25     \class BagetToken
       
    26     \brief Represents a Baget that can be created.
       
    27 
       
    28     Bagets are located in baget providers. Each provider
       
    29     exposes its contained Bagets as baget tokens. A token has all
       
    30     the needed information for Baget selection and creation.
       
    31 */
       
    32 class BagetToken
       
    33 {
       
    34 
       
    35 public:
       
    36 
       
    37     /*!
       
    38         The name of the library/plugin that contains the Baget.
       
    39     */
       
    40     QString mLibrary;
       
    41 
       
    42     /*!
       
    43         Uniquely identifies the Baget.
       
    44     */
       
    45     QString mUri;
       
    46 
       
    47 };
       
    48 
       
    49 class Baget;
       
    50 
       
    51 /*!
       
    52     \class IBagetProvider
       
    53     \brief Defines a mechanism for retrieving a Baget.
       
    54 
       
    55     Interface that defines a mechanism for retrieving a Baget. 
       
    56     Each Baget provider implements this interface. 
       
    57 */
       
    58 class IBagetProvider
       
    59 {
       
    60 
       
    61 public:
       
    62 
       
    63     /*!
       
    64         Destructor.
       
    65     */
       
    66     virtual ~IBagetProvider() {}
       
    67 
       
    68 public:
       
    69 
       
    70     /*!
       
    71         Returns contained Bagets as a list of baget tokens.
       
    72         \return Contained Bagets as tokens.
       
    73     */
       
    74     virtual QList<BagetToken> bagets() = 0;
       
    75 
       
    76     /*!
       
    77         Creates and returns a Baget based on the given token.
       
    78         \param token Identifies the Baget to be created.
       
    79         \return The created Baget or null in failure cases.
       
    80     */
       
    81     virtual Baget *createBaget(const BagetToken &token) = 0;
       
    82 
       
    83 };
       
    84 
       
    85 Q_DECLARE_METATYPE(BagetToken)
       
    86 Q_DECLARE_INTERFACE(IBagetProvider, "com.nokia.baget.ibagetprovider/1.0")
       
    87 
       
    88 #endif // IBAGETPROVIDER_H