1.1 --- a/epoc32/include/t32wld.h Wed Mar 31 12:27:01 2010 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,376 +0,0 @@
1.4 -// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 -// All rights reserved.
1.6 -// This component and the accompanying materials are made available
1.7 -// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.8 -// which accompanies this distribution, and is available
1.9 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 -//
1.11 -// Initial Contributors:
1.12 -// Nokia Corporation - initial contribution.
1.13 -//
1.14 -// Contributors:
1.15 -//
1.16 -// Description:
1.17 -//
1.18 -
1.19 -#ifndef __T32WLD_H__
1.20 -#define __T32WLD_H__
1.21 -
1.22 -#include <e32base.h>
1.23 -#include <dial_consts.h>
1.24 -
1.25 -
1.26 -//
1.27 -//
1.28 -// Literal constants
1.29 -_LIT(KWorldServerName, "!WorldServer");
1.30 -
1.31 -_LIT(KWorldServerImageName, "WorldServer");
1.32 -//
1.33 -/**
1.34 -@internalComponent
1.35 -@released
1.36 -*/
1.37 -const TUid KWorldServerUid = { 0x101F5025 };
1.38 -//
1.39 -
1.40 -/**
1.41 -@internalComponent
1.42 -@released
1.43 -*/
1.44 -const TInt KWorldServerMajorVN=1;
1.45 -
1.46 -/**
1.47 -@internalComponent
1.48 -@released
1.49 -*/
1.50 -const TInt KWorldServerMinorVN=0;
1.51 -
1.52 -/**
1.53 -@internalComponent
1.54 -@released
1.55 -*/
1.56 -const TInt KWorldServerBuildVN=105;
1.57 -//
1.58 -/**
1.59 -@internalComponent
1.60 -@released
1.61 -*/
1.62 -const TInt KMaxZoneName=3;
1.63 -
1.64 -/** Maximum length for TCityName.
1.65 -@internalComponent
1.66 -@released
1.67 -*/
1.68 -const TInt KMaxCityName=25;
1.69 -
1.70 -/** Maximum length for TCountryName.
1.71 -@internalComponent
1.72 -@released
1.73 -*/
1.74 -const TInt KMaxCountryName=25;
1.75 -
1.76 -/**
1.77 -@internalComponent
1.78 -@released
1.79 -*/
1.80 -const TInt KMaxWorldRomTitle=32;
1.81 -
1.82 -/**
1.83 -@internalComponent
1.84 -@released
1.85 -*/
1.86 -const TInt KMaxWorldLatitudeMinutes=90*60;
1.87 -
1.88 -/**
1.89 -@internalComponent
1.90 -@released
1.91 -*/
1.92 -const TInt KMaxWorldLongitudeMinutes=180*60;
1.93 -
1.94 -/**
1.95 -@internalComponent
1.96 -@released
1.97 -*/
1.98 -const TInt KMaxWorldUniversalTimeOffsetMinutes=17*60;
1.99 -
1.100 -/**
1.101 -@internalComponent
1.102 -@released
1.103 -*/
1.104 -const TInt KISOCountryCodeLength=2;
1.105 -//
1.106 -
1.107 -/** A buffer for a city name.
1.108 -@publishedAll
1.109 -@released
1.110 -*/
1.111 -typedef TBuf<KMaxCityName> TCityName;
1.112 -
1.113 -/** A buffer for a country name.
1.114 -@publishedAll
1.115 -@released
1.116 -*/
1.117 -typedef TBuf<KMaxCountryName> TCountryName;
1.118 -
1.119 -/**
1.120 -@publishedAll
1.121 -@released
1.122 -*/
1.123 -typedef TBuf<KISOCountryCodeLength> TISOCountryCode;
1.124 -//
1.125 -
1.126 -/** Defines the distance units which can be used by the world server.
1.127 -@publishedAll
1.128 -@released
1.129 -*/
1.130 -enum TWldDistanceUnits
1.131 - {
1.132 - /** Miles. */
1.133 - EWldMiles,
1.134 - /** Kilometres. */
1.135 - EWldKilometers,
1.136 - /** Nautical miles. */
1.137 - EWldNauticalMiles
1.138 - };
1.139 -
1.140 -/** City search mode flags. These define whether a search for a city involves the
1.141 -whole of the world database, or just a single country.
1.142 -For example, the RWorldServer::NextCity() function returns either the next
1.143 -city in the country, or the next city in the world, depending on which of these two
1.144 -values is set in the TWorldId.
1.145 -@publishedAll
1.146 -@released
1.147 -*/
1.148 -enum TWldSelect
1.149 - {
1.150 - /** The search is within the whole world database. */
1.151 - EWithinWorld,
1.152 - /** The search is within the current country only. */
1.153 - EWithinCountry
1.154 - };
1.155 -
1.156 -/** Flags which indicate the reasons why the server cannot delete a
1.157 -city or country. Bitmasks of these flags are returned by the RWorldServer
1.158 -functions IsCityDeletable() and IsCountryDeletable().
1.159 -@publishedAll
1.160 -@released
1.161 -*/
1.162 -enum TWldDeleteDeniedFlags
1.163 - {
1.164 - /** The specified TWorldId is not found. */
1.165 - EWldDelNotFound=0x01,
1.166 - /** The specified TWorldId is in a read-only file. */
1.167 - EWldDelDerivedFromRom=0x02,
1.168 - /** The specified TWorldId is the home city or country. */
1.169 - EWldDelHomeCityCountry=0x04,
1.170 - /** The specified TWorldId is a capital city. */
1.171 - EWldDelCapitalCity=0x08,
1.172 - /** The specified TWorldId is the default country. */
1.173 - EWldDelDefaultCountry=0x10,
1.174 - /** The specified TWorldId cannot be deleted for all of the above reasons. */
1.175 - EWldDelAll=0xff
1.176 - };
1.177 -//
1.178 -class TLatLong
1.179 -/**
1.180 -@publishedAll
1.181 -@deprecated Interface is deprecated and is available for backward compatibility reasons only
1.182 -*/
1.183 - {
1.184 -public:
1.185 - inline TInt MinutesLat() const; // North is +ve, South is -ve
1.186 - inline TInt MinutesLong() const; // West is +ve, East is -ve
1.187 - IMPORT_C void SetMinutesL(TInt aLat,TInt aLong); // North and West are +ve, South and East are -ve
1.188 - IMPORT_C void SetMinutesCorrectingErrors(TInt aLat,TInt aLong); // North and West are +ve, South and East are -ve
1.189 -private:
1.190 - TInt16 iLat;
1.191 - TInt16 iLong;
1.192 - };
1.193 -//
1.194 -class TCityData
1.195 -/** City information.
1.196 -
1.197 -This class stores information about a city, including its name, country,
1.198 -area code, daylight savings zone, latitude and longitude, map position and
1.199 -UTC offset.
1.200 -@publishedAll
1.201 -@released
1.202 -*/
1.203 - {
1.204 -public:
1.205 - /** The city name. */
1.206 - TCityName iCity;
1.207 - /** The country name. */
1.208 - TCountryName iCountry;
1.209 - /** The position of the city in pixels on a map on the screen. */
1.210 - TPoint iMapPos;
1.211 - /** The city's latitude and longitude. This is used to calculate the distance
1.212 - between cities, and the sunrise and sunset time. */
1.213 - TLatLong iLatLong;
1.214 - /** The local area code. */
1.215 - TAreaCode iAreaCode;
1.216 - /** The UTC offset in minutes. */
1.217 - TInt iUniversalTimeOffset;
1.218 - /** The daylight savings zone. */
1.219 - TDaylightSavingZone iDaylightSavingZone;
1.220 - };
1.221 -//
1.222 -class TCountryData
1.223 -/** Country information.
1.224 -
1.225 -This class stores information about a country.
1.226 -@publishedAll
1.227 -@released
1.228 -*/
1.229 - {
1.230 -public:
1.231 - /** The country's name. */
1.232 - TCountryName iCountry;
1.233 - /** The country's national dialling code. */
1.234 - TNatCode iNatCode;
1.235 - /** The country's capital city. */
1.236 - TCityName iCapital;
1.237 - /** The national dialling prefix. */
1.238 - TNatPrefCode iNatPref;
1.239 - /** The country's international dialling prefix. */
1.240 - TIntlPrefCode iIntlPref;
1.241 - };
1.242 -//
1.243 -//
1.244 -class TWorldId
1.245 -/** World ID.
1.246 -
1.247 -This class stores the world ID for a city/country. This consists of the city
1.248 -and country names. Unique IDs of this type are used to identify every city
1.249 -in the world database.
1.250 -
1.251 -It also defines a field for setting whether city searches span the
1.252 -whole database, or just the current country.
1.253 -@publishedAll
1.254 -@deprecated Interface is deprecated and is available for backward compatibility reasons only
1.255 -*/
1.256 - {
1.257 -public:
1.258 - IMPORT_C TWorldId();
1.259 - inline const TCityName& City() const;
1.260 - inline const TCountryName& Country() const;
1.261 - inline TWldSelect Select() const;
1.262 - inline void SetSelect(TWldSelect aSelector);
1.263 -private:
1.264 - TCityName iCity;
1.265 - TWldSelect iSelect;
1.266 - TCountryName iCountry;
1.267 - friend class RWorldServer;
1.268 - };
1.269 -//
1.270 -class RWorldServer : public RSessionBase
1.271 -/** Defines the client side API to the world server.
1.272 -
1.273 -Clients can use this API to connect to the server, add, update and delete
1.274 -cities/countries, retrieve city/country information, navigate and search the
1.275 -world database, set the home city, default country, and the units used in
1.276 -distance comparisons. In addition, clients can use the file handling functions
1.277 -to import and export database data files.
1.278 -@publishedAll
1.279 -@deprecated Interface is deprecated and is available for backward compatibility reasons only
1.280 -*/
1.281 - {
1.282 -public:
1.283 - IMPORT_C TInt Connect();
1.284 - IMPORT_C TVersion Version() const;
1.285 - IMPORT_C void RomTitle(TDes& aText) const;
1.286 - IMPORT_C TInt NumberCities() const;
1.287 - IMPORT_C TInt NumberCountries() const;
1.288 - //
1.289 - IMPORT_C void NotifyOnChange(TRequestStatus& aStatus);
1.290 - IMPORT_C void NotifyOnChangeCancel();
1.291 - //
1.292 - IMPORT_C TInt ResetAllData();
1.293 - IMPORT_C TInt DataFileSave();
1.294 - IMPORT_C TInt DataFileRevertToSaved();
1.295 - //
1.296 - IMPORT_C TInt DefaultCountry(TWorldId& aCountry) const;
1.297 - IMPORT_C TInt SetDefaultCountry(const TWorldId& aId);
1.298 - IMPORT_C TInt Home(TWorldId& aHome) const;
1.299 - IMPORT_C TInt SetHome(const TWorldId& aId);
1.300 - //
1.301 - IMPORT_C TInt AddCity(const TCityData& aCity);
1.302 - IMPORT_C TInt AddCountry(const TCountryData& aCountry,const TCityData& aCapital);
1.303 - IMPORT_C TInt CityData(TCityData& aCity,const TWorldId& aId) const;
1.304 - IMPORT_C TInt CountryData(TCountryData& aCountry,const TWorldId& aId) const;
1.305 - IMPORT_C TInt CalculateDistance(TInt& aDistance,const TWorldId& aLeft,const TWorldId& aRight) const;
1.306 - IMPORT_C TInt CalculateSunlight(TTime& aSunrise,TTime& aSunset,const TWorldId& aId,const TTime& aDate=Time::NullTTime()) const;
1.307 - IMPORT_C TInt DeleteCity(TWorldId& aId);
1.308 - IMPORT_C TInt DeleteCountry(TWorldId& aId);
1.309 - IMPORT_C TInt DistanceUnits(TWldDistanceUnits& aDistanceUnit) const;
1.310 - IMPORT_C TInt SetDistanceUnits(TWldDistanceUnits aUnit);
1.311 - IMPORT_C TInt Find(TWorldId& aId,const TDesC& aCity,const TDesC& aCountry) const;
1.312 - IMPORT_C TInt FindCity(TWorldId& aCity,const TDesC& aPartialCity) const;
1.313 - IMPORT_C TInt FindCountry(TWorldId& aCountry,const TDesC& aPartialCountry) const;
1.314 - IMPORT_C TInt FirstCity(TWorldId& aId) const;
1.315 - IMPORT_C TInt FirstCountry(TWorldId& aId) const;
1.316 - IMPORT_C TInt IsCityDeletable(TInt& aDeleteDeniedFlags,const TWorldId& aId) const;
1.317 - IMPORT_C TInt IsCountryDeletable(TInt& aDeleteDeniedFlags,const TWorldId& aId) const;
1.318 - IMPORT_C TInt LastCity(TWorldId& aId) const;
1.319 - IMPORT_C TInt LastCountry(TWorldId& aId) const;
1.320 - IMPORT_C TInt NearestCity(const TPoint& aMapCoord,const TWorldId* aCityToBeat=NULL);
1.321 - IMPORT_C TInt NextNearestCity(TWorldId& aId,TInt aMaxNumberToCompare=KMaxTInt);
1.322 - IMPORT_C TInt NextCity(TWorldId& aId) const;
1.323 - IMPORT_C TInt NextCountry(TWorldId& aId) const;
1.324 - IMPORT_C TInt PrevCity(TWorldId& aId) const;
1.325 - IMPORT_C TInt PrevCountry(TWorldId& aId) const;
1.326 - IMPORT_C TInt UpdateCity(TWorldId& aId,const TCityData& aCity);
1.327 - IMPORT_C TInt UpdateCountry(TWorldId& aId,const TCountryData& aCountry);
1.328 - IMPORT_C TInt GetCountryNameByISOCode(const TDesC& aCode, TDes& aCountry) const;
1.329 - IMPORT_C TInt SetCollationLevelForFind(TInt aCollationLevel); // this is a per-client setting
1.330 -public:
1.331 - IMPORT_C void __DbgFailAlloc(TInt aCount);
1.332 - IMPORT_C void __DbgMarkEnd();
1.333 - IMPORT_C void __DbgMarkHeap();
1.334 - IMPORT_C TInt SetRomDatabaseToUse(const TDesC& aRomDatabaseToUse);
1.335 - IMPORT_C TBool ReadOnlyDataIsInRAM() const;
1.336 - };
1.337 -//
1.338 -// TWorldId
1.339 -inline TWldSelect TWorldId::Select() const
1.340 -/** Gets the current city search mode. Clients can search for cities by country,
1.341 -or over the whole world database.
1.342 -
1.343 -@return The current city search mode. */
1.344 - {
1.345 - return(iSelect);
1.346 - }
1.347 -inline const TCityName& TWorldId::City() const
1.348 -/** Gets the city name in the current TWorldId.
1.349 -
1.350 -@return A reference to the city name. */
1.351 - {
1.352 - return(iCity);
1.353 - }
1.354 -inline const TCountryName& TWorldId::Country() const
1.355 -/** Gets the country name in the current TWorldId.
1.356 -
1.357 -@return A reference to the country name. */
1.358 - {
1.359 - return(iCountry);
1.360 - }
1.361 -inline void TWorldId::SetSelect(TWldSelect aSelector)
1.362 -/** Sets the city search mode. Clients can search for cities by country, or over
1.363 -the whole world database.
1.364 -
1.365 -@param aSelector The city search mode. */
1.366 - {
1.367 - iSelect=aSelector;
1.368 - }
1.369 -//
1.370 -// TLatLong
1.371 -inline TInt TLatLong::MinutesLat() const
1.372 - {
1.373 - return(iLat);
1.374 - }
1.375 -inline TInt TLatLong::MinutesLong() const
1.376 - {
1.377 - return(iLong);
1.378 - }
1.379 -#endif