blob: 1cbc53fad580187cab9fa23b6fda8bd902817227 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#ifndef PARADOX_STRING_H
#define PARADOX_STRING_H
#include <objc/objc.h>
#include <objc/runtime.h>
#include <Paradox/Object.h>
#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
|