| 56 | static inline const char *getName() { return "unknown"; } |
| 57 | static inline String toString( const void *inValue ) { return HX_CSTRING("Struct"); } |
| 58 | static inline void handler(DynamicHandlerOp op, void *ioValue, int inSize, void *outResult) |
| 59 | { |
| 60 | if (op==dhoToString) |
| 61 | *(String *)outResult = toString(ioValue); |
| 62 | else if (op==dhoGetClassName) |
| 63 | *(const char **)outResult = getName(); |
| 64 | else if (op==dhoToDynamic) |
| 65 | { |
| 66 | // Handle outsize.. |
| 67 | *(hx::Object **)outResult = 0; |
| 68 | } |
| 69 | else if (op==dhoFromDynamic) |
| 70 | { |
| 71 | StructHandlerDynamicParams *params = (StructHandlerDynamicParams *)outResult; |
| 72 | hx::Object *ptr= params->inData; |
| 73 | void *data = (void *)ptr->__GetHandle(); |
| 74 | int len = ptr->__length(); |
| 75 | if (data && len>=inSize && ptr->__CStr()==params->inName) |
| 76 | { |
| 77 | memcpy(ioValue,data,inSize); |
| 78 | params->outProcessed = true; |
| 79 | } |
| 80 | } |
| 81 | else if (op==dhoIs) |
| 82 | { |
| 83 | StructHandlerDynamicParams *params = (StructHandlerDynamicParams *)outResult; |
| 84 | hx::Object *ptr= params->inData; |
| 85 | void *data = (void *)ptr->__GetHandle(); |
| 86 | int len = ptr->__length(); |
| 87 | params->outProcessed = data && len>=inSize && ptr->__CStr()==params->inName; |
| 88 | } |
| 89 | } |
| 90 | }; |
| 91 | |
| 92 |
nothing calls this directly
no test coverage detected