MCPcopy Create free account
hub / github.com/MaaXYZ/MaaFramework / ctor

Method ctor

source/binding/NodeJS/src/apis/resource.cpp:384–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

382}
383
384ResourceImpl* 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
404void ResourceImpl::init_proto(maajs::ObjectType proto, maajs::FunctionType)
405{

Callers

nothing calls this directly

Calls 3

Utf8ValueMethod · 0.80
MaaResourceCreateFunction · 0.50
LengthMethod · 0.45

Tested by

no test coverage detected