本文整理汇总了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('}');
}
示例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());
}
示例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");
}
示例4:
void
String::Serialise(TextWriter &writer, gcc_unused int indent) const
{
writer.Format("\"%s\"", value.c_str());
}
示例5: WriteLong
/**
* Writer for a JSON integer value.
*/
static inline void WriteLong(TextWriter &writer, long value) {
writer.Format("%ld", value);
}
示例6: WriteUnsigned
/**
* Writer for a JSON integer value.
*/
static inline void WriteUnsigned(TextWriter &writer, unsigned value) {
writer.Format("%u", value);
}
示例7: WriteInteger
/**
* Writer for a JSON integer value.
*/
static inline void WriteInteger(TextWriter &writer, int value) {
writer.Format("%d", value);
}
示例8: WriteFixed
/**
* Writer for a JSON floating/fixed point value.
*/
static inline void WriteFixed(TextWriter &writer, fixed value) {
writer.Format("%f", (double)value);
}