Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 38 lines (29 sloc) 2.54 kb
82df2b2b »
2010-09-08 This is me flailing.
1 // TETextUtils.h
2 // TextExtras
3 //
4 // Copyright © 1996-2006, Mike Ferris.
5 // All rights reserved.
6
7 #import <Cocoa/Cocoa.h>
8
9 // Identifying paragraph boundaries
10 extern BOOL TE_IsParagraphSeparator(unichar uchar, NSString *str, unsigned index);
11 extern BOOL TE_IsHardLineBreakUnichar(unichar uchar, NSString *str, unsigned index);
12
13 // Space/Tab utilities
14 extern unsigned TE_numberOfLeadingSpacesFromRangeInString(NSString *string, NSRange *range, unsigned tabWidth);
15 extern NSString *TE_tabbifiedStringWithNumberOfSpaces(unsigned origNumSpaces, unsigned tabWidth, BOOL usesTabs);
16 extern NSArray *TE_tabStopArrayForFontAndTabWidth(NSFont *font, unsigned tabWidth);
17
18 extern NSRange TE_rangeOfLineWithLeadingWhiteSpace(NSString *string, NSRange startRange, unsigned leadingSpaces, NSComparisonResult matchStyle, BOOL backwardFlag, unsigned tabWidth);
19 // Starting at the given startRange in string, this function locates the next (or previous) line whose leading whitespace is either smaller than, equal to or greater than the given leadingSpaces. NSOrderedAscending means greater than, NSOrderedDescending means smaller than. Return value is the range of the line whose leading space staisfies the match.
20
21 // Nest/Unnest utilities
22 extern NSAttributedString *TE_attributedStringByIndentingParagraphs(NSAttributedString *origString, int levels, NSRange *selRange, NSDictionary *defaultAttrs, unsigned tabWidth, unsigned indentWidth, BOOL usesTabs);
23
24 // Brace matching utilities
25 extern unichar TE_matchingDelimiter(unichar delimiter);
26 extern BOOL TE_isOpeningBrace(unichar delimiter);
27 extern BOOL TE_isClosingBrace(unichar delimiter);
28 extern NSRange TE_findMatchingBraceForRangeInString(NSRange origRange, NSString *string);
29
30 // Variable substitution
31
32 extern unsigned TE_expandVariablesInString(NSMutableString *input, NSString *variableStart, NSString *variableEnd, id modalDelegate, SEL callbackSelector, void *context);
33 // Variable references must begin with variableStart and end with variableEnd. There's no support for "escaping" the end string.
34 // callbackSelector must have the following signature:
35 // - (NSString *)expansionForVariableName:(NSString *)name inputString:(NSString *)input variableNameRange:(NSRange)nameRange fullVariableRange:(NSRange)fullRange context:(void *)context;
36 // The return value of the callback is the replacement for the whole variable reference, or nil if the reference should be left unreplaced.
37 // The return value of the funtion is the number of variables found and replaced.
Something went wrong with that request. Please try again.