| 213 | CENCODING UArray_encoding(const UArray *self) { return self->encoding; } |
| 214 | |
| 215 | void UArray_setEncoding_(UArray *self, CENCODING encoding) { |
| 216 | // ensure that size matches new encoding |
| 217 | |
| 218 | switch (encoding) { |
| 219 | case CENCODING_ASCII: |
| 220 | case CENCODING_UTF8: |
| 221 | UArray_setItemType_(self, CTYPE_uint8_t); |
| 222 | break; |
| 223 | case CENCODING_UCS2: |
| 224 | UArray_setItemType_(self, CTYPE_uint16_t); |
| 225 | break; |
| 226 | case CENCODING_UCS4: |
| 227 | UArray_setItemType_(self, CTYPE_uint32_t); |
| 228 | break; |
| 229 | case CENCODING_NUMBER: |
| 230 | // Don't change itemType when setting raw encoding. Raw encoding |
| 231 | // used for vectors and numbers and the item type may have been set |
| 232 | // before this call. |
| 233 | break; |
| 234 | } |
| 235 | |
| 236 | self->encoding = encoding; |
| 237 | } |
| 238 | |
| 239 | void UArray_convertToEncoding_(UArray *self, CENCODING encoding) { |
| 240 | switch (encoding) { |
no test coverage detected