2018-02-12 14:15:04 +00:00
|
|
|
#ifndef UNITOFMEASURE_H
|
|
|
|
#define UNITOFMEASURE_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The UnitOfMeasure class represents a way to measure an ingredient. It contains a name, an abbreviation, plural name, and some information on conversion.
|
|
|
|
*/
|
|
|
|
|
|
|
|
class UnitOfMeasure
|
|
|
|
{
|
|
|
|
public:
|
2018-03-04 08:05:20 +00:00
|
|
|
//Constants Declarations.
|
2018-03-11 07:57:57 +00:00
|
|
|
static const int MASS = 0;
|
|
|
|
static const int VOLUME = 1;
|
|
|
|
static const int LENGTH = 2;
|
|
|
|
static const int MISC = 3;
|
2018-03-04 08:05:20 +00:00
|
|
|
|
2018-02-12 19:27:27 +00:00
|
|
|
//Full constructor.
|
2018-03-10 07:51:17 +00:00
|
|
|
UnitOfMeasure(string name, string plural, string abbreviation, int type, double coef);
|
2018-03-03 09:18:38 +00:00
|
|
|
//Attempt to guess unit from just a string.
|
|
|
|
UnitOfMeasure(string name);
|
2018-02-12 19:27:27 +00:00
|
|
|
//Constructor with default values.
|
|
|
|
UnitOfMeasure();
|
2018-02-12 18:20:38 +00:00
|
|
|
|
|
|
|
//Getters
|
2018-02-13 09:22:05 +00:00
|
|
|
string getName() const;
|
|
|
|
string getNamePlural() const;
|
|
|
|
string getAbbreviation() const;
|
2018-03-04 08:05:20 +00:00
|
|
|
int getType() const;
|
2018-03-10 07:51:17 +00:00
|
|
|
double getMetricCoefficient() const;
|
2018-02-12 14:15:04 +00:00
|
|
|
private:
|
2018-02-12 15:27:24 +00:00
|
|
|
string name; //The name of the unit of measure.
|
|
|
|
string plural; //The plural name.
|
|
|
|
string abbreviation; //A short version of the unit.
|
2018-03-04 08:05:20 +00:00
|
|
|
int type; //The type of unit, as one of the constants above.
|
|
|
|
double metricCoefficient; //The conversion from this unit to the standard metric unit.
|
2018-02-12 14:15:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // UNITOFMEASURE_H
|