Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
ms_cronoptions.hpp
1/*
2##############################################################################
3# file: ms_cronoptions.hpp #
4# 'msparser' toolkit #
5# Represents parameters from cron-section of 'mascot.dat' configuration file #
6##############################################################################
7# COPYRIGHT NOTICE #
8# Copyright 1998-2003 Matrix Science Limited All Rights Reserved. #
9# #
10##############################################################################
11# $Archive:: /Mowse/ms_mascotresfile/include/ms_cronoptions.hpp $ #
12# $Author: villek@matrixscience.com $ #
13# $Date: 2018-07-30 16:23:53 +0100 $ #
14# $Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_3_0_0-2024-09-24-0-g93ebaeb4f4 $ #
15# $NoKeywords:: $ #
16##############################################################################
17*/
18
19#ifndef MS_CRONOPTIONS_HPP
20#define MS_CRONOPTIONS_HPP
21
22
23#include <string>
24#include <vector>
25
26
27namespace matrix_science {
34
37 class MS_MASCOTRESFILE_API ms_cronjob
38 {
39 friend class ms_datfile;
40 friend class ms_cronoptions;
41
42 public:
44 ms_cronjob();
45
47 ms_cronjob(const ms_cronjob& src);
48
51
53 void defaultValues();
54
56 void copyFrom(const ms_cronjob* right);
57
58#ifndef SWIG
60 ms_cronjob& operator=(const ms_cronjob& right);
61#endif
63 bool isEnabled() const;
64
66 void setEnabled(const bool enabled);
67
69 bool isMinute(const int min) const;
70
72 void setMinute(const int min, const bool value);
73
75 bool isHour(const int hour) const;
76
78 void setHour(const int hour, const bool value);
79
81 bool isDayOfMonth(const int day) const;
82
84 void setDayOfMonth(const int day, const bool value);
85
87 bool isMonthOfYear(const int month) const;
88
90 void setMonthOfYear(const int month, const bool value);
91
93 bool isDayOfWeek(const int day) const;
94
96 void setDayOfWeek(const int day, const bool value);
97
99 std::string getCommandStr() const;
100
102 void setCommandStr(const char* str);
103
104 // used internally
105 std::string getStringValue() const;
106
107 private:
108 bool enabled_; /* If false, then a #[space] at start of line */
109 bool minute_[60]; /* index of 0-59 - Value of true means do it */
110 bool hour_[24]; /* index of 0-23 - Value of true means do it */
111 bool dayOfMonth_[32]; /* index of 1-31 - Value of true means do it */
112 bool monthOfYear_[13]; /* index of 1-12 - Value of true means do it */
113 bool dayOfWeek_[7]; /* index of 0-6 (0 = Sunday) */
114 std::string szCommand_;
115
116 void setCustomString();
117 std::string customString_;
118 }; // class ms_cronjob
119
121
149 class MS_MASCOTRESFILE_API ms_cronoptions: public ms_customproperty
150 {
151 friend class ms_datfile;
152 public:
153
156
158 ms_cronoptions(const ms_cronoptions& src);
159
162
164 void defaultValues();
165
167 void copyFrom(const ms_cronoptions* right);
168
169#ifndef SWIG
171 ms_cronoptions& operator=(const ms_cronoptions& right);
172#endif
174 bool isSectionAvailable() const;
175
177 void setSectionAvailable(const bool value);
178
180 bool isCronEnabled() const;
181
183 void setCronEnabled(const bool value);
184
186 int getNumberOfCronJobs() const;
187
189 const ms_cronjob getCronJob(const int idx) const;
190
192 bool setCronJob(const int idx, const ms_cronjob job);
193
195 bool deleteCronJob(const int idx);
196
198 void clearCronJobs();
199
201 void appendCronJob(const ms_cronjob* job);
202
204 int getLoggingLevel() const;
205
207 bool setLoggingLevel(const int level);
208
210 std::string getLogFileName() const;
211
213 bool setLogFileName(const std::string & fileName);
214
215
216#ifdef SUPPRESS_MS_CUSTOMPROPERTY_INHERITANCE
217#include "suppress_ms_customproperty.hpp"
218#endif
219
220 private:
221 int findProperty(const ms_cronjob & job) const;
222 bool getPropertyNameValue(const ms_cronjob & job, std::string & name, std::string & value) const;
223 bool sectionAvailable_;
224 bool cronEnabled_;
225 std::vector< ms_cronjob > cronJobArray_;
226 int loggingLevel_;
227 std::string logFileName_;
228 }; // ms_cronoptions // end of config_group
230} // namespace matrix_science
231
232#endif // MS_CRONOPTIONS_HPP
233
234/*------------------------------- End of File -------------------------------*/
Represents a single entry from the cron section of mascot.dat.
Definition: ms_cronoptions.hpp:38
Contains parameters from the cron section of mascot.dat.
Definition: ms_cronoptions.hpp:150
The class is used as a base for property-containing classes, such as ms_mascotoptions.
Definition: ms_customproperty.hpp:91
Encapsulates the mascot.dat file that contains the most important parameters.
Definition: ms_datfile.hpp:47