本文整理汇总了C++中Appender::append方法的典型用法代码示例。如果您正苦于以下问题:C++ Appender::append方法的具体用法?C++ Appender::append怎么用?C++ Appender::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Appender
的用法示例。
在下文中一共展示了Appender::append方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeArray
void Writer::writeArray(Appender& appender, const Value& value, Size indent)
{
appender.append("[" + lineBreak());
for (Size i = 0; i < value.getLength(); i++)
{
appender.append(space(indent + 1));
write(appender, value.get(i), indent + 1);
if (i + 1 != value.getLength())
{
appender.append(",");
}
appender.append(lineBreak());
}
appender.append(space(indent) + "]");
}
示例2: writeObject
void Writer::writeObject(Appender& appender, const Value& value, Size indent)
{
appender.append("{" + lineBreak());
auto propNames = value.getPropertyNames();
for (Size i = 0; i < propNames.size(); i++)
{
const std::string& name = propNames[i];
appender.append(space(indent + 1) + '"' + name + "\": ");
write(appender, value.get(name), indent + 1);
if (i + 1 != propNames.size())
{
appender.append(",");
}
appender.append(lineBreak());
}
appender.append(space(indent) + "}");
}
示例3: dispatch_to_string
size_t dispatch_to_string(const Arg& arg, Appender& app, FmtFlags flags,
integral_constant<bool, false> has_overload2_opt,
integral_constant<bool, true> has_overload1_opt,
integral_constant<bool, b1> has_overload2,
integral_constant<bool, b2> has_overload1)
{
auto string = to_string(arg, flags);
app.append(string);
return string.size();
}
示例4: generic_append
void generic_append(char const *begin,char const *end,Appender &a)
{
a.append('"');
char const *i,*last;
char buf[8] = "\\u00";
for(i=begin,last = begin;i!=end;) {
char const *addon = 0;
unsigned char c=*i;
switch(c) {
case 0x22: addon = "\\\""; break;
case 0x5C: addon = "\\\\"; break;
case '\b': addon = "\\b"; break;
case '\f': addon = "\\f"; break;
case '\n': addon = "\\n"; break;
case '\r': addon = "\\r"; break;
case '\t': addon = "\\t"; break;
default:
if(c<=0x1F) {
static char const tohex[]="0123456789abcdef";
buf[4]=tohex[c >> 4];
buf[5]=tohex[c & 0xF];
buf[6]=0;
addon = buf;
}
};
if(addon) {
a.append(last,i-last);
a.append(addon);
i++;
last = i;
}
else {
i++;
}
}
a.append(last,i-last);
a.append('"');
}
示例5: processSerialCommands
// gather command from serial input
// this may be performed in multiple passes - only a newline (not stored) marks command ready to process
void processSerialCommands() {
int inch;
// append any newly arrived chars & execute command if return received
while ((inch = Serial.read()) >= 0) {
if (inch == '\n') { // end of line
if(doCommand(commandBuffer)) {
showPrompt();
}
commandAp.reset();
return; // process at most one command per loop
}
else { // continue line
commandAp.append((char) inch);
}
}
}
示例6: assertString
void assertString(const vespalib::string &input, const vespalib::string &output) {
std::vector<char> buf;
_appender.append(buf, input.c_str(), input.size());
EXPECT_EQUAL(output, vespalib::string(&buf[0], buf.size()));
}
示例7: writeString
void Writer::writeString(Appender& appender, const std::string& value)
{
appender.append('"' + value + '"');
}
示例8: writeNumber
void Writer::writeNumber(Appender& appender, Float64 value)
{
appender.append(std::floor(value) == value ? std::to_string((Int32) value) : std::to_string(value));
}
示例9: writeBoolean
void Writer::writeBoolean(Appender& appender, bool value)
{
appender.append(value ? "true" : "false");
}
示例10: writeNull
void Writer::writeNull(Appender& appender)
{
appender.append("null");
}