smf/inc/common/smfcontacts/smfpost.h
changeset 7 be09cf1f39dd
parent 6 c39a6cfd1fb9
child 8 4102c67b6e56
equal deleted inserted replaced
6:c39a6cfd1fb9 7:be09cf1f39dd
     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 post class represents an instance of a post to a SN site
       
    17  *
       
    18  */
       
    19 
       
    20 #ifndef SMFPOST_H_
       
    21 #define SMFPOST_H_
       
    22 
       
    23 #include <QImage>
       
    24 #include <QUrl>
       
    25 #include <qdatastream.h>
       
    26 #include <QSharedData>
       
    27 #include <QTextDocument>
       
    28 #include <smfclientglobal.h>
       
    29 
       
    30 class SmfPostPrivate;
       
    31 
       
    32 
       
    33 /**
       
    34  * @ingroup smf_common_group
       
    35  * The post class represents an instance of a post to a SN site
       
    36  */
       
    37 class SMFCLIENT_EXPORT SmfPost : public QTextDocument
       
    38 	{
       
    39 
       
    40 public:
       
    41 	/**
       
    42 	 * Constructor with default argument
       
    43 	 * @param text Text
       
    44 	 * @param aParent The parent object
       
    45 	 */
       
    46 	SmfPost( QString text,QObject *aParent = 0 );
       
    47 	
       
    48 	/**
       
    49 	 * Constructor
       
    50 	 * @param aText The post's text
       
    51 	 * @param aImage The post's image
       
    52 	 * @param aUrl The post's url
       
    53 	 */
       
    54 	SmfPost( QString aTitle, QString aDesc, QImage aImage, QUrl aUrl );
       
    55 
       
    56 	/**
       
    57 	 * Copy Constructor
       
    58 	 * @param aOther The reference object
       
    59 	 */
       
    60 	SmfPost( const SmfPost &aOther );
       
    61 	
       
    62 	/**
       
    63 	 * Destructor
       
    64 	 */
       
    65 	~SmfPost( );
       
    66 	
       
    67 	/**
       
    68 	 * Method to get the title of the post
       
    69 	 * @return The post's title
       
    70 	 */
       
    71 	QString title( ) const;
       
    72 	
       
    73 	/**
       
    74 	 * Method to get the description of the post
       
    75 	 * @return The post's description
       
    76 	 */
       
    77 	QString description( ) const;
       
    78 	
       
    79 	/**
       
    80 	 * Method to get the image of the post
       
    81 	 * @return The post's image
       
    82 	 */
       
    83 	QImage image( ) const;
       
    84 	
       
    85 	/**
       
    86 	 * Method to get the url of the post
       
    87 	 * @return The post's url
       
    88 	 */
       
    89 	QUrl url( ) const;
       
    90 	
       
    91 	/**
       
    92 	 * Method to get the id of the post
       
    93 	 * @return The ID value 
       
    94 	 */
       
    95 	QString id( ) const;
       
    96 	
       
    97 	/**
       
    98 	 * Method to set the title of the post
       
    99 	 * @param aTitle The post's new title
       
   100 	 */
       
   101 	void setTitle( const QString &aTitle );
       
   102 	
       
   103 	/**
       
   104 	 * Method to set the description of the post
       
   105 	 * @param aDesc The post's new description
       
   106 	 */
       
   107 	void setDescription( const QString &aDesc );
       
   108 	
       
   109 	/**
       
   110 	 * Method to set the image of the post
       
   111 	 * @param aPic The post's image
       
   112 	 */
       
   113 	void setImage( const QImage& aPic );
       
   114 	
       
   115 	/**
       
   116 	 * Method to set the url of the post
       
   117 	 * @param aUrl The post's url
       
   118 	 */
       
   119 	void setUrl( QUrl& aUrl );
       
   120 	
       
   121 private:
       
   122 	QSharedDataPointer<SmfPostPrivate> d;
       
   123 
       
   124 	friend QDataStream &operator<<( QDataStream &aDataStream, 
       
   125 			const SmfPost &aPost );
       
   126 
       
   127 	friend QDataStream &operator>>( QDataStream &aDataStream, 
       
   128 			SmfPost &aPost );
       
   129 	
       
   130 	};
       
   131 
       
   132 
       
   133 /**
       
   134  * Method for Externalization. Writes the SmfPost object to 
       
   135  * the stream and returns a reference to the stream.
       
   136  * @param aDataStream Stream to be written
       
   137  * @param aPost The SmfPost object to be externalized
       
   138  * @return reference to the written stream
       
   139  */
       
   140 QDataStream &operator<<( QDataStream &aDataStream, 
       
   141 		const SmfPost &aPost );
       
   142 
       
   143 /**
       
   144  * Method for Internalization. Reads a SmfPost object from 
       
   145  * the stream and returns a reference to the stream.
       
   146  * @param aDataStream Stream to be read
       
   147  * @param aPost The SmfPost object to be internalized
       
   148  * @return reference to the stream
       
   149  */
       
   150 QDataStream &operator>>( QDataStream &aDataStream, 
       
   151 		SmfPost &aPost);
       
   152 
       
   153 // Make the class SmfPost known to QMetaType, so that as to register it.
       
   154 Q_DECLARE_METATYPE(SmfPost)
       
   155 
       
   156 #endif /* SMFPOST_H_ */