Kaydet (Commit) b450d322 authored tarafından Stefan Weiberg's avatar Stefan Weiberg Kaydeden (comit) Miklos Vajna

fdo#82088: changed namespace from utl to css::util

- edit: deleted redefined css (alrdy global)

Change-Id: I2e1b0a3d71ef25fdca2a56094283ed076e5cdd30
Reviewed-on: https://gerrit.libreoffice.org/11171Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst f9857727
......@@ -53,7 +53,6 @@ namespace dbtools
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::util;
namespace utl = ::com::sun::star::util;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::lang;
......@@ -61,13 +60,13 @@ namespace dbtools
::com::sun::star::util::Date DBTypeConversion::getStandardDate()
css::util::Date DBTypeConversion::getStandardDate()
{
static ::com::sun::star::util::Date STANDARD_DB_DATE(1,1,1900);
static css::util::Date STANDARD_DB_DATE(1,1,1900);
return STANDARD_DB_DATE;
}
OUString DBTypeConversion::toDateString(const utl::Date& rDate)
OUString DBTypeConversion::toDateString(const css::util::Date& rDate)
{
sal_Char s[11];
snprintf(s,
......@@ -80,7 +79,7 @@ namespace dbtools
return OUString::createFromAscii(s);
}
OUString DBTypeConversion::toTimeStringS(const utl::Time& rTime)
OUString DBTypeConversion::toTimeStringS(const css::util::Time& rTime)
{
std::ostringstream ostr;
using std::setw;
......@@ -91,7 +90,7 @@ namespace dbtools
return OUString::createFromAscii(ostr.str().c_str());
}
OUString DBTypeConversion::toTimeString(const utl::Time& rTime)
OUString DBTypeConversion::toTimeString(const css::util::Time& rTime)
{
std::ostringstream ostr;
using std::setw;
......@@ -103,20 +102,20 @@ namespace dbtools
return OUString::createFromAscii(ostr.str().c_str());
}
OUString DBTypeConversion::toDateTimeString(const utl::DateTime& _rDateTime)
OUString DBTypeConversion::toDateTimeString(const css::util::DateTime& _rDateTime)
{
utl::Date aDate(_rDateTime.Day,_rDateTime.Month,_rDateTime.Year);
css::util::Date aDate(_rDateTime.Day,_rDateTime.Month,_rDateTime.Year);
OUStringBuffer aTemp(toDateString(aDate));
aTemp.appendAscii(" ");
utl::Time const aTime(_rDateTime.NanoSeconds, _rDateTime.Seconds,
css::util::Time const aTime(_rDateTime.NanoSeconds, _rDateTime.Seconds,
_rDateTime.Minutes, _rDateTime.Hours, _rDateTime.IsUTC);
aTemp.append( toTimeString(aTime) );
return aTemp.makeStringAndClear();
}
utl::Date DBTypeConversion::toDate(sal_Int32 _nVal)
css::util::Date DBTypeConversion::toDate(sal_Int32 _nVal)
{
utl::Date aReturn;
css::util::Date aReturn;
aReturn.Day = (sal_uInt16)(_nVal % 100);
aReturn.Month = (sal_uInt16)((_nVal / 100) % 100);
aReturn.Year = (sal_uInt16)(_nVal / 10000);
......@@ -124,9 +123,9 @@ namespace dbtools
}
utl::Time DBTypeConversion::toTime(sal_Int64 _nVal)
css::util::Time DBTypeConversion::toTime(sal_Int64 _nVal)
{
utl::Time aReturn;
css::util::Time aReturn;
sal_uInt64 unVal = static_cast<sal_uInt64>(_nVal >= 0 ? _nVal : -_nVal);
aReturn.Hours = unVal / hourMask;
aReturn.Minutes = (unVal / minMask) % 100;
......@@ -135,7 +134,7 @@ namespace dbtools
return aReturn;
}
sal_Int64 DBTypeConversion::getNsFromTime(const utl::Time& rVal)
sal_Int64 DBTypeConversion::getNsFromTime(const css::util::Time& rVal)
{
sal_Int32 nHour = rVal.Hours;
sal_Int32 nMin = rVal.Minutes;
......@@ -179,7 +178,7 @@ namespace dbtools
}
static sal_Int32 implRelativeToAbsoluteNull(const utl::Date& _rDate)
static sal_Int32 implRelativeToAbsoluteNull(const css::util::Date& _rDate)
{
sal_Int32 nDays = 0;
......@@ -237,28 +236,28 @@ namespace dbtools
rDay = (sal_uInt16)nTempDays;
}
sal_Int32 DBTypeConversion::toDays(const utl::Date& _rVal, const utl::Date& _rNullDate)
sal_Int32 DBTypeConversion::toDays(const css::util::Date& _rVal, const css::util::Date& _rNullDate)
{
return implRelativeToAbsoluteNull(_rVal) - implRelativeToAbsoluteNull(_rNullDate);
}
double DBTypeConversion::toDouble(const utl::Date& rVal, const utl::Date& _rNullDate)
double DBTypeConversion::toDouble(const css::util::Date& rVal, const css::util::Date& _rNullDate)
{
return (double)toDays(rVal, _rNullDate);
}
double DBTypeConversion::toDouble(const utl::Time& rVal)
double DBTypeConversion::toDouble(const css::util::Time& rVal)
{
return (double)getNsFromTime(rVal) / fNanoSecondsPerDay;
}
double DBTypeConversion::toDouble(const utl::DateTime& _rVal, const utl::Date& _rNullDate)
double DBTypeConversion::toDouble(const css::util::DateTime& _rVal, const css::util::Date& _rNullDate)
{
sal_Int64 nTime = toDays(utl::Date(_rVal.Day, _rVal.Month, _rVal.Year), _rNullDate);
utl::Time aTimePart;
sal_Int64 nTime = toDays(css::util::Date(_rVal.Day, _rVal.Month, _rVal.Year), _rNullDate);
css::util::Time aTimePart;
aTimePart.Hours = _rVal.Hours;
aTimePart.Minutes = _rVal.Minutes;
......@@ -268,7 +267,7 @@ namespace dbtools
return ((double)nTime) + toDouble(aTimePart);
}
static void addDays(sal_Int32 nDays, utl::Date& _rDate)
static void addDays(sal_Int32 nDays, css::util::Date& _rDate)
{
sal_Int32 nTempDays = implRelativeToAbsoluteNull( _rDate );
......@@ -289,7 +288,7 @@ namespace dbtools
implBuildFromRelative( nTempDays, _rDate.Day, _rDate.Month, _rDate.Year );
}
static void subDays( sal_Int32 nDays, utl::Date& _rDate )
static void subDays( sal_Int32 nDays, css::util::Date& _rDate )
{
sal_Int32 nTempDays = implRelativeToAbsoluteNull( _rDate );
......@@ -310,9 +309,9 @@ namespace dbtools
implBuildFromRelative( nTempDays, _rDate.Day, _rDate.Month, _rDate.Year );
}
utl::Date DBTypeConversion::toDate(double dVal, const utl::Date& _rNullDate)
css::util::Date DBTypeConversion::toDate(double dVal, const css::util::Date& _rNullDate)
{
utl::Date aRet = _rNullDate;
css::util::Date aRet = _rNullDate;
if (dVal >= 0)
addDays((sal_Int32)dVal,aRet);
......@@ -323,7 +322,7 @@ namespace dbtools
return aRet;
}
utl::Time DBTypeConversion::toTime(double dVal, short nDigits)
css::util::Time DBTypeConversion::toTime(double dVal, short nDigits)
{
sal_Int32 nDays = (sal_Int32)dVal;
sal_Int64 nNS;
......@@ -342,7 +341,7 @@ namespace dbtools
else
nSign = 1;
utl::Time xRet;
css::util::Time xRet;
// normalize time
// we have to sal_Int32 here because otherwise we get an overflow
sal_Int64 nNanoSeconds = nNS;
......@@ -371,16 +370,16 @@ namespace dbtools
return xRet;
}
utl::DateTime DBTypeConversion::toDateTime(double dVal, const utl::Date& _rNullDate)
css::util::DateTime DBTypeConversion::toDateTime(double dVal, const css::util::Date& _rNullDate)
{
utl::Date aDate = toDate(dVal, _rNullDate);
css::util::Date aDate = toDate(dVal, _rNullDate);
// there is not enough precision in a double to have both a date
// and a time up to nanoseconds -> limit to microseconds to have
// correct rounding, that is e.g. 13:00:00.000000000 instead of
// 12:59:59.999999790
utl::Time aTime = toTime(dVal, 6);
css::util::Time aTime = toTime(dVal, 6);
utl::DateTime xRet;
css::util::DateTime xRet;
xRet.Day = aDate.Day;
xRet.Month = aDate.Month;
......@@ -395,7 +394,7 @@ namespace dbtools
return xRet;
}
utl::Date DBTypeConversion::toDate(const OUString& _sSQLString)
css::util::Date DBTypeConversion::toDate(const OUString& _sSQLString)
{
// get the token out of a string
static sal_Unicode sDateSep = '-';
......@@ -412,19 +411,19 @@ namespace dbtools
nDay = (sal_uInt16)_sSQLString.getToken(0,sDateSep,nIndex).toInt32();
}
return utl::Date(nDay,nMonth,nYear);
return css::util::Date(nDay,nMonth,nYear);
}
utl::DateTime DBTypeConversion::toDateTime(const OUString& _sSQLString)
css::util::DateTime DBTypeConversion::toDateTime(const OUString& _sSQLString)
{
//@see http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Timestamp.html#valueOf(java.lang.String)
//@see http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Date.html#valueOf(java.lang.String)
//@see http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Time.html#valueOf(java.lang.String)
// the date part
utl::Date aDate = toDate(_sSQLString);
utl::Time aTime;
css::util::Date aDate = toDate(_sSQLString);
css::util::Time aTime;
sal_Int32 nSeparation = _sSQLString.indexOf( ' ' );
if ( -1 != nSeparation )
{
......@@ -435,14 +434,14 @@ namespace dbtools
aTime = toTime( _sSQLString.copy( nSeparation ) );
}
return utl::DateTime(aTime.NanoSeconds, aTime.Seconds, aTime.Minutes, aTime.Hours,
return css::util::DateTime(aTime.NanoSeconds, aTime.Seconds, aTime.Minutes, aTime.Hours,
aDate.Day, aDate.Month, aDate.Year, false);
}
utl::Time DBTypeConversion::toTime(const OUString& _sSQLString)
css::util::Time DBTypeConversion::toTime(const OUString& _sSQLString)
{
utl::Time aTime;
css::util::Time aTime;
::utl::ISO8601parseTime(_sSQLString, aTime);
return aTime;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment