-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcron_parser.h
59 lines (35 loc) · 1.26 KB
/
cron_parser.h
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
#ifndef __CRON_CRON_PARSER_H__
#define __CRON_CRON_PARSER_H__
#include "cron.h"
#include "cron_spec.h"
namespace Cron {
class SpecParser : public IParser {
public:
ISchedulePtr Parse(const std::string & str) override;
private:
ISchedulePtr parseDescriptor(const std::string & str);
ISchedulePtr returnNullandThrow(const std::string & str);
};
struct bounds {
public:
int min ;
int max ;
std::map<std::string,int> names ;
TimeItem GetField(const std::string & str) const ;
TimeItem All() const {
return getBits(min,max,1) | SpecSchedule::AnyMark ;
}
protected:
TimeItem getRange(const std::string & str) const ;
int parseIntOrName(const std::string & str) const ;
int mustParseInt(const std::string & str) const ;
TimeItem getBits( int start , int end , int step )const ;
};
extern const bounds seconds ;
extern const bounds minutes;
extern const bounds hours;
extern const bounds months;
extern const bounds dom;
extern const bounds dow;
}
#endif //__CRON_CRON_PARSER_H__