-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCsParameterDefaultValue.cs
More file actions
73 lines (65 loc) · 3.75 KB
/
CsParameterDefaultValue.cs
File metadata and controls
73 lines (65 loc) · 3.75 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
//*****************************************************************************
//* Code Factory SDK
//* Copyright (c) 2020-2022 CodeFactory, LLC
//*****************************************************************************
using System.Collections.Generic;
using CodeFactory.SourceCode;
namespace CodeFactory.DotNet.CSharp
{
/// <summary>
/// Data model that represents the default value for a parameter.
/// </summary>
public abstract class CsParameterDefaultValue:CsModel,ICsParameterDefaultValue
{
#region Property backing fields
private readonly string _lookupPath;
private readonly ParameterDefaultValueType _valueType;
private readonly string _value;
private readonly string _parentPath;
#endregion
/// <summary>
/// Constructor for the <see cref="CsParameterDefaultValue"/>
/// </summary>
/// <param name="isLoaded">Flag that determines if the model was loaded.</param>
/// <param name="hasErrors">Flag that determine if errors were found creating the model.</param>
/// <param name="loadedFromSource">Flag that determines if the model was loaded from source code or from an existing library.</param>
/// <param name="language">The target language the model was generated from.</param>
/// <param name="parentPath">The fully qualified path name for the parent model to this model. </param>
/// <param name="sourceDocument">The source document that was used to build this model. This is optional parameter and can be null.</param>
/// <param name="modelStore">Optional the lookup storage for models created during the compile or lookup of the model.</param>
/// <param name="modelErrors">Optional the error that occurred while creating the model.</param>
/// <param name="lookupPath">The fully qualified path for the model in the model store.</param>
/// <param name="valueType">The type of default value assigned to the parameter.</param>
/// <param name="value">The value assigned as the default value.</param>
protected CsParameterDefaultValue(bool isLoaded, bool hasErrors, bool loadedFromSource, SourceCodeType language, string lookupPath,
ParameterDefaultValueType valueType, string value, string parentPath, string sourceDocument = null, ModelStore<ICsModel> modelStore = null,
IReadOnlyList<ModelLoadException> modelErrors = null)
: base(isLoaded, hasErrors, loadedFromSource, language, CsModelType.ParameterDefaultValue, sourceDocument, modelStore, modelErrors)
{
_lookupPath = lookupPath;
_valueType = valueType;
_value = value;
_parentPath = parentPath;
}
/// <summary>
/// The parent to the current model. This will return null if there is no parent for this model, or the parent could not be located.
/// </summary>
IDotNetModel DotNet.IParent.Parent => Parent;
/// <summary>
/// The fully qualified path for this model that can be used when searching the source for the model.
/// </summary>
public string LookupPath => _lookupPath;
/// <summary>
/// The type of default value assigned to the parameter.
/// </summary>
public ParameterDefaultValueType ValueType => _valueType;
/// <summary>
/// If the default value is a literal value the value will be set, otherwise it will be set to null.
/// </summary>
public string Value => _value;
/// <summary>
/// The parent to the current model. This will return null if there is no parent for this model, or the parent could not be located.
/// </summary>
public CsModel Parent => GetModel(_parentPath);
}
}