location_plat/location_picker_service_api/inc/qlocationpickeritem.h
changeset 15 13ae750350c9
child 30 96df3ab41000
equal deleted inserted replaced
0:522cd55cc3d7 15:13ae750350c9
       
     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      {};
       
    32     ~QLocationPickerItem() {};
       
    33 
       
    34     // copy contructor
       
    35     inline QLocationPickerItem(const QLocationPickerItem &l)
       
    36     {
       
    37         mIsValid = l.mIsValid;
       
    38         mName = l.mName;
       
    39         mStreet = l.mStreet;
       
    40         mPostalCode = l.mPostalCode;
       
    41         mCity = l.mCity;
       
    42         mState = l.mState;
       
    43         mCountry = l.mCountry;
       
    44         mLatitude = l.mLatitude;
       
    45         mLongitude = l.mLongitude;
       
    46     };
       
    47 
       
    48     // assignment operator
       
    49     inline QLocationPickerItem &operator=(const QLocationPickerItem &l)
       
    50     {
       
    51         mIsValid = l.mIsValid;
       
    52         mName = l.mName;
       
    53         mStreet = l.mStreet;
       
    54         mPostalCode = l.mPostalCode;
       
    55         mCity = l.mCity;
       
    56         mState = l.mState;
       
    57         mCountry = l.mCountry;
       
    58         mLatitude = l.mLatitude;
       
    59         mLongitude = l.mLongitude;
       
    60         return *this;
       
    61     };
       
    62 
       
    63     bool mIsValid; // if the current object is valid
       
    64     QString mName; // location name
       
    65     QString mStreet; // location street
       
    66     QString mPostalCode; // location postal code
       
    67     QString mCity; // location city
       
    68     QString mState; // location state/region
       
    69     QString mCountry; // location country
       
    70     double mLatitude; // latitude
       
    71     double mLongitude; // longitude
       
    72 
       
    73     // functions to pass data between application
       
    74     template <typename Stream> void serialize(Stream &stream) const;
       
    75     template <typename Stream> void deserialize(Stream &stream);
       
    76 };
       
    77 
       
    78 template <typename Stream> inline void QLocationPickerItem::serialize(Stream &s) const
       
    79 {
       
    80     s << mIsValid;
       
    81     s << mName;
       
    82     s << mStreet;
       
    83     s << mPostalCode;
       
    84     s << mCity;
       
    85     s << mState;
       
    86     s << mCountry;
       
    87     s << mLatitude;
       
    88     s << mLongitude;
       
    89 }
       
    90 
       
    91 template <typename Stream> inline void QLocationPickerItem::deserialize(Stream &s)
       
    92 {
       
    93     s >> mIsValid;
       
    94     s >> mName;
       
    95     s >> mStreet;
       
    96     s >> mPostalCode;
       
    97     s >> mCity;
       
    98     s >> mState;
       
    99     s >> mCountry;
       
   100     s >> mLatitude;
       
   101     s >> mLongitude;
       
   102 }
       
   103 
       
   104 
       
   105 Q_DECLARE_USER_METATYPE(QLocationPickerItem)
       
   106 
       
   107 #endif // QLOCATIONPICKERITEM_H