LCOV - code coverage report
Current view: directory - dom/src/geolocation - nsGeoPosition.cpp (source / functions) Found Hit Coverage
Test: app.info Lines: 97 0 0.0 %
Date: 2012-06-02 Functions: 35 0 0.0 %

       1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2                 : /* ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :  * the License. You may obtain a copy of the License at
       8                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is Geolocation.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is Mozilla Foundation
      18                 :  * Portions created by the Initial Developer are Copyright (C) 2009
      19                 :  * the Initial Developer. All Rights Reserved.
      20                 :  *
      21                 :  * Contributor(s):
      22                 :  *  Doug Turner <dougt@meer.net>  (Original Author)
      23                 :  *  Nino D'Aversa <ninodaversa@gmail.com>
      24                 :  *  Mike Kristoffersen <moz@mikek.dk>
      25                 :  *
      26                 :  * Alternatively, the contents of this file may be used under the terms of
      27                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
      28                 :  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      29                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      30                 :  * of those above. If you wish to allow use of your version of this file only
      31                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      32                 :  * use your version of this file under the terms of the MPL, indicate your
      33                 :  * decision by deleting the provisions above and replace them with the notice
      34                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      35                 :  * the provisions above, a recipient may use your version of this file under
      36                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      37                 :  *
      38                 :  * ***** END LICENSE BLOCK ***** */
      39                 : 
      40                 : #include "nsGeoPosition.h"
      41                 : #include "nsDOMClassInfoID.h"
      42                 : 
      43                 : ////////////////////////////////////////////////////
      44                 : // nsGeoPositionAddress
      45                 : ////////////////////////////////////////////////////
      46                 : 
      47               0 : nsGeoPositionAddress::nsGeoPositionAddress(const nsAString &aStreetNumber,
      48                 :                                            const nsAString &aStreet,
      49                 :                                            const nsAString &aPremises,
      50                 :                                            const nsAString &aCity,
      51                 :                                            const nsAString &aCounty,
      52                 :                                            const nsAString &aRegion,
      53                 :                                            const nsAString &aCountry,
      54                 :                                            const nsAString &aPostalCode)
      55                 :     : mStreetNumber(aStreetNumber)
      56                 :     , mStreet(aStreet)
      57                 :     , mPremises(aPremises)
      58                 :     , mCity(aCity)
      59                 :     , mCounty(aCounty)
      60                 :     , mRegion(aRegion)
      61                 :     , mCountry(aCountry)
      62               0 :     , mPostalCode(aPostalCode)
      63                 : {
      64               0 : }
      65                 : 
      66               0 : nsGeoPositionAddress::~nsGeoPositionAddress()
      67                 : {
      68               0 : }
      69                 : 
      70                 : DOMCI_DATA(GeoPositionAddress, nsGeoPositionAddress)
      71                 : 
      72               0 : NS_INTERFACE_MAP_BEGIN(nsGeoPositionAddress)
      73               0 : NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMGeoPositionAddress)
      74               0 : NS_INTERFACE_MAP_ENTRY(nsIDOMGeoPositionAddress)
      75               0 : NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(GeoPositionAddress)
      76               0 : NS_INTERFACE_MAP_END
      77                 : 
      78               0 : NS_IMPL_THREADSAFE_ADDREF(nsGeoPositionAddress)
      79               0 : NS_IMPL_THREADSAFE_RELEASE(nsGeoPositionAddress)
      80                 : 
      81                 : NS_IMETHODIMP
      82               0 : nsGeoPositionAddress::GetStreetNumber(nsAString & aStreetNumber)
      83                 : {
      84               0 :   aStreetNumber = mStreetNumber;
      85               0 :   return NS_OK;
      86                 : }
      87                 : 
      88                 : NS_IMETHODIMP
      89               0 : nsGeoPositionAddress::GetStreet(nsAString & aStreet)
      90                 : {
      91               0 :   aStreet = mStreet;
      92               0 :   return NS_OK;
      93                 : }
      94                 : 
      95                 : NS_IMETHODIMP
      96               0 : nsGeoPositionAddress::GetPremises(nsAString & aPremises)
      97                 : {
      98               0 :   aPremises = mPremises;
      99               0 :   return NS_OK;
     100                 : }
     101                 : 
     102                 : NS_IMETHODIMP
     103               0 : nsGeoPositionAddress::GetCity(nsAString & aCity)
     104                 : {
     105               0 :   aCity = mCity;
     106               0 :   return NS_OK;
     107                 : }
     108                 : 
     109                 : NS_IMETHODIMP
     110               0 : nsGeoPositionAddress::GetCounty(nsAString & aCounty)
     111                 : {
     112               0 :   aCounty = mCounty;
     113               0 :   return NS_OK;
     114                 : }
     115                 : 
     116                 : NS_IMETHODIMP
     117               0 : nsGeoPositionAddress::GetRegion(nsAString & aRegion)
     118                 : {
     119               0 :   aRegion = mRegion;
     120               0 :   return NS_OK;
     121                 : }
     122                 : 
     123                 : NS_IMETHODIMP
     124               0 : nsGeoPositionAddress::GetCountry(nsAString & aCountry)
     125                 : {
     126               0 :   aCountry = mCountry;
     127               0 :   return NS_OK;
     128                 : }
     129                 : 
     130                 : NS_IMETHODIMP
     131               0 : nsGeoPositionAddress::GetPostalCode(nsAString & aPostalCode)
     132                 : {
     133               0 :   aPostalCode = mPostalCode;
     134               0 :   return NS_OK;
     135                 : }
     136                 : 
     137                 : ////////////////////////////////////////////////////
     138                 : // nsGeoPositionCoords
     139                 : ////////////////////////////////////////////////////
     140               0 : nsGeoPositionCoords::nsGeoPositionCoords(double aLat, double aLong,
     141                 :                                          double aAlt, double aHError,
     142                 :                                          double aVError, double aHeading,
     143                 :                                          double aSpeed)
     144                 :   : mLat(aLat)
     145                 :   , mLong(aLong)
     146                 :   , mAlt(aAlt)
     147                 :   , mHError(aHError)
     148                 :   , mVError(aVError)
     149                 :   , mHeading(aHeading)
     150               0 :   , mSpeed(aSpeed)
     151                 : {
     152               0 : }
     153                 : 
     154               0 : nsGeoPositionCoords::~nsGeoPositionCoords()
     155                 : {
     156               0 : }
     157                 : 
     158                 : DOMCI_DATA(GeoPositionCoords, nsGeoPositionCoords)
     159                 : 
     160               0 : NS_INTERFACE_MAP_BEGIN(nsGeoPositionCoords)
     161               0 : NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMGeoPositionCoords)
     162               0 : NS_INTERFACE_MAP_ENTRY(nsIDOMGeoPositionCoords)
     163               0 : NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(GeoPositionCoords)
     164               0 : NS_INTERFACE_MAP_END
     165                 : 
     166               0 : NS_IMPL_THREADSAFE_ADDREF(nsGeoPositionCoords)
     167               0 : NS_IMPL_THREADSAFE_RELEASE(nsGeoPositionCoords)
     168                 : 
     169                 : NS_IMETHODIMP
     170               0 : nsGeoPositionCoords::GetLatitude(double *aLatitude)
     171                 : {
     172               0 :   *aLatitude = mLat;
     173               0 :   return NS_OK;
     174                 : }
     175                 : 
     176                 : NS_IMETHODIMP
     177               0 : nsGeoPositionCoords::GetLongitude(double *aLongitude)
     178                 : {
     179               0 :   *aLongitude = mLong;
     180               0 :   return NS_OK;
     181                 : }
     182                 : 
     183                 : NS_IMETHODIMP
     184               0 : nsGeoPositionCoords::GetAltitude(double *aAltitude)
     185                 : {
     186               0 :   *aAltitude = mAlt;
     187               0 :   return NS_OK;
     188                 : }
     189                 : 
     190                 : NS_IMETHODIMP
     191               0 : nsGeoPositionCoords::GetAccuracy(double *aAccuracy)
     192                 : {
     193               0 :   *aAccuracy = mHError;
     194               0 :   return NS_OK;
     195                 : }
     196                 : 
     197                 : NS_IMETHODIMP
     198               0 : nsGeoPositionCoords::GetAltitudeAccuracy(double *aAltitudeAccuracy)
     199                 : {
     200               0 :   *aAltitudeAccuracy = mVError;
     201               0 :   return NS_OK;
     202                 : }
     203                 : 
     204                 : NS_IMETHODIMP
     205               0 : nsGeoPositionCoords::GetHeading(double *aHeading)
     206                 : {
     207               0 :   *aHeading = mHeading;
     208               0 :   return NS_OK;
     209                 : }
     210                 : 
     211                 : NS_IMETHODIMP
     212               0 : nsGeoPositionCoords::GetSpeed(double *aSpeed)
     213                 : {
     214               0 :   *aSpeed = mSpeed;
     215               0 :   return NS_OK;
     216                 : }
     217                 : 
     218                 : ////////////////////////////////////////////////////
     219                 : // nsGeoPosition
     220                 : ////////////////////////////////////////////////////
     221                 : 
     222               0 : nsGeoPosition::nsGeoPosition(double aLat, double aLong,
     223                 :                              double aAlt, double aHError,
     224                 :                              double aVError, double aHeading,
     225                 :                              double aSpeed, long long aTimestamp) :
     226               0 :     mTimestamp(aTimestamp)
     227                 : {
     228                 :     mCoords = new nsGeoPositionCoords(aLat, aLong,
     229                 :                                       aAlt, aHError,
     230                 :                                       aVError, aHeading,
     231               0 :                                       aSpeed);
     232               0 : }
     233                 : 
     234               0 : nsGeoPosition::nsGeoPosition(nsIDOMGeoPositionCoords *aCoords,
     235                 :                              long long aTimestamp) :
     236                 :     mTimestamp(aTimestamp),
     237               0 :     mCoords(aCoords)
     238                 : {
     239               0 : }
     240                 : 
     241               0 : nsGeoPosition::nsGeoPosition(nsIDOMGeoPositionCoords *aCoords,
     242                 :                              nsIDOMGeoPositionAddress *aAddress,
     243                 :                              DOMTimeStamp aTimestamp) :
     244                 :   mTimestamp(aTimestamp),
     245                 :   mCoords(aCoords),
     246               0 :   mAddress(aAddress)
     247                 : {
     248               0 : }
     249                 : 
     250               0 : nsGeoPosition::~nsGeoPosition()
     251                 : {
     252               0 : }
     253                 : 
     254                 : DOMCI_DATA(GeoPosition, nsGeoPosition)
     255                 : 
     256               0 : NS_INTERFACE_MAP_BEGIN(nsGeoPosition)
     257               0 : NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMGeoPosition)
     258               0 : NS_INTERFACE_MAP_ENTRY(nsIDOMGeoPosition)
     259               0 : NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(GeoPosition)
     260               0 : NS_INTERFACE_MAP_END
     261                 : 
     262               0 : NS_IMPL_THREADSAFE_ADDREF(nsGeoPosition)
     263               0 : NS_IMPL_THREADSAFE_RELEASE(nsGeoPosition)
     264                 : 
     265                 : NS_IMETHODIMP
     266               0 : nsGeoPosition::GetTimestamp(DOMTimeStamp* aTimestamp)
     267                 : {
     268               0 :   *aTimestamp = mTimestamp;
     269               0 :   return NS_OK;
     270                 : }
     271                 : 
     272                 : NS_IMETHODIMP
     273               0 : nsGeoPosition::GetCoords(nsIDOMGeoPositionCoords * *aCoords)
     274                 : {
     275               0 :   NS_IF_ADDREF(*aCoords = mCoords);
     276               0 :   return NS_OK;
     277                 : }
     278                 : 
     279                 : NS_IMETHODIMP
     280               0 : nsGeoPosition::GetAddress(nsIDOMGeoPositionAddress** aAddress)
     281                 : {
     282               0 :   NS_IF_ADDREF(*aAddress = mAddress);
     283               0 :   return NS_OK;
     284                 : }
     285                 : 

Generated by: LCOV version 1.7