MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / handler

Method handler

include/cpp/Int64.h:12–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10 static inline const char *getName() { return "cpp.Int64"; }
11 static inline String toString( const void *inValue ) { return String( *(Int64 *)inValue ); }
12 static inline void handler(DynamicHandlerOp op, void *ioValue,int inSize, void *outResult)
13 {
14 if (op==dhoToString)
15 *(String *)outResult = toString(ioValue);
16 else if (op==dhoGetClassName)
17 *(const char **)outResult = getName();
18 else if (op==dhoFromDynamic)
19 {
20 StructHandlerDynamicParams *params = (StructHandlerDynamicParams *)outResult;
21 cpp::Int64 &value = *(cpp::Int64 *)ioValue;
22 params->outProcessed = true;
23 if (!params->inData)
24 value = 0;
25 else
26 value = params->inData->__ToInt64();
27 }
28 else if (op==dhoToDynamic)
29 {
30 Dynamic value = *(cpp::Int64 *)ioValue;
31 *(hx::Object **)outResult = value.mPtr;
32 }
33 else if (op==dhoIs)
34 {
35 StructHandlerDynamicParams *params = (StructHandlerDynamicParams *)outResult;
36 hx::Object *obj = params->inData;
37 int type = obj->__GetType();
38 params->outProcessed = type==vtInt || type==vtInt64;
39 }
40 else
41 return DefaultStructHandler::handler(op,ioValue,inSize, outResult);
42 }
43};
44
45typedef Struct<Int64,Int64Handler> Int64Struct;

Callers

nothing calls this directly

Calls 3

toStringFunction · 0.85
__ToInt64Method · 0.45
__GetTypeMethod · 0.45

Tested by

no test coverage detected