diff options
author | Michael Stahl <mst@openoffice.org> | 2009-11-19 11:56:21 +0100 |
---|---|---|
committer | Michael Stahl <mst@openoffice.org> | 2009-11-19 11:56:21 +0100 |
commit | 9ea262814e66ea01c6b3ace22833e644e3ce30a1 (patch) | |
tree | 2da99c13f322e6ff0ec2cb46ef3abefd43c97ee6 /sax/inc | |
parent | 001cc8fcaaa5614aa63bbd3184b6f1780ab57dbb (diff) |
#i97029#: sax::Converter: properly support XMLSchema-2 "duration" type:
replace convertTime() funtions with convertDuration().
reimplement convertDuration(util::Duration) to be free of rounding error.
Diffstat (limited to 'sax/inc')
-rw-r--r-- | sax/inc/sax/tools/converter.hxx | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/sax/inc/sax/tools/converter.hxx b/sax/inc/sax/tools/converter.hxx index 6632dda8507e..f8c988d2fceb 100644 --- a/sax/inc/sax/tools/converter.hxx +++ b/sax/inc/sax/tools/converter.hxx @@ -31,11 +31,13 @@ #ifndef _SAX_CONVERTER_HXX #define _SAX_CONVERTER_HXX -#include <sal/types.h> #include "sax/dllapi.h" -#include <com/sun/star/util/Date.hpp> + +#include <sal/types.h> + #include <com/sun/star/util/MeasureUnit.hpp> + namespace rtl { class OUString; @@ -43,8 +45,12 @@ class OUStringBuffer; } namespace com { namespace sun { namespace star { - namespace util { struct DateTime; } -}}} + namespace util { + struct Date; + struct DateTime; + struct Duration; + } +} } } namespace sax { @@ -138,36 +144,37 @@ public: /** convert string to double number (using ::rtl::math) with unit conversion */ static bool convertDouble(double& rValue, const ::rtl::OUString& rString, sal_Int16 nTargetUnit ); - /** convert double to ISO Time String */ - static void convertTime( ::rtl::OUStringBuffer& rBuffer, - const double& fTime); + /** convert double to ISO "duration" string; negative durations allowed */ + static void convertDuration(::rtl::OUStringBuffer& rBuffer, + const double fTime); - /** convert util::DateTime to ISO Time String */ - static void convertTime( ::rtl::OUStringBuffer& rBuffer, - const ::com::sun::star::util::DateTime& rDateTime ); + /** convert util::Duration to ISO "duration" string */ + static void convertDuration(::rtl::OUStringBuffer& rBuffer, + const ::com::sun::star::util::Duration& rDuration); - /** convert ISO Time String to double */ - static bool convertTime( double& fTime, + /** convert ISO "duration" string to double; negative durations allowed */ + static bool convertDuration(double & rfTime, const ::rtl::OUString& rString); - /** convert ISO Time String to util::DateTime */ - static bool convertTime( ::com::sun::star::util::DateTime& rDateTime, - const ::rtl::OUString& rString ); + /** convert ISO "duration" string to util::Duration */ + static bool convertDuration(::com::sun::star::util::Duration& rDuration, + const ::rtl::OUString& rString); - /** convert util::Date to ISO Date String */ + /** convert util::Date to ISO "date" string */ static void convertDate( ::rtl::OUStringBuffer& rBuffer, const com::sun::star::util::Date& rDate ); - /** convert util::DateTime to ISO Date or DateTime String */ + /** convert util::DateTime to ISO "date" or "dateTime" string */ static void convertDateTime( ::rtl::OUStringBuffer& rBuffer, const com::sun::star::util::DateTime& rDateTime, bool bAddTimeIf0AM = false ); - /** convert ISO Date or DateTime String to util::DateTime */ + /** convert ISO "date" or "dateTime" string to util::DateTime */ static bool convertDateTime( com::sun::star::util::DateTime& rDateTime, const ::rtl::OUString& rString ); - /** convert ISO Date or DateTime String to util::DateTime or util::Date */ + /** convert ISO "date" or "dateTime" string to util::DateTime or + util::Date */ static bool convertDateOrDateTime( com::sun::star::util::Date & rDate, com::sun::star::util::DateTime & rDateTime, |