Matrix Science header

ms_cronoptions.hpp

00001 /*
00002 ##############################################################################
00003 # file: ms_cronoptions.hpp                                                   #
00004 # 'msparser' toolkit                                                         #
00005 # Represents parameters from cron-section of 'mascot.dat' configuration file #
00006 ##############################################################################
00007 # COPYRIGHT NOTICE                                                           #
00008 # Copyright 1998-2003 Matrix Science Limited  All Rights Reserved.           #
00009 #                                                                            #
00010 ##############################################################################
00011 #    $Archive:: /Mowse/ms_mascotresfile/include/ms_cronoptions.hpp         $ #
00012 #     $Author: davidc $ #
00013 #       $Date: 2011/10/24 09:50:20 $ #
00014 #   $Revision: 1.9 $ #
00015 # $NoKeywords::                                                            $ #
00016 ##############################################################################
00017 */
00018 
00019 #ifndef MS_CRONOPTIONS_HPP
00020 #define MS_CRONOPTIONS_HPP
00021 
00022 #ifdef _WIN32
00023 #pragma warning(disable:4251)   // Don't want all classes to be exported
00024 #pragma warning(disable:4786)   // Debug symbols too long
00025 #   ifndef _MATRIX_USE_STATIC_LIB
00026 #       ifdef MS_MASCOTRESFILE_EXPORTS
00027 #           define MS_MASCOTRESFILE_API __declspec(dllexport)
00028 #       else
00029 #           define MS_MASCOTRESFILE_API __declspec(dllimport)
00030 #       endif
00031 #   else
00032 #       define MS_MASCOTRESFILE_API
00033 #   endif
00034 #else
00035 #   define MS_MASCOTRESFILE_API
00036 #endif
00037 
00038 // for the sake of #include <string>
00039 #ifdef __ALPHA_UNIX__
00040 #include <ctype.h>
00041 #endif
00042 #include <string>
00043 #include <vector>
00044 
00045 
00046 namespace matrix_science {
00052 
00053 
00056     class MS_MASCOTRESFILE_API ms_cronjob
00057     {
00058         friend class ms_datfile;
00059         friend class ms_cronoptions;
00060 
00061     public:
00063         ms_cronjob();
00064 
00066         ms_cronjob(const ms_cronjob& src);
00067 
00069         ~ms_cronjob();
00070 
00072         void defaultValues();
00073 
00075         void copyFrom(const ms_cronjob* right);
00076 
00077 #ifndef SWIG
00078 
00079         ms_cronjob& operator=(const ms_cronjob& right);
00080 #endif
00081 
00082         bool isEnabled() const;
00083 
00085         void setEnabled(const bool enabled);
00086 
00088         bool isMinute(const int min) const;
00089 
00091         void setMinute(const int min, const bool value);
00092 
00094         bool isHour(const int hour) const;
00095 
00097         void setHour(const int hour, const bool value);
00098 
00100         bool isDayOfMonth(const int day) const;
00101 
00103         void setDayOfMonth(const int day, const bool value);
00104 
00106         bool isMonthOfYear(const int month) const;
00107 
00109         void setMonthOfYear(const int month, const bool value);
00110 
00112         bool isDayOfWeek(const int day) const;
00113 
00115         void setDayOfWeek(const int day, const bool value);
00116 
00118         std::string getCommandStr() const;
00119 
00121         void setCommandStr(const char* str);
00122 
00123         // used internally
00124         std::string getStringValue() const;
00125 
00126     private:
00127         bool  enabled_;               /* If false, then a #[space] at start of line */
00128         bool  minute_[60];            /* index of 0-59 - Value of true means do it  */
00129         bool  hour_[24];              /* index of 0-23 - Value of true means do it  */
00130         bool  dayOfMonth_[32];        /* index of 1-31 - Value of true means do it  */
00131         bool  monthOfYear_[13];       /* index of 1-12 - Value of true means do it  */
00132         bool  dayOfWeek_[7];          /* index of  0-6 (0 = Sunday)                 */
00133         std::string szCommand_;
00134 
00135         void setCustomString();
00136         std::string customString_;
00137     }; // class ms_cronjob
00138 
00140 
00168     class MS_MASCOTRESFILE_API ms_cronoptions: public ms_customproperty
00169     {
00170         friend class ms_datfile;
00171     public:
00172 
00174         ms_cronoptions();
00175 
00177         ms_cronoptions(const ms_cronoptions& src);
00178 
00180         ~ms_cronoptions();
00181 
00183         void defaultValues();
00184 
00186         void copyFrom(const ms_cronoptions* right);
00187 
00188 #ifndef SWIG
00189 
00190         ms_cronoptions& operator=(const ms_cronoptions& right);
00191 #endif
00192 
00193         bool isSectionAvailable() const;
00194 
00196         void setSectionAvailable(const bool value);
00197 
00199         bool isCronEnabled() const;
00200 
00202         void setCronEnabled(const bool value);
00203 
00205         int getNumberOfCronJobs() const;
00206 
00208         const ms_cronjob getCronJob(const int idx) const;
00209 
00211         bool setCronJob(const int idx, const ms_cronjob job);
00212 
00214         bool deleteCronJob(const int idx);
00215 
00217         void clearCronJobs();
00218 
00220         void appendCronJob(const ms_cronjob* job);
00221 
00223         int getLoggingLevel() const;
00224 
00226         bool setLoggingLevel(const int level);
00227 
00229         std::string getLogFileName() const;
00230 
00232         bool setLogFileName(const std::string & fileName);
00233 
00234 
00235 #ifdef SUPPRESS_MS_CUSTOMPROPERTY_INHERITANCE
00236 #include "suppress_ms_customproperty.hpp"
00237 #endif
00238 
00239     private:
00240         int findProperty(const ms_cronjob & job) const;
00241         bool getPropertyNameValue(const ms_cronjob & job, std::string & name, std::string & value) const;
00242         bool                        sectionAvailable_;
00243         bool                        cronEnabled_;
00244         std::vector< ms_cronjob  >  cronJobArray_;
00245         int                         loggingLevel_;
00246         std::string                 logFileName_;
00247     }; // ms_cronoptions // end of config_group
00249 } // namespace matrix_science
00250 
00251 #endif // MS_CRONOPTIONS_HPP
00252 
00253 /*------------------------------- End of File -------------------------------*/
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:50