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