本文整理汇总了C++中JsonIn::get_ate_separator方法的典型用法代码示例。如果您正苦于以下问题:C++ JsonIn::get_ate_separator方法的具体用法?C++ JsonIn::get_ate_separator怎么用?C++ JsonIn::get_ate_separator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsonIn
的用法示例。
在下文中一共展示了JsonIn::get_ate_separator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: format_collection
static void format_collection( JsonIn &jsin, JsonOut &jsout, int depth,
std::function<void(JsonIn &, JsonOut &, int, bool )>write_func )
{
if( depth > 1 ) {
// We're backtracking by storing jsin and jsout state before formatting
// and restoring it afterwards if necessary.
int in_start_pos = jsin.tell();
bool ate_seperator = jsin.get_ate_separator();
int out_start_pos = jsout.tell();
bool need_separator = jsout.get_need_separator();
write_func( jsin, jsout, depth, false );
if( jsout.tell() - out_start_pos <= 120 ) {
// Line is short enough, so we're done.
return;
} else {
// Reset jsin and jsout to their initial state,
// and we'll serialize while forcing wrapping.
jsin.seek( in_start_pos );
jsin.set_ate_separator( ate_seperator );
jsout.seek( out_start_pos );
if( need_separator ) {
jsout.set_need_separator();
}
}
}
write_func( jsin, jsout, depth, true );
}
示例2: write_object
static void write_object( JsonIn &jsin, JsonOut &jsout, int depth, bool force_wrap )
{
jsout.start_object( force_wrap );
jsin.start_object();
while( !jsin.end_object() ) {
std::string name = jsin.get_member_name();
jsout.member( name );
bool override_wrap = false;
if( name == "rows" || name == "blueprint" ) {
// Introspect into the row, if it has more than one element, force it to wrap.
int in_start_pos = jsin.tell();
bool ate_seperator = jsin.get_ate_separator();
{
JsonArray arr = jsin.get_array();
if( arr.size() > 1 ) {
override_wrap = true;
}
}
jsin.seek( in_start_pos );
jsin.set_ate_separator( ate_seperator );
}
format( jsin, jsout, depth, override_wrap );
}
jsout.end_object();
}