本文整理汇总了C++中writeCString函数的典型用法代码示例。如果您正苦于以下问题:C++ writeCString函数的具体用法?C++ writeCString怎么用?C++ writeCString使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了writeCString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeProbablyBackQuotedString
void CollectAliases::dump(WriteBuffer & out) const
{
/// For need of tests, we need to dump result in some fixed order.
std::vector<Aliases::const_iterator> vec;
vec.reserve(aliases.size());
for (auto it = aliases.begin(); it != aliases.end(); ++it)
vec.emplace_back(it);
std::sort(vec.begin(), vec.end(), [](const auto & a, const auto & b) { return a->first < b->first; });
for (const auto & it : vec)
{
writeProbablyBackQuotedString(it->first, out);
writeCString(" -> ", out);
switch (it->second.kind)
{
case Kind::Expression:
writeCString("(expression) ", out);
break;
case Kind::Table:
writeCString("(table) ", out);
break;
case Kind::ArrayJoin:
writeCString("(array join) ", out);
break;
}
std::stringstream formatted_ast;
formatAST(*it->second.node, formatted_ast, 0, false, true);
writeString(formatted_ast.str(), out);
writeChar('\n', out);
}
}
示例2: drawMenu
void
drawMenu(int option)
{
SDL_Rect a,b;
/* erase the screen */
SDL_FillRect(screen,NULL,SDL_MapRGB(screen->format,0,0,0));
/* BETA */
a.x=97;//77
a.y=20;
b.x=100;
b.y=46;
b.w=125;//166
b.h=15;
SDL_BlitSurface(gfx, &b, screen, &a);
/* options */
writeCString(gfx, screen, 105, 50, "play", (option==1));//orig diff=17 now 26
writeCString(gfx, screen, 105, 76, "hall of fame", (option==2));//105, 94 option==3
writeCString(gfx, screen, 105, 102, "options", (option==3));//105, 111 option==4
writeCString(gfx, screen, 105, 128, "about", (option==4));//105, 138 option==5
writeCString(gfx, screen, 105, 154, "exit game", (option==5));//105, 155 option==6
/* some credit
a.x=154;
a.y=184;
b.x=268;
b.y=57;
b.w=166;
b.h=16;
SDL_BlitSurface(gfx, &b, screen, &a);*/
SDL_Flip(screen);
}
示例3: drawHiscores
void
drawHiscores(int max)
{
int i;
SDL_Rect a,b;
/* erase the screen */
SDL_FillRect(screen,NULL,SDL_MapRGB(screen->format,0,0,0));
/* DD2 characters */
a.x=60;
a.y=5;
b.x=450;
b.y=43;
b.w=211;
b.h=190;
SDL_BlitSurface(gfx, &b, screen, &a);
/* header */
writeCString(gfx, screen, 80, 2, "the hall of fame", 1);
for(i=0;i<max;i++) {
writeNumber(gfx, screen, 10, 23+i*17, i+1, 2);
writeCString(gfx, screen, 30, 20+i*17, hiscore[i].name, 0);
writeCString(gfx, screen, 180, 20+i*17, "st",0);
writeNumber(gfx, screen, 200, 23+i*17, hiscore[i].stage,2);
writeCString(gfx, screen, 236, 20+i*17, "sc",0);
writeNumber(gfx, screen, 260, 23+i*17, hiscore[i].score,6);
}
SDL_Flip(screen);
}
示例4: writeString
String ASTFunction::getColumnNameImpl() const
{
WriteBufferFromOwnString wb;
writeString(name, wb);
if (parameters)
{
writeChar('(', wb);
for (ASTs::const_iterator it = parameters->children.begin(); it != parameters->children.end(); ++it)
{
if (it != parameters->children.begin())
writeCString(", ", wb);
writeString((*it)->getColumnName(), wb);
}
writeChar(')', wb);
}
writeChar('(', wb);
for (ASTs::const_iterator it = arguments->children.begin(); it != arguments->children.end(); ++it)
{
if (it != arguments->children.begin())
writeCString(", ", wb);
writeString((*it)->getColumnName(), wb);
}
writeChar(')', wb);
return wb.str();
}
示例5: writeCString
void VerticalRowOutputStream::writeSpecialRow(const Block & block, size_t row_num, const char * title)
{
writeCString("\n", ostr);
row_number = 0;
field_number = 0;
size_t columns = block.columns();
writeCString(title, ostr);
writeCString(":\n", ostr);
size_t width = strlen(title) + 1;
for (size_t i = 0; i < width; ++i)
writeCString("─", ostr);
writeChar('\n', ostr);
for (size_t i = 0; i < columns; ++i)
{
if (i != 0)
writeFieldDelimiter();
auto & col = block.getByPosition(i);
writeField(*col.column, *col.type, row_num);
}
}
示例6: writeCString
void JSONRowOutputStream::writeField(const IColumn & column, const IDataType & type, size_t row_num)
{
writeCString("\t\t\t", *ostr);
writeString(fields[field_number].name, *ostr);
writeCString(": ", *ostr);
type.serializeTextJSON(column, row_num, *ostr, force_quoting_64bit_integers);
++field_number;
}
示例7: writeCString
void XMLRowOutputStream::writeRowsBeforeLimitAtLeast()
{
if (applied_limit)
{
writeCString("\t<rows_before_limit_at_least>", *ostr);
writeIntText(rows_before_limit, *ostr);
writeCString("</rows_before_limit_at_least>\n", *ostr);
}
}
示例8: writeChar
void KoXmlWriter::addAttribute(const char* attrName, const QByteArray& value)
{
// Same as the const char* one, but here we know the size
writeChar(' ');
writeCString(attrName);
writeCString("=\"");
char* escaped = escapeForXML(value.constData(), value.size());
writeCString(escaped);
if (escaped != d->escapeBuffer)
delete[] escaped;
writeChar('"');
}
示例9: writeCString
void PrettySpaceBlockOutputStream::writeSuffix()
{
if (total_rows >= max_rows)
{
writeCString("\nShowed first ", ostr);
writeIntText(max_rows, ostr);
writeCString(".\n", ostr);
}
total_rows = 0;
writeTotals();
writeExtremes();
}
示例10: calculateWidths
void PrettyCompactMonoBlockOutputStream::writeSuffix()
{
if (blocks.empty())
return;
Widths_t max_widths;
Widths_t name_widths;
for (size_t i = 0; i < blocks.size(); ++i)
calculateWidths(blocks[i], max_widths, name_widths);
writeHeader(blocks.front(), max_widths, name_widths);
size_t row_count = 0;
for (size_t block_id = 0; block_id < blocks.size() && row_count < max_rows; ++block_id)
{
const Block & block = blocks[block_id];
size_t rows = block.rows();
for (size_t i = 0; i < rows && row_count < max_rows; ++i)
{
writeRow(i, block, max_widths, name_widths);
++row_count;
}
}
writeBottom(max_widths);
if (total_rows >= max_rows)
{
writeCString(" Showed first ", ostr);
writeIntText(max_rows, ostr);
writeCString(".\n", ostr);
}
total_rows = 0;
if (totals)
{
writeCString("\nTotals:\n", ostr);
PrettyCompactBlockOutputStream::write(totals);
}
if (extremes)
{
writeCString("\nExtremes:\n", ostr);
PrettyCompactBlockOutputStream::write(extremes);
}
}
示例11: ostr
VerticalRowOutputStream::VerticalRowOutputStream(
WriteBuffer & ostr_, const Block & sample_, const FormatSettings & format_settings)
: ostr(ostr_), sample(sample_), format_settings(format_settings)
{
size_t columns = sample.columns();
using Widths = std::vector<size_t>;
Widths name_widths(columns);
size_t max_name_width = 0;
String serialized_value;
for (size_t i = 0; i < columns; ++i)
{
/// Note that number of code points is just a rough approximation of visible string width.
const String & name = sample.getByPosition(i).name;
name_widths[i] = UTF8::countCodePoints(reinterpret_cast<const UInt8 *>(name.data()), name.size());
if (name_widths[i] > max_name_width)
max_name_width = name_widths[i];
}
names_and_paddings.resize(columns);
for (size_t i = 0; i < columns; ++i)
{
WriteBufferFromString out(names_and_paddings[i]);
writeString(sample.getByPosition(i).name, out);
writeCString(": ", out);
}
for (size_t i = 0; i < columns; ++i)
names_and_paddings[i].resize(max_name_width + strlen(": "), ' ');
}
示例12: writeCString
void MergeTreePartition::serializeText(const MergeTreeData & storage, WriteBuffer & out, const FormatSettings & format_settings) const
{
size_t key_size = storage.partition_key_sample.columns();
if (key_size == 0)
{
writeCString("tuple()", out);
}
else if (key_size == 1)
{
const DataTypePtr & type = storage.partition_key_sample.getByPosition(0).type;
auto column = type->createColumn();
column->insert(value[0]);
type->serializeAsText(*column, 0, out, format_settings);
}
else
{
DataTypes types;
Columns columns;
for (size_t i = 0; i < key_size; ++i)
{
const auto & type = storage.partition_key_sample.getByPosition(i).type;
types.push_back(type);
auto column = type->createColumn();
column->insert(value[i]);
columns.push_back(std::move(column));
}
DataTypeTuple tuple_type(types);
auto tuple_column = ColumnTuple::create(columns);
tuple_type.serializeText(*tuple_column, 0, out, format_settings);
}
}
示例13: writeChar
void JSONRowOutputStream::writeRowEndDelimiter()
{
writeChar('\n', *ostr);
writeCString("\t\t}", *ostr);
field_number = 0;
++row_count;
}
示例14: writeCString
void JSONCompactRowOutputStream::writeExtremes()
{
if (extremes)
{
writeCString(",\n", *ostr);
writeChar('\n', *ostr);
writeCString("\t\"extremes\":\n", *ostr);
writeCString("\t{\n", *ostr);
writeExtremesElement("min", extremes, 0, *ostr, settings);
writeCString(",\n", *ostr);
writeExtremesElement("max", extremes, 1, *ostr, settings);
writeChar('\n', *ostr);
writeCString("\t}", *ostr);
}
}
示例15: writeExtremesElement
static void writeExtremesElement(const char * title, const Block & extremes, size_t row_num, WriteBuffer & ostr, const FormatSettings & settings)
{
writeCString("\t\t\"", ostr);
writeCString(title, ostr);
writeCString("\": [", ostr);
size_t extremes_columns = extremes.columns();
for (size_t i = 0; i < extremes_columns; ++i)
{
if (i != 0)
writeChar(',', ostr);
const ColumnWithTypeAndName & column = extremes.safeGetByPosition(i);
column.type->serializeTextJSON(*column.column.get(), row_num, ostr, settings);
}
writeChar(']', ostr);
}