Esempio n. 1
0
static void __print_value (string & result
        , string const & key
        , json::value const & value
        , print_spec const & pspec
        , int indent)
{
    result.append(__stringify(key));
    result.append(pspec.ws_before_kvseparator);
    result.append(pspec.key_separator);
    
    if (value.is_scalar()) {
        result.append(pspec.ws_after_kvseparator);
        __print_scalar(result, value);
    } else {
        if (pspec.brace_position == json::brace_same_line) {
            result.append(pspec.ws_after_kvseparator);
        } else if (pspec.brace_position == json::brace_next_line) {
            result.append(pspec.new_line);
            __print_indent(result, pspec, indent);
            __print_brace_indent(result, pspec, pspec.brace_indent);
        }
        
        indent += pspec.brace_indent;
        __print_container(result, value, pspec, indent);
        indent -= pspec.brace_indent;
    }
}
Esempio n. 2
0
static string __to_string (json::value const & v, print_spec const & pspec)
{
    string r;
    
    if (v.is_scalar()) {
        __print_scalar(r, v);
        return r;
    }
    
    json::__print_container(r, v, pspec, 0);
    
    return r;
}
Esempio n. 3
0
static void __print_value (string & result
        , json::value const & value
        , print_spec const & pspec
        , int indent)
{
//    __print_indent(result, pspec, indent);
    
    if (value.is_scalar()) {
        __print_scalar(result, value);
    } else {
        __print_container(result, value, pspec, indent);
    }
}