mirror of
https://github.com/eliasstepanik/OSCADSharpDotnet7.git
synced 2026-01-11 21:48:34 +00:00
Removed IBindable and ICloneable
This commit is contained in:
parent
cf1a0f2cbc
commit
81408731aa
@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OSCADSharp
|
||||
{
|
||||
internal interface IBindings
|
||||
{
|
||||
void Bind<T>(T obj, string property, Variable variable);
|
||||
|
||||
bool Contains(string openScadFieldName);
|
||||
|
||||
Binding Get(string propertyName);
|
||||
|
||||
void Synonym(string propertyName, string alternateName);
|
||||
}
|
||||
}
|
||||
@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OSCADSharp
|
||||
{
|
||||
internal interface ICloneable<T>
|
||||
{
|
||||
T Clone();
|
||||
}
|
||||
}
|
||||
@ -43,8 +43,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BindableBoolean.cs" />
|
||||
<Compile Include="IBindings.cs" />
|
||||
<Compile Include="ICloneable.cs" />
|
||||
<Compile Include="VariableCalculator.cs" />
|
||||
<Compile Include="CompoundVariable.cs" />
|
||||
<Compile Include="Dependencies.cs" />
|
||||
|
||||
@ -14,25 +14,19 @@ namespace OSCADSharp
|
||||
{
|
||||
private StringBuilder SB { get; set; } = new StringBuilder();
|
||||
private Bindings bindings = null;
|
||||
private IBindings ibindings = null;
|
||||
|
||||
|
||||
internal StatementBuilder(Bindings bindings)
|
||||
{
|
||||
this.bindings = bindings;
|
||||
}
|
||||
|
||||
internal StatementBuilder(IBindings ibindings)
|
||||
{
|
||||
this.ibindings = ibindings;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Special append method for conditionally adding value-pairs
|
||||
/// </summary>
|
||||
/// <param name="name">The Name of the value-pair</param>
|
||||
/// <param name="value">The value - if null this method does nothing</param>
|
||||
/// <param name="prefixWithComma">(optional) Flag indicating whether a comma should be added before the value-pair</param>
|
||||
internal void AppendValuePairIfExists(string name, object value, bool prefixWithComma = false)
|
||||
public void AppendValuePairIfExists(string name, object value, bool prefixWithComma = false)
|
||||
{
|
||||
bool useBinding = this.shouldUseBinding(name);
|
||||
|
||||
@ -46,10 +40,9 @@ namespace OSCADSharp
|
||||
SB.Append(name);
|
||||
SB.Append(" = ");
|
||||
|
||||
if(useBinding)
|
||||
if (useBinding)
|
||||
{
|
||||
SB.Append(this.bindings?.Get(name).BoundVariable.Text);
|
||||
SB.Append(this.ibindings?.Get(name).BoundVariable.Text);
|
||||
SB.Append(this.bindings.Get(name).BoundVariable.Text);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -60,19 +53,18 @@ namespace OSCADSharp
|
||||
|
||||
private bool shouldUseBinding(string name)
|
||||
{
|
||||
return (this.bindings != null && this.bindings.Contains(name))
|
||||
|| (this.ibindings != null && this.ibindings.Contains(name));
|
||||
return this.bindings != null && this.bindings.Contains(name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pass-through for StringBuilder.Append
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
internal void Append(string text)
|
||||
public void Append(string text)
|
||||
{
|
||||
SB.Append(text);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets this builder's full string
|
||||
/// </summary>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user