Beispiel #1
0
aligned_unique_ptr<NFA> constructLBR(const PureRepeat &repeat,
                                     const vector<vector<CharReach>> &triggers,
                                     const CompileContext &cc) {
    if (!cc.grey.allowLbr) {
        return nullptr;
    }

    assert(!repeat.reach.none());

    if (repeat.reports.size() != 1) {
        DEBUG_PRINTF("too many reports\n");
        return nullptr;
    }

    bool is_reset;
    u32 min_period = minPeriod(triggers, repeat.reach, &is_reset);

    if (depth(min_period) > repeat.bounds.max) {
        DEBUG_PRINTF("trigger is longer than repeat; only need one offset\n");
        is_reset = true;
    }

    ReportID report = *repeat.reports.begin();

    DEBUG_PRINTF("building LBR %s\n", repeat.bounds.str().c_str());
    return constructLBR(repeat.reach, repeat.bounds.min, repeat.bounds.max,
                        min_period, is_reset, report);
}
RecurrenceWidget::RecurrenceWidget(QWidget *parent, const char *pName) :
  QWidget(parent)
{
  setupUi(this);

  if(pName)
    setObjectName(pName);

  setMinPeriod(Minutely);

  if (minPeriod() < Weekly)
    _period->setCode("W");

  _dates->setStartCaption(tr("From:"));
  _dates->setEndCaption(tr("Until:"));
  _dates->setStartNull(tr("Today"), QDate::currentDate(), true);
  setStartDateVisible(false);
  setEndTimeVisible(false);
  setStartTimeVisible(false);

  setMaxVisible(true);

  if (_x_preferences)
  {
    XSqlQuery eotq("SELECT endOfTime() AS eot;");
    if (eotq.first())
    {
      _eot = QDateTime(eotq.value("eot").toDate(), QTime(23, 59, 59, 999));
      _dates->setEndNull(tr("Forever"), _eot.date(), true);
    }
    else
      qWarning("RecurrenceWidget could not get endOfTime()");
  }

  _dates->setEndNull(tr("Forever"), _eot.date(), true);
  if (! _eot.isValid())
    _eot = QDateTime(QDate(2100,12,31), QTime(23, 59, 59, 999));

  clear();
}