-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathViewStep.cs
103 lines (86 loc) · 2.12 KB
/
ViewStep.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
using System;
namespace Inversion.Process {
/// <summary>
/// Represents a step in a rendering view pipeline.
/// </summary>
/// <remarks>
/// A step can either have <see cref="Content"/> or
/// a <see cref="Model"/>, but not both.
/// </remarks>
public class ViewStep {
private readonly string _name;
private readonly string _contentType;
private readonly string _content;
private readonly IData _model;
/// <summary>
/// The human readable name of the step.
/// </summary>
public string Name {
get {
return _name;
}
}
/// <summary>
/// The content type of the <see cref="Content"/>
/// if there is any.
/// </summary>
public string ContentType {
get {
return _contentType;
}
}
/// <summary>
/// The content if any of the step.
/// </summary>
public string Content {
get {
return _content;
}
}
/// <summary>
/// The model if any of the step.
/// </summary>
public IData Model {
get {
return _model;
}
}
/// <summary>
/// Determines whether or not the step has any content.
/// </summary>
public bool HasContent {
get {
return !String.IsNullOrEmpty(this.Content);
}
}
/// <summary>
/// Determines whether or not the step has a model.
/// </summary>
public bool HasModel {
get {
return this.Model != null;
}
}
/// <summary>
/// Creates a new instance of a step with the parameters provided.
/// </summary>
/// <param name="name">Human readable name of the step.</param>
/// <param name="contentType">The type of the steps content.</param>
/// <param name="content">The actual content of the step.</param>
public ViewStep(string name, string contentType, string content) {
_name = name;
_contentType = contentType;
_content = content;
}
/// <summary>
/// Creates a new instance of a step with the parameters provided.
/// </summary>
/// <param name="name">The human readable name of the step.</param>
/// <param name="model">The actual model of the step.</param>
public ViewStep(string name, IData model) {
_name = name;
_contentType = "model";
_model = model;
}
}
}