Base class for the measurement system classes. More...
#include <ilviews/printing/units.h>
Public Member Functions | |
IlvPrintUnit () | |
Default constructor. More... | |
IlvPrintUnit (double units) | |
Conversion constructor from a double. More... | |
virtual | ~IlvPrintUnit () |
Destructor. More... | |
virtual double | getPoints () const =0 |
Returns the value expressed in points. More... | |
virtual IlString | getUnitName () const =0 |
Returns a string that is the name of the unit. More... | |
double | getUnits () const |
Returns the value expressed in units. More... | |
IlBoolean | operator!= (IlvPrintUnit const &other) const |
InEquality test. More... | |
IlvPrintUnit & | operator*= (double units) |
Multiplies the current object by the value expressed in units given as parameter. More... | |
IlvPrintUnit & | operator+= (double units) |
Adds to the current object the value expressed in units given as parameter. More... | |
IlvPrintUnit & | operator+= (IlvPrintUnit const &other) |
Adds to the current object the value of the object given as parameter. More... | |
IlvPrintUnit & | operator-= (double units) |
Subtracts from the current object the value expressed in units given as parameter. More... | |
IlvPrintUnit & | operator-= (IlvPrintUnit const &other) |
Subtracts from the current object the value of the object given as parameter. More... | |
IlvPrintUnit & | operator/= (double units) |
Divides the current object by the value expressed in units given as parameter. More... | |
IlvPrintUnit & | operator= (double units) |
Assignment operator. More... | |
IlvPrintUnit & | operator= (IlvPrintUnit const &other) |
Assignment operator. More... | |
IlBoolean | operator== (IlvPrintUnit const &other) const |
Equality test. More... | |
virtual void | setPoints (double points)=0 |
Sets the value expressed in points. More... | |
void | setUnits (double units) |
Sets the value expressed in units. More... | |
IlString | toString () const |
Returns a string representation of the value expressed in units. More... | |
Protected Member Functions | |
virtual IlString | getUnitNamePlural () const =0 |
Returns a string that is the plural name of the unit. More... | |
Base class for the measurement system classes.
Library: ilvprint
This class is intended to be derived by implementing the member functions getPoints()
and setPoints()
. It stores the value expressed in the current units of the class.
|
virtual |
Destructor.
The destructor actually does nothing, but it is declared as virtual so that inherited classes may override it.
IlvPrintUnit::IlvPrintUnit | ( | ) |
Default constructor.
It initializes the object in a coherent state.
IlvPrintUnit::IlvPrintUnit | ( | double | units | ) |
Conversion constructor from a double.
This constructor creates an IlvPrint
from a double.
units | A double, the number of units of the IlvPrintUnit . |
|
pure virtual |
Returns the value expressed in points.
This function is a pure virtual one and must be overridden by the inherited classes.
Its purpose is to translate the value returned by getUnits
into a value expressed in points.
Implemented in IlvPrintPointUnit, IlvPrintPicaUnit, IlvPrintInchUnit, and IlvPrintCMUnit.
|
pure virtual |
Returns a string that is the name of the unit.
This function is a pure virtual one and must be overridden by the inherited classes.
IlString
, the unit name. Implemented in IlvPrintPointUnit, IlvPrintPicaUnit, IlvPrintInchUnit, and IlvPrintCMUnit.
|
protectedpure virtual |
Returns a string that is the plural name of the unit.
IlString
, the plural name unit. Implemented in IlvPrintPointUnit, IlvPrintPicaUnit, IlvPrintInchUnit, and IlvPrintCMUnit.
double IlvPrintUnit::getUnits | ( | ) | const |
Returns the value expressed in units.
This functions gets the value expressed in units and stores it in the object.
IlBoolean IlvPrintUnit::operator!= | ( | IlvPrintUnit const & | other | ) | const |
InEquality test.
Tests whether both objects have different values. The comparison is done on the values expressed in points.
other | The other object to be compared with the current one. |
IlBoolean
, IlFalse
when both objects are equal, IlTrue
otherwise. IlvPrintUnit & IlvPrintUnit::operator*= | ( | double | units | ) |
Multiplies the current object by the value expressed in units given as parameter.
The calculation is done in points.
units | A double, the value to be multiplied by. |
IlvPrintUnit & IlvPrintUnit::operator+= | ( | double | units | ) |
Adds to the current object the value expressed in units given as parameter.
The calculation is done in points.
units | A double, the value expressed in units. |
IlvPrintUnit & IlvPrintUnit::operator+= | ( | IlvPrintUnit const & | other | ) |
Adds to the current object the value of the object given as parameter.
The calculation is done in points.
other | A const reference to an object. |
IlvPrintUnit & IlvPrintUnit::operator-= | ( | double | units | ) |
Subtracts from the current object the value expressed in units given as parameter.
The calculation is done in points.
units | A double, the value expressed in units. |
IlvPrintUnit & IlvPrintUnit::operator-= | ( | IlvPrintUnit const & | other | ) |
Subtracts from the current object the value of the object given as parameter.
The calculation is done in points.
other | A const reference to an object. |
IlvPrintUnit & IlvPrintUnit::operator/= | ( | double | units | ) |
Divides the current object by the value expressed in units given as parameter.
The calculation is done in points.
units | A double, the value to be divided by. |
IlvPrintUnit & IlvPrintUnit::operator= | ( | double | units | ) |
Assignment operator.
This operator assigns to the current object the value given as parameter and expressed in units.
units | A double, the value expressed in units. |
IlvPrintUnit & IlvPrintUnit::operator= | ( | IlvPrintUnit const & | other | ) |
Assignment operator.
This operator assigns to the current object the value stored in the object given as parameter.
other | A const reference to an object. |
IlBoolean IlvPrintUnit::operator== | ( | IlvPrintUnit const & | other | ) | const |
Equality test.
Tests whether both objects have the same value. The comparison is done on the values expressed in points.
other | The other object to be compared with the current one. |
IlBoolean
, IlTrue
when both objects are equal, IlFalse
otherwise.
|
pure virtual |
Sets the value expressed in points.
This function is a pure virtual one and must be overridden by the inherited classes.
Its purpose is to translate the value given as parameter into units and then stores it (through setUnits
).
points | A double, the value expressed in points. |
Implemented in IlvPrintPointUnit, IlvPrintPicaUnit, IlvPrintInchUnit, and IlvPrintCMUnit.
void IlvPrintUnit::setUnits | ( | double | units | ) |
Sets the value expressed in units.
This function stores the value expressed in units.
units | A double, the value expressed in units. |
IlString IlvPrintUnit::toString | ( | ) | const |
Returns a string representation of the value expressed in units.
This function actually calls getUnits()
and getUnitName()
.
IlString
, the value expressed in units.