| 55 | } |
| 56 | |
| 57 | libmexclass::proxy::MakeResult Field::make( |
| 58 | const libmexclass::proxy::FunctionArguments& constructor_arguments) { |
| 59 | namespace mda = ::matlab::data; |
| 60 | using FieldProxy = arrow::matlab::type::proxy::Field; |
| 61 | |
| 62 | mda::StructArray opts = constructor_arguments[0]; |
| 63 | const mda::StringArray name_mda = opts[0]["Name"]; |
| 64 | const mda::TypedArray<uint64_t> type_proxy_id_mda = opts[0]["TypeProxyID"]; |
| 65 | |
| 66 | const std::u16string& name_utf16 = name_mda[0]; |
| 67 | MATLAB_ASSIGN_OR_ERROR(const auto name, arrow::util::UTF16StringToUTF8(name_utf16), |
| 68 | error::UNICODE_CONVERSION_ERROR_ID); |
| 69 | |
| 70 | auto proxy = std::static_pointer_cast<type::proxy::Type>( |
| 71 | libmexclass::proxy::ProxyManager::getProxy(type_proxy_id_mda[0])); |
| 72 | auto type = proxy->unwrap(); |
| 73 | auto field = arrow::field(name, type); |
| 74 | return std::make_shared<FieldProxy>(std::move(field)); |
| 75 | } |
| 76 | |
| 77 | } // namespace arrow::matlab::type::proxy |