-
Notifications
You must be signed in to change notification settings - Fork 0
/
text.h
47 lines (36 loc) · 1.82 KB
/
text.h
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
41
42
43
44
45
46
47
#pragma once
#define get_objectFromUserdata(objType, L, idx, tag) (objType*)*((void**)luaL_checkudata(L, idx, tag))
static const char * const USERDATA_TAG = "hs.text" ;
static const char * const UTF16_UD_TAG = "hs.text.utf16" ;
static const char * const HTTP_UD_TAG = "hs.text.http" ;
static const char * const REGEX_UD_TAG = "hs.text.regex" ;
extern int luaopen_hs_text_utf16(lua_State *L) ;
extern int luaopen_hs_text_http(lua_State *L) ;
extern int luaopen_hs_text_regex(lua_State *L) ;
@interface HSTextObject : NSObject
@property NSData *contents ;
@property int selfRefCount ;
@property NSStringEncoding encoding ;
- (instancetype)init:(NSData *)data withEncoding:(NSStringEncoding)encoding ;
@end
@interface HSTextUTF16Object : NSObject
@property NSString *utf16string ;
@property int selfRefCount ;
- (instancetype)initWithString:(NSString *)string ;
@end
// Definition of the collection delegate to receive callbacks from NSUrlConnection
@interface HSTextHTTPDelegate : NSObject<NSURLConnectionDelegate, NSURLConnectionDataDelegate>
@property lua_State* L;
@property int fn;
@property(nonatomic, retain) NSMutableData* receivedData;
@property(nonatomic, retain) NSHTTPURLResponse* httpResponse;
@property(nonatomic, retain) NSURLConnection* connection;
- (void)connection:(NSURLConnection * __unused)connection didReceiveResponse:(NSURLResponse *)response ;
- (void)connection:(NSURLConnection * __unused)connection didReceiveData:(NSData *)data ;
- (void)connectionDidFinishLoading:(NSURLConnection * __unused)connection ;
- (void)connection:(NSURLConnection * __unused)connection didFailWithError:(NSError *)error ;
@end
@interface HSRegularExpression : NSRegularExpression
@property int selfRefCount ;
- (instancetype)initWithPattern:(NSString *)pattern options:(NSRegularExpressionOptions)options ;
@end