example/clientapi/smf/inc/common/smfcontacts/smfpost.h
changeset 2 86af6c333601
parent 1 4b1e636e8a71
--- a/example/clientapi/smf/inc/common/smfcontacts/smfpost.h	Thu Mar 25 14:44:08 2010 +0530
+++ b/example/clientapi/smf/inc/common/smfcontacts/smfpost.h	Tue Apr 06 16:35:37 2010 +0530
@@ -1,75 +1,153 @@
 /**
-* Copyright (c) 2010 Sasken Communication Technologies Ltd.
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the "{License}"
-* which accompanies  this distribution, and is available
-* at the URL "{LicenseUrl}".
-*
-* Initial Contributors:
-* Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
-*
-* Contributors:
-* Manasij Roy
-* Description:
-* Interface spefication for sfm service provider
-*
-*/
+ * Copyright (c) 2010 Sasken Communication Technologies Ltd.
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the "Eclipse Public License v1.0" 
+ * which accompanies  this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html"
+ *
+ * Initial Contributors:
+ * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
+ *
+ * Contributors:
+ * Manasij Roy, Nalina Hariharan
+ * 
+ * Description:
+ * The post class represents an instance of a post to a SN site
+ *
+ */
 
 #ifndef SMFPOST_H_
 #define SMFPOST_H_
-#include "SmfClientGlobal.h"
+
+#include <QImage>
+#include <QUrl>
+#include <qdatastream.h>
+#include <QSharedData>
+#include <QTextDocument>
+#include <smfclientglobal.h>
+
+class SmfPostPrivate;
+
+
 /**
- * class for post, later may be we need to add media. 
- * Post consists of a title and description
+ * @ingroup smf_common_group
+ * The post class represents an instance of a post to a SN site
  */
-
-class SMFCLIENT_EXPORT SmfPost : public QObject
+class SMFCLIENT_EXPORT SmfPost : public QTextDocument
 	{
 	Q_OBJECT
 public:
 	/**
-	 * Constructs a post 
+	 * Constructor with default argument
+	 * @param text Text
+	 * @param aParent The parent object
+	 */
+	SmfPost( QString text,QObject *aParent = 0 );
+	
+	/**
+	 * Constructor
+	 * @param aText The post's text
+	 * @param aImage The post's image
+	 * @param aUrl The post's url
 	 */
-	SmfPost(QObject* provider=0);
+	SmfPost( QString aTitle, QString aDesc, QImage aImage, QUrl aUrl );
+
+	/**
+	 * Copy Constructor
+	 * @param aOther The reference object
+	 */
+	SmfPost( const SmfPost &aOther );
+	
+	/**
+	 * Destructor
+	 */
+	~SmfPost( );
 	
 	/**
-	 * Constructs a post with text,image and url
+	 * Method to get the title of the post
+	 * @return The post's title
 	 */
-	SmfPost(QString text,QPixmap image, QString url);
-	~SmfPost();
+	QString title( ) const;
+	
+	/**
+	 * Method to get the description of the post
+	 * @return The post's description
+	 */
+	QString description( ) const;
 	
 	/**
-	 * Gets post title
+	 * Method to get the image of the post
+	 * @return The post's image
 	 */
-	QString* getTitle();
+	QImage image( ) const;
 	
 	/**
-	 * Gets post text
+	 * Method to get the url of the post
+	 * @return The post's url
 	 */
-	QString* getDescription();
+	QUrl url( ) const;
+	
+	/**
+	 * Method to get the id of the post
+	 * @return The ID value 
+	 */
+	QString id( ) const;
 	
 	/**
-	 * Sets post title
+	 * Method to set the title of the post
+	 * @param aTitle The post's new title
 	 */
-	void setTitle(QString* title);
+	void setTitle( const QString &aTitle );
+	
+	/**
+	 * Method to set the description of the post
+	 * @param aDesc The post's new description
+	 */
+	void setDescription( const QString &aDesc );
+	
+	/**
+	 * Method to set the image of the post
+	 * @param aPic The post's image
+	 */
+	void setImage( const QImage& aPic );
 	
 	/**
-	 * Sets post text
+	 * Method to set the url of the post
+	 * @param aUrl The post's url
 	 */
-	void setDescription(QString* desc);
+	void setUrl( QUrl& aUrl );
+	
+private:
+	QSharedDataPointer<SmfPostPrivate> d;
 
-private:
-	QString m_text;
-	QPixmap m_image;
-	QString m_url;
+	friend QDataStream &operator<<( QDataStream &aDataStream, 
+			const SmfPost &aPost );
+
+	friend QDataStream &operator>>( QDataStream &aDataStream, 
+			SmfPost &aPost );
+	
 	};
-/**
-* Externalization
-*/
-QDataStream &operator<<(QDataStream &, const SmfPost&);
+
+
 /**
- * Internalization
+ * Method for Externalization. Writes the SmfPost object to 
+ * the stream and returns a reference to the stream.
+ * @param aDataStream Stream to be written
+ * @param aPost The SmfPost object to be externalized
+ * @return reference to the written stream
  */
-QDataStream &operator>>(QDataStream &, SmfPost&);
+QDataStream &operator<<( QDataStream &aDataStream, 
+		const SmfPost &aPost );
+
+/**
+ * Method for Internalization. Reads a SmfPost object from 
+ * the stream and returns a reference to the stream.
+ * @param aDataStream Stream to be read
+ * @param aPost The SmfPost object to be internalized
+ * @return reference to the stream
+ */
+QDataStream &operator>>( QDataStream &aDataStream, 
+		SmfPost &aPost);
+
 #endif /* SMFPOST_H_ */