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


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

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


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

示例1:

void
WayPointFileWinPilot::composeFlags(TextWriter &writer,
                                   const WaypointFlags &src)
{
  if (src.Airport)
    writer.write('A');
  if (src.TurnPoint)
    writer.write('T');
  if (src.LandPoint)
    writer.write('L');
  if (src.Home)
    writer.write('H');
  if (src.StartPoint)
    writer.write('S');
  if (src.FinishPoint)
    writer.write('F');
  if (src.Restricted)
    writer.write('R');
  if (src.WaypointFlag)
    writer.write('W');

  // set as turnpoint by default if nothing else
  if (!src.Airport && !src.TurnPoint && !src.LandPoint && !src.Home &&
      !src.StartPoint && !src.FinishPoint && !src.Restricted &&
      !src.WaypointFlag)
    writer.write('T');
}
开发者ID:galippi,项目名称:xcsoar,代码行数:27,代码来源:WayPointFileWinPilot.cpp

示例2: write

		/// <summary>
		/// レコードを書き込みます。
		/// </summary>
		/// <param name="record">
		/// 書き込むデータ
		/// </param>
		/// <returns>
		/// なし
		/// </returns>
		void write(const String& record)
		{
			if (!std::exchange(m_isHead, false))
			{
				m_writer.write(L',');
			}

			m_writer.write(L'\"');

			m_writer.write(record);

			m_writer.write(L'\"');
		}
开发者ID:7th-Douji,项目名称:Siv3D-Reference,代码行数:22,代码来源:CSVWriter.hpp

示例3: rewrite

QString RewriteBinding::rewrite(QString code, unsigned position,
                                AST::Statement *node)
{
    TextWriter w;
    _writer = &w;
    _position = position;
    _inLoop = 0;

    accept(node);

    unsigned startOfStatement = node->firstSourceLocation().begin() - _position;
    unsigned endOfStatement = node->lastSourceLocation().end() - _position;

    _writer->replace(startOfStatement, 0, QLatin1String("(function ") + QString::fromUtf8(_name) + QLatin1String("() { "));
    _writer->replace(endOfStatement, 0, QLatin1String(" })"));

    if (rewriteDump()) {
        qWarning() << "=============================================================";
        qWarning() << "Rewrote:";
        qWarning() << qPrintable(code);
    }

    w.write(&code);

    if (rewriteDump()) {
        qWarning() << "To:";
        qWarning() << qPrintable(code);
        qWarning() << "=============================================================";
    }

    return code;
}
开发者ID:,项目名称:,代码行数:32,代码来源:

示例4:

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,代码来源:

示例5: while

static void
write_xml_string(TextWriter &writer, const TCHAR *source)
{
  while (*source) {
    switch (*source) {
    case '<':
      writer.write("&lt;");
      break;
    case '>':
      writer.write("&gt;");
      break;
    case '&':
      writer.write("&amp;");
      break;
    case '\'':
      writer.write("&apos;");
      break;
    case '"':
      writer.write("&quot;");
      break;
    default:
      writer.write(*source);
      break;
    }
    source++;
  }
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例6: 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,代码来源:

示例7: readText

void CasmReader::readText(charstring Filename,
                          std::shared_ptr<SymbolTable> EnclosingScope) {
  Symtab = std::make_shared<SymbolTable>(EnclosingScope);
  Driver Parser(Symtab);
  if (TraceRead)
    Parser.setTraceParsing(true);
  if (TraceLexer)
    Parser.setTraceLexing(true);
  if (!Parser.parse(Filename)) {
    foundErrors();
    return;
  }
  if (Install)
    Symtab->install();
  if (TraceTree) {
    TextWriter Writer;
    Writer.write(stderr, Symtab.get());
  }
}
开发者ID:WebAssembly,项目名称:decompressor-prototype,代码行数:19,代码来源:CasmReader.cpp

示例8: 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

示例9: nextLine

		/// <summary>
		/// 改行します。
		/// </summary>
		/// <returns>
		/// なし
		/// </returns>
		void nextLine()
		{
			m_writer.write(L"\r\n");

			m_isHead = true;
		}
开发者ID:7th-Douji,项目名称:Siv3D-Reference,代码行数:12,代码来源:CSVWriter.hpp

示例10: assert

void
XMLNode::serialiseR(const XMLNodeData *pEntry, TextWriter &writer, int nFormat)
{
  unsigned cb;
  int nChildFormat = -1;
  bool bHasChildren = false;

  assert(pEntry);

  // If the element has no name then assume this is the head node.
  if (!string_is_empty(pEntry->lpszName)) {
    // "<elementname "
    cb = nFormat == -1 ? 0 : nFormat;

    write_indent(writer, cb);
    writer.write('<');
    if (pEntry->isDeclaration)
      writer.write('?');
    writer.write(pEntry->lpszName);

    // Enumerate attributes and add them to the string
    for (auto i = pEntry->pAttribute.begin(), end = pEntry->pAttribute.end();
         i != end; ++i) {
      const XMLNodeData::Attribute *pAttr = &*i;
      writer.write(' ');
      writer.write(pAttr->lpszName);
      writer.write('=');
      writer.write('"');
      if (pAttr->lpszValue != NULL)
        write_xml_string(writer, pAttr->lpszValue);
      writer.write('"');
      pAttr++;
    }

    bHasChildren = pEntry->HasChildren();
    if (pEntry->isDeclaration) {
      writer.write('?');
      writer.write('>');
      if (nFormat != -1)
        writer.newline();
    } else
    // If there are child nodes we need to terminate the start tag
    if (bHasChildren) {
      writer.write('>');
      if (nFormat != -1)
        writer.newline();
    }
  }

  // Calculate the child format for when we recurse.  This is used to
  // determine the number of spaces used for prefixes.
  if (nFormat != -1) {
    if (!string_is_empty(pEntry->lpszName))
      nChildFormat = nFormat + 1;
    else
      nChildFormat = nFormat;
  }

  /* write the child elements */
  for (auto i = pEntry->begin(), end = pEntry->end(); i != end; ++i)
    serialiseR(i->d, writer, nChildFormat);

  /* write the text */
  if (!pEntry->text.empty()) {
    if (nFormat != -1) {
      write_indent(writer, nFormat + 1);
      write_xml_string(writer, pEntry->text.c_str());
      writer.newline();
    } else {
      write_xml_string(writer, pEntry->text.c_str());
    }
  }

  if (!string_is_empty(pEntry->lpszName) && !pEntry->isDeclaration) {
    // If we have child entries we need to use long XML notation for
    // closing the element - "<elementname>blah blah blah</elementname>"
    if (bHasChildren) {
      // "</elementname>\0"
      if (nFormat != -1)
        write_indent(writer, nFormat);

      writer.write("</");
      writer.write(pEntry->lpszName);

      writer.write('>');
    } else {
      // If there are no children we can use shorthand XML notation -
      // "<elementname/>"
      // "/>\0"
      writer.write("/>");
    }

    if (nFormat != -1)
      writer.newline();
  }
}
开发者ID:,项目名称:,代码行数:96,代码来源:


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