smf/smfservermodule/smfclient/common/smfcomment.cpp
changeset 7 be09cf1f39dd
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 comment class represents a comment (on a picture or a music track etc)
       
    17  *
       
    18  */
       
    19 
       
    20 
       
    21 #include "smfcomment.h"
       
    22 #include "smfcomment_p.h"
       
    23 
       
    24 /**
       
    25  * Constructor with default argument
       
    26  */
       
    27 SmfComment::SmfComment()
       
    28 	{
       
    29 	d = new SmfCommentPrivate;
       
    30 	}
       
    31 
       
    32 /**
       
    33  * Copy Constructor
       
    34  * @param aOther The reference object
       
    35  */
       
    36 SmfComment::SmfComment( const SmfComment &aOther )
       
    37 	:d( aOther.d )
       
    38 	{
       
    39 	}
       
    40 
       
    41 /**
       
    42  * Overloaded = operator
       
    43  * @param aOther The reference object
       
    44  * @return The current object reference
       
    45  */
       
    46 SmfComment& SmfComment::operator=(const SmfComment &aOther)
       
    47 	{
       
    48 	d->m_text = aOther.d->m_text;
       
    49 	d->m_timeStamp = aOther.d->m_timeStamp;
       
    50 	d->m_commentId = aOther.d->m_commentId;
       
    51 	return *this;
       
    52 	}
       
    53 
       
    54 /**
       
    55  * Destructor
       
    56  */
       
    57 SmfComment::~SmfComment( )
       
    58 	{
       
    59 	}
       
    60 
       
    61 /**
       
    62  * Method to get the comment text
       
    63  * @return The comment text
       
    64  */
       
    65 QString SmfComment::text( ) const
       
    66 	{
       
    67 	return d->m_text;
       
    68 	}
       
    69 
       
    70 /**
       
    71  * Method to get the comment time stamp
       
    72  * @return The comment time stamp value
       
    73  */
       
    74 QDateTime SmfComment::timeStamp( ) const
       
    75 	{
       
    76 	return d->m_timeStamp;
       
    77 	}
       
    78 
       
    79 /**
       
    80  * Method to get the id of the comment
       
    81  * @return The ID value 
       
    82  */
       
    83 QString SmfComment::id( ) const	
       
    84 	{
       
    85 	return d->m_commentId;
       
    86 	}
       
    87 
       
    88 /**
       
    89  * Method to set the comment text
       
    90  * @param aText The comment text to be set
       
    91  */
       
    92 void SmfComment::setText( const QString &aText )
       
    93 	{
       
    94 	d->m_text = aText;
       
    95 	}
       
    96 
       
    97 /**
       
    98  * Method to set the time stamp
       
    99  * @param aDateTime The comment time stamp value to be set
       
   100  */
       
   101 void SmfComment::setTimeStamp( const QDateTime &aDateTime )
       
   102 	{
       
   103 	d->m_timeStamp = aDateTime;
       
   104 	}
       
   105 
       
   106 /**
       
   107  * Method to set the id of the comment
       
   108  * @param aId The ID value to be set
       
   109  */
       
   110 void SmfComment::setId( const QString &aId )
       
   111 	{
       
   112 	d->m_commentId = aId;
       
   113 	}
       
   114 
       
   115 
       
   116 /**
       
   117  * Method for Externalization. Writes the SmfComment object to 
       
   118  * the stream and returns a reference to the stream.
       
   119  * @param aDataStream Stream to be written
       
   120  * @param aComment The SmfComment object to be externalized
       
   121  * @return reference to the written stream
       
   122  */
       
   123 QDataStream &operator<<( QDataStream &aDataStream, 
       
   124 		const SmfComment &aComment )
       
   125 	{
       
   126 	// Serialize d->m_text
       
   127 	aDataStream<<aComment.d->m_text;
       
   128 	
       
   129 	// Serialize d->m_timeStamp
       
   130 	aDataStream<<aComment.d->m_timeStamp;
       
   131 	
       
   132 	// Serialize d->m_commentId
       
   133 	aDataStream<<aComment.d->m_commentId;
       
   134 	
       
   135 	return aDataStream;
       
   136 	}
       
   137 
       
   138 /**
       
   139  * Method for Internalization. Reads a SmfComment object from 
       
   140  * the stream and returns a reference to the stream.
       
   141  * @param aDataStream Stream to be read
       
   142  * @param aComment The SmfComment object to be internalized
       
   143  * @return reference to the stream
       
   144  */
       
   145 QDataStream &operator>>( QDataStream &aDataStream, 
       
   146 		SmfComment &aComment)
       
   147 	{
       
   148 	// Deserialize d->m_text
       
   149 	aDataStream>>aComment.d->m_text;
       
   150 	
       
   151 	// Deserialize d->m_timeStamp
       
   152 	aDataStream>>aComment.d->m_timeStamp;
       
   153 	
       
   154 	// Deserialize d->m_commentId
       
   155 	aDataStream>>aComment.d->m_commentId;
       
   156 	
       
   157 	return aDataStream;
       
   158 	}
       
   159