00001 // formatnum.h 00002 // 00003 // Copyright (C) 2003, Chris Laurel <claurel@shatters.net> 00004 // 00005 // This program is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU General Public License 00007 // as published by the Free Software Foundation; either version 2 00008 // of the License, or (at your option) any later version. 00009 00010 #ifndef CELUTIL_FORMATNUM_H_ 00011 #define CELUTIL_FORMATNUM_H_ 00012 00013 #include <iostream> 00014 00015 00016 class FormattedNumber 00017 { 00018 public: 00019 FormattedNumber(double, unsigned int _precision, unsigned int _flags); 00020 double getValue() const; 00021 double getRoundedValue() const; 00022 00023 enum 00024 { 00025 GroupThousands = 0x1, 00026 SignificantDigits = 0x2, 00027 }; 00028 00029 friend std::ostream& operator<<(std::ostream& out, const FormattedNumber& num); 00030 00031 private: 00032 double value; 00033 unsigned int precision; 00034 unsigned int flags; 00035 }; 00036 00037 00038 #endif // CELUTIL_FORMATNUM_H_ 00039
1.4.1