winix/core/timezones.h

67 lines
931 B
C
Raw Normal View History

/*
* 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