| 382 | } |
| 383 | |
| 384 | ResourceImpl* ResourceImpl::ctor(const maajs::CallbackInfo& info) |
| 385 | { |
| 386 | if (info.Length() == 1) { |
| 387 | try { |
| 388 | MaaResource* handle = reinterpret_cast<MaaResource*>(std::stoull(info[0].As<maajs::StringType>().Utf8Value())); |
| 389 | return new ResourceImpl { handle, false }; |
| 390 | } |
| 391 | catch (std::exception&) { |
| 392 | return nullptr; |
| 393 | } |
| 394 | } |
| 395 | else { |
| 396 | auto handle = MaaResourceCreate(); |
| 397 | if (!handle) { |
| 398 | return nullptr; |
| 399 | } |
| 400 | return new ResourceImpl { handle, true }; |
| 401 | } |
| 402 | } |
| 403 | |
| 404 | void ResourceImpl::init_proto(maajs::ObjectType proto, maajs::FunctionType) |
| 405 | { |
nothing calls this directly
no test coverage detected