当前位置: 首页>>代码示例>>C++>>正文


C++ FlarmId::format方法代码示例

本文整理汇总了C++中FlarmId::format方法的典型用法代码示例。如果您正苦于以下问题:C++ FlarmId::format方法的具体用法?C++ FlarmId::format怎么用?C++ FlarmId::format使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FlarmId的用法示例。


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

示例1: Details

/**
 * Updates all the dialogs fields.
 * Should be called on dialog opening as it closes the dialog when the
 * target does not exist.
 */
static void
Update()
{
  TCHAR tmp[200], tmp_id[7];

  // Set the dialog caption
  _stprintf(tmp, _T("FLARM Traffic Details (%s)"), target_id.format(tmp_id));
  wf->SetCaption(tmp);

  // Try to find the target in the FLARMnet database
  /// @todo: make this code a little more usable
  const FlarmNet::Record *record = FlarmDetails::LookupRecord(target_id);
  if (record) {
    // Fill the pilot name field
    _tcscpy(tmp, record->pilot);
    ((WndProperty *)wf->FindByName(_T("prpPilot")))->SetText(tmp);

    // Fill the frequency field
    _tcscpy(tmp, record->frequency);
    _tcscat(tmp, _T("MHz"));
    ((WndProperty *)wf->FindByName(_T("prpFrequency")))->SetText(tmp);

    // Fill the home airfield field
    _tcscpy(tmp, record->airfield);
    ((WndProperty *)wf->FindByName(_T("prpAirport")))->SetText(tmp);

    // Fill the plane type field
    _tcscpy(tmp, record->plane_type);
    ((WndProperty *)wf->FindByName(_T("prpPlaneType")))->SetText(tmp);
  } else {
    // Fill the pilot name field
    ((WndProperty *)wf->FindByName(_T("prpPilot")))->SetText(_T("--"));

    // Fill the frequency field
    ((WndProperty *)wf->FindByName(_T("prpFrequency")))->SetText(_T("--"));

    // Fill the home airfield field
    ((WndProperty *)wf->FindByName(_T("prpAirport")))->SetText(_T("--"));

    // Fill the plane type field
    const FLARM_TRAFFIC* target =
        XCSoarInterface::Basic().flarm.FindTraffic(target_id);

    const TCHAR* actype;
    if (target == NULL ||
        (actype = FLARM_TRAFFIC::GetTypeString(target->type)) == NULL)
      actype = _T("--");

    ((WndProperty *)wf->FindByName(_T("prpPlaneType")))->SetText(actype);
  }

  // Fill the callsign field (+ registration)
  // note: don't use target->Name here since it is not updated
  //       yet if it was changed
  const TCHAR* cs = FlarmDetails::LookupCallsign(target_id);
  if (cs != NULL && cs[0] != 0) {
    _tcscpy(tmp, cs);
    if (record) {
      _tcscat(tmp, _T(" ("));
      _tcscat(tmp, record->registration);
      _tcscat(tmp, _T(")"));
    }
  } else
    _tcscpy(tmp, _T("--"));
  ((WndProperty *)wf->FindByName(_T("prpCallsign")))->SetText(tmp);

  // Update the frequently changing fields too
  UpdateChanging();
}
开发者ID:macsux,项目名称:XCSoar,代码行数:74,代码来源:dlgFlarmTrafficDetails.cpp


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