forked from appsquickly/XcodeEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXCSourceFileDefinition.m
More file actions
85 lines (66 loc) · 2.33 KB
/
XCSourceFileDefinition.m
File metadata and controls
85 lines (66 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
////////////////////////////////////////////////////////////////////////////////
//
// JASPER BLUES
// Copyright 2012 Jasper Blues
// All Rights Reserved.
//
// NOTICE: Jasper Blues permits you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
#import "XCSourceFileDefinition.h"
@implementation XCSourceFileDefinition
@synthesize sourceFileName = _sourceFileName;
@synthesize type = _type;
@synthesize data = _data;
/* ====================================================================================================================================== */
#pragma mark - Class Methods
+ (XCSourceFileDefinition*)sourceDefinitionWithName:(NSString*)name text:(NSString*)text type:(XcodeSourceFileType)type
{
return [[XCSourceFileDefinition alloc] initWithName:name text:text type:type];
}
+ (XCSourceFileDefinition*)sourceDefinitionWithName:(NSString*)name data:(NSData*)data type:(XcodeSourceFileType)type
{
return [[XCSourceFileDefinition alloc] initWithName:name data:data type:type];
}
+ (XCSourceFileDefinition*)sourceDefinitionWithAssetCatalogName:(NSString*)name
{
XCSourceFileDefinition *definition = [[XCSourceFileDefinition alloc] initWithName:name type:AssetCatalog];
definition.fileOperationType = XCFileOperationTypeAcceptExisting;
return definition;
}
/* ====================================================================================================================================== */
#pragma mark - Initialization & Destruction
- (id)initWithName:(NSString*)name text:(NSString*)text type:(XcodeSourceFileType)type
{
self = [super init];
if (self)
{
_sourceFileName = [name copy];
_data = [[text dataUsingEncoding:NSUTF8StringEncoding] copy];
_type = type;
}
return self;
}
- (id)initWithName:(NSString*)name data:(NSData*)data type:(XcodeSourceFileType)type
{
self = [super init];
if (self)
{
_sourceFileName = [name copy];
_data = [data copy];
_type = type;
}
return self;
}
- (id)initWithName:(NSString*)name type:(XcodeSourceFileType)type
{
self = [super init];
if (self)
{
_sourceFileName = [name copy];
_type = type;
}
return self;
}
@end