• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ Validity类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Validity的典型用法代码示例。如果您正苦于以下问题:C++ Validity类的具体用法?C++ Validity怎么用?C++ Validity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Validity类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: MacCreadyProcessTimer

static bool
MacCreadyProcessTimer()
{
  bool modified = false;

  static ExternalSettings last_external_settings;
  static Validity last_auto_mac_cready;

  const NMEAInfo &basic = CommonInterface::Basic();
  const DerivedInfo &calculated = CommonInterface::Calculated();

  if (last_auto_mac_cready.Modified(calculated.auto_mac_cready_available)) {
    /* time warp, reset */
    last_auto_mac_cready.Clear();
    modified = true;
  }

  if (basic.settings.mac_cready_available.Modified(last_external_settings.mac_cready_available)) {
    ActionInterface::SetMacCready(basic.settings.mac_cready, false);
    modified = true;
  } else if (calculated.auto_mac_cready_available.Modified(last_auto_mac_cready)) {
    last_auto_mac_cready = calculated.auto_mac_cready_available;
    ActionInterface::SetMacCready(calculated.auto_mac_cready);
    modified = true;
  }

  last_external_settings = basic.settings;

  return modified;
}
开发者ID:DRIZO,项目名称:xcsoar,代码行数:30,代码来源:ApplyExternalSettings.cpp


示例2: invalid

static Validity
invalid()
{
  Validity v;
  v.Clear();
  return v;
}
开发者ID:Advi42,项目名称:XCSoar,代码行数:7,代码来源:TestValidity.cpp


示例3: main

int main(int argc, char **argv)
{
  Args args(argc, argv, "DRIVER FILE");
  DebugReplay *replay = CreateDebugReplay(args);
  if (replay == NULL)
    return EXIT_FAILURE;

  args.ExpectEnd();

  printf("# time wind_bearing (deg) wind_speed (m/s)\n");

  GlidePolar glide_polar(fixed(0));

  CirclingSettings circling_settings;

  WindSettings wind_settings;
  wind_settings.SetDefaults();

  CirclingComputer circling_computer;
  circling_computer.Reset();

  WindComputer wind_computer;
  wind_computer.Reset();

  Validity last;
  last.Clear();

  while (replay->Next()) {
    const MoreData &basic = replay->Basic();
    const DerivedInfo &calculated = replay->Calculated();

    circling_computer.TurnRate(replay->SetCalculated(),
                               basic, calculated.flight);
    circling_computer.Turning(replay->SetCalculated(),
                              basic,
                              calculated.flight,
                              circling_settings);

    wind_computer.Compute(wind_settings, glide_polar, basic,
                          replay->SetCalculated());

    if (calculated.estimated_wind_available.Modified(last)) {
      TCHAR time_buffer[32];
      FormatTime(time_buffer, replay->Basic().time);

      _tprintf(_T("%s %d %g\n"),
               time_buffer, (int)calculated.estimated_wind.bearing.Degrees(),
               (double)calculated.estimated_wind.norm);
    }

    last = calculated.estimated_wind_available;
  }

  delete replay;
}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:55,代码来源:RunWindComputer.cpp


示例4: activeSheet

void CanvasBase::validateSelection()
{
    register Sheet * const sheet = activeSheet();
    if (!sheet)
        return;
#if 0
XXX TODO
    if (selection()->isSingular()) {
        const Cell cell = Cell(sheet, selection()->marker()).masterCell();
        Validity validity = cell.validity();
        if (validity.displayValidationInformation()) {
            const QString title = validity.titleInfo();
            QString message = validity.messageInfo();
            if (title.isEmpty() && message.isEmpty())
                return;

            if (!d->validationInfo) {
                d->validationInfo = new QLabel(this);
                QPalette palette = d->validationInfo->palette();
                palette.setBrush(QPalette::Window, palette.toolTipBase());
                palette.setBrush(QPalette::WindowText, palette.toolTipText());
                d->validationInfo->setPalette(palette);
//                 d->validationInfo->setWindowFlags(Qt::ToolTip);
                d->validationInfo->setFrameShape(QFrame::Box);
                d->validationInfo->setAlignment(Qt::AlignVCenter);
                d->validationInfo->setTextFormat(Qt::RichText);
            }

            QString resultText("<html><body>");
            if (!title.isEmpty()) {
                resultText += "<h2>" + title + "</h2>";
            }
            if (!message.isEmpty()) {
                message.replace(QChar('\n'), QString("<br>"));
                resultText += "<p>" + message + "</p>";
            }
            resultText += "</body></html>";
            d->validationInfo->setText(resultText);

            const double xpos = sheet->columnPosition(cell.column()) + cell.width();
            const double ypos = sheet->rowPosition(cell.row()) + cell.height();
            const QPointF position = QPointF(xpos, ypos) - offset();
            const QPoint viewPosition = viewConverter()->documentToView(position).toPoint();
            d->validationInfo->move(/*mapToGlobal*/(viewPosition)); // Qt::ToolTip!
            d->validationInfo->show();
        } else {
            delete d->validationInfo;
            d->validationInfo = 0;
        }
    } else {
        delete d->validationInfo;
        d->validationInfo = 0;
    }
#endif
}
开发者ID:crayonink,项目名称:calligra-2,代码行数:55,代码来源:CanvasBase.cpp


示例5: Cell

void ValidityDialog::init()
{
    const Map *const map = m_selection->activeSheet()->map();
    const CalculationSettings *settings = map->calculationSettings();
    const KLocale* locale = settings->locale();
    Validity validity = Cell(m_selection->activeSheet(), m_selection->marker()).validity();
    if (!validity.isEmpty()) {
        message->setPlainText(validity.message());
        title->setText(validity.title());
        QString tmp;
        switch (validity.restriction()) {
        case Validity::None:
            chooseType->setCurrentIndex(0);
            break;
        case Validity::Number:
            chooseType->setCurrentIndex(1);
            if (validity.condition() >= 5)
                val_max->setText(tmp.setNum((double)numToDouble(validity.maximumValue().asFloat())));
            val_min->setText(tmp.setNum((double)numToDouble(validity.minimumValue().asFloat())));
            break;
        case Validity::Integer:
            chooseType->setCurrentIndex(2);
            if (validity.condition() >= 5)
                val_max->setText(tmp.setNum((double)numToDouble(validity.maximumValue().asFloat())));
            val_min->setText(tmp.setNum((double)numToDouble(validity.minimumValue().asFloat())));
            break;
        case Validity::TextLength:
            chooseType->setCurrentIndex(6);
            if (validity.condition() >= 5)
                val_max->setText(tmp.setNum((double)numToDouble(validity.maximumValue().asFloat())));
            val_min->setText(tmp.setNum((double)numToDouble(validity.minimumValue().asFloat())));
            break;
        case Validity::Text:
            chooseType->setCurrentIndex(3);
            break;
        case Validity::Date:
            chooseType->setCurrentIndex(4);
            val_min->setText(locale->formatDate(validity.minimumValue().asDate(settings), KLocale::ShortDate));
            if (validity.condition() >= 5)
                val_max->setText(locale->formatDate(validity.maximumValue().asDate(settings), KLocale::ShortDate));
            break;
        case Validity::Time:
            chooseType->setCurrentIndex(5);
            val_min->setText(locale->formatTime(validity.minimumValue().asTime(settings), true));
            if (validity.condition() >= 5)
                val_max->setText(locale->formatTime(validity.maximumValue().asTime(settings), true));
            break;
        case Validity::List: {
            chooseType->setCurrentIndex(7);
            const QStringList lst = validity.validityList();
            QString tmp;
            for (QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it) {
                tmp += (*it) + '\n';
            }
            validityList->setText(tmp);
        }
        break;
        default :
            chooseType->setCurrentIndex(0);
            break;
        }
        chooseAction->setCurrentIndex(chooseAction->findData(QVariant::fromValue(validity.action())));
        choose->setCurrentIndex(choose->findData(QVariant::fromValue(validity.condition())));
        displayMessage->setChecked(validity.displayMessage());
        allowEmptyCell->setChecked(validity.allowEmptyCell());
        titleHelp->setText(validity.titleInfo());
        messageHelp->setPlainText(validity.messageInfo());
        displayHelp->setChecked(validity.displayValidationInformation());
    }
    changeIndexType(chooseType->currentIndex()) ;
    changeIndexCond(choose->currentIndex()) ;
}
开发者ID:KDE,项目名称:calligra-history,代码行数:72,代码来源:ValidityDialog.cpp


示例6: i18n

void ValidityDialog::OkPressed()
{
    const KLocale* locale = m_selection->activeSheet()->map()->calculationSettings()->locale();
    const ValueParser *const parser = m_selection->activeSheet()->map()->parser();
    Validity validity;
    if (chooseType->currentIndex() == 1) {
        bool ok;
        val_min->text().toDouble(&ok);
        if (! ok) {
            KMessageBox::error(this , i18n("This is not a valid value."), i18n("Error"));
            val_min->setText("");
            return;
        }
        val_max->text().toDouble(&ok);
        if (! ok && choose->currentIndex() >= 5 && choose->currentIndex() < 7) {
            KMessageBox::error(this , i18n("This is not a valid value."), i18n("Error"));
            val_max->setText("");
            return;
        }
    } else if (chooseType->currentIndex() == 2 || chooseType->currentIndex() == 6) {
        bool ok;
        val_min->text().toInt(&ok);
        if (! ok) {
            KMessageBox::error(this , i18n("This is not a valid value."), i18n("Error"));
            val_min->setText("");
            return;
        }
        val_max->text().toInt(&ok);
        if (! ok && choose->currentIndex() >= 5 && choose->currentIndex() < 7) {
            KMessageBox::error(this , i18n("This is not a valid value."), i18n("Error"));
            val_max->setText("");
            return;
        }
    } else  if (chooseType->currentIndex() == 5) {
        if (!locale->readTime(val_min->text()).isValid()) {
            KMessageBox::error(this , i18n("This is not a valid time."), i18n("Error"));
            val_min->setText("");
            return;
        }
        if (!locale->readTime(val_max->text()).isValid() && choose->currentIndex()  >= 5) {
            KMessageBox::error(this , i18n("This is not a valid time."), i18n("Error"));
            val_max->setText("");
            return;
        }
    } else  if (chooseType->currentIndex() == 4) {
        if (!locale->readDate(val_min->text()).isValid()) {
            KMessageBox::error(this , i18n("This is not a valid date."), i18n("Error"));
            val_min->setText("");
            return;
        }
        if (!locale->readDate(val_max->text()).isValid() && choose->currentIndex()  >= 5) {
            KMessageBox::error(this , i18n("This is not a valid date."), i18n("Error"));
            val_max->setText("");
            return;
        }
    } else if (chooseType->currentIndex() == 7) {
        //Nothing
    }

    if (chooseType->currentIndex() == 0) {//no validity
        validity.setRestriction(Validity::None);
        validity.setAction(Validity::Stop);
        validity.setCondition(Conditional::Equal);
        validity.setMessage(message->toPlainText());
        validity.setTitle(title->text());
        validity.setMinimumValue(Value());
        validity.setMaximumValue(Value());
    } else {
        validity.setRestriction(chooseType->itemData(chooseType->currentIndex()).value<Validity::Restriction>());
        validity.setAction(chooseAction->itemData(chooseAction->currentIndex()).value<Validity::Action>());
        validity.setCondition(choose->itemData(choose->currentIndex()).value<Conditional::Type>());
        validity.setMessage(message->toPlainText());
        validity.setTitle(title->text());
        validity.setMinimumValue(Value());
        validity.setMaximumValue(Value());

        if (chooseType->currentIndex() == 1) {
            if (choose->currentIndex()  < 5) {
                validity.setMinimumValue(Value(val_min->text().toDouble()));
            } else {
                validity.setMinimumValue(Value(qMin(val_min->text().toDouble(), val_max->text().toDouble())));
                validity.setMaximumValue(Value(qMax(val_max->text().toDouble(), val_min->text().toDouble())));
            }
        } else if (chooseType->currentIndex() == 2 || chooseType->currentIndex() == 6) {
            if (choose->currentIndex()  < 5) {
                validity.setMinimumValue(Value(val_min->text().toInt()));
            } else {
                validity.setMinimumValue(Value(qMin(val_min->text().toInt(), val_max->text().toInt())));
                validity.setMaximumValue(Value(qMax(val_max->text().toInt(), val_min->text().toInt())));
            }
        } else  if (chooseType->currentIndex() == 4) {
            const Value minValue = parser->tryParseDate(val_min->text());
            const Value maxValue = parser->tryParseDate(val_max->text());
            if (choose->currentIndex()  < 5) {
                validity.setMinimumValue(minValue);
            } else {
                if (minValue.less(maxValue)) {
                    validity.setMinimumValue(minValue);
                    validity.setMaximumValue(maxValue);
                } else {
//.........这里部分代码省略.........
开发者ID:KDE,项目名称:calligra-history,代码行数:101,代码来源:ValidityDialog.cpp


示例7: Reset

 void Reset() {
   bank_angle_available.Clear();
   bank_angle_computed = false;
   pitch_angle_available.Clear();
   pitch_angle_computed = false;
   heading_available.Clear();
   heading_computed = false;
 }
开发者ID:Advi42,项目名称:XCSoar,代码行数:8,代码来源:Attitude.hpp


示例8: Expire

  void Expire(fixed clock) {
    new_traffic.Expire(clock, fixed(60));

    for (unsigned i = list.size(); i-- > 0;)
      if (!list[i].Refresh(clock))
        list.quick_remove(i);
  }
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:7,代码来源:List.hpp


示例9: protect

void
TrafficListWidget::UpdateList()
{
  assert(filter_widget != nullptr);

  items.clear();
  last_update.Clear();

  const TCHAR *callsign = filter_widget->GetValueString(CALLSIGN);
  if (!StringIsEmpty(callsign)) {
    FlarmId ids[30];
    unsigned count = FlarmDetails::FindIdsByCallSign(callsign, ids, 30);

    for (unsigned i = 0; i < count; ++i)
      AddItem(ids[i]);
  } else {
    /* if no filter was set, show a list of current traffic and known
       traffic */

    /* add live FLARM traffic */
    for (const auto &i : CommonInterface::Basic().flarm.traffic.list) {
      AddItem(i.id);
    }

    /* add FLARM peers that have a user-defined color */
    for (const auto &i : traffic_databases->flarm_colors) {
      Item &item = AddItem(i.first);
      item.color = i.second;
    }

    /* add FLARM peers that have a user-defined name */
    for (const auto &i : traffic_databases->flarm_names) {
      AddItem(i.id);
    }

#ifdef HAVE_SKYLINES_TRACKING_HANDLER
    /* show SkyLines traffic unless this is a FLARM traffic picker
       dialog (from dlgTeamCode) */
    if (action_listener == nullptr) {
      const auto &data = tracking->GetSkyLinesData();
      const ScopeLock protect(data.mutex);
      for (const auto &i : data.traffic) {
        items.emplace_back(i.first, i.second.location);
        Item &item = items.back();

        if (i.second.location.IsValid() &&
            CommonInterface::Basic().location_available)
          item.vector = GeoVector(CommonInterface::Basic().location,
                                  i.second.location);
      }
    }
#endif
  }

  GetList().SetLength(items.size());

  UpdateVolatile();
  UpdateButtons();
}
开发者ID:henrik1g,项目名称:XCSoar,代码行数:59,代码来源:TrafficList.cpp


示例10: ProvideAutoMacCready

  void ProvideAutoMacCready(fixed clock, fixed mc) {
    if (auto_mac_cready_available &&
        fabs(auto_mac_cready - mc) < fixed(0.05))
      /* change is too small, ignore the new value to limit the rate */
      return;

    auto_mac_cready = mc;
    auto_mac_cready_available.Update(clock);
  }
开发者ID:mobotics,项目名称:XCSoar,代码行数:9,代码来源:Derived.hpp


示例11: ProvideWeakBaroAltitude

  /**
   * Same as ProvideBaroAltitudeTrue(), but don't overwrite a "strong"
   * value.
   */
  void ProvideWeakBaroAltitude(double value) {
    if (baro_altitude_available && !baro_altitude_weak)
      /* don't overwrite "strong" value */
      return;

    baro_altitude = value;
    baro_altitude_weak = true;
    baro_altitude_available.Update(clock);
  }
开发者ID:MaxPower-No1,项目名称:XCSoar,代码行数:13,代码来源:Info.hpp


示例12: ProvideWeakPressureAltitude

  /**
   * Same as ProvidePressureAltitude(), but don't overwrite a "strong"
   * value.
   */
  void ProvideWeakPressureAltitude(double value) {
    if (pressure_altitude_available && !pressure_altitude_weak)
      /* don't overwrite "strong" value */
      return;

    pressure_altitude = value;
    pressure_altitude_weak = true;
    pressure_altitude_available.Update(clock);
  }
开发者ID:MaxPower-No1,项目名称:XCSoar,代码行数:13,代码来源:Info.hpp


示例13: Refresh

  void Refresh(fixed Time) {
    available.Expire(Time, fixed(10));
    if (!available)
      traffic.clear();

    for (unsigned i = traffic.size(); i-- > 0;)
      if (!traffic[i].Refresh(Time))
        traffic.quick_remove(i);

    NewTraffic = false;
  }
开发者ID:macsux,项目名称:XCSoar,代码行数:11,代码来源:State.hpp


示例14: Complement

 void Complement(const FlarmError &add) {
   if (available.Complement(add.available)) {
     severity = add.severity;
     code = add.code;
   }
 }
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:6,代码来源:Error.hpp


示例15: Clear

 void Clear() {
   available.Clear();
 }
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:3,代码来源:Error.hpp


示例16: ProvideExternalWind

 /**
  * Set the external wind value.
  */
 void ProvideExternalWind(const SpeedVector &value) {
   external_wind = value;
   external_wind_available.Update(clock);
 }
开发者ID:MaxPower-No1,项目名称:XCSoar,代码行数:7,代码来源:Info.hpp


示例17: Clear

 void Clear() {
   new_traffic.Clear();
   list.clear();
 }
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:4,代码来源:List.hpp


示例18: ProvideNoncompVario

 /**
  * Set the gross, non-compensated, plain-old vertical speed vario value [m/s].
  */
 void ProvideNoncompVario(double value) {
   noncomp_vario = value;
   noncomp_vario_available.Update(clock);
 }
开发者ID:MaxPower-No1,项目名称:XCSoar,代码行数:7,代码来源:Info.hpp


示例19: ProvideBothAirspeeds

 /**
  * Set both true airspeed and indicated airspeed to two different
  * values [m/s].
  */
 void ProvideBothAirspeeds(double ias, double tas) {
   indicated_airspeed = ias;
   true_airspeed = tas;
   airspeed_available.Update(clock);
   airspeed_real = true;
 }
开发者ID:MaxPower-No1,项目名称:XCSoar,代码行数:10,代码来源:Info.hpp


示例20: ProvideSensorCalibration

 /**
  * Used only as a config value that should be saved.
  *
  * Currently used for:
  *       battery voltage measurement (multiplier)
  *       offset between the pitot- and the static pressure sensor in hPa (zero).
  *       temperature sensor
  */
 void ProvideSensorCalibration(double value, double offset) {
   sensor_calibration_factor = value;
   sensor_calibration_offset = offset;
   sensor_calibration_available.Update(clock);
 }
开发者ID:MaxPower-No1,项目名称:XCSoar,代码行数:13,代码来源:Info.hpp



注:本文中的Validity类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Value类代码示例发布时间:2022-05-31
下一篇:
C++ ValidatorResult类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap