+Added Variable class, Bind method to OSCADObject

This commit is contained in:
Michael Smith 2016-02-25 22:51:39 -08:00
parent eb49310d8a
commit 4f0d3ed1be
3 changed files with 39 additions and 0 deletions

View File

@ -227,6 +227,17 @@ namespace OSCADSharp
#endregion
#region Utility Methods
private Dictionary<string, Variable> bindings = new Dictionary<string, Variable>();
/// <summary>
/// Binds a variable to property of this object
/// </summary>
/// <param name="property"></param>
/// <param name="variable"></param>
public void Bind(string property, Variable variable)
{
bindings[property] = variable;
}
/// <summary>
/// Returns the computed position of this object.
///

View File

@ -50,6 +50,7 @@
<Compile Include="Ids.cs" />
<Compile Include="Scripting\SingleStatementObject.cs" />
<Compile Include="Scripting\StatementBuilder.cs" />
<Compile Include="Scripting\Variable.cs" />
<Compile Include="Settings.cs" />
<Compile Include="Sizes.cs" />
<Compile Include="Spatial\Bounds.cs" />

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OSCADSharp.Scripting
{
/// <summary>
/// A value for setting object properties in script output to
/// a specific variable
/// </summary>
public class Variable
{
/// <summary>
/// Name of the variable
/// </summary>
public string Name { get; set; }
/// <summary>
/// Value of the variable.
///
/// Must be compatible with the data type being assigned to.
/// </summary>
public object Value { get; set; }
}
}