|
octext Specification SheetPortable Object Compiler (c) 1997,98,99. All Rights Reserved.
TextInherits from: ObjectMaturity Index: Experimental
Class DescriptionThe Text class associates to a String instance a RunArray. The runs for a string, consist of string segments that have the same text attributes, such as font, boldface, fontsize etc.
Method typesCreationComparisonAccessing
EmphasisFormat ConversionsPrintingMethodsnew+newCreates an instance whose value is set to the empty string.
new:+new:(unsigned)nCharsCreates an instance whose value is set to the empty string, can hold at least nChars without having to expand.
str:+str:(STR)aStringCreates an instance whose value is set to a copy of aString. If aString is NULL, creates an instance whose value is set to the empty string.
sprintf:+sprintf:(STR)format,...Returns a new instace initialized just as the standard C library sprintf(). See the documentation on sprintf() for the formats and variable declarations.
fromString:+fromString:aStringCreates an instance whose value is set to aString.
string:attribute:+string:aStringattribute:attribCreates an instance whose value is set to aString and then sends itself an addAttribute: message.
copy-copyReturns a copy of the receiver with its internal C string copied as well.
free-freeFrees the receiver and its internal C string as well.
hash- (unsigned)hashReturns a hash value based upon the contents of the string held in the receiver.
isEqual:- (BOOL)isEqual:aStrReturns YES if the string and runarray contained by aStr is equal to the contents of the receiver.
string-stringReturns the String instance for this Text object.
runs-runsReturns the RunArray instance for this Text object.
str- (STR)strReturns a pointer to the NULL-terminated C string stored in the receiver.
size- (unsigned)sizeReturns the size of the String instance for this Text object. The following all return the same value :
[text size]; [[text string] size]; [[text runs] size]; charAt:- (char)charAt:(unsigned)anOffsetReturns the character at anOffset or zero if anOffset is greater than the length of the C string.
charAt:put:- (char)charAt:(unsigned)anOffsetput:(char)aCharReplaces the character at anOffset with aChar and returns the old character which was in that location. Returns zero if anOffset is greater than the length of the C string.
at:insert:-at:(unsigned)anOffsetinsert:aString at:insert:count:-at:(unsigned)anOffsetinsert:(char*)aStringcount:(int)size deleteFrom:to:-deleteFrom:(unsigned)pto:(unsigned)q concat:-concat:b concatSTR:-concatSTR:(STR)b allBold-allBoldThis message is equivalent to,
Returns self (the text object).[self makeBoldFrom:0 to:[self size] - 1].
makeBoldFrom:to:-makeBoldFrom:(unsigned)pto:(unsigned)qAdds a boldface TextAttribute for the characters from index p to q (including the characters at offset p and q). A boldface attribute has emphasiscode equal to 1.
addAttribute:-addAttribute:attributeThis message is equivalent to,
Returns self (the text object).[self addAttribute:attribute from:0 to:[self size] - 1].
addAttribute:from:to:-addAttribute:attributefrom:(unsigned)pto:(unsigned)qAdds attribute to the string segments between p and q.
attributesAt:-attributesAt:(unsigned)iReturns an OrdCltn of TextAttribute instances for the character at index i.
runLengthFor:- (unsigned)runLengthFor:(unsigned)iReturns the number of remaining characters in the string segment to which the character at position i belongs. If i is the first character of a run, this method returns the size of the run. Otherwise it returns the size minus the index of character in the run.
asString-asStringEquivalent to string.
asText-asTextReturns the object itself.
asParagraph-asParagraphReturns a paragraph for this text object.
printOn:-printOn:(IOD)aFilePrints the Text for the string contained by this instance. Returns the receiver.
|