kviewshell
units.h
Go to the documentation of this file.00001 // units.h 00002 // 00003 // Part of KVIEWSHELL - A framework for multipage text/gfx viewers 00004 // 00005 // (C) 2003 Stefan Kebekus 00006 // Distributed under the GPL 00007 00008 // Add header files alphabetically 00009 00010 #ifndef UNITS_H 00011 #define UNITS_H 00012 00013 class QString; 00014 00015 class distance { 00016 public: 00017 // This method converts a string that gives a distance in one of the 00018 // commonly used units, such as "12.3mm", "12 inch" or "15 didot" to 00019 // millimeters. For a complete list of supported units, see the 00020 // static lists that are hardcoded in "units.cpp". 00021 // 00022 // If the conversion is not possible *ok is set to "false" and an 00023 // undefined value is returned. If the unit could not be recognized, 00024 // an error message is printed via kdError(). Otherwise, *ok is set 00025 // to true. 00026 // 00027 // It is possible in rare circumstances that ok is set to true 00028 // although the string is malformed. 00029 // 00030 // It is fine to set ok to 0. 00031 static float convertToMM(const QString &distance, bool *ok=0); 00032 }; 00033 00034 #endif