1.00.0
C++ Standard Airline IT Object Library
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
BasParserHelperTypes.hpp
Go to the documentation of this file.
1
#ifndef __STDAIR_BAS_BASCOMPARSERHELPERTYPES_HPP
2
#define __STDAIR_BAS_BASCOMPARSERHELPERTYPES_HPP
3
4
// //////////////////////////////////////////////////////////////////////
5
// Import section
6
// //////////////////////////////////////////////////////////////////////
7
// STL
8
#include <string>
9
#include <sstream>
10
// StdAir
11
#include <
stdair/stdair_exceptions.hpp
>
12
#include <
stdair/service/Logger.hpp
>
13
14
namespace
stdair {
15
16
// ////////////////////////////////////////////////////////////////////
17
//
18
// Parser structure helper
19
//
20
// ////////////////////////////////////////////////////////////////////
22
template
<
int
MIN = 0,
int
MAX = 0>
23
struct
date_time_element
{
24
unsigned
int
_value
;
25
26
// ////////// Constructors ///////////
28
date_time_element
() { }
30
date_time_element
(
const
date_time_element
& t) :
_value
(t.
_value
) { }
32
date_time_element
(
int
i) :
_value
(i) { }
34
void
check
()
const
{
35
if
(_value < MIN || _value > MAX) {
36
std::ostringstream oMessage;
37
oMessage <<
"The value: "
<<
_value
<<
" is out of range ("
38
<< MIN <<
", "
<< MAX <<
")"
;
39
throw
stdair::ParserException
(oMessage.str());
40
}
41
}
42
};
43
45
template
<
int
MIN,
int
MAX>
46
inline
date_time_element<MIN,
47
MAX>
operator*
(
const
date_time_element<MIN, MAX>
& o1,
48
const
date_time_element<MIN, MAX>
& o2){
49
return
date_time_element<MIN, MAX>
(o1.
_value
* o2.
_value
);
50
}
51
53
template
<
int
MIN,
int
MAX>
54
inline
date_time_element<MIN,
55
MAX>
operator+
(
const
date_time_element<MIN, MAX>
& o1,
56
const
date_time_element<MIN, MAX>
& o2){
57
return
date_time_element<MIN, MAX>
(o1.
_value
+ o2.
_value
);
58
}
59
61
typedef
date_time_element<0, 23>
hour_t
;
62
typedef
date_time_element<0, 59>
minute_t
;
63
typedef
date_time_element<0, 59>
second_t
;
64
typedef
date_time_element<1900, 2100>
year_t
;
65
typedef
date_time_element<1, 12>
month_t
;
66
typedef
date_time_element<1, 31>
day_t
;
67
68
}
69
#endif // __STDAIR_BAS_BASCOMPARSERHELPERTYPES_HPP
Generated on Sat Dec 22 2012 16:51:53 for StdAir by
1.8.1.1