File indexing completed on 2024-05-05 05:48:31

0001 /*
0002     CT Day of Week Header
0003     --------------------------------------------------------------------
0004     SPDX-FileCopyrightText: 1999 Gary Meyer <gary@meyer.net>
0005     --------------------------------------------------------------------
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #pragma once
0010 
0011 #include <QList>
0012 #include <QString>
0013 
0014 #include "ctunit.h"
0015 
0016 /**
0017  * Scheduled task days of week.
0018  */
0019 class CTDayOfWeek : public CTUnit
0020 {
0021 public:
0022     /**
0023      * Constructs from a tokenized string.
0024      */
0025     explicit CTDayOfWeek(const QString &tokStr = QLatin1String(""));
0026 
0027     /**
0028      * Override initialize to support crontab using both 0 and 7 for
0029      * Sunday.
0030      */
0031     void initialize(const QString &tokStr = QLatin1String(""));
0032 
0033     /**
0034      * Get natural language description.
0035      */
0036     virtual QString describe() const;
0037 
0038     /**
0039      * Get day of week name.
0040      */
0041     static QString getName(const int ndx, const bool format = CTDayOfWeek::longFormat);
0042 
0043     static const int MINIMUM = 1;
0044     static const int MAXIMUM = 7;
0045 
0046 private:
0047     static void initializeNames();
0048     static QList<QString> shortName;
0049     static QList<QString> longName;
0050 };
0051