本文整理汇总了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');
}
示例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'\"');
}
示例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;
}
示例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");
}
示例5: while
static void
write_xml_string(TextWriter &writer, const TCHAR *source)
{
while (*source) {
switch (*source) {
case '<':
writer.write("<");
break;
case '>':
writer.write(">");
break;
case '&':
writer.write("&");
break;
case '\'':
writer.write("'");
break;
case '"':
writer.write(""");
break;
default:
writer.write(*source);
break;
}
source++;
}
}
示例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());
}
示例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());
}
}
示例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());
}
示例9: nextLine
/// <summary>
/// 改行します。
/// </summary>
/// <returns>
/// なし
/// </returns>
void nextLine()
{
m_writer.write(L"\r\n");
m_isHead = true;
}
示例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();
}
}