| 29 | } |
| 30 | |
| 31 | libmexclass::proxy::MakeResult TimestampType::make( |
| 32 | const libmexclass::proxy::FunctionArguments& constructor_arguments) { |
| 33 | namespace mda = ::matlab::data; |
| 34 | |
| 35 | using TimestampTypeProxy = arrow::matlab::type::proxy::TimestampType; |
| 36 | |
| 37 | mda::StructArray opts = constructor_arguments[0]; |
| 38 | |
| 39 | // Get the mxArray from constructor arguments |
| 40 | const mda::StringArray timezone_mda = opts[0]["TimeZone"]; |
| 41 | const mda::StringArray timeunit_mda = opts[0]["TimeUnit"]; |
| 42 | |
| 43 | // extract the time zone |
| 44 | const std::u16string& utf16_timezone = timezone_mda[0]; |
| 45 | MATLAB_ASSIGN_OR_ERROR(const auto timezone, |
| 46 | arrow::util::UTF16StringToUTF8(utf16_timezone), |
| 47 | error::UNICODE_CONVERSION_ERROR_ID); |
| 48 | |
| 49 | // extract the time unit |
| 50 | const std::u16string& utf16_timeunit = timeunit_mda[0]; |
| 51 | MATLAB_ASSIGN_OR_ERROR(const auto timeunit, |
| 52 | arrow::matlab::type::timeUnitFromString(utf16_timeunit), |
| 53 | error::UNKNOWN_TIME_UNIT_ERROR_ID); |
| 54 | |
| 55 | auto type = arrow::timestamp(timeunit, timezone); |
| 56 | auto time_type = std::static_pointer_cast<arrow::TimestampType>(type); |
| 57 | return std::make_shared<TimestampTypeProxy>(std::move(time_type)); |
| 58 | } |
| 59 | |
| 60 | void TimestampType::getTimeZone(libmexclass::proxy::method::Context& context) { |
| 61 | namespace mda = ::matlab::data; |
nothing calls this directly
no test coverage detected