-
Notifications
You must be signed in to change notification settings - Fork 6
/
PBXFileReference.cs
executable file
·147 lines (134 loc) · 5.1 KB
/
PBXFileReference.cs
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
//
// This file is part of Monobjc, a .NET/Objective-C bridge
// Copyright (C) 2007-2014 - Laurent Etiemble
//
// Monobjc is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// Monobjc is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Monobjc. If not, see <http://www.gnu.org/licenses/>.
//
using System;
using System.Collections.Generic;
using System.IO;
using Monobjc.Tools.Utilities;
namespace Monobjc.Tools.Xcode
{
public class PBXFileReference : PBXFileElement
{
/// <summary>
/// Initializes a new instance of the <see cref = "PBXFileReference" /> class.
/// </summary>
public PBXFileReference()
{
this.IncludeInIndex = 1;
}
/// <summary>
/// Initializes a new instance of the <see cref = "PBXFileReference" /> class.
/// </summary>
/// <param name = "name">The name.</param>
public PBXFileReference(string name) : base(name)
{
this.IncludeInIndex = 1;
}
/// <summary>
/// Gets or sets the file encoding.
/// </summary>
/// <value>The file encoding.</value>
public PBXFileEncoding FileEncoding { get; set; }
/// <summary>
/// Gets or sets the type of the explicit file.
/// </summary>
/// <value>The type of the explicit file.</value>
public PBXFileType ExplicitFileType { get; set; }
/// <summary>
/// Gets or sets if the file is included in the index.
/// </summary>
/// <value>If the file is included in the index.</value>
public int IncludeInIndex { get; set; }
/// <summary>
/// Gets or sets the last type of the known file.
/// </summary>
/// <value>The last type of the known file.</value>
public PBXFileType LastKnownFileType { get; set; }
/// <summary>
/// Gets or sets the line ending.
/// </summary>
/// <value>The line ending.</value>
public PBXLineEnding LineEnding { get; set; }
/// <summary>
/// Gets or sets the path.
/// </summary>
/// <value>The path.</value>
public String Path { get; set; }
/// <summary>
/// Gets or sets the source tree.
/// </summary>
/// <value>The source tree.</value>
public PBXSourceTree SourceTree { get; set; }
/// <summary>
/// Gets the elemnt's nature.
/// </summary>
/// <value>The nature.</value>
public override PBXElementType Nature
{
get { return PBXElementType.PBXFileReference; }
}
/// <summary>
/// Gets the description.
/// </summary>
/// <value>The description.</value>
public override string Description
{
get { return String.IsNullOrEmpty(this.Name) ? this.Path : this.Name; }
}
/// <summary>
/// Accepts the specified visitor.
/// </summary>
/// <param name = "visitor">The visitor.</param>
public override void Accept(IPBXVisitor visitor)
{
visitor.Visit(this);
}
/// <summary>
/// Writes this element to the writer.
/// </summary>
/// <param name = "writer">The writer.</param>
/// <param name = "map">The map.</param>
public override void WriteTo(ProjectWriter writer, IDictionary<IPBXElement, string> map)
{
writer.WritePBXElementPrologue(2, map, this, true);
if (this.FileEncoding != PBXFileEncoding.Default)
{
writer.WritePBXProperty(3, map, "fileEncoding", (int) this.FileEncoding, true);
}
if (this.ExplicitFileType != PBXFileType.None)
{
writer.WritePBXProperty(3, map, "explicitFileType", this.ExplicitFileType.ToDescription(), true);
}
if (this.IncludeInIndex != 1)
{
writer.WritePBXProperty(3, map, "includeInIndex", this.IncludeInIndex, true);
}
if (this.LastKnownFileType != PBXFileType.None)
{
writer.WritePBXProperty(3, map, "lastKnownFileType", this.LastKnownFileType.ToDescription(), true);
}
if (this.LineEnding != PBXLineEnding.Unix)
{
writer.WritePBXProperty(3, map, "lineEnding", (int) this.LineEnding, true);
}
writer.WritePBXProperty(3, map, "name", this.Name, true);
writer.WritePBXProperty(3, map, "path", this.Path, true);
writer.WritePBXProperty(3, map, "sourceTree", this.SourceTree.ToDescription(), true);
writer.WritePBXElementEpilogue(2);
}
}
}