Class: NSAttributedString
- Defined in:
- ext/accessibility/bridge/bridge.c,
ext/accessibility/bridge/bridge.c
Overview
A 90% drop-in replacement for Cocoa's NSAttributedString
class. The most likely
to use methods have been bridged. Remaining methods can be bridged upon request.
See Apple's Developer Reference for documentation on the methods available in this class.
Class Method Summary collapse
-
.alloc ⇒ Object
LOL, but required to be a drop-in replacement.
Instance Method Summary collapse
- #initWithString(, self) ⇒ Object
-
#isEqualToAttributedString(other) ⇒ Object
(also: #==)
rb_define_method(rb_cAttributedString, "attributesAtIndex", rb_astring_attrs_at_index, -1);.
- #length ⇒ Object
-
#string ⇒ Object
(also: #to_s, #to_str)
rb_define_method(rb_cAttributedString, "initWithAttributedString", rb_astring_init_with_astring, 2);.
Class Method Details
.alloc ⇒ Object
LOL, but required to be a drop-in replacement
324 325 326 327 328 329 |
# File 'ext/accessibility/bridge/bridge.c', line 324
static
VALUE
rb_astring_alloc(const VALUE self)
{
return wrap_nsattributed_string([NSAttributedString alloc]);
}
|
Instance Method Details
#initWithString(, self) ⇒ Object
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
# File 'ext/accessibility/bridge/bridge.c', line 331
static
VALUE
rb_astring_init_with_string(const int argc, VALUE* const argv, const VALUE self)
{
if (!argc)
rb_raise(rb_eArgError, "wrong number of arguments (0 for 1+)");
NSString* const nsstring =
unwrap_nsstring(argv[0]);
NSAttributedString* const old_astring =
unwrap_nsattributed_string(self);
NSAttributedString* const new_astring =
[old_astring initWithString:nsstring];
[nsstring release];
if (old_astring == new_astring)
return self;
return wrap_nsattributed_string(new_astring);
}
|
#isEqualToAttributedString(other) ⇒ Object Also known as: ==
rb_define_method(rb_cAttributedString, "attributesAtIndex", rb_astring_attrs_at_index, -1);
367 368 369 370 371 372 |
# File 'ext/accessibility/bridge/bridge.c', line 367
static
VALUE
rb_astring_equality(const VALUE self, const VALUE other)
{
OBJC_EQUALITY(rb_cAttributedString, unwrap_nsattributed_string);
}
|
#length ⇒ Object
360 361 362 363 364 365 |
# File 'ext/accessibility/bridge/bridge.c', line 360
static
VALUE
rb_astring_length(const VALUE self)
{
return ULONG2NUM([unwrap_nsattributed_string(self) length]);
}
|
#string ⇒ Object Also known as: to_s, to_str
rb_define_method(rb_cAttributedString, "initWithAttributedString", rb_astring_init_with_astring, 2);
351 352 353 354 355 356 357 358 |
# File 'ext/accessibility/bridge/bridge.c', line 351
static
VALUE
rb_astring_string(const VALUE self)
{
NSString* const string = [unwrap_nsattributed_string(self) string];
const VALUE rb_str = wrap_nsstring(string);
return rb_str;
}
|