func toString(jv C.jv) string { // Dump it! dumped := C.jv_dump_string(jv, 0) defer C.jv_free(dumped) // Convert dump to string! strval := C.jv_string_value(dumped) return C.GoString(strval) }
// GetInvalidMessageAsString gets the error message for this Jv. If there is none it // will return ("", false). Otherwise it will return the message as a string and true, // converting non-string values if necessary. If you want the message in it's // native Jv type use `GetInvalidMessage()` // // Consumes the invocant. func (jv *Jv) GetInvalidMessageAsString() (string, bool) { msg := C.jv_invalid_get_msg(jv.jv) defer C.jv_free(msg) if C.jv_get_kind(msg) == C.JV_KIND_NULL { return "", false } else if C.jv_get_kind(msg) != C.JV_KIND_STRING { msg = C.jv_dump_string(msg, 0) } return C.GoString(C.jv_string_value(msg)), true }
func dumpJson(jv C.jv) string { strJv := C.jv_dump_string(jv, 0) result := C.jv_string_value(strJv) freeJv(strJv) return C.GoString(result) }
// Dump produces a human readable version of the string with the requested formatting. // // Consumes the invocant func (jv *Jv) Dump(flags JvPrintFlags) string { jv_str := Jv{C.jv_dump_string(jv.jv, C.int(flags))} defer jv_str.Free() return jv_str._string() }