From: Fridrich S. <str...@us...> - 2008-12-03 12:16:05
|
Update of /cvsroot/libwpd/libwpd2/src/lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv794/src/lib Modified Files: WPXProperty.cpp WPXProperty.h WPXPropertyList.cpp WPXPropertyList.h Log Message: use double instead of float in WPXProperty* stuff Index: WPXPropertyList.cpp =================================================================== RCS file: /cvsroot/libwpd/libwpd2/src/lib/WPXPropertyList.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- WPXPropertyList.cpp 4 Jul 2007 20:39:41 -0000 1.12 +++ WPXPropertyList.cpp 3 Dec 2008 12:16:00 -0000 1.13 @@ -136,7 +136,7 @@ m_mapImpl->insert(name, WPXPropertyFactory::newStringProp(val)); } -void WPXPropertyList::insert(const char * name, const float val, const WPXUnit units) +void WPXPropertyList::insert(const char * name, const double val, const WPXUnit units) { if (units == WPX_INCH) m_mapImpl->insert(name, WPXPropertyFactory::newInchProp(val)); Index: WPXPropertyList.h =================================================================== RCS file: /cvsroot/libwpd/libwpd2/src/lib/WPXPropertyList.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- WPXPropertyList.h 4 Jul 2007 20:39:41 -0000 1.13 +++ WPXPropertyList.h 3 Dec 2008 12:16:00 -0000 1.14 @@ -45,7 +45,7 @@ void insert(const char * name, const int val); void insert(const char * name, const bool val); void insert(const char * name, const WPXString &val); - void insert(const char * name, const float val, const WPXUnit units = WPX_INCH); + void insert(const char * name, const double val, const WPXUnit units = WPX_INCH); void remove(const char * name); const WPXProperty * operator[](const char *name) const; Index: WPXProperty.cpp =================================================================== RCS file: /cvsroot/libwpd/libwpd2/src/lib/WPXProperty.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- WPXProperty.cpp 9 Nov 2007 16:02:41 -0000 1.17 +++ WPXProperty.cpp 3 Dec 2008 12:16:00 -0000 1.18 @@ -32,7 +32,7 @@ WPXStringProperty(const WPXString &str); WPXStringProperty(const char * str); virtual int getInt() const; - virtual float getFloat() const; + virtual double getDouble() const; virtual WPXString getStr() const; virtual WPXProperty * clone() const; @@ -45,7 +45,7 @@ public: WPXIntProperty(const int val); virtual int getInt() const; - virtual float getFloat() const; + virtual double getDouble() const; virtual WPXString getStr() const; virtual WPXProperty * clone() const; @@ -61,45 +61,45 @@ virtual WPXProperty * clone() const; }; -class WPXFloatProperty : public WPXProperty +class WPXDoubleProperty : public WPXProperty { public: - WPXFloatProperty(const float val); + WPXDoubleProperty(const double val); virtual int getInt() const; - virtual float getFloat() const; + virtual double getDouble() const; private: - float m_val; + double m_val; }; -class WPXInchProperty : public WPXFloatProperty +class WPXInchProperty : public WPXDoubleProperty { public: - WPXInchProperty(const float val); + WPXInchProperty(const double val); virtual WPXString getStr() const; virtual WPXProperty * clone() const; }; -class WPXPercentProperty : public WPXFloatProperty +class WPXPercentProperty : public WPXDoubleProperty { public: - WPXPercentProperty(const float val); + WPXPercentProperty(const double val); virtual WPXString getStr() const; virtual WPXProperty * clone() const; }; -class WPXPointProperty : public WPXFloatProperty +class WPXPointProperty : public WPXDoubleProperty { public: - WPXPointProperty(const float val); + WPXPointProperty(const double val); virtual WPXString getStr() const; virtual WPXProperty * clone() const; }; -class WPXTwipProperty : public WPXFloatProperty +class WPXTwipProperty : public WPXDoubleProperty { public: - WPXTwipProperty(const float val); + WPXTwipProperty(const double val); virtual WPXString getStr() const; virtual WPXProperty * clone() const; }; @@ -121,7 +121,7 @@ return 0; } -float WPXStringProperty::getFloat() const +double WPXStringProperty::getDouble() const { return 0.0f; } @@ -146,9 +146,9 @@ return m_val; } -float WPXIntProperty::getFloat() const +double WPXIntProperty::getDouble() const { - return (float)m_val; + return (double)m_val; } WPXString WPXIntProperty::getStr() const @@ -180,57 +180,57 @@ return new WPXBoolProperty(getInt() != 0); } -WPXFloatProperty::WPXFloatProperty(const float val) : +WPXDoubleProperty::WPXDoubleProperty(const double val) : m_val(val) { } -int WPXFloatProperty::getInt() const +int WPXDoubleProperty::getInt() const { return (int)m_val; } -float WPXFloatProperty::getFloat() const +double WPXDoubleProperty::getDouble() const { return m_val; } -WPXInchProperty::WPXInchProperty(const float val) : - WPXFloatProperty(val) +WPXInchProperty::WPXInchProperty(const double val) : + WPXDoubleProperty(val) { } WPXString WPXInchProperty::getStr() const { - WPXString str = doubleToString(getFloat()); + WPXString str = doubleToString(getDouble()); str.append("in"); return str; } WPXProperty * WPXInchProperty::clone() const { - return new WPXInchProperty(getFloat()); + return new WPXInchProperty(getDouble()); } -WPXPercentProperty::WPXPercentProperty(const float val) : - WPXFloatProperty(val) +WPXPercentProperty::WPXPercentProperty(const double val) : + WPXDoubleProperty(val) { } WPXString WPXPercentProperty::getStr() const { - WPXString str = doubleToString(getFloat()*100.0f); + WPXString str = doubleToString(getDouble()*100.0f); str.append("%"); return str; } WPXProperty * WPXPercentProperty::clone() const { - return new WPXPercentProperty(getFloat()); + return new WPXPercentProperty(getDouble()); } -WPXPointProperty::WPXPointProperty(const float val) : - WPXFloatProperty(val) +WPXPointProperty::WPXPointProperty(const double val) : + WPXDoubleProperty(val) { } @@ -243,11 +243,11 @@ WPXProperty * WPXPointProperty::clone() const { - return new WPXPointProperty(getFloat()); + return new WPXPointProperty(getDouble()); } -WPXTwipProperty::WPXTwipProperty(const float val) : - WPXFloatProperty(val) +WPXTwipProperty::WPXTwipProperty(const double val) : + WPXDoubleProperty(val) { } @@ -260,7 +260,7 @@ WPXProperty * WPXTwipProperty::clone() const { - return new WPXTwipProperty(getFloat()); + return new WPXTwipProperty(getDouble()); } WPXProperty * WPXPropertyFactory::newStringProp(const WPXString &str) @@ -283,22 +283,22 @@ return static_cast<WPXProperty *>(new WPXBoolProperty(val)); } -WPXProperty * WPXPropertyFactory::newInchProp(const float val) +WPXProperty * WPXPropertyFactory::newInchProp(const double val) { return static_cast<WPXProperty *>(new WPXInchProperty(val)); } -WPXProperty * WPXPropertyFactory::newPercentProp(const float val) +WPXProperty * WPXPropertyFactory::newPercentProp(const double val) { return static_cast<WPXProperty *>(new WPXPercentProperty(val)); } -WPXProperty * WPXPropertyFactory::newPointProp(const float val) +WPXProperty * WPXPropertyFactory::newPointProp(const double val) { return static_cast<WPXProperty *>(new WPXPointProperty(val)); } -WPXProperty * WPXPropertyFactory::newTwipProp(const float val) +WPXProperty * WPXPropertyFactory::newTwipProp(const double val) { return static_cast<WPXProperty *>(new WPXTwipProperty(val)); } Index: WPXProperty.h =================================================================== RCS file: /cvsroot/libwpd/libwpd2/src/lib/WPXProperty.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- WPXProperty.h 4 Jul 2007 20:39:41 -0000 1.13 +++ WPXProperty.h 3 Dec 2008 12:16:00 -0000 1.14 @@ -34,7 +34,7 @@ public: virtual ~WPXProperty(); virtual int getInt() const = 0; - virtual float getFloat() const = 0; + virtual double getDouble() const = 0; virtual WPXString getStr() const = 0; virtual WPXProperty * clone() const = 0; }; @@ -46,9 +46,9 @@ static WPXProperty * newStringProp(const char *str); static WPXProperty * newIntProp(const int val); static WPXProperty * newBoolProp(const bool val); - static WPXProperty * newInchProp(const float val); - static WPXProperty * newPercentProp(const float val); - static WPXProperty * newPointProp(const float val); - static WPXProperty * newTwipProp(const float val); + static WPXProperty * newInchProp(const double val); + static WPXProperty * newPercentProp(const double val); + static WPXProperty * newPointProp(const double val); + static WPXProperty * newTwipProp(const double val); }; #endif /* WPXPROPERTY_H */ |