Skip to content

Commit

Permalink
Add ImperialCivil Units Schema
Browse files Browse the repository at this point in the history
- units for civil engineering - ft, ft2, ft3, mph,
  and angles as degrees/minutes/seconds
  • Loading branch information
WandererFan authored and yorikvanhavre committed Dec 6, 2018
1 parent eb9aa5c commit 00e6e37
Show file tree
Hide file tree
Showing 12 changed files with 749 additions and 639 deletions.
1 change: 1 addition & 0 deletions src/App/ExpressionParser.y
Expand Up @@ -69,6 +69,7 @@ input: exp { ScanResult = $1; valueExpression = true;

exp: num { $$ = $1; }
| num unit_exp %prec NUM_AND_UNIT { $$ = new OperatorExpression(DocumentObject, $1, OperatorExpression::UNIT, $2); }
| num unit_exp %prec NUM_AND_UNIT %prec NUM_AND_UNIT { $$ = new OperatorExpression(DocumentObject, $1, OperatorExpression::UNIT, $2, $3); }
| STRING { $$ = new StringExpression(DocumentObject, $1); }
| identifier { $$ = new VariableExpression(DocumentObject, $1); }
| MINUSSIGN exp %prec NEG { $$ = new OperatorExpression(DocumentObject, $2, OperatorExpression::NEG, new NumberExpression(DocumentObject, Quantity(-1))); }
Expand Down
3 changes: 3 additions & 0 deletions src/Base/Quantity.cpp
Expand Up @@ -32,6 +32,7 @@
#include "Quantity.h"
#include "Exception.h"
#include "UnitsApi.h"
#include "Console.h"

// suppress annoying warnings from generated source files
#ifdef _MSC_VER
Expand Down Expand Up @@ -305,6 +306,8 @@ Quantity Quantity::WattSecond (1e+6 ,Unit(2,1,-2)); // Joule (kg
Quantity Quantity::KMH (277.778 ,Unit(1,0,-1)); // km/h
Quantity Quantity::MPH (447.04 ,Unit(1,0,-1)); // Mile/h

Quantity Quantity::AngMinute (1.0/60.0 ,Unit(0,0,0,0,0,0,0,1)); // angular minute
Quantity Quantity::AngSecond (1.0/3600.0 ,Unit(0,0,0,0,0,0,0,1)); // angular minute
Quantity Quantity::Degree (1.0 ,Unit(0,0,0,0,0,0,0,1)); // degree (internal standard angle)
Quantity Quantity::Radian (180/M_PI ,Unit(0,0,0,0,0,0,0,1)); // radian
Quantity Quantity::Gon (360.0/400.0 ,Unit(0,0,0,0,0,0,0,1)); // gon
Expand Down
2 changes: 2 additions & 0 deletions src/Base/Quantity.h
Expand Up @@ -256,6 +256,8 @@ class BaseExport Quantity
static Quantity Degree;
static Quantity Radian;
static Quantity Gon;
static Quantity AngMinute;
static Quantity AngSecond;
//@}


Expand Down

0 comments on commit 00e6e37

Please sign in to comment.