example/clientapi/smf/inc/smfplugins/base/smfproviderbase.h
changeset 3 0446eb7b28aa
parent 2 86af6c333601
child 4 969092730d34
equal deleted inserted replaced
2:86af6c333601 3:0446eb7b28aa
     1 /**
       
     2  * Copyright (c) 2010 Sasken Communication Technologies Ltd.
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of the "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  * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
       
    11  *
       
    12  * Contributors:
       
    13  * Manasij Roy, Nalina Hariharan
       
    14  * 
       
    15  * Description:
       
    16  * The Provider Base class is the class that has to be contained as a member 
       
    17  * in all Plug-in Interfaces.
       
    18  *
       
    19  */
       
    20 
       
    21 #ifndef SMFPROVIDERBASE_H_
       
    22 #define SMFPROVIDERBASE_H_
       
    23 
       
    24 #include <QImage>
       
    25 #include <QUrl>
       
    26 #include <QBuffer>
       
    27 #include <smfglobal.h>
       
    28 #include <qdatastream.h>
       
    29 #include <QSharedData>
       
    30 
       
    31 class SmfProviderBasePrivate;
       
    32 
       
    33 /**
       
    34  * @ingroup smf_plugin_group
       
    35  * The Provider Base class is the class that has to be contained as a member 
       
    36  * in all Plug-in Interfaces.
       
    37  * 
       
    38  * All of plug-ins should contain this class as a member and should also 
       
    39  * contain a public method to get instance of this class. 
       
    40  */
       
    41 class SmfProviderBase : public QObject
       
    42 	{
       
    43 	Q_OBJECT
       
    44 
       
    45 public:
       
    46 	/**
       
    47 	 * Constructor with default argument
       
    48 	 * @param aParent The parent object
       
    49 	 */
       
    50 	SmfProviderBase( QObject* aParent = 0 );
       
    51 	
       
    52 	/**
       
    53 	 * Copy Constructor
       
    54 	 * @param aOther The reference object
       
    55 	 */
       
    56 	SmfProviderBase( const SmfProviderBase &aOther );
       
    57 	
       
    58 	/**
       
    59 	 * Destructor
       
    60 	 */
       
    61 	~SmfProviderBase( );
       
    62 
       
    63 	/**
       
    64 	 * Method to get the Localisable name of the service.
       
    65 	 * @return The Localisable name of the service.
       
    66 	 */
       
    67 	QString serviceName( ) const;
       
    68 	
       
    69 	/**
       
    70 	 * Method to get the Logo of the service
       
    71 	 * @return The Logo of the service
       
    72 	 */
       
    73 	QImage serviceIcon( ) const;
       
    74 	
       
    75 	/**
       
    76 	 * Method to get the Readable service description
       
    77 	 * @return The Readable service description
       
    78 	 */
       
    79 	QString description( ) const;
       
    80 	
       
    81 	/**
       
    82 	 * Method to get the Website of the service
       
    83 	 * @return The Website of the service
       
    84 	 */
       
    85 	QUrl serviceUrl( ) const;
       
    86 	
       
    87 	/**
       
    88 	 * Method to get the URL of the Application providing this service
       
    89 	 * @return The URL of the Application providing this service
       
    90 	 */
       
    91 	QUrl applicationUrl( ) const;
       
    92 	
       
    93 	/**
       
    94 	 * Method to get the Icon of the application
       
    95 	 * @return The Icon of the application
       
    96 	 */
       
    97 	QImage applicationIcon( ) const;
       
    98 	
       
    99 	/**
       
   100 	 * Method to get the Plugin specific ID
       
   101 	 * @return The Plugin specific ID
       
   102 	 */
       
   103 	quint32 pluginId( ) const;
       
   104 	
       
   105 	/**
       
   106 	 * Method to get the ID of the authentication application 
       
   107 	 * for this service
       
   108 	 * @param aProgram The authentication application name
       
   109 	 * @param aArguments List of arguments required for authentication app
       
   110 	 * @param aMode Strting mode for authentication application
       
   111 	 * @return The ID of the authentication application 
       
   112 	 */
       
   113 	quint32 authenticationApp( QString &aProgram, QStringList & aArguments, 
       
   114 			QIODevice::OpenModeFlag aMode = QIODevice::ReadWrite ) const;
       
   115 	
       
   116 	/**
       
   117 	 * Method to get the unique registration ID provided by the 
       
   118 	 * Smf for authorised plugins
       
   119 	 * @return The unique registration ID/token provided by the Smf for 
       
   120 	 * authorised plugins
       
   121 	 */
       
   122 	QString smfRegistrationId( ) const;
       
   123 	
       
   124 	/**
       
   125 	 * Method to get the data usage of each plugin
       
   126 	 * @return The data usage structure
       
   127 	 */
       
   128 	SmfPluginDataUsage getDataUsage( ) const;
       
   129 	
       
   130 	/**
       
   131 	 * Method to get the reference count for loading.
       
   132 	 * The reference count increased with each load request and decreased 
       
   133 	 * with each unload request
       
   134 	 * @return The reference count value for loading of the plugins
       
   135 	 */
       
   136 	uint getLoadRefCount( ) const;
       
   137 	
       
   138 private:
       
   139 	QSharedDataPointer<SmfProviderBasePrivate> d;
       
   140 
       
   141 	friend QDataStream &operator<<( QDataStream &aDataStream, 
       
   142 			const SmfProviderBase &aProviderBase );
       
   143 
       
   144 	friend QDataStream &operator>>( QDataStream &aDataStream, 
       
   145 			SmfProviderBase &aProviderBase );
       
   146 	
       
   147 	};
       
   148 
       
   149 
       
   150 /**
       
   151  * Method for Externalization. Writes the SmfProviderBase object to 
       
   152  * the stream and returns a reference to the stream.
       
   153  * @param aDataStream Stream to be written
       
   154  * @param aProviderBase The SmfProviderBase object to be externalized
       
   155  * @return reference to the written stream
       
   156  */
       
   157 QDataStream &operator<<( QDataStream &aDataStream, 
       
   158 		const SmfProviderBase &aProviderBase );
       
   159 
       
   160 /**
       
   161  * Method for Internalization. Reads a SmfProviderBase object from 
       
   162  * the stream and returns a reference to the stream.
       
   163  * @param aDataStream Stream to be read
       
   164  * @param aProviderBase The SmfProviderBase object to be internalized
       
   165  * @return reference to the stream
       
   166  */
       
   167 QDataStream &operator>>( QDataStream &aDataStream, 
       
   168 		SmfProviderBase &aProviderBase);
       
   169 
       
   170 #endif /* SMFPROVIDERBASE_H_ */