smf/smfservermodule/smfclient/common/smflocation.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 SmfLocation class represents a location and its related information
       
    17  * Note: This class has dependencies on QtMobility project
       
    18  *
       
    19  */
       
    20 
       
    21 
       
    22 #include <smflocation.h>
       
    23 #include <smflocation_p.h>
       
    24 
       
    25 /**
       
    26  * Constructor with default argument
       
    27  */
       
    28 SmfLocation::SmfLocation( )
       
    29 	{
       
    30 	d = new SmfLocationPrivate;
       
    31 	}
       
    32 
       
    33 /**
       
    34  * Copy Constructor
       
    35  * @param aOther The reference object
       
    36  */
       
    37 SmfLocation::SmfLocation( const SmfLocation &aOther )
       
    38 	:d( aOther.d )
       
    39 	{
       
    40 	}
       
    41 
       
    42 /**
       
    43  * Overloaded = operator 
       
    44  * @param aOther The reference object
       
    45  */
       
    46 SmfLocation& SmfLocation::operator=( const SmfLocation &aOther )
       
    47 	{
       
    48 	d->m_name = aOther.d->m_name;
       
    49 	d->m_city = aOther.d->m_city;
       
    50 	d->m_street = aOther.d->m_street;
       
    51 	d->m_zipcode = aOther.d->m_zipcode;
       
    52 	d->m_country = aOther.d->m_country;
       
    53 	d->m_geo = aOther.d->m_geo;
       
    54 	d->m_url = aOther.d->m_url;
       
    55 	d->m_placeId = aOther.d->m_placeId;
       
    56 	return *this;
       
    57 	}
       
    58 
       
    59 /**
       
    60  * Destructor
       
    61  */
       
    62 SmfLocation::~SmfLocation( )
       
    63 	{
       
    64 	}
       
    65 
       
    66 /**
       
    67  * Method to get the place name
       
    68  * @return The place name
       
    69  */
       
    70 QString SmfLocation::name( ) const
       
    71 	{
       
    72 	return d->m_name;
       
    73 	}
       
    74 
       
    75 /**
       
    76  * Method to get the city of place
       
    77  * @return The city of the place
       
    78  */
       
    79 QString SmfLocation::city( ) const
       
    80 	{
       
    81 	return d->m_city;
       
    82 	}
       
    83 
       
    84 /**
       
    85  * Method to get the street information of place
       
    86  * @return The street information of the place
       
    87  */
       
    88 QString SmfLocation::street( ) const
       
    89 	{
       
    90 	return d->m_street;
       
    91 	}
       
    92 
       
    93 /**
       
    94  * Method to get the zip code of place
       
    95  * @return The zip code of place
       
    96  */
       
    97 QString SmfLocation::zipCode( ) const
       
    98 	{
       
    99 	return d->m_zipcode;
       
   100 	}
       
   101 
       
   102 /**
       
   103  * Method to get the country of place
       
   104  * @return The country of place
       
   105  */
       
   106 QString SmfLocation::country( ) const
       
   107 	{
       
   108 	return d->m_country;
       
   109 	}
       
   110 
       
   111 /**
       
   112  * Method to get the Geo Position information (like information gathered 
       
   113  * on a global position, direction and velocity at a particular point 
       
   114  * in time) of the place.
       
   115  * @return The Geo Position information of place
       
   116  */
       
   117 QGeoPositionInfo SmfLocation::geoPositionInfo( ) const
       
   118 	{
       
   119 	return d->m_geo;
       
   120 	}
       
   121 
       
   122 /**
       
   123  * Method to get the url indicating the place
       
   124  * @return The url indicating the place
       
   125  */
       
   126 QUrl SmfLocation::url( ) const
       
   127 	{
       
   128 	return d->m_url;
       
   129 	}
       
   130 
       
   131 /**
       
   132  * Method to get the id of the place
       
   133  * @return The ID value 
       
   134  */
       
   135 QString SmfLocation::id( ) const
       
   136 	{
       
   137 	return d->m_placeId;
       
   138 	}
       
   139 
       
   140 /**
       
   141  * Method to set the place name
       
   142  * @param aPlace The new place name
       
   143  */
       
   144 void SmfLocation::setName( const QString& aPlace )
       
   145 	{
       
   146 	d->m_name = aPlace;
       
   147 	}
       
   148 
       
   149 /**
       
   150  * Method to set the city of  place
       
   151  * @param aCity The new city of the place
       
   152  */
       
   153 void SmfLocation::setCity( const QString& aCity )
       
   154 	{
       
   155 	d->m_city = aCity;
       
   156 	}
       
   157 
       
   158 /**
       
   159  * Method to set the street information of place
       
   160  * @param aStreet The new street information of the place
       
   161  */
       
   162 void SmfLocation::setStreet( const QString& aStreet )
       
   163 	{
       
   164 	d->m_street = aStreet;
       
   165 	}
       
   166 
       
   167 /**
       
   168  * Method to set the zip code of place
       
   169  * @param aZipCode The new zip code of place
       
   170  */
       
   171 void SmfLocation::setZipCode( const QString& aZipCode )
       
   172 	{
       
   173 	d->m_zipcode = aZipCode;
       
   174 	}
       
   175 
       
   176 /**
       
   177  * Method to set the country of place
       
   178  * @param aCountry The new country of place
       
   179  */
       
   180 void SmfLocation::setCountry( const QString& aCountry )
       
   181 	{
       
   182 	d->m_country = aCountry;
       
   183 	}
       
   184 
       
   185 /**
       
   186  * Method to set the Geo Postion information (like information gathered 
       
   187  * on a global position, direction and velocity at a particular point 
       
   188  * in time) of the place.
       
   189  * @param aGeoPosInfo The new Geo Position information of place
       
   190  */
       
   191 void SmfLocation::setGeoPositionInfo( const QGeoPositionInfo& aGeoPosInfo )
       
   192 	{
       
   193 	d->m_geo = aGeoPosInfo;
       
   194 	}
       
   195 
       
   196 /**
       
   197  * Method to set the url indicating the place
       
   198  * @param aUrl The new url indicating the place
       
   199  */
       
   200 void SmfLocation::setUrl( const QUrl& aUrl )
       
   201 	{
       
   202 	d->m_url = aUrl;
       
   203 	}
       
   204 
       
   205 /**
       
   206  * Method to set the id of the place
       
   207  * @return The ID value 
       
   208  */
       
   209 void SmfLocation::setId( const QString &aId )
       
   210 	{
       
   211 	d->m_placeId = aId;
       
   212 	}
       
   213 
       
   214 
       
   215 /**
       
   216  * Method for Externalization. Writes the SmfLocation object to 
       
   217  * the stream and returns a reference to the stream.
       
   218  * @param aDataStream Stream to be written
       
   219  * @param aPlace The SmfLocation object to be externalized
       
   220  * @return reference to the written stream
       
   221  */
       
   222 QDataStream &operator<<( QDataStream &aDataStream, 
       
   223 		const SmfLocation &aPlace )
       
   224 	{
       
   225 	// Serialize d->m_name
       
   226 	aDataStream<<aPlace.d->m_name;
       
   227 	
       
   228 	// Serialize d->m_city
       
   229 	aDataStream<<aPlace.d->m_city;
       
   230 	
       
   231 	// Serialize d->m_street
       
   232 	aDataStream<<aPlace.d->m_street;
       
   233 	
       
   234 	// Serialize d->m_zipcode
       
   235 	aDataStream<<aPlace.d->m_zipcode;
       
   236 	
       
   237 	// Serialize d->m_country
       
   238 	aDataStream<<aPlace.d->m_country;
       
   239 	
       
   240 	// Serialize d->m_geo
       
   241 	aDataStream<<aPlace.d->m_geo;
       
   242 	
       
   243 	// Serialize d->m_url
       
   244 	aDataStream<<aPlace.d->m_url;
       
   245 	
       
   246 	// Serialize d->m_placeId
       
   247 	aDataStream<<aPlace.d->m_placeId;
       
   248 		
       
   249 	return aDataStream;
       
   250 	}
       
   251 
       
   252 /**
       
   253  * Method for Internalization. Reads a SmfLocation object from 
       
   254  * the stream and returns a reference to the stream.
       
   255  * @param aDataStream Stream to be read
       
   256  * @param aPlace The SmfLocation object to be internalized
       
   257  * @return reference to the stream
       
   258  */
       
   259 QDataStream &operator>>( QDataStream &aDataStream, 
       
   260 		SmfLocation &aPlace)
       
   261 	{
       
   262 	// Deserialize d->m_name
       
   263 	aDataStream>>aPlace.d->m_name;
       
   264 	
       
   265 	// Deserialize d->m_city
       
   266 	aDataStream>>aPlace.d->m_city;
       
   267 	
       
   268 	// Deserialize d->m_street
       
   269 	aDataStream>>aPlace.d->m_street;
       
   270 	
       
   271 	// Deserialize d->m_zipcode
       
   272 	aDataStream>>aPlace.d->m_zipcode;
       
   273 	
       
   274 	// Deserialize d->m_country
       
   275 	aDataStream>>aPlace.d->m_country;
       
   276 	
       
   277 	// Deserialize d->m_geo
       
   278 	aDataStream>>aPlace.d->m_geo;
       
   279 	
       
   280 	// Deserialize d->m_url
       
   281 	aDataStream>>aPlace.d->m_url;
       
   282 	
       
   283 	// Deserialize d->m_placeId
       
   284 	aDataStream>>aPlace.d->m_placeId;
       
   285 		
       
   286 	return aDataStream;
       
   287 	}