TimePattern.h
1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef TIMEPATTERN_H
#define TIMEPATTERN_H
#include <list>
#include <string>
#include "../Common/TREPSTypes.h"
#include "../Application/Application.h"
using namespace TREPS::Common;
using namespace TREPS::Application;
namespace TREPS
{
namespace TimeManager
{
//type of time pattern part
typedef enum
{
TPPT_STRING,
TPPT_YEAR_4D,
TPPT_YEAR_2D,
TPPT_MONTH,
TPPT_DAY,
TPPT_DOY,
TPPT_HOUR,
TPPT_MIN,
TPPT_SEC,
TPPT_MLS,
} t_TimePatternPartType;
//time pattern part
typedef struct
{
//type
t_TimePatternPartType type;
//length (ie string length)
int length;
//value
string strVal;
} t_TimePatternPart;
//list of time pattern part
typedef list<t_TimePatternPart> t_TimePatternPartList;
class TimePatternClass
{
public :
TimePatternClass(void);
//init the time pattern from definition
bool init(const char *pattern);
//load pattern time
bool load(const char *time, t_Time &t, bool verbose);
//write pattern time
bool write(t_Time &t, string &time);
//get size of the pattern (ie string length)
int getSize(void);
private :
ApplicationClass *app;
t_TimePatternPartList partList;
string pattern;
};
}
}
#endif