Develop and Download Open Source Software

Browse CVS Repository

Annotation of /undmail/guiproto/LineTextFormatter.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Fri Feb 14 16:50:14 2003 UTC (21 years, 2 months ago) by footashida
Branch: MAIN
CVS Tags: HEAD
*** empty log message ***

1 footashida 1.1 #import "LineTextFormatter.h"
2    
3    
4     @implementation LineTextFormatter
5     -(NSAttributedString *)formatWithAttributedString:
6     (NSAttributedString *)attributedString{
7     NSString *string;
8     NSMutableAttributedString *ret;
9     NSRange lineRange;
10     NSRange stringRange;
11    
12     ret = [[[NSMutableAttributedString alloc] init] autorelease];
13     [ret appendAttributedString:attributedString];
14     string = [attributedString string];
15    
16     // patternが空文字列の場合はすべてに適用する。
17     string = [attributedString string];
18     if([_pattern isEqual:@""]){
19     [ret setAttributes:[self attributedDictionary]
20     range:NSMakeRange(0, [string length])];
21     return ret;
22     }
23     stringRange = NSMakeRange(0, [string length]);
24     while(stringRange.length > 0){
25     lineRange = [string lineRangeForRange:NSMakeRange(stringRange.location, 0)];
26     if([[string substringWithRange:lineRange] hasPrefix:_pattern]){
27     [ret setAttributes:[self attributedDictionary] range:lineRange];
28     }
29     stringRange.location = NSMaxRange(lineRange);
30     stringRange.length -= lineRange.length;
31     }
32     return ret;
33     }
34    
35     @end

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26