WXP C++ Library Version 6.74.9
Loading...
Searching...
No Matches
Unit.h
1#ifndef _WINC_UNIT
2#define _WINC_UNIT
3
4#include <WXP/String.h>
5#include <WXP/UnitData.h>
6
7namespace WXP {
8 class Unit {
9 UnitData cvs[10]; // Stored conversions
10 int ncvs;
11
12 public:
13 Unit();
14 int init();
15 bool valid( const char *in, const char *out );
16 float convert( float value, const char *in, const char *out );
17 int readFile( const char *uin, const char *uout, UnitData &data );
18
19 static int scale( const char *in, float rscale, const char *mstr, String &out );
20 static int parse( const char *str, String &var, String &units );
21 static int change( String &str, const char *units );
22 static bool equal( const char *unit1, const char *unit2 );
23 static int simplify( char *unit );
24 static int simplify( String &unit );
25 };
26}
27#endif
This is a variable length string class.
Definition String.h:5
This class converts units.
Definition Unit.h:8
int init()
Definition Unit.cc:33
static int scale(const char *in, float rscale, const char *mstr, String &out)
Definition Unit.cc:375
int readFile(const char *uin, const char *uout, UnitData &data)
Definition Unit.cc:318
static bool equal(const char *unit1, const char *unit2)
Definition Unit.cc:461
Unit()
Definition Unit.cc:26
bool valid(const char *in, const char *out)
Definition Unit.cc:49
static int parse(const char *str, String &var, String &units)
Definition Unit.cc:413
static int simplify(char *unit)
Definition Unit.cc:469
float convert(float value, const char *in, const char *out)
Definition Unit.cc:174
static int change(String &str, const char *units)
Definition Unit.cc:444
All WXP classes fall under the WXP namespace.
Definition Angle.h:4
This struct stores specific unit conversions.
Definition UnitData.h:5