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
This commit is contained in:
@@ -21,42 +21,57 @@ class TimeZones
|
||||
{
|
||||
public:
|
||||
|
||||
struct Zone
|
||||
{
|
||||
TimeZone time_zone;
|
||||
std::wstring name_key; // a key to locale
|
||||
|
||||
void Clear()
|
||||
{
|
||||
time_zone.Clear();
|
||||
name_key.clear();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
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);
|
||||
|
||||
Zone * FindZone(int tz_id);
|
||||
Zone & operator[](size_t index);
|
||||
// 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;
|
||||
bool Empty() const;
|
||||
void Clear();
|
||||
|
||||
// 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:
|
||||
|
||||
typedef std::vector<Zone> Tab;
|
||||
Tab tab;
|
||||
// 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;
|
||||
Zone temp_zone;
|
||||
TimeZone temp_zone;
|
||||
|
||||
time_t ParseOffset(const wchar_t * str);
|
||||
void ParseZones();
|
||||
void ParseZones();
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user