Created using Text::to_nsstring
.
cocoa :: NSString :: defaultinit
cocoa :: NSString :: native_http_get
core :: Pointer :: address_is_null
Is the address behind this Object at NULL?core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
cocoa :: NSString :: defaultinit
cocoa :: NSObject :: defaultinit
core :: Object :: defaultinit
core :: Pointer :: defaultinit
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: native_class_name
The class name of the object in CString format.core :: Pointer :: native_equals
cocoa :: NSString :: native_http_get
core :: Object :: output_class_name
Display class name on stdout (debug only).core :: Pointer :: premultiply_alpha
Multiply RGB values by their alpha value
# String of the Foundation Kit
#
# Created using `Text::to_nsstring`.
extern class NSString in "ObjC" `{ NSString * `}
super NSObject
# Null pointer
new nil in "ObjC" `{ return nil; `}
# Get an UTF8 encoded `char*` copy of `self`
fun utf8_string: CString in "ObjC" `{ return (char *)[self UTF8String]; `}
redef fun to_s do return utf8_string.to_s
end
lib/cocoa/foundation.nit:28,1--41,3
redef class NSString
private fun native_open_in_browser
in "ObjC" `{
NSURL *nsurl = [NSURL URLWithString: self];
[[UIApplication sharedApplication] openURL: nsurl];
`}
end
lib/ios/ui/ui.nit:623,1--629,3
redef class NSString
private fun native_http_get(timeout: Float, error_ref: Ref[NSString]): NSData
import Ref[NSString].item= in "ObjC" `{
NSURL *url = [NSURL URLWithString:self];
NSURLRequest *request = [NSURLRequest requestWithURL:url
cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:timeout];
NSURLResponse *response = nil;
NSError *error = nil;
NSData *data = [NSURLConnection sendSynchronousRequest:request
returningResponse:&response error:&error];
if (data == nil) {
// Report error
Ref_of_NSString_item__assign(error_ref, [error localizedDescription]);
return nil;
}
return data;
`}
end
lib/ios/http_request.nit:49,1--70,3