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


C++ NarrowString::UnsafeFormat方法代码示例

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


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

示例1: Set

bool
TCPClientPort::Connect(const char *host, unsigned port)
{
  NarrowString<32> service;
  service.UnsafeFormat("%u", port);

  StaticSocketAddress address;
  if (!address.Lookup(host, service, AF_INET))
    return false;

  SocketDescriptor s;
  if (!s.CreateTCP())
    return false;

#ifdef HAVE_POSIX
  s.SetNonBlocking();
#endif

  if (s.Connect(address)) {
    Set(std::move(s));
    return true;
  }

#ifdef HAVE_POSIX
  if (errno == EINPROGRESS) {
    connecting = std::move(s);
    io_thread->LockAdd(connecting.ToFileDescriptor(), Poll::WRITE, *this);
    StateChanged();
    return true;
  }
#endif

  return false;
}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:34,代码来源:TCPClientPort.cpp

示例2: Set

void
Profile::SetGeoPoint(const char *key, const GeoPoint &value)
{
  NarrowString<128> buffer;
  buffer.UnsafeFormat("%f %f",
                      (double)value.longitude.Degrees(),
                      (double)value.latitude.Degrees());
  Set(key, buffer);
}
开发者ID:Adrien81,项目名称:XCSoar,代码行数:9,代码来源:Earth.cpp

示例3:

bool
V7ConfigWidget::Save(bool &_changed, bool &require_restart)
{
  PopupOperationEnvironment env;
  bool changed = false;
  NarrowString<32> buffer;

  if (SaveValue(BRGPS, brgps)) {
    buffer.UnsafeFormat("%u", brgps);
    device.SendV7Setting("BRGPS", buffer, env);
    changed = true;
  }

  if (SaveValue(BRPDA, brpda)) {
    buffer.UnsafeFormat("%u", brpda);
    device.SendV7Setting("BRPDA", buffer, env);
    changed = true;
  }

  _changed |= changed;
  return true;
}
开发者ID:damianob,项目名称:xcsoar,代码行数:22,代码来源:V7ConfigWidget.cpp

示例4: strtoul

bool
NanoConfigWidget::SaveSetting(const char *name, unsigned idx,
                              OperationEnvironment &env)
{
  const std::string old_value = device.GetNanoSetting(name);
  unsigned value = strtoul(old_value.c_str(), NULL, 10);
  if (!SaveValue(idx, value))
    return false;

  NarrowString<32> buffer;
  buffer.UnsafeFormat("%u", value);
  return device.SendNanoSetting(name, buffer, env);
}
开发者ID:osteocool,项目名称:XCSoar-1,代码行数:13,代码来源:NanoConfigWidget.cpp

示例5:

bool
TCPClientPort::Connect(const char *host, unsigned port)
{
  NarrowString<32> service;
  service.UnsafeFormat("%u", port);

  resolver.async_resolve({host, service.c_str()},
                         std::bind(&TCPClientPort::OnResolved, this,
                                   std::placeholders::_1,
                                   std::placeholders::_2));

  return true;
}
开发者ID:XCSoar,项目名称:XCSoar,代码行数:13,代码来源:TCPClientPort.cpp

示例6: ParseUnsigned

bool
LX16xxConfigWidget::SaveUnsignedSetting(LX1600::Setting key, unsigned idx,
                                        LX1600::SettingsMap &settings)
{
  const std::string old_value = device.GetLX16xxSetting(key);
  unsigned value = ParseUnsigned(old_value.c_str());
  if (!SaveValue(idx, value))
    return false;

  NarrowString<32> buffer;
  buffer.UnsafeFormat("%u", value);
  settings[key] = std::string(buffer.c_str(), buffer.end());
  return true;
}
开发者ID:arogithub,项目名称:XCSoar-TE,代码行数:14,代码来源:LX16xxConfigWidget.cpp

示例7:

bool
FLARMConfigWidget::Save(bool &_changed)
{
  PopupOperationEnvironment env;
  bool changed = false;
  NarrowString<32> buffer;

  if (SaveValue(Baud, baud)) {
    buffer.UnsafeFormat("%u", baud);
    device.SendSetting("BAUD", buffer, env);
    changed = true;
  }

  if (SaveValue(Priv, priv)) {
    buffer.UnsafeFormat("%u", priv);
    device.SendSetting("PRIV", buffer, env);
    changed = true;
  }

  if (SaveValue(Thre, thre)) {
    buffer.UnsafeFormat("%u", thre);
    device.SendSetting("THRE", buffer, env);
    changed = true;
  }

  if (SaveValue(Range, range)) {
    buffer.UnsafeFormat("%u", range);
    device.SendSetting("RANGE", buffer, env);
    changed = true;
  }

  if (SaveValue(Acft, acft)) {
    buffer.UnsafeFormat("%u", acft);
    device.SendSetting("ACFT", buffer, env);
    changed = true;
  }

  if (SaveValue(LogInt, log_int)) {
    buffer.UnsafeFormat("%u", log_int);
    device.SendSetting("LOGINT", buffer, env);
    changed = true;
  }

  if (SaveValue(NoTrack, notrack)) {
    buffer.UnsafeFormat("%u", notrack);
    device.SendSetting("NOTRACK", buffer, env);
    changed = true;
  }

  _changed |= changed;
  return true;
}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:52,代码来源:ConfigWidget.cpp

示例8: unsigned

bool
LX16xxConfigWidget::SaveFixedEnumSetting(LX1600::Setting key, unsigned idx,
                                         LX1600::SettingsMap &settings,
                                         unsigned factor)
{
  const std::string old_value = device.GetLX16xxSetting(key);
  unsigned value = unsigned(ParseDouble(old_value.c_str()) * factor);
  if (!SaveValue(idx, value))
    return false;

  NarrowString<32> buffer;
  buffer.UnsafeFormat("%.2f", (double)value / factor);
  settings[key] = std::string(buffer.c_str(), buffer.end());
  return true;
}
开发者ID:arogithub,项目名称:XCSoar-TE,代码行数:15,代码来源:LX16xxConfigWidget.cpp


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