Views
Foundation Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions | Protected Member Functions
IlvPrintUnit Class Referenceabstract

Base class for the measurement system classes. More...

#include <ilviews/printing/units.h>

Inheritance diagram for IlvPrintUnit:
IlvPrintCMUnit IlvPrintInchUnit IlvPrintPicaUnit IlvPrintPointUnit

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...
 
IlvPrintUnitoperator*= (double units)
 Multiplies the current object by the value expressed in units given as parameter. More...
 
IlvPrintUnitoperator+= (double units)
 Adds to the current object the value expressed in units given as parameter. More...
 
IlvPrintUnitoperator+= (IlvPrintUnit const &other)
 Adds to the current object the value of the object given as parameter. More...
 
IlvPrintUnitoperator-= (double units)
 Subtracts from the current object the value expressed in units given as parameter. More...
 
IlvPrintUnitoperator-= (IlvPrintUnit const &other)
 Subtracts from the current object the value of the object given as parameter. More...
 
IlvPrintUnitoperator/= (double units)
 Divides the current object by the value expressed in units given as parameter. More...
 
IlvPrintUnitoperator= (double units)
 Assignment operator. More...
 
IlvPrintUnitoperator= (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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ~IlvPrintUnit()

virtual IlvPrintUnit::~IlvPrintUnit ( )
virtual

Destructor.

The destructor actually does nothing, but it is declared as virtual so that inherited classes may override it.

◆ IlvPrintUnit() [1/2]

IlvPrintUnit::IlvPrintUnit ( )

Default constructor.

It initializes the object in a coherent state.

◆ IlvPrintUnit() [2/2]

IlvPrintUnit::IlvPrintUnit ( double  units)

Conversion constructor from a double.

This constructor creates an IlvPrint from a double.

Parameters
unitsA double, the number of units of the IlvPrintUnit.

Member Function Documentation

◆ getPoints()

virtual double IlvPrintUnit::getPoints ( ) const
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.

Returns
A double, the value expressed in points.

Implemented in IlvPrintPointUnit, IlvPrintPicaUnit, IlvPrintInchUnit, and IlvPrintCMUnit.

◆ getUnitName()

virtual IlString IlvPrintUnit::getUnitName ( ) const
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.

Returns
An IlString, the unit name.

Implemented in IlvPrintPointUnit, IlvPrintPicaUnit, IlvPrintInchUnit, and IlvPrintCMUnit.

◆ getUnitNamePlural()

virtual IlString IlvPrintUnit::getUnitNamePlural ( ) const
protectedpure virtual

Returns a string that is the plural name of the unit.

Returns
An IlString, the plural name unit.

Implemented in IlvPrintPointUnit, IlvPrintPicaUnit, IlvPrintInchUnit, and IlvPrintCMUnit.

◆ getUnits()

double IlvPrintUnit::getUnits ( ) const

Returns the value expressed in units.

This functions gets the value expressed in units and stores it in the object.

Returns
A double, the value expressed in units.

◆ operator!=()

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.

Parameters
otherThe other object to be compared with the current one.
Returns
An IlBoolean, IlFalse when both objects are equal, IlTrue otherwise.

◆ operator*=()

IlvPrintUnit & IlvPrintUnit::operator*= ( double  units)

Multiplies the current object by the value expressed in units given as parameter.

The calculation is done in points.

Parameters
unitsA double, the value to be multiplied by.
Returns
A reference to this object.

◆ operator+=() [1/2]

IlvPrintUnit & IlvPrintUnit::operator+= ( double  units)

Adds to the current object the value expressed in units given as parameter.

The calculation is done in points.

Parameters
unitsA double, the value expressed in units.
Returns
A reference to this object.

◆ operator+=() [2/2]

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.

Parameters
otherA const reference to an object.
Returns
A reference to this object.

◆ operator-=() [1/2]

IlvPrintUnit & IlvPrintUnit::operator-= ( double  units)

Subtracts from the current object the value expressed in units given as parameter.

The calculation is done in points.

Parameters
unitsA double, the value expressed in units.
Returns
A reference to this object.

◆ operator-=() [2/2]

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.

Parameters
otherA const reference to an object.
Returns
A reference to this object.

◆ operator/=()

IlvPrintUnit & IlvPrintUnit::operator/= ( double  units)

Divides the current object by the value expressed in units given as parameter.

The calculation is done in points.

Parameters
unitsA double, the value to be divided by.
Returns
A reference to this object.

◆ operator=() [1/2]

IlvPrintUnit & IlvPrintUnit::operator= ( double  units)

Assignment operator.

This operator assigns to the current object the value given as parameter and expressed in units.

Parameters
unitsA double, the value expressed in units.
Returns
A reference to this object.

◆ operator=() [2/2]

IlvPrintUnit & IlvPrintUnit::operator= ( IlvPrintUnit const &  other)

Assignment operator.

This operator assigns to the current object the value stored in the object given as parameter.

Parameters
otherA const reference to an object.
Returns
A reference to this object.

◆ operator==()

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.

Parameters
otherThe other object to be compared with the current one.
Returns
An IlBoolean, IlTrue when both objects are equal, IlFalse otherwise.

◆ setPoints()

virtual void IlvPrintUnit::setPoints ( double  points)
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).

Parameters
pointsA double, the value expressed in points.

Implemented in IlvPrintPointUnit, IlvPrintPicaUnit, IlvPrintInchUnit, and IlvPrintCMUnit.

◆ setUnits()

void IlvPrintUnit::setUnits ( double  units)

Sets the value expressed in units.

This function stores the value expressed in units.

Parameters
unitsA double, the value expressed in units.

◆ toString()

IlString IlvPrintUnit::toString ( ) const

Returns a string representation of the value expressed in units.

This function actually calls getUnits() and getUnitName().

Returns
An IlString, the value expressed in units.