| 64 | } |
| 65 | |
| 66 | object ParamValue_getitem(const ParamValue& self, int n) { |
| 67 | if (n >= self.nvalues()) { |
| 68 | PyErr_SetString(PyExc_IndexError, "ParamValue index out of range"); |
| 69 | throw_error_already_set(); |
| 70 | } |
| 71 | |
| 72 | TypeDesc t = self.type(); |
| 73 | |
| 74 | #define ParamValue_convert_dispatch(TYPE) \ |
| 75 | case TypeDesc::TYPE: \ |
| 76 | return ParamValue_convert(t,n,(CType<TypeDesc::TYPE>::type*)self.data()); |
| 77 | |
| 78 | switch (t.basetype) { |
| 79 | ParamValue_convert_dispatch(UCHAR) |
| 80 | ParamValue_convert_dispatch(CHAR) |
| 81 | ParamValue_convert_dispatch(USHORT) |
| 82 | ParamValue_convert_dispatch(SHORT) |
| 83 | ParamValue_convert_dispatch(UINT) |
| 84 | ParamValue_convert_dispatch(INT) |
| 85 | ParamValue_convert_dispatch(ULONGLONG) |
| 86 | ParamValue_convert_dispatch(LONGLONG) |
| 87 | #ifdef _HALF_H_ |
| 88 | ParamValue_convert_dispatch(HALF) |
| 89 | #endif |
| 90 | ParamValue_convert_dispatch(FLOAT) |
| 91 | ParamValue_convert_dispatch(DOUBLE) |
| 92 | case TypeDesc::STRING: |
| 93 | return ParamValue_convert(t, n, (ustring*)self.data()); |
| 94 | default: return object(); |
| 95 | } |
| 96 | |
| 97 | #undef ParamValue_convert_dispatch |
| 98 | } |
| 99 | |
| 100 | |
| 101 | static std::string |
no test coverage detected