#ifndef PARADOX_STRING_H #define PARADOX_STRING_H #include #include #include #define PXStringFlagOwned 0x00010000 @interface PXString : PXObject { /* old declaration did not conform to the API or some shit */ /*char *_bytes; size_t _length;*/ /* flags. currently only low 2 bits are used for encoding * values: * 0. ASCII (utf-8 but 7bit chars) * 1. UTF-8 * 2. UTF-16 * 3. UTF-32 */ uint32_t flags; uint32_t len; // num of UTF-16 code units uint32_t size; // num of bytes uint32_t hash; char *_bytes; // as per ABI it's `const char * const _bytes;` when compiler-generated but too bad } /* init/lifecycle */ + (instancetype)stringWithCString:(const char *)cstring; - (instancetype)initWithCString:(const char *)cstring; /* getters */ - (const char *)UTF8String; - (uint32_t)length; - (BOOL)isEqual:(PXString *)string; @end #endif