Beispiel #1
0
static uint64_t NewJsonI(JSONMemoryPool *pool, KJSONTYPE type, va_list ap)
{
	switch(type) {
		case KJSON_OBJECT:   return JSONObject_new(pool, 0).bits;
		case KJSON_ARRAY:    return JSONArray_new(pool, 0).bits;
		case KJSON_STRING:   {
			const char *s = va_arg(ap, const char*);
			return JSONString_new(pool, s, strlen(s)).bits;
		}
		case KJSON_INT:      return JSONInt_new(pool, va_arg(ap, int)).bits;
		case KJSON_DOUBLE:   return JSONDouble_new(va_arg(ap, double)).bits;
		case KJSON_BOOLEAN:  return JSONBool_new(va_arg(ap, int)).bits;
		case KJSON_NULL:     return JSONNull_new().bits;
		case KJSON_INT64:    return JSONInt_new(pool, va_arg(ap, int64_t)).bits;
		case KJSON_LONG:     return JSONInt_new(pool, va_arg(ap, long)).bits;
	}
	return 0;
}
Beispiel #2
0
static void kJSON_init(KonohaContext *kctx, kObject *o, void *conf)
{
	kJSON *json = (kJSON *)o;
	json->json  = JSONNull_new();
}