Qt Virtual Chart Table (QVCT)
CUnitTimeZone.hpp
Go to the documentation of this file.
1 // INDENTING (emacs/vi): -*- mode:c++; tab-width:2; c-basic-offset:2; intent-tabs-mode:nil; -*- ex: set tabstop=2 expandtab:
2 
3 /*
4  * Qt Virtual Chart Table (QVCT)
5  * Copyright (C) 2012 Cedric Dufour <http://cedric.dufour.name>
6  * Author: Cedric Dufour <http://cedric.dufour.name>
7  *
8  * The Qt Virtual Chart Table (QVCT) is free software:
9  * you can redistribute it and/or modify it under the terms of the GNU General
10  * Public License as published by the Free Software Foundation, Version 3.
11  *
12  * The Qt Virtual Chart Table (QVCT) is distributed in the hope
13  * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
14  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  *
16  * See the GNU General Public License for more details.
17  */
18 
19 #ifndef QVCT_CUNITTIMEZONE_HPP
20 #define QVCT_CUNITTIMEZONE_HPP
21 
22 // QT
23 #include <QMap>
24 #include <QString>
25 
26 // QVCT
27 class CUnitTimeZoneSymbols; // see below
28 class CUnitTimeZoneCodes; // see below
29 
30 
32 
39 {
40 
41  //------------------------------------------------------------------------------
42  // CONSTANTS / STATIC
43  //------------------------------------------------------------------------------
44 
45 public:
47  enum EUnit {
48  UTC,
50  UNDEFINED
51  };
52 
53 private:
58 
59 public:
61  static const QMap<EUnit,QString> &symbols();
63  static QString toSymbol( EUnit _eUnit );
65  static EUnit fromSymbol( const QString& _rqsSymbol );
67  static const QMap<EUnit,QString> &codes();
69  static QString toCode( EUnit _eUnit );
71  static EUnit fromCode( const QString& _rqsCode );
72 
73 };
74 
77 {
78  friend class CUnitTimeZone;
79 
80  //------------------------------------------------------------------------------
81  // CONSTRUCTORS / DESTRUCTOR
82  //------------------------------------------------------------------------------
83 
84 private:
86  {
87  qMapSymbols.insert( CUnitTimeZone::UTC, "UTC[Z]" );
88  qMapSymbols.insert( CUnitTimeZone::LOCAL, "Local" );
89  };
90  QMap<CUnitTimeZone::EUnit,QString> qMapSymbols;
91 };
92 
95 {
96  friend class CUnitTimeZone;
97 
98  //------------------------------------------------------------------------------
99  // CONSTRUCTORS / DESTRUCTOR
100  //------------------------------------------------------------------------------
101 
102 private:
104  {
105  qMapCodes.insert( CUnitTimeZone::UTC, "utc" );
106  qMapCodes.insert( CUnitTimeZone::LOCAL, "local" );
107  };
108  QMap<CUnitTimeZone::EUnit,QString> qMapCodes;
109 };
110 
111 #endif // QVCT_CUNITTIMEZONE_HPP
Container class for supported machine-friendly format/unit codes.
QMap< CUnitTimeZone::EUnit, QString > qMapCodes
Container class for supported human-readable format/unit symbols.
QMap< CUnitTimeZone::EUnit, QString > qMapSymbols
Time zone (UTC, local) selection class.
static QString toCode(EUnit _eUnit)
Returns the machine-friendly code corresponding to the given format/unit ID.
static EUnit fromSymbol(const QString &_rqsSymbol)
Returns the format/unit ID corresponding to the given human-readable symbol.
static EUnit fromCode(const QString &_rqsCode)
Returns the format/unit ID corresponding to the given machine-friendly code.
static QString toSymbol(EUnit _eUnit)
Returns the human-readable symbol corresponding to the given format/unit ID.
static const QMap< EUnit, QString > & symbols()
Returns the list of supported human-readable format/unit symbols.
static const CUnitTimeZoneSymbols oUnitTimeZoneSymbols
Container for supported human-readable format/unit symbols.
static const QMap< EUnit, QString > & codes()
Returns the list of supported machine-friendly format/unit codes.
static const CUnitTimeZoneCodes oUnitTimeZoneCodes
Container for supported machine-friendly format/unit codes.
EUnit
Format/unit ID.
@ UNDEFINED
undefined format/unit
@ LOCAL
Local Time.
@ UTC
Universal Time Coordinates.