Пример #1
0
void msgpack_rpc_from_object(Object result, msgpack_packer *res)
{
  switch (result.type) {
    case kObjectTypeNil:
      msgpack_pack_nil(res);
      break;

    case kObjectTypeBool:
      msgpack_rpc_from_bool(result.data.boolean, res);
      break;

    case kObjectTypeInt:
      msgpack_rpc_from_int64_t(result.data.integer, res);
      break;

    case kObjectTypeFloat:
      msgpack_rpc_from_double(result.data.floating_point, res);
      break;

    case kObjectTypeString:
      msgpack_rpc_from_string(result.data.string, res);
      break;

    case kObjectTypeArray:
      msgpack_rpc_from_array(result.data.array, res);
      break;

    case kObjectTypeDictionary:
      msgpack_rpc_from_dictionary(result.data.dictionary, res);
      break;

    default:
      abort();
  }
}
Пример #2
0
void msgpack_rpc_from_stringarray(StringArray result, msgpack_packer *res)
{
  msgpack_pack_array(res, result.size);

  for (size_t i = 0; i < result.size; i++) {
    msgpack_rpc_from_string(result.items[i], res);
  }
}
Пример #3
0
void msgpack_rpc_from_dictionary(Dictionary result, msgpack_packer *res)
{
  msgpack_pack_map(res, result.size);

  for (size_t i = 0; i < result.size; i++) {
    msgpack_rpc_from_string(result.items[i].key, res);
    msgpack_rpc_from_object(result.items[i].value, res);
  }
}
Пример #4
0
void msgpack_rpc_from_object(Object result, msgpack_packer *res)
{
  switch (result.type) {
    case kObjectTypeNil:
      msgpack_pack_nil(res);
      break;

    case kObjectTypeBoolean:
      msgpack_rpc_from_boolean(result.data.boolean, res);
      break;

    case kObjectTypeInteger:
      msgpack_rpc_from_integer(result.data.integer, res);
      break;

    case kObjectTypeFloat:
      msgpack_rpc_from_float(result.data.floating, res);
      break;

    case kObjectTypeString:
      msgpack_rpc_from_string(result.data.string, res);
      break;

    case kObjectTypeArray:
      msgpack_rpc_from_array(result.data.array, res);
      break;

    case kObjectTypePosition:
      msgpack_rpc_from_position(result.data.position, res);
      break;

    case kObjectTypeBuffer:
      msgpack_rpc_from_buffer(result.data.buffer, res);
      break;

    case kObjectTypeWindow:
      msgpack_rpc_from_window(result.data.window, res);
      break;

    case kObjectTypeTabpage:
      msgpack_rpc_from_tabpage(result.data.tabpage, res);
      break;

    case kObjectTypeStringArray:
      msgpack_rpc_from_stringarray(result.data.stringarray, res);
      break;

    case kObjectTypeBufferArray:
      msgpack_rpc_from_bufferarray(result.data.bufferarray, res);
      break;

    case kObjectTypeWindowArray:
      msgpack_rpc_from_windowarray(result.data.windowarray, res);
      break;

    case kObjectTypeTabpageArray:
      msgpack_rpc_from_tabpagearray(result.data.tabpagearray, res);
      break;

    case kObjectTypeDictionary:
      msgpack_rpc_from_dictionary(result.data.dictionary, res);
      break;
  }
}