📄 codegraph.cs
字号:
public override GraphTypes GraphType{get{return GraphTypes.ExprStmt;}}
#region Expression
private Expression p_expression;
/// <summary>
/// Gets or sets the expression this statement encapsulates.
/// </summary>
[CodeElement]
public Expression Expression
{
get
{
return p_expression;
}
set
{
p_expression = value;
}
}
#endregion
}
#endregion
#region CommentStmt
/// <summary>
/// A normal comment.
/// </summary>
public class CommentStmt : Statement
{
/// <exclude/>
public override GraphTypes GraphType{get{return GraphTypes.CommentStmt;}}
#region Comment
private Comment p_comment = new Comment();
/// <summary>
/// Gets or sets the comment string.
/// </summary>
[CodeElement]
public Comment Comment
{
get
{
return p_comment;
}
set
{
p_comment = value;
}
}
#endregion
}
#endregion
#region VariableDeclStmt
/// <summary>
/// A variable declaration statement.
/// </summary>
public class VariableDeclStmt : Statement
{
/// <exclude/>
public override GraphTypes GraphType{get{return GraphTypes.VariableDeclStmt;}}
#region Delcarators
private DeclaratorCollection p_declarators = new DeclaratorCollection();
/// <summary>
/// Gets the collection of declarators created. Variable declarations can declare multiple variables at once, so this must be a collection.
/// </summary>
[CodeCollection]
public DeclaratorCollection Delcarators
{
get
{
return p_declarators;
}
}
#endregion
#region Type
private TypeRef p_type;
/// <summary>
/// Gets or sets the type of the variable. While one can declare multiple variables they must be of the same type - therefore this is not a collection.
/// </summary>
[CodeElement]
public TypeRef Type
{
get
{
return p_type;
}
set
{
p_type = value;
}
}
#endregion
#region DimensionCount
private int p_dimensions = 0;
/// <summary>
/// Gets or sets the number of dimensions if this is an array. Zero dimensions indicates this is not an array. The dimensions are represented by commas in C#, like [,,].
/// </summary>
[CodeElement]
public int DimensionCount
{
get
{
return p_dimensions;
}
set
{
p_dimensions = value;
}
}
#endregion
}
#endregion
#region ConstantDeclStmt
/// <summary>
/// A constant declaration statement.
/// </summary>
public class ConstantDeclStmt : Statement
{
/// <exclude/>
public override GraphTypes GraphType{get{return GraphTypes.ConstantDeclStmt;}}
#region Delcarators
private DeclaratorCollection p_declarators = new DeclaratorCollection();
/// <summary>
/// Gets the collection of declarators created. Constant declarations can declare multiple variables at once, so this must be a collection.
/// </summary>
[CodeCollection]
public DeclaratorCollection Delcarators
{
get
{
return p_declarators;
}
}
#endregion
#region Type
private TypeRef p_type;
/// <summary>
/// Gets or sets the type of the constant. While one can declare multiple constant variables they must be of the same type - therefore this is not a collection.
/// </summary>
[CodeElement]
public TypeRef Type
{
get
{
return p_type;
}
set
{
p_type = value;
}
}
#endregion
}
#endregion
#region IfStmt
/// <summary>
/// An if (conditional) statement.
/// </summary>
public class IfStmt : Statement
{
/// <exclude/>
public override GraphTypes GraphType{get{return GraphTypes.IfStmt;}}
#region Condition
private Expression p_condition;
/// <summary>
/// Gets or sets the condition to be tested.
/// </summary>
[CodeElement]
public Expression Condition
{
get
{
return p_condition;
}
set
{
p_condition = value;
}
}
#endregion
#region TrueStatements
private StatementCollection p_trueStatements = new StatementCollection();
/// <summary>
/// Gets or sets the statements to be executed if the condition is true.
/// </summary>
[CodeCollection]
public StatementCollection TrueStatements
{
get
{
return p_trueStatements;
}
}
#endregion
#region FalseStatements
private StatementCollection p_falseStatements = new StatementCollection();
/// <summary>
/// Gets or sets the statements to be executed if the condition is false.
/// </summary>
[CodeCollection]
public StatementCollection FalseStatements
{
get
{
return p_falseStatements;
}
}
#endregion
}
#endregion
#region SwitchStmt
/// <summary>
/// A switch statement.
/// </summary>
public class SwitchStmt : Statement
{
/// <exclude/>
public override GraphTypes GraphType{get{return GraphTypes.SwitchStmt;}}
#region Condition
private Expression p_condition;
/// <summary>
/// Gets or sets the switch condition to be tested.
/// </summary>
[CodeElement]
public Expression Condition
{
get
{
return p_condition;
}
set
{
p_condition = value;
}
}
#endregion
#region Cases
private CaseCollection p_cases = new CaseCollection();
/// <summary>
/// Gets a collection of cases that will be called based on the condition.
/// </summary>
[CodeCollection]
public CaseCollection Cases
{
get
{
return p_cases;
}
}
#endregion
}
#endregion
#region Case
/// <summary>
/// A case clause for a switch statement.
/// </summary>
public class Case : CSharpGraph
{
/// <exclude/>
public override GraphTypes GraphType{get{return GraphTypes.Case;}}
#region IsDefault
private bool p_default = false;
/// <summary>
/// Gets or sets the flag that indicates whether or not this is a 'default' case.
/// </summary>
[CodeElement]
public bool IsDefault
{
get
{
return p_default;
}
set
{
p_default = value;
}
}
#endregion
#region Condition
private Expression p_condition;
/// <summary>
/// Gets or sets the expression that the switch condition will be compared to.
/// </summary>
[CodeElement]
public Expression Condition
{
get
{
return p_condition;
}
set
{
p_condition = value;
}
}
#endregion
#region Statements
private StatementCollection p_statements = new StatementCollection();
/// <summary>
/// Gets the collection of statements in the case clause. This must include a break statement.
/// </summary>
[CodeCollection]
public StatementCollection Statements
{
get
{
return p_statements;
}
}
#endregion
#region Text
/// <exclude/>
public override string Text
{
get
{
return this.GetType().Name;
}
}
#endregion
}
#endregion
#region IterationStmt
/// <summary>
/// A loop construct. This can be a for, do or while loop, however foreach loops are treated separately (as a ForEachStmt).
/// </summary>
public class IterationStmt : Statement
{
/// <exclude/>
public override GraphTypes GraphType{get{return GraphTypes.IterationStmt;}}
#region IterationType
private IterationType p_iType = IterationType.While;
/// <summary>
/// Gets or sets the type of iteration (for, while, do). This is mostly useful when rebuilding code.
/// </summary>
[CodeElement]
public IterationType IterationType
{
get
{
return p_iType;
}
set
{
p_iType = value;
}
}
#endregion
#region TestFirst
/// <summary>
/// Gets or sets a flag that specifies the test happens at the start of a loop, like in a 'while' loop. 'For' and 'do' loops test at the end of the loop.
/// </summary>
[CodeElement]
public bool TestFirst
{
get
{
if(p_iType == IterationType.Do) return false;
return true;
}
}
#endregion
#region Init
private StatementCollection p_init = new StatementCollection();
/// <summary>
/// Gets a collection of statements that initalize the loop.
/// </summary>
[CodeCollection]
public StatementCollection Init
{
get
{
return p_init;
}
}
#endregion
#region Test
private Expression p_test;
/// <summary>
/// Gets or sets the test condition that determines if the loop will be terminated.
/// </summary>
[CodeElement]
public Expression Test
{
get
{
return p_test;
}
set
{
p_test = value;
}
}
#endregion
#region Increment
private StatementCollection p_increment = new StatementCollection();
/// <summary>
/// Gets a collection of statements that increments the loop.
/// </summary>
[CodeCollection]
public StatementCollection Increment
{
get
{
return p_increment;
}
}
#endregion
#region Statements
private StatementCollection p_statements = new StatementCollection();
/// <summary>
/// Gets the collection of statements that will be looped over.
/// </summary>
[CodeCollection]
public StatementCollection Statements
{
get
{
return p_statements;
}
}
#endregion
}
#endregion
#region ForEachStmt
/// <summary>
/// A foreach statement that enumerates over a collection.
/// </summary>
public class ForEachStmt : Statement
{
/// <exclude/>
public override GraphTypes GraphType{get{return GraphTypes.ForEachStmt;}}
#region IterationType
/// <summary>
/// Gets the type of iteration statement. This will always be 'IterationType.ForEach'.
/// </summary>
[CodeElement]
public IterationType IterationType
{
get
{
return IterationType.ForEach;
}
}
#endregion
#region Name
private string p_Name = "";
/// <summary>
/// Gets or sets the name of the variable that holds the current enumeration value.
/// </summary>
[CodeElement]
public string Name
{
get
{
return p_Name;
}
set
{
p_Name = value;
}
}
#endregion
#region Type
private TypeRef p_type;
/// <summary>
/// Gets or sets the type of the object to be found in the collection.
/// </summary>
[CodeElement]
public TypeRef Type
{
get
{
return p_type;
}
set
{
p_type = value;
}
}
#endregion
#region Collection
private Expression p_collection;
/// <summary>
/// Gets the collection that will be searched.
/// </summary>
[CodeElement]
public Expression Collection
{
get
{
return p_collection;
}
set
{
p_collection = value;
}
}
#endregion
#region Statements
private StatementCollection p_statements = new StatementCollection();
/// <summary>
/// Gets the collection of statements in the loop.
/// </summary>
[CodeCollection]
public StatementCollection Statements
{
get
{
return p_statements;
}
}
#endregion
}
#endregion
#region GotoStmt
/// <summary>
/// A goto statement, jumps to a label or a case clause.
/// </summary>
public class GotoStmt : Statement
{
/// <exclude/>
public override GraphTypes GraphType{get{return GraphTypes.GotoStmt;}}
#region Label
private string p_label = "";
/// <summary>
/// Gets or sets the label to jump to. If this jumps between cases, the label will be 'case' or 'default'.
/// </summary>
[CodeElement]
public string Label
{
get
{
return p_label;
}
set
{
p_label = value;
}
}
#endregion
#region CaseLabel
private Expression p_caseLabel;
/// <summary>
/// Gets or sets the case statement to jump to if this is inside a switch statement. The label holds the word 'case', so this is just the expression part.
/// </summary>
[CodeElement]
public Expression CaseLabel
{
get
{
return p_caseLabel;
}
set
{
p_caseLabel = value;
}
}
#endregion
}
#endregion
#region LabeledStmt
/// <summary>
/// A labeled statement that can be jumped to with a goto statement.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -