DrawKit
Vector and illustration framework for Mac OS X
Instance Methods | Class Methods | Protected Attributes | List of all members
DKTextSubstitutor Class Reference

This objects abstracts the text substitution task used by text adornments, et. More...

Inheritance diagram for DKTextSubstitutor:
Inheritance graph
[legend]

Instance Methods

(NSArray *) - allKeys
 
(NSDictionary *) - attributes
 
(id- initWithAttributedString:
 
(id- initWithString:
 
(NSAttributedString *) - masterString
 
(NSString *) - metadataStringFromObject:
 
(void) - processMasterString
 
(void) - setAttributes:
 
(void) - setMasterString:
 
(void) - setString:withAttributes:
 
(NSString *) - string
 
(NSAttributedString *) - substitutedStringWithObject:
 
- Instance Methods inherited from NSObject
(NSString *) - address
 
(DKStyleRegistry *) - applicationWillReturnStyleRegistry
 
(BOOL- canBeUsedWithSelectionTool
 
(id- categoryManager:shouldReplaceObject:withObject:
 
(Class- classForCoder
 
(NSColor *) - colorValue
 
(NSColor *) - colourValue
 
(id- copy
 
(void) - dealloc
 
(id- deepCopy
 
(NSDictionary *) - dimensionValuesForArrowStroke:
 
(CGFloat- drawing:convertDistanceToExternalCoordinates:
 
(NSPoint) - drawing:convertLocationToExternalCoordinates:
 
(void) - drawing:didDrawRect:inView:
 
(void) - drawing:willDrawRect:inView:
 
(NSString *) - drawing:willReturnAbbreviationForUnit:
 
(NSString *) - drawing:willReturnFormattedCoordinateForDistance:
 
(CGFloat- drawingWillReturnUnitToPointsConversonFactor:
 
(void) - finalize
 
(NSString *) - hexString
 
(void) - hotspot:didEndTrackingWithEvent:inView:
 
(void) - hotspot:isTrackingWithEvent:inView:
 
(void) - hotspot:willBeginTrackingWithEvent:inView:
 
(NSData *) - imageData
 
(NSImage *) - imageResourceNamed:
 
(id- init
 
(id- initWithExpression:
 
(id- instantiateObjectWithShortName:parameters:
 
(BOOL- isLiteralValue
 
(void) - layoutManager:willPlaceGlyphAtIndex:atLocation:pathAngle:yOffset:
 
(void) - menuItem:wasAddedForObject:inCategory:
 
(BOOL- moveObjectTo:position:slope:userInfo:
 
(id- mutableCopy
 
(void) - oneShotComplete
 
(void) - oneShotHasReached:
 
(void) - oneShotWillBegin
 
(void) - path:elementIndex:type:points:subPathIndex:subPathClosed:contextInfo:
 
(id- placeLinkFromPoint:toPoint:onPath:linkNumber:userInfo:
 
(id- placeObjectAtPoint:onPath:position:slope:userInfo:
 
(NSPoint) - point
 
(NSPoint) - pointForTextLayout
 
(DKStyle *) - registry:shouldReplaceStyle:withStyle:
 
(NSBezierPath *) - renderer:willRenderPath:
 
(void) - routeFinder:progressHasReached:
 
(void) - setValue:forNumericParameter:
 
(NSString *) - stringValue
 
(CGFloat- taperFactorAtDistance:onPath:ofLength:
 
(void) - toolDidPerformUndoableAction:
 
(void) - toolWillPerformUndoableAction:
 
(NSURL *) - url
 
- Instance Methods inherited from <NSObject>
(NSString *) - description
 
(NSUInteger- hash
 
(BOOL- isEqual:
 
- Instance Methods inherited from <NSKeyValueBindingCreation>
(void) - bind:toObject:withKeyPath:options:
 
(NSArray *) - exposedBindings
 
(NSDictionary *) - infoForBinding:
 
(NSArray *) - optionDescriptionsForBinding:
 
(void) - unbind:
 
(Class- valueClassForBinding:
 
- Instance Methods inherited from <NSCoding>
(void) - encodeWithCoder:
 
(id- initWithCoder:
 

Class Methods

(NSString *) + delimiterString
 
(NSCharacterSet *) + keyBreakingCharacterSet
 
(void) + setDelimiterString:
 
- Class Methods inherited from NSObject
(id+ alloc
 
(Class+ class
 
(void) + initialize
 
(void) + load
 
(id+ new
 
- Class Methods inherited from <NSKeyValueBindingCreation>
(void) + exposeBinding:
 

Protected Attributes

NSMutableArraymKeys
 
NSAttributedStringmMasterString
 
BOOL mNeedsToEvaluate
 

Detailed Description

This objects abstracts the text substitution task used by text adornments, et.

Author
Contributions from the community; see CONTRIBUTORS.md
Date
2005-2015

This objects abstracts the text substitution task used by text adornments, et. al. It allows strings of the form:

"This is fixed text %%sub1 more fixed text %%sub2 and so on..."

Where %sub1 and %sub2 (where the word following %% represents a metadata key) are replaced by the metadata value keyed.

A non-property key can also have further flags, called subKeys. These are . delimited single character attributes which invoke specific behaviours. By default these are the digits 0-9 which extract the nth word from the original data, and the flags U, L and C which convert the data to upper, lower and capitalized strings respectively.

Method Documentation

- (NSArray*) allKeys
- (NSDictionary*) attributes
+ (NSString*) delimiterString
- (id) initWithAttributedString: (NSAttributedString *)  aString
- (id) initWithString: (NSString *)  aString
+ (NSCharacterSet*) keyBreakingCharacterSet
- (NSAttributedString*) masterString
- (NSString*) metadataStringFromObject: (id object
- (void) processMasterString
- (void) setAttributes: (NSDictionary *)  attrs
+ (void) setDelimiterString: (NSString *)  delim
- (void) setMasterString: (NSAttributedString *)  master
- (void) setString: (NSString *)  aString
withAttributes: (NSDictionary *)  attrs 
- (NSString*) string
- (NSAttributedString*) substitutedStringWithObject: (id anObject

Member Data Documentation

- (NSMutableArray*) mKeys
protected
- (NSAttributedString*) mMasterString
protected
- (BOOL) mNeedsToEvaluate
protected