Files
winix/core/timezones.h
Tomasz Sowa b8ff5d4cfc added: winix functions: locale, timezone
changed: time zones -- now we have the daylight saving time
       different for each year (start, end)
added: config option: time_zone_id (size_t)
       time zone identifier for not logged users
       or for newly created accounts
       those identifiers you can see in etc/time_zones.conf file
       or by using timezone winix function with 'a' parameter (timezone/a) (!!IMPROVE ME NOT IMPLEMENTED YET)
       default: 34 (Coordinated Universal Time UTC+00:00)
added: config option: locale_default_id (size_t)
       locale for not logged users
       or for newly created accounts
added: config option: locale_max_id (size_t)
       a maximum value of a locale identifier
       default: 100 (maximum: 1000)
       each locale files should have its own identifier (in "winix_locale_id" field)
       from zero to this value
added: config option: time_zone_max_id (size_t)
       maximum value of a time zone identifier
       time zones with an id greater than this will be skipped
       default: 130 (maximum: 1000)
removed: config option: locale_default



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@852 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-06-26 23:19:19 +00:00

82 lines
1.8 KiB
C++

/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2012, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_timezones
#define headerfile_winix_core_timezones
#include <string>
#include <vector>
#include "timezone.h"
#include "space/spaceparser.h"
class TimeZones
{
public:
TimeZones();
// maximum allowed time zone's identifier
void SetTimeZoneMaxId(size_t max_id);
// reading time zone from a file
bool ReadTimeZones(const wchar_t * path);
bool ReadTimeZones(const std::wstring & path);
// returning true if there is a time zone with the zone_id identifier
bool HasZone(size_t zone_id);
// returning a time zone by time zone's identifier
// can return a null pointer if there is no such a zone
TimeZone * GetZone(size_t zone_id);
// returning the number of all time zones
size_t Size() const;
// returning a time zone by an internal index
// usuful for iterating through all zones
// this index is in a range of <0, Size()-1>
// can return a null pointer if the index is out of range
TimeZone * GetZoneByIndex(size_t zone_index);
// return true if there are not any time zones
bool Empty() const;
// clears all time zones
// this does not affect SetTimeZoneMaxId()
// so the size of zone_indices is not changed but all indices are invalidated
void Clear();
private:
// indices to 'tab'
// with this we have O(1) time to find a time zone in 'tab'
// everywhere we use zone_id we refer to this table
// SetTimeZoneMaxId(size_t max_id) sets size of this table to max_id+1
std::vector<size_t> zone_indices;
// time zones
// everywhere we use zone_index we refer to this table
std::vector<TimeZone> zone_tab;
PT::SpaceParser parser;
PT::Space temp_space;
TimeZone temp_zone;
void ParseZones();
};
#endif