Private
Public Access
Added Variable Values
This commit is contained in:
1 parent
3a979f8faa
commit
e0ff2ab464
2 files changed
+28
-15
No files matched your search
+5
-2
@@ -89,7 +89,7 @@
|
||||
<Compile Include="Verbs\DrawingVerbs\ResetPen.cs" />
|
||||
<Compile Include="Verbs\DrawingVerbs\Square.cs" />
|
||||
<Compile Include="Verbs\DrawingVerbs\Triangle.cs" />
|
||||
<Compile Include="Verbs\Value\Expression.cs" />
|
||||
<Compile Include="Verbs\Value\ValueTypes\ExpressionValue.cs" />
|
||||
<Compile Include="Verbs\Value\DeclareVariable.cs" />
|
||||
<Compile Include="Verbs\Value\UpdateVariable.cs" />
|
||||
<Compile Include="Verbs\Value\ValueFactory.cs" />
|
||||
@@ -100,6 +100,7 @@
|
||||
<Compile Include="Verbs\Value\ValueTypes\ColorValue.cs" />
|
||||
<Compile Include="Verbs\Value\ValueTypes\DoubleValue.cs" />
|
||||
<Compile Include="Verbs\Value\ValueTypes\IntValue.cs" />
|
||||
<Compile Include="Verbs\Value\ValueTypes\VariableValue.cs" />
|
||||
<Compile Include="Windows\AboutWindow.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -207,6 +208,8 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\logo.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Folder Include="Exceptions\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
+23
-13
@@ -1,38 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Advanced_Software_Engineering.Verbs.Value.ValueTypes {
|
||||
class VariableValue : IValue {
|
||||
|
||||
public class VariableValue : IValue {
|
||||
private Drawer drawer;
|
||||
private string variableName;
|
||||
|
||||
public VariableValue(Drawer drawer, string variableName) {
|
||||
this.variableName = variableName;
|
||||
if (!drawer.CheckVariableExists(variableName)) throw new Exception("Tried to access " + variableName + " before it was assigned. ");
|
||||
this.drawer = drawer;
|
||||
}
|
||||
|
||||
private IValue get() {
|
||||
return drawer.GetVariable(variableName);
|
||||
}
|
||||
|
||||
public string GetDescription() {
|
||||
throw new NotImplementedException();
|
||||
return get().GetDescription();
|
||||
}
|
||||
|
||||
public string GetOriginalType() {
|
||||
throw new NotImplementedException();
|
||||
return get().GetOriginalType();
|
||||
}
|
||||
|
||||
public bool isInitialised() {
|
||||
throw new NotImplementedException();
|
||||
return get().isInitialised();
|
||||
}
|
||||
|
||||
public bool ToBool() {
|
||||
throw new NotImplementedException();
|
||||
return get().ToBool();
|
||||
}
|
||||
|
||||
public Color ToColor() {
|
||||
throw new NotImplementedException();
|
||||
return get().ToColor();
|
||||
}
|
||||
|
||||
public double ToDouble() {
|
||||
throw new NotImplementedException();
|
||||
return get().ToDouble();
|
||||
}
|
||||
|
||||
public int ToInt() {
|
||||
throw new NotImplementedException();
|
||||
return get().ToInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user