summaryrefslogtreecommitdiffstats
path: root/kviewshell/units.h
blob: db83d6758c99908ca3722a9ed2dc8dd7d0385be6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// units.h
//
// Part of KVIEWSHELL - A framework for multipage text/gfx viewers
//
// (C) 2003 Stefan Kebekus
// Distributed under the GPL

// Add header files alphabetically

#ifndef UNITS_H
#define UNITS_H

class TQString;

class distance {
 public:
  // 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.
  static float convertToMM(const TQString &distance, bool *ok=0);
};

#endif