Skip to content

Commit

Permalink
added /rad to torque
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanLarsson committed Oct 18, 2014
1 parent f921034 commit d812c26
Show file tree
Hide file tree
Showing 41 changed files with 4,138 additions and 134 deletions.
9 changes: 0 additions & 9 deletions Gu.Units.Generator.Tests/Gu.Units.Generator.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="MockSettings.cs" />
Expand All @@ -59,10 +54,6 @@
<Project>{E2703762-7D3C-49AE-B8A8-B3A792F018E3}</Project>
<Name>Gu.Units.Generator</Name>
</ProjectReference>
<ProjectReference Include="..\Gu.Units\Gu.Units.csproj">
<Project>{F1F8B138-BECC-4475-A7AB-B3019338BC7B}</Project>
<Name>Gu.Units</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
Expand Down
10 changes: 5 additions & 5 deletions Gu.Units.Generator/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:generator="clr-namespace:Gu.Units.Generator"
StartupUri="MainWindow.xaml">
<Application.Resources >
<Application.Resources>
<GroupStyle x:Key="GroupStyle">
<GroupStyle.HeaderTemplate >
<GroupStyle.HeaderTemplate>
<DataTemplate DataType="{x:Type generator:IUnit}">
<StackPanel>
<TextBlock Text="{Binding QuantityName}" />
Expand All @@ -16,13 +16,13 @@
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}" >
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander>
<Expander.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding QuantityName}" />
<TextBlock Text="{Binding Path=ItemCount}"/>
<TextBlock Text="Items"/>
<TextBlock Text="{Binding Path=ItemCount}" />
<TextBlock Text="Items" />
</StackPanel>
</Expander.Header>
<ItemsPresenter />
Expand Down
6 changes: 5 additions & 1 deletion Gu.Units.Generator/GeneratorSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@
<Namespace>Gu.Units</Namespace>
<ClassName>RadiansPerSecond</ClassName>
<Symbol>rad/s</Symbol>
<QuantityName>AngularVelocity</QuantityName>
<QuantityName>AngularSpeed</QuantityName>
<SubUnits />
<Parts>
<UnitAndPower>
Expand Down Expand Up @@ -514,6 +514,10 @@
<UnitName>Metres</UnitName>
<Power>1</Power>
</UnitAndPower>
<UnitAndPower>
<UnitName>Radians</UnitName>
<Power>-1</Power>
</UnitAndPower>
</Parts>
<ExplicitName>false</ExplicitName>
</DerivedUnit>
Expand Down
10 changes: 8 additions & 2 deletions Gu.Units.Generator/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
Expand Down Expand Up @@ -73,8 +74,13 @@
</GroupBox>
</Grid>
</GroupBox>

<GroupBox Grid.Column="1" Header="Conversions">

<GridSplitter Grid.Column="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
ResizeDirection="Columns" />

<GroupBox Grid.Column="2" Header="Conversions">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
Expand Down
12 changes: 12 additions & 0 deletions Gu.Units.Generator/Templates/Quantity.tt
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,18 @@ namespace <#= quantity.Namespace #>
return From(<#= su.ParameterName #>, <#= quantity.ClassName #>Unit.<#= su.ClassName #>);
}

<#
}
#>
<#
foreach(var op in quantity.OperatorOverloads)
{
#>
public static <#= op.Result.ClassName #> operator<#= op.Operator #>(<#= op.Left.ClassName #> left, <#= op.Right.ClassName #> right)
{
return <#= op.Result.ClassName #>.From<#= op.Result.Unit.ClassName #>(left.<#= op.Left.Unit.ClassName #> <#= op.Operator #> right.<#= op.Right.Unit.ClassName #>);
}

<#
}
#>
Expand Down
27 changes: 24 additions & 3 deletions Gu.Units.Generator/Templates/QuantityGenerator.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@

Read Settings found 16 units
Read Settings found 23 units
//-> Acceleration.generated.cs

//-> Angle.generated.cs

//-> AngularVelocity.generated.cs
//-> AngularSpeed.generated.cs

//-> Area.generated.cs

//-> Current.generated.cs

//-> Density.generated.cs

//-> Energy.generated.cs
Expand All @@ -24,18 +28,34 @@ Read Settings found 16 units

//-> Pressure.generated.cs

//-> Resistance.generated.cs

//-> Speed.generated.cs

//-> Stiffness.generated.cs

//-> Temperature.generated.cs

//-> Time.generated.cs

//-> Torque.generated.cs

//-> Voltage.generated.cs

//-> Volume.generated.cs

//-> VolumetricFlow.generated.cs
// Generated helper templates
// Gu.Units\Gu.Units\QuantityGenerator.txt4
// Generated items
// Gu.Units\Gu.Units\Resistance.generated.cs
// Gu.Units\Gu.Units\Voltage.generated.cs
// Gu.Units\Gu.Units\VolumetricFlow.generated.cs
// Gu.Units\Gu.Units\Stiffness.generated.cs
// Gu.Units\Gu.Units\Torque.generated.cs
// Gu.Units\Gu.Units\Acceleration.generated.cs
// Gu.Units\Gu.Units\Frequency.generated.cs
// Gu.Units\Gu.Units\AngularVelocity.generated.cs
// Gu.Units\Gu.Units\AngularSpeed.generated.cs
// Gu.Units\Gu.Units\Speed.generated.cs
// Gu.Units\Gu.Units\Power.generated.cs
// Gu.Units\Gu.Units\Energy.generated.cs
Expand All @@ -44,6 +64,7 @@ Read Settings found 16 units
// Gu.Units\Gu.Units\Force.generated.cs
// Gu.Units\Gu.Units\Volume.generated.cs
// Gu.Units\Gu.Units\Area.generated.cs
// Gu.Units\Gu.Units\Current.generated.cs
// Gu.Units\Gu.Units\Fraction.generated.cs
// Gu.Units\Gu.Units\Angle.generated.cs
// Gu.Units\Gu.Units\Temperature.generated.cs
Expand Down
27 changes: 24 additions & 3 deletions Gu.Units.Generator/Templates/UnitGenerator.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@

Read Settings found 6 units
Read Settings found 7 units
//-> AccelerationUnit.generated.cs

//-> AngleUnit.generated.cs

//-> AngularVelocityUnit.generated.cs
//-> AngularSpeedUnit.generated.cs

//-> AreaUnit.generated.cs

//-> CurrentUnit.generated.cs

//-> DensityUnit.generated.cs

//-> EnergyUnit.generated.cs
Expand All @@ -24,18 +28,34 @@ Read Settings found 6 units

//-> PressureUnit.generated.cs

//-> ResistanceUnit.generated.cs

//-> SpeedUnit.generated.cs

//-> StiffnessUnit.generated.cs

//-> TemperatureUnit.generated.cs

//-> TimeUnit.generated.cs

//-> TorqueUnit.generated.cs

//-> VoltageUnit.generated.cs

//-> VolumetricFlowUnit.generated.cs

//-> VolumeUnit.generated.cs
// Generated helper templates
// Gu.Units\Gu.Units\UnitGenerator.txt4
// Generated items
// Gu.Units\Gu.Units\ResistanceUnit.generated.cs
// Gu.Units\Gu.Units\VoltageUnit.generated.cs
// Gu.Units\Gu.Units\VolumetricFlowUnit.generated.cs
// Gu.Units\Gu.Units\StiffnessUnit.generated.cs
// Gu.Units\Gu.Units\TorqueUnit.generated.cs
// Gu.Units\Gu.Units\AccelerationUnit.generated.cs
// Gu.Units\Gu.Units\FrequencyUnit.generated.cs
// Gu.Units\Gu.Units\AngularVelocityUnit.generated.cs
// Gu.Units\Gu.Units\AngularSpeedUnit.generated.cs
// Gu.Units\Gu.Units\SpeedUnit.generated.cs
// Gu.Units\Gu.Units\PowerUnit.generated.cs
// Gu.Units\Gu.Units\EnergyUnit.generated.cs
Expand All @@ -44,6 +64,7 @@ Read Settings found 6 units
// Gu.Units\Gu.Units\ForceUnit.generated.cs
// Gu.Units\Gu.Units\VolumeUnit.generated.cs
// Gu.Units\Gu.Units\AreaUnit.generated.cs
// Gu.Units\Gu.Units\CurrentUnit.generated.cs
// Gu.Units\Gu.Units\FractionUnit.generated.cs
// Gu.Units\Gu.Units\AngleUnit.generated.cs
// Gu.Units\Gu.Units\TemperatureUnit.generated.cs
Expand Down
1 change: 0 additions & 1 deletion Gu.Units.Tests/ArithmeticsTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
namespace Gu.Units.Tests
{
using Moq;
using NUnit.Framework;

//public class ArithmeticsTests
Expand Down
8 changes: 0 additions & 8 deletions Gu.Units.Tests/Gu.Units.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,11 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Moq">
<HintPath>..\packages\Moq.4.2.1409.1722\lib\net40\Moq.dll</HintPath>
</Reference>
<Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ArithmeticsTests.cs" />
Expand Down
1 change: 0 additions & 1 deletion Gu.Units.sln
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ Global
{9785A89E-8B39-48BA-8C0A-BEB7D761D402}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9785A89E-8B39-48BA-8C0A-BEB7D761D402}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9785A89E-8B39-48BA-8C0A-BEB7D761D402}.Generator Only|Any CPU.ActiveCfg = Release|Any CPU
{9785A89E-8B39-48BA-8C0A-BEB7D761D402}.Generator Only|Any CPU.Build.0 = Release|Any CPU
{9785A89E-8B39-48BA-8C0A-BEB7D761D402}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9785A89E-8B39-48BA-8C0A-BEB7D761D402}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
Expand Down
Loading

0 comments on commit d812c26

Please sign in to comment.