UNNAMED_READER/corelibrary
UNNAMED_READER::Length Class Reference
#include <length.h>
List of all members.
Detailed Description
Represents a phyical length.
This class is used to represent a physical length. Its main purpose it to help in the conversion of units, and to avoid confusion about units. To avoid misunderstandings, the default constructor does not take a float, so that the length value needs to be explicitly initialized with one of the functions below.
- Warning:
- Lengths are stored internally in mm. If you convert to or from any other unit, expect floating point round-off errors.
- Author:
- Stefan Kebekus <kebekus@kde.org>
- Version:
- 1.0.0
Definition at line 55 of file length.h.
Constructor & Destructor Documentation
| UNNAMED_READER::Length::Length |
( |
|
) |
[inline] |
constructs a 'length = 0mm' object
Definition at line 59 of file length.h.
Member Function Documentation
| float UNNAMED_READER::Length::convertToMM |
( |
const QString & |
distance, |
|
|
bool * |
ok = 0 | |
|
) |
| | [static] |
This method converts a string that gives a distance in one of the commonly used units, such as "12.3mm", "12 inch" or "15 didot" to millimeters.
For a complete list of supported units, see the static lists that are hardcoded in "units.cpp".
If the conversion is not possible *ok is set to "false" and an undefined value is returned. If the unit could not be recognized, an error message is printed via kdError(). Otherwise, *ok is set to true.
It is possible in rare circumstances that ok is set to true although the string is malformed.
It is fine to set ok to 0.
Definition at line 70 of file length.cpp.
| double UNNAMED_READER::Length::getLength_in_bigPoints |
( |
|
) |
const [inline] |
- Returns:
- the length in big points (1/72 of an inch)
Definition at line 111 of file length.h.
| double UNNAMED_READER::Length::getLength_in_cicero |
( |
|
) |
const [inline] |
- Returns:
- the length in ciceros (0.178 inches)
Definition at line 120 of file length.h.
| double UNNAMED_READER::Length::getLength_in_cm |
( |
|
) |
const [inline] |
- Returns:
- the length in centimeters
Definition at line 99 of file length.h.
| double UNNAMED_READER::Length::getLength_in_didot |
( |
|
) |
const [inline] |
- Returns:
- the length in didots (0.0148 inches)
Definition at line 117 of file length.h.
| double UNNAMED_READER::Length::getLength_in_inch |
( |
|
) |
const [inline] |
- Returns:
- the length in inches
Definition at line 105 of file length.h.
| double UNNAMED_READER::Length::getLength_in_m |
( |
|
) |
const [inline] |
- Returns:
- the length in meters
Definition at line 102 of file length.h.
| double UNNAMED_READER::Length::getLength_in_mm |
( |
|
) |
const [inline] |
- Returns:
- the length in millimeters
Definition at line 96 of file length.h.
| double UNNAMED_READER::Length::getLength_in_pica |
( |
|
) |
const [inline] |
- Returns:
- the length in picas (1/6 of an inch)
Definition at line 114 of file length.h.
| int UNNAMED_READER::Length::getLength_in_pixel |
( |
double |
res |
) |
[inline] |
- Returns:
- the length in pixel.
The parameter
- Parameters:
-
| res | is the resolution of the used device in DPI. |
Definition at line 127 of file length.h.
| double UNNAMED_READER::Length::getLength_in_scaledPoints |
( |
|
) |
const [inline] |
- Returns:
- the length in scaled points (1 scaled point = 65536 TeX points)
Definition at line 123 of file length.h.
| double UNNAMED_READER::Length::getLength_in_TeXPoints |
( |
|
) |
const [inline] |
- Returns:
- the length in TeX points
Definition at line 108 of file length.h.
| bool UNNAMED_READER::Length::isNearlyEqual |
( |
const Length & |
o |
) |
const [inline] |
- Returns:
- true is lengths differ by no more than 2mm
Definition at line 130 of file length.h.
| Length UNNAMED_READER::Length::operator * |
( |
const double |
l |
) |
const [inline] |
Multiplication of a length.
- Returns:
- a multiplied length as a Length
Definition at line 180 of file length.h.
| UNNAMED_READER::Length::operator QString |
( |
|
) |
const [inline] |
This simple method implements typecasts to QString.
Definition at line 199 of file length.h.
| Length UNNAMED_READER::Length::operator+ |
( |
const Length & |
o |
) |
const [inline] |
Sum of two lengthes.
- Returns:
- the sum of the lengthes as a Length
Definition at line 158 of file length.h.
| Length UNNAMED_READER::Length::operator- |
( |
const Length & |
o |
) |
const [inline] |
Difference of two lengthes.
- Returns:
- the difference of the lengthes as a Length
Definition at line 164 of file length.h.
| Length UNNAMED_READER::Length::operator/ |
( |
const double |
l |
) |
const [inline] |
Division of a length.
- Warning:
- There is no safeguared to prevent you from division by zero. If the number in the denominator is near 0.0, a floating point exception may occur.
- Returns:
- a fraction of the original length as a Length
Definition at line 174 of file length.h.
| double UNNAMED_READER::Length::operator/ |
( |
const Length & |
o |
) |
const [inline] |
Ratio of two lengthes.
- Warning:
- There is no safeguared to prevent you from division by zero. If the length in the denominator is near 0.0, a floating point exception may occur.
- Returns:
- the ratio of the two lengthes as a double
Definition at line 152 of file length.h.
| bool UNNAMED_READER::Length::operator< |
( |
const Length & |
o |
) |
const [inline] |
Comparison of two lengthes.
Definition at line 136 of file length.h.
| bool UNNAMED_READER::Length::operator<= |
( |
const Length & |
o |
) |
const [inline] |
Comparison of two lengthes.
Definition at line 142 of file length.h.
| bool UNNAMED_READER::Length::operator> |
( |
const Length & |
o |
) |
const [inline] |
Comparison of two lengthes.
Definition at line 133 of file length.h.
| bool UNNAMED_READER::Length::operator>= |
( |
const Length & |
o |
) |
const [inline] |
Comparison of two lengthes.
Definition at line 139 of file length.h.
| void UNNAMED_READER::Length::setLength_in_bigPoints |
( |
double |
l |
) |
[inline] |
sets the length in big points (1/72 of an inch)
Definition at line 77 of file length.h.
| void UNNAMED_READER::Length::setLength_in_cicero |
( |
double |
l |
) |
[inline] |
sets the length in ciceros (0.178 inches)
Definition at line 86 of file length.h.
| void UNNAMED_READER::Length::setLength_in_cm |
( |
double |
l |
) |
[inline] |
sets the length in centimeters
Definition at line 65 of file length.h.
| void UNNAMED_READER::Length::setLength_in_didot |
( |
double |
l |
) |
[inline] |
sets the length in didots (0.0148 inches)
Definition at line 83 of file length.h.
| void UNNAMED_READER::Length::setLength_in_inch |
( |
double |
l |
) |
[inline] |
sets the length in inches
Definition at line 71 of file length.h.
| void UNNAMED_READER::Length::setLength_in_m |
( |
double |
l |
) |
[inline] |
sets the length in meters
Definition at line 68 of file length.h.
| void UNNAMED_READER::Length::setLength_in_mm |
( |
double |
l |
) |
[inline] |
sets the length in millimeters
Definition at line 62 of file length.h.
| void UNNAMED_READER::Length::setLength_in_pica |
( |
double |
l |
) |
[inline] |
sets the length in picas (1/6 of an inch)
Definition at line 80 of file length.h.
| void UNNAMED_READER::Length::setLength_in_pixel |
( |
int |
l, |
|
|
double |
res | |
|
) |
| | [inline] |
sets the length in pixel.
The parameter
- Parameters:
-
| res | is the resolution of the used device in DPI, |
| l | is the number of pixels. |
Definition at line 93 of file length.h.
| void UNNAMED_READER::Length::setLength_in_scaledPoints |
( |
double |
l |
) |
[inline] |
sets the length in scaled points (1 scaled point = 65536 TeX points)
Definition at line 89 of file length.h.
| void UNNAMED_READER::Length::setLength_in_TeXPoints |
( |
double |
l |
) |
[inline] |
sets the length in TeX points
Definition at line 74 of file length.h.
The documentation for this class was generated from the following files: