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


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

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


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

示例1: SerialiseIndent

void
Object::Serialise(TextWriter &writer, int indent) const
{
  writer.Write('{');
  if (indent >= 0)
    writer.NewLine();

  for (auto it = children.begin(), end = children.end(); it != end;) {
    if (indent >= 0) {
      SerialiseIndent(writer, indent + 1);
      writer.Format("\"%s\": ", it->first.c_str());
      it->second->Serialise(writer, indent + 1);
      if (++it != end)
        writer.Write(',');
      writer.NewLine();
    } else {
      writer.Format("\"%s\":", it->first.c_str());
      it->second->Serialise(writer, indent);
      if (++it != end)
        writer.Write(',');
    }
  }

  if (indent >= 0)
    SerialiseIndent(writer, indent);

  writer.Write('}');
}
开发者ID:Adrien81,项目名称:XCSoar,代码行数:28,代码来源:json.cpp

示例2: WriteAngleDMM

void
WriteCup(TextWriter &writer, const Waypoint &wp)
{
  // Write Title
  writer.Format(_T("\"%s\","), wp.name.c_str());

  // Write Code
  writer.Write(',');

  // Write Country
  writer.Write(',');

  // Write Latitude
  WriteAngleDMM(writer, wp.location.latitude, true);
  writer.Write(',');

  // Write Longitude
  WriteAngleDMM(writer, wp.location.longitude, false);
  writer.Write(',');

  // Write Elevation
  WriteAltitude(writer, wp.elevation);
  writer.Write(',');

  // Write Style
  WriteSeeYouFlags(writer, wp);
  writer.Write(',');

  // Write Runway Direction
  if ((wp.type == Waypoint::Type::AIRFIELD ||
       wp.type == Waypoint::Type::OUTLANDING) &&
      wp.runway.IsDirectionDefined())
    writer.Format("%03u", wp.runway.GetDirectionDegrees());

  writer.Write(',');

  // Write Runway Length
  if ((wp.type == Waypoint::Type::AIRFIELD ||
       wp.type == Waypoint::Type::OUTLANDING) &&
      wp.runway.IsLengthDefined())
    writer.Format("%03uM", wp.runway.GetLength());

  writer.Write(',');

  // Write Airport Frequency
  if (wp.radio_frequency.IsDefined()) {
    const unsigned freq = wp.radio_frequency.GetKiloHertz();
    writer.Format("\"%u.%03u\"", freq / 1000, freq % 1000);
  }

  writer.Write(',');

  // Write Description
  writer.FormatLine(_T("\"%s\""), wp.comment.c_str());
}
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:55,代码来源:CupWriter.cpp

示例3:

static void
WriteAngleDMM(TextWriter &writer, const Angle angle, bool is_latitude)
{
  // Calculate degrees, minutes and decimal minutes
  unsigned deg, min, mmm;
  bool is_positive;
  angle.ToDMM(deg, min, mmm, is_positive);

  // Save them into the buffer string
  writer.Format(is_latitude ? "%02u%02u.%03u" : "%03u%02u.%03u",
                deg, min, mmm);

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

示例4:

void
String::Serialise(TextWriter &writer, gcc_unused int indent) const
{
  writer.Format("\"%s\"", value.c_str());
}
开发者ID:Adrien81,项目名称:XCSoar,代码行数:5,代码来源:json.cpp

示例5: WriteLong

 /**
  * Writer for a JSON integer value.
  */
 static inline void WriteLong(TextWriter &writer, long value) {
   writer.Format("%ld", value);
 }
开发者ID:Adrien81,项目名称:XCSoar,代码行数:6,代码来源:Writer.hpp

示例6: WriteUnsigned

 /**
  * Writer for a JSON integer value.
  */
 static inline void WriteUnsigned(TextWriter &writer, unsigned value) {
   writer.Format("%u", value);
 }
开发者ID:Adrien81,项目名称:XCSoar,代码行数:6,代码来源:Writer.hpp

示例7: WriteInteger

 /**
  * Writer for a JSON integer value.
  */
 static inline void WriteInteger(TextWriter &writer, int value) {
   writer.Format("%d", value);
 }
开发者ID:Adrien81,项目名称:XCSoar,代码行数:6,代码来源:Writer.hpp

示例8: WriteFixed

/**
 * Writer for a JSON floating/fixed point value.
 */
static inline void WriteFixed(TextWriter &writer, fixed value) {
    writer.Format("%f", (double)value);
}
开发者ID:,项目名称:,代码行数:6,代码来源:


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