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


C++ TextWriter::printf方法代码示例

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


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

示例1: WriteAngle

void
WaypointWriter::WriteWaypoint(TextWriter &writer, const Waypoint& wp)
{
  // Write the waypoint id
  writer.printf("%u,", wp.original_id > 0 ? wp.original_id : wp.id);

  // Write the latitude
  WriteAngle(writer, wp.location.latitude, true);
  writer.write(',');

  // Write the longitude id
  WriteAngle(writer, wp.location.longitude, false);
  writer.write(',');

  // Write the altitude id
  WriteAltitude(writer, wp.altitude);
  writer.write(',');

  // Write the waypoint flags
  WriteFlags(writer, wp);
  writer.write(',');

  // Write the waypoint name
  writer.write(wp.name.c_str());
  writer.write(',');

  // Write the waypoint description
  writer.writeln(wp.comment.c_str());
}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例2:

void
WaypointWriter::WriteAngle(TextWriter &writer, const Angle &angle,
                           bool is_latitude)
{
  // Calculate degrees, minutes and seconds
  int deg, min, sec;
  bool is_positive;
  angle.ToDMS(deg, min, sec, is_positive);

  // Save them into the buffer string
  writer.printf(is_latitude ? "%02d:%02d:%02d" : "%03d:%02d:%02d", deg, min, sec);

  // Attach the buffer string to the output
  if (is_latitude)
    writer.write(is_positive ? "N" : "S");
  else
    writer.write(is_positive ? "E" : "W");
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例3:

void
WayPointFileWinPilot::composeAngle(TextWriter &writer,
                                   const Angle& src, const bool lat)
{
  // Calculate degrees, minutes and seconds
  int deg, min, sec;
  bool is_positive;
  if (lat)
    Units::LatitudeToDMS(src, &deg, &min, &sec, &is_positive);
  else
    Units::LongitudeToDMS(src, &deg, &min, &sec, &is_positive);

  // Save them into the buffer string
  writer.printf(lat ? "%02d:%02d:%02d" : "%03d:%02d:%02d",
            deg, min, sec);

  // Attach the buffer string to the output
  if (lat)
    writer.write(is_positive ? "N" : "S");
  else
    writer.write(is_positive ? "E" : "W");
}
开发者ID:galippi,项目名称:xcsoar,代码行数:22,代码来源:WayPointFileWinPilot.cpp

示例4: composeAngle

void
WayPointFileWinPilot::composeLine(TextWriter &writer, const Waypoint& wp)
{
  // Attach the waypoint id to the output
  writer.printf("%u,", wp.id);
  // Attach the latitude to the output
  composeAngle(writer, wp.Location.Latitude, true);
  writer.write(',');
  // Attach the longitude id to the output
  composeAngle(writer, wp.Location.Longitude, false);
  writer.write(',');
  // Attach the altitude id to the output
  composeAltitude(writer, wp.Altitude);
  writer.write(',');
  // Attach the waypoint flags to the output
  composeFlags(writer, wp.Flags);
  writer.write(',');
  // Attach the waypoint name to the output
  writer.write(wp.Name.c_str());
  writer.write(',');
  // Attach the waypoint description to the output
  writer.writeln(wp.Comment.c_str());
}
开发者ID:galippi,项目名称:xcsoar,代码行数:23,代码来源:WayPointFileWinPilot.cpp


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