NSSTring_RegEx: Add support for regular expressions to NSString
[GitX.git] / PBChangedFile.m
blob4cbeabbe328d53f06da99a9d4c3a181948561677
1 //
2 //  PBChangedFile.m
3 //  GitX
4 //
5 //  Created by Pieter de Bie on 22-09-08.
6 //  Copyright 2008 __MyCompanyName__. All rights reserved.
7 //
9 #import "PBChangedFile.h"
10 #import "PBEasyPipe.h"
12 @implementation PBChangedFile
14 @synthesize path, status, hasStagedChanges, hasUnstagedChanges, commitBlobSHA, commitBlobMode;
16 - (id) initWithPath:(NSString *)p
18         if (![super init])
19                 return nil;
21         path = p;
22         return self;
25 - (NSString *)indexInfo
27         if (!self.commitBlobSHA)
28                 return [NSString stringWithFormat:@"0 0000000000000000000000000000000000000000\t%@\0", self.path];
29         else
30                 return [NSString stringWithFormat:@"%@ %@\t%@\0", self.commitBlobMode, self.commitBlobSHA, self.path];
33 - (NSImage *) icon
35         NSString *filename;
36         switch (status) {
37                 case NEW:
38                         filename = @"new_file";
39                         break;
40                 case DELETED:
41                         filename = @"deleted_file";
42                         break;
43                 default:
44                         filename = @"empty_file";
45                         break;
46         }
47         NSString *p = [[NSBundle mainBundle] pathForResource:filename ofType:@"png"];
48         return [[NSImage alloc] initByReferencingFile: p];
51 + (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector
53         return NO;
56 + (BOOL)isKeyExcludedFromWebScript:(const char *)name {
57         return NO;
60 @end