added: a new directory "etc"

there'll be some generic config files for winix
added: a new file in etc directory: time_zones_file
       list of time zones (not finished yet -- daylight saving time is needed)
added: option to config: etc_dir
       a directory in which there are some config files
       used mainly when winix starts
       default: empty (means not for using)
added: option to config: time_zones_file
       a file in etc_dir with time zones info
       default: time_zones.conf
       this is a Space structure with all time zones
added: to system: TimeZones struct
       list of time zones read from etc/time_zones.conf



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@849 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2012-06-22 23:34:33 +00:00
parent abafb80caf
commit d11cda3577
27 changed files with 1592 additions and 330 deletions

66
core/timezones.h Normal file
View File

@@ -0,0 +1,66 @@
/*
* 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:
struct Zone
{
TimeZone time_zone;
std::wstring name_key; // a key to locale
void Clear()
{
time_zone.Clear();
name_key.clear();
}
};
TimeZones();
bool ReadTimeZones(const wchar_t * path);
bool ReadTimeZones(const std::wstring & path);
Zone * FindZone(int tz_id);
Zone & operator[](size_t index);
size_t Size() const;
bool Empty() const;
void Clear();
private:
typedef std::vector<Zone> Tab;
Tab tab;
PT::SpaceParser parser;
PT::Space temp_space;
Zone temp_zone;
time_t ParseOffset(const wchar_t * str);
void ParseZones();
};
#endif