epoc32/include/t32wld.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // 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
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef __T32WLD_H__
    17 #define __T32WLD_H__
    18 
    19 #include <e32base.h>
    20 #include <dial_consts.h>
    21 
    22 
    23 //
    24 //
    25 // Literal constants
    26 _LIT(KWorldServerName, "!WorldServer");
    27 
    28 _LIT(KWorldServerImageName, "WorldServer");
    29 //
    30 /**
    31 @internalComponent
    32 @released
    33 */
    34 const TUid KWorldServerUid = { 0x101F5025 };
    35 //
    36 
    37 /**
    38 @internalComponent
    39 @released
    40 */
    41 const TInt KWorldServerMajorVN=1;
    42 
    43 /**
    44 @internalComponent
    45 @released
    46 */
    47 const TInt KWorldServerMinorVN=0;
    48 
    49 /**
    50 @internalComponent
    51 @released
    52 */
    53 const TInt KWorldServerBuildVN=105;
    54 //
    55 /**
    56 @internalComponent
    57 @released
    58 */
    59 const TInt KMaxZoneName=3;
    60 
    61 /** Maximum length for TCityName. 
    62 @internalComponent
    63 @released
    64 */
    65 const TInt KMaxCityName=25;  
    66 
    67 /** Maximum length for TCountryName. 
    68 @internalComponent
    69 @released
    70 */
    71 const TInt KMaxCountryName=25;
    72 
    73 /**
    74 @internalComponent
    75 @released
    76 */
    77 const TInt KMaxWorldRomTitle=32;
    78 
    79 /**
    80 @internalComponent
    81 @released
    82 */
    83 const TInt KMaxWorldLatitudeMinutes=90*60;
    84 
    85 /**
    86 @internalComponent
    87 @released
    88 */
    89 const TInt KMaxWorldLongitudeMinutes=180*60;
    90 
    91 /**
    92 @internalComponent
    93 @released
    94 */
    95 const TInt KMaxWorldUniversalTimeOffsetMinutes=17*60;
    96 
    97 /**
    98 @internalComponent
    99 @released
   100 */
   101 const TInt KISOCountryCodeLength=2;
   102 //
   103 
   104 /** A buffer for a city name. 
   105 @publishedAll
   106 @released
   107 */
   108 typedef TBuf<KMaxCityName> TCityName;
   109 
   110 /** A buffer for a country name. 
   111 @publishedAll
   112 @released
   113 */
   114 typedef TBuf<KMaxCountryName> TCountryName;
   115 
   116 /**
   117 @publishedAll
   118 @released
   119 */
   120 typedef TBuf<KISOCountryCodeLength> TISOCountryCode;
   121 //
   122 
   123 /** Defines the distance units which can be used by the world server. 
   124 @publishedAll
   125 @released
   126 */
   127 enum TWldDistanceUnits 
   128 	{
   129 	/** Miles. */
   130 	EWldMiles,
   131 	/** Kilometres. */
   132 	EWldKilometers,
   133 	/** Nautical miles. */
   134 	EWldNauticalMiles
   135 	};
   136 
   137 /** City search mode flags. These define whether a search for a city involves the 
   138 whole of the world database, or just a single country. 
   139 For example, the RWorldServer::NextCity() function returns either the next 
   140 city in the country, or the next city in the world, depending on which of these two 
   141 values is set in the TWorldId. 
   142 @publishedAll
   143 @released
   144 */
   145 enum TWldSelect 
   146 	{
   147 	/** The search is within the whole world database. */
   148 	EWithinWorld,
   149 	/** The search is within the current country only. */
   150 	EWithinCountry
   151 	};
   152 
   153 /** Flags which indicate the reasons why the server cannot delete a  
   154 city or country. Bitmasks of these flags are returned by the RWorldServer 
   155 functions IsCityDeletable() and IsCountryDeletable(). 
   156 @publishedAll
   157 @released
   158 */
   159 enum TWldDeleteDeniedFlags
   160 	{
   161 	/** The specified TWorldId is not found. */
   162 	EWldDelNotFound=0x01,
   163 	/** The specified TWorldId is in a read-only file. */
   164 	EWldDelDerivedFromRom=0x02,
   165 	/** The specified TWorldId is the home city or country. */
   166 	EWldDelHomeCityCountry=0x04,
   167 	/** The specified TWorldId is a capital city. */
   168 	EWldDelCapitalCity=0x08,
   169 	/** The specified TWorldId is the default country. */
   170 	EWldDelDefaultCountry=0x10,
   171 	/** The specified TWorldId cannot be deleted for all of the above reasons. */
   172 	EWldDelAll=0xff
   173 	};
   174 //
   175 class TLatLong
   176 /**
   177 @publishedAll
   178 @deprecated Interface is deprecated and is available for backward compatibility reasons only
   179 */
   180     {
   181 public:
   182 	inline TInt MinutesLat() const; // North is +ve, South is -ve
   183 	inline TInt MinutesLong() const; // West is +ve, East is -ve
   184 	IMPORT_C void SetMinutesL(TInt aLat,TInt aLong); // North and West are +ve, South and East are -ve
   185 	IMPORT_C void SetMinutesCorrectingErrors(TInt aLat,TInt aLong); // North and West are +ve, South and East are -ve
   186 private:
   187     TInt16 iLat;
   188     TInt16 iLong;
   189     };
   190 //
   191 class TCityData
   192 /** City information.
   193 
   194 This class stores information about a city, including its name, country, 
   195 area code, daylight savings zone, latitude and longitude, map position and 
   196 UTC offset. 
   197 @publishedAll
   198 @released
   199 */
   200     {
   201 public:
   202 	/** The city name. */
   203     TCityName iCity;
   204 	/** The country name. */
   205     TCountryName iCountry;
   206 	/** The position of the city in pixels on a map on the screen. */
   207     TPoint iMapPos;
   208 	/** The city's latitude and longitude. This is used to calculate the distance 
   209 	between cities, and the sunrise and sunset time. */
   210     TLatLong iLatLong;
   211 	/** The local area code. */
   212     TAreaCode iAreaCode;
   213 	/** The UTC offset in minutes. */
   214     TInt iUniversalTimeOffset;
   215 	/** The daylight savings zone. */
   216     TDaylightSavingZone iDaylightSavingZone;
   217     };
   218 //
   219 class TCountryData  
   220 /** Country information.
   221 
   222 This class stores information about a country. 
   223 @publishedAll
   224 @released
   225 */
   226     {
   227 public:
   228 	/** The country's name. */
   229     TCountryName iCountry;
   230 	/** The country's national dialling code. */
   231     TNatCode iNatCode;
   232 	/** The country's capital city. */
   233     TCityName iCapital;
   234 	/** The national dialling prefix. */
   235     TNatPrefCode iNatPref;
   236 	/** The country's international dialling prefix. */
   237     TIntlPrefCode iIntlPref;
   238     };
   239 //
   240 //
   241 class TWorldId
   242 /** World ID.
   243 
   244 This class stores the world ID for a city/country. This consists of the city 
   245 and country names. Unique IDs of this type are used to identify every city 
   246 in the world database.
   247 
   248 It also defines a field for setting whether city searches span the 
   249 whole database, or just the current country. 
   250 @publishedAll
   251 @deprecated Interface is deprecated and is available for backward compatibility reasons only
   252 */
   253     {
   254 public:
   255     IMPORT_C TWorldId();
   256     inline const TCityName& City() const;
   257     inline const TCountryName& Country() const;
   258     inline TWldSelect Select() const;
   259 	inline void SetSelect(TWldSelect aSelector);
   260 private:
   261     TCityName iCity;
   262     TWldSelect iSelect;
   263     TCountryName iCountry;
   264 	friend class RWorldServer;
   265     };
   266 //
   267 class RWorldServer : public RSessionBase
   268 /** Defines the client side API to the world server.
   269 
   270 Clients can use this API to connect to the server, add, update and delete 
   271 cities/countries, retrieve city/country information, navigate and search the 
   272 world database, set the home city, default country, and the units used in 
   273 distance comparisons. In addition, clients can use the file handling functions 
   274 to import and export database data files. 
   275 @publishedAll
   276 @deprecated Interface is deprecated and is available for backward compatibility reasons only
   277 */
   278     {
   279 public:
   280     IMPORT_C TInt Connect();
   281 	IMPORT_C TVersion Version() const;
   282 	IMPORT_C void RomTitle(TDes& aText) const;
   283 	IMPORT_C TInt NumberCities() const;
   284 	IMPORT_C TInt NumberCountries() const;
   285 	//
   286     IMPORT_C void NotifyOnChange(TRequestStatus& aStatus);
   287     IMPORT_C void NotifyOnChangeCancel();
   288 	//
   289 	IMPORT_C TInt ResetAllData();
   290 	IMPORT_C TInt DataFileSave();
   291 	IMPORT_C TInt DataFileRevertToSaved();
   292 	//
   293     IMPORT_C TInt DefaultCountry(TWorldId& aCountry) const;
   294     IMPORT_C TInt SetDefaultCountry(const TWorldId& aId);
   295     IMPORT_C TInt Home(TWorldId& aHome) const;
   296     IMPORT_C TInt SetHome(const TWorldId& aId);
   297 	//
   298     IMPORT_C TInt AddCity(const TCityData& aCity);
   299     IMPORT_C TInt AddCountry(const TCountryData& aCountry,const TCityData& aCapital);
   300     IMPORT_C TInt CityData(TCityData& aCity,const TWorldId& aId) const;
   301     IMPORT_C TInt CountryData(TCountryData& aCountry,const TWorldId& aId) const;
   302 	IMPORT_C TInt CalculateDistance(TInt& aDistance,const TWorldId& aLeft,const TWorldId& aRight) const;
   303 	IMPORT_C TInt CalculateSunlight(TTime& aSunrise,TTime& aSunset,const TWorldId& aId,const TTime& aDate=Time::NullTTime()) const;
   304     IMPORT_C TInt DeleteCity(TWorldId& aId);
   305     IMPORT_C TInt DeleteCountry(TWorldId& aId);
   306     IMPORT_C TInt DistanceUnits(TWldDistanceUnits& aDistanceUnit) const;
   307     IMPORT_C TInt SetDistanceUnits(TWldDistanceUnits aUnit);
   308     IMPORT_C TInt Find(TWorldId& aId,const TDesC& aCity,const TDesC& aCountry) const;
   309     IMPORT_C TInt FindCity(TWorldId& aCity,const TDesC& aPartialCity) const;
   310     IMPORT_C TInt FindCountry(TWorldId& aCountry,const TDesC& aPartialCountry) const;
   311 	IMPORT_C TInt FirstCity(TWorldId& aId) const;
   312 	IMPORT_C TInt FirstCountry(TWorldId& aId) const;
   313 	IMPORT_C TInt IsCityDeletable(TInt& aDeleteDeniedFlags,const TWorldId& aId) const;
   314 	IMPORT_C TInt IsCountryDeletable(TInt& aDeleteDeniedFlags,const TWorldId& aId) const;
   315 	IMPORT_C TInt LastCity(TWorldId& aId) const;
   316 	IMPORT_C TInt LastCountry(TWorldId& aId) const;
   317     IMPORT_C TInt NearestCity(const TPoint& aMapCoord,const TWorldId* aCityToBeat=NULL);
   318     IMPORT_C TInt NextNearestCity(TWorldId& aId,TInt aMaxNumberToCompare=KMaxTInt);
   319     IMPORT_C TInt NextCity(TWorldId& aId) const;
   320     IMPORT_C TInt NextCountry(TWorldId& aId) const;
   321     IMPORT_C TInt PrevCity(TWorldId& aId) const;
   322     IMPORT_C TInt PrevCountry(TWorldId& aId) const;
   323     IMPORT_C TInt UpdateCity(TWorldId& aId,const TCityData& aCity);
   324     IMPORT_C TInt UpdateCountry(TWorldId& aId,const TCountryData& aCountry);
   325 	IMPORT_C TInt GetCountryNameByISOCode(const TDesC& aCode, TDes& aCountry) const;
   326 	IMPORT_C TInt SetCollationLevelForFind(TInt aCollationLevel); // this is a per-client setting
   327 public: 
   328 	IMPORT_C void __DbgFailAlloc(TInt aCount);
   329 	IMPORT_C void __DbgMarkEnd();
   330 	IMPORT_C void __DbgMarkHeap();
   331 	IMPORT_C TInt SetRomDatabaseToUse(const TDesC& aRomDatabaseToUse);
   332 	IMPORT_C TBool ReadOnlyDataIsInRAM() const;
   333     };
   334 //
   335 // TWorldId
   336 inline TWldSelect TWorldId::Select() const
   337 /** Gets the current city search mode. Clients can search for cities by country, 
   338 or over the whole world database.
   339 
   340 @return The current city search mode. */
   341 	{
   342 	return(iSelect);
   343 	}
   344 inline const TCityName& TWorldId::City() const
   345 /** Gets the city name in the current TWorldId.
   346 
   347 @return A reference to the city name. */
   348 	{
   349 	return(iCity);
   350 	}
   351 inline const TCountryName& TWorldId::Country() const
   352 /** Gets the country name in the current TWorldId.
   353 
   354 @return A reference to the country name. */
   355 	{
   356 	return(iCountry);
   357 	}
   358 inline void TWorldId::SetSelect(TWldSelect aSelector)
   359 /** Sets the city search mode. Clients can search for cities by country, or over 
   360 the whole world database.
   361 
   362 @param aSelector The city search mode. */
   363 	{
   364 	iSelect=aSelector;
   365 	}
   366 //
   367 // TLatLong
   368 inline TInt TLatLong::MinutesLat() const
   369 	{
   370 	return(iLat);
   371 	}
   372 inline TInt TLatLong::MinutesLong() const
   373 	{
   374 	return(iLong);
   375 	}
   376 #endif