A mutable character string with attributes. More...
#import <CPAttributedString.h>
Additional Inherited Members | |
Class Methods inherited from CPObject | |
(BOOL) | + accessInstanceVariablesDirectly |
(id) | + alloc |
(id) | + allocWithCoder: |
(BOOL) | + automaticallyNotifiesObserversForKey: |
(void) | + cancelPreviousPerformRequestsWithTarget: |
(void) | + cancelPreviousPerformRequestsWithTarget:selector:object: |
(Class) | + class |
(BOOL) | + conformsToProtocol: |
(void) | + exposeBinding: |
(void) | + initialize |
(IMP) | + instanceMethodForSelector: |
(BOOL) | + instancesImplementSelector: |
(BOOL) | + instancesRespondToSelector: |
(BOOL) | + isBindingExclusive: |
(BOOL) | + isSubclassOfClass: |
(CPSet) | + keyPathsForValuesAffectingValueForKey: |
(void) | + load |
(id) | + new |
(void) | + object:performSelector:withObject:afterDelay:inModes: |
(void) | + setVersion: |
(Class) | + superclass |
(int) | + version |
A mutable character string with attributes.
A character string with sets of attributes that apply to single or ranges of characters. The attributes are contained within a CPDictionary class. Attributes can be any name/value pair. The data type of the value is not restricted. This class is mutable.
Definition at line 2 of file CPAttributedString.h.
|
implementation |
Add an attribute with the given name and value to the specified character range.
-setAttributes
:range:. anAttribute | a CPString of the attribute name. |
aValue | a value to assign to the attribute. Can be of any type. |
aRange | a CPRange indicating the range of characters to add the attribute too. |
Definition at line 658 of file CPAttributedString.j.
|
implementation |
Add a collection of attributes to the specified character range.
-setAttributes
:range:. aDictionary | a CPDictionary of attributes (names and values) to add. |
aRange | a CPRange indicating the range of characters to add the attributes to. |
Reimplemented in CPTextStorage.
Definition at line 622 of file CPAttributedString.j.
|
implementation |
Append an attributed string (characters and attributes) on to the end of the receiver.
aString | a CPAttributedString to append. |
Definition at line 691 of file CPAttributedString.j.
|
implementation |
Returns the specified named attribute for the given character index and, if required, the range over which the attribute applies.
-attribute
:atIndex:longestEffectiveRange:inRange: instead but note that it may take significantly longer to execute. attribute | the name of the desired attribute. |
anIndex | is an unsigned integer character index from which to retrieve the attribute. It must lie within the bounds of the string. |
aRange | is a reference to a CPRange object, that is set upon return to the range over which the named attribute applies. If not required pass nil . |
nil
is the attribute does not exist. Definition at line 291 of file CPAttributedString.j.
|
implementation |
Returns the specified named attribute for the given character index and the range over which the attribute applies. This is the maximum range both forwards and backwards in the string over which the attribute applies, bounded in both directions by the range limit parameter, rangeLimit
.
rangeLimit
to limit the search space or use -attribute
:atIndex:effectiveRange: but note that it is not guaranteed to return the full range of the current character's named attribute. attribute | the name of the desired attribute. |
anIndex | is an unsigned integer character index from which to retrieve the attribute. It must lie within the bounds of the string. |
aRange | is a reference to a CPRange object, that is set upon return to the range over which the named attribute applies. |
rangeLimit | a range limiting the search for the attribute's applicable range. |
nil
is the attribute does not exist. Definition at line 328 of file CPAttributedString.j.
|
implementation |
Extracts a substring from the receiver, both characters and attributes, within the range given by aRange
.
aRange | the range of the substring to extract. |
CPRangeException | if the range lies outside the receiver's bounds. |
Reimplemented in CPTextStorage.
Definition at line 451 of file CPAttributedString.j.
|
implementation |
Returns a dictionary of attributes for the character at a given index. The range in which this character resides in which the attributes are the same, can be returned if desired.
attributesAtIndex:longestEffectiveRange:inRange:
instead. Note however that it may take significantly longer to execute. anIndex | is an unsigned integer index. It must lie within the bounds of the string. |
aRange | is a reference to a CPRange object that is set (upon return) to the range over which the attributes are the same as those at index, anIndex . If not required pass nil . |
anIndex
. Returns an empty dictionary if index is out of bounds. Definition at line 175 of file CPAttributedString.j.
|
implementation |
Returns a dictionary of all attributes for the character at a given index and, by reference, the range over which the attributes apply. This is the maximum range both forwards and backwards in the string over which the attributes apply, bounded in both directions by the range limit parameter, rangeLimit
.
rangeLimit
to limit the search space or use -attributesAtIndex
:effectiveRange: but note that it is not guaranteed to return the full range of the current character's attributes. anIndex | is the unsigned integer index. It must lie within the bounds of the string. |
aRange | is a reference to a CPRange object that is set (upon return) to the range over which the attributes apply. |
rangeLimit | a range limiting the search for the attributes' applicable range. |
anIndex
. Returns an empty dictionary if index is out of bounds. Definition at line 215 of file CPAttributedString.j.
|
implementation |
This function is deliberately empty. It is provided to ease code converting from Cocoa.
Reimplemented in CPTextStorage.
Definition at line 813 of file CPAttributedString.j.
|
implementation |
Deletes a range of characters and their associated attributes.
aRange | a CPRange indicating the range of characters to delete. |
Reimplemented in CPTextStorage.
Definition at line 576 of file CPAttributedString.j.
|
implementation |
Reimplemented in CPTextStorage.
Provided by category CPAttributedString(CPCoding).
Definition at line 854 of file CPAttributedString.j.
|
implementation |
This function is deliberately empty. It is provided to ease code converting from Cocoa.
Reimplemented in CPTextStorage.
Definition at line 822 of file CPAttributedString.j.
|
implementation |
Creates an empty attributed string.
Reimplemented from CPObject.
Reimplemented in CPTextStorage.
Definition at line 50 of file CPAttributedString.j.
|
implementation |
Creates a new attributed string from an existing attributed string.
aString | is the attributed string to initialise from. |
aString
. Definition at line 70 of file CPAttributedString.j.
|
implementation |
Reimplemented in CPTextStorage.
Provided by category CPAttributedString(CPCoding).
Definition at line 835 of file CPAttributedString.j.
|
implementation |
Creates a new attributed string from a character string.
aString | is the string to initialise from. |
aString
. Reimplemented in CPTextStorage.
Definition at line 60 of file CPAttributedString.j.
|
implementation |
Creates a new attributed string from a character string and the specified dictionary of attributes.
aString | is the attributed string to initialise from. |
attributes | is a dictionary of string attributes. |
aString
with associated attributes, attributes
. Reimplemented in CPTextStorage.
Definition at line 87 of file CPAttributedString.j.
|
implementation |
Inserts an attributed string (characters and attributes) at index, anIndex
, into the receiver. The portion of the receiver's attributed string from the specified index to the end is shifted until after the inserted string.
aString | a CPAttributedString to insert. |
anIndex | the index at which the insert is to occur. |
CPRangeException | If the index is out of bounds. |
Definition at line 705 of file CPAttributedString.j.
|
implementation |
Determine whether the given object is the same as the receiver. If the specified object is an attributed string then an attributed string compare is performed.
anObject | an object to test for equality. |
Reimplemented from CPObject.
Definition at line 432 of file CPAttributedString.j.
|
implementation |
Compares the receiver's characters and attributes to the specified attributed string, aString
, and tests for equality.
aString | the CPAttributedString to compare. |
Definition at line 395 of file CPAttributedString.j.
|
implementation |
Get the length of the string.
Definition at line 129 of file CPAttributedString.j.
|
implementation |
Returns a string containing the receiver's character data without attributes.
Definition at line 119 of file CPAttributedString.j.
|
implementation |
Remove a named attribute from a character range.
anAttribute | a CPString specifying the name of the attribute. |
aRange | a CPRange indicating the range of character from which the attribute will be removed. |
Reimplemented in CPTextStorage.
Definition at line 669 of file CPAttributedString.j.
|
implementation |
Replaces characters and attributes in the range aRange
with those of the given attributed string, aString
.
aRange | a CPRange object specifying the range of characters and attributes in the object to replace. |
aString | a CPAttributedString containing the data to be used for replacement. |
Reimplemented in CPTextStorage.
Definition at line 745 of file CPAttributedString.j.
|
implementation |
Replaces the characters in the receiver with those of the specified string over the range, aRange
. If the range has a length of 0 then the specified string is inserted at the range location. The new characters inherit the attributes of the first character in the range that they replace or in the case if a 0 range length, the first character before of after the insert (after if the insert is at location 0).
aString
is inserted and thus the receiver's length changes to match this aRange | the range of characters to replace. |
aString | the string to replace the specified characters in the receiver. |
Reimplemented in CPTextStorage.
Definition at line 517 of file CPAttributedString.j.
|
implementation |
Sets the objects characters and attributes to those of aString
.
aString | is a CPAttributedString from which the contents will be copied. |
Definition at line 756 of file CPAttributedString.j.
|
implementation |
Sets the attributes of the specified character range.
-addAttributes
:range:. aDictionary | a CPDictionary of attributes (names and values) to set to. |
aRange | a CPRange indicating the range of characters to set their associated attributes to aDictionary . |
Definition at line 593 of file CPAttributedString.j.
|
implementation |
Returns a string containing the receiver's character data without attributes.
Definition at line 109 of file CPAttributedString.j.