location_plat/location_picker_service_api/inc/qlocationpickeritem.h
branchRCL_3
changeset 17 1fc85118c3ae
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "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 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: QLocationPickerItem class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef QLOCATIONPICKERITEM_H
       
    20 #define QLOCATIONPICKERITEM_H
       
    21 
       
    22 #include <QString>
       
    23 #include <xqserviceipcmarshal.h>
       
    24 
       
    25 /** class defines location type
       
    26   */
       
    27 class QLocationPickerItem
       
    28 {
       
    29 public:
       
    30     QLocationPickerItem():mIsValid(false),
       
    31     	                  mLatitude(200.0),
       
    32     	                  mLongitude(200.0)
       
    33      {};
       
    34     ~QLocationPickerItem() {};
       
    35 
       
    36     // copy contructor
       
    37     inline QLocationPickerItem(const QLocationPickerItem &l)
       
    38     {
       
    39         mIsValid = l.mIsValid;
       
    40         mName = l.mName;
       
    41         mStreet = l.mStreet;
       
    42         mPostalCode = l.mPostalCode;
       
    43         mCity = l.mCity;
       
    44         mState = l.mState;
       
    45         mCountry = l.mCountry;
       
    46         mLatitude = l.mLatitude;
       
    47         mLongitude = l.mLongitude;
       
    48     };
       
    49 
       
    50     // assignment operator
       
    51     inline QLocationPickerItem &operator=(const QLocationPickerItem &l)
       
    52     {
       
    53         mIsValid = l.mIsValid;
       
    54         mName = l.mName;
       
    55         mStreet = l.mStreet;
       
    56         mPostalCode = l.mPostalCode;
       
    57         mCity = l.mCity;
       
    58         mState = l.mState;
       
    59         mCountry = l.mCountry;
       
    60         mLatitude = l.mLatitude;
       
    61         mLongitude = l.mLongitude;
       
    62         return *this;
       
    63     };
       
    64 
       
    65     bool mIsValid; // if the current object is valid
       
    66     QString mName; // location name
       
    67     QString mStreet; // location street
       
    68     QString mPostalCode; // location postal code
       
    69     QString mCity; // location city
       
    70     QString mState; // location state/region
       
    71     QString mCountry; // location country
       
    72     double mLatitude; // latitude
       
    73     double mLongitude; // longitude
       
    74 
       
    75     // functions to pass data between application
       
    76     template <typename Stream> void serialize(Stream &stream) const;
       
    77     template <typename Stream> void deserialize(Stream &stream);
       
    78 };
       
    79 
       
    80 template <typename Stream> inline void QLocationPickerItem::serialize(Stream &s) const
       
    81 {
       
    82     s << mIsValid;
       
    83     s << mName;
       
    84     s << mStreet;
       
    85     s << mPostalCode;
       
    86     s << mCity;
       
    87     s << mState;
       
    88     s << mCountry;
       
    89     s << mLatitude;
       
    90     s << mLongitude;
       
    91 }
       
    92 
       
    93 template <typename Stream> inline void QLocationPickerItem::deserialize(Stream &s)
       
    94 {
       
    95     s >> mIsValid;
       
    96     s >> mName;
       
    97     s >> mStreet;
       
    98     s >> mPostalCode;
       
    99     s >> mCity;
       
   100     s >> mState;
       
   101     s >> mCountry;
       
   102     s >> mLatitude;
       
   103     s >> mLongitude;
       
   104 }
       
   105 
       
   106 
       
   107 Q_DECLARE_USER_METATYPE(QLocationPickerItem)
       
   108 
       
   109 #endif // QLOCATIONPICKERITEM_H