Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
56dc7982
Kaydet (Commit)
56dc7982
authored
Haz 29, 2013
tarafından
Michael Stahl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
i#108348 sax::Converter: support negative date and dateTime
Change-Id: Ie2726c7ec941a5690e053d39212d7f516e2c27ba
üst
cc8625f0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
10 deletions
+18
-10
test_converter.cxx
sax/qa/cppunit/test_converter.cxx
+4
-2
converter.cxx
sax/source/tools/converter.cxx
+14
-8
No files found.
sax/qa/cppunit/test_converter.cxx
Dosyayı görüntüle @
56dc7982
...
...
@@ -192,8 +192,10 @@ void ConverterTest::testDateTime()
doTest
(
util
::
DateTime
(
0
,
0
,
0
,
0
,
1
,
1
,
1
),
"0001-01-01T00:00:00"
);
doTest
(
util
::
DateTime
(
0
,
0
,
0
,
0
,
1
,
1
,
1
),
"0001-01-01T00:00:00Z"
,
"0001-01-01T00:00:00"
);
// doTest( util::DateTime(0, 0, 0, 0, 1, 1, -1), "-0001-01-01T00:00:00" );
// doTest( util::DateTime(0, 0, 0, 0, 1, 1, -1), "-0001-01-01T00:00:00Z" );
doTest
(
util
::
DateTime
(
0
,
0
,
0
,
0
,
1
,
1
,
-
1
),
"-0001-01-01T00:00:00"
);
// doTest( util::DateTime(0, 0, 0, 0, 1, 1, -1), "-0001-01-01T00:00:00Z");
doTest
(
util
::
DateTime
(
0
,
0
,
0
,
0
,
1
,
1
,
-
324
),
"-0324-01-01T00:00:00"
);
doTest
(
util
::
DateTime
(
0
,
0
,
0
,
0
,
1
,
1
,
1
),
"0001-01-01T00:00:00-00:00"
,
"0001-01-01T00:00:00"
);
doTest
(
util
::
DateTime
(
0
,
0
,
0
,
0
,
1
,
1
,
1
),
...
...
sax/source/tools/converter.cxx
Dosyayı görüntüle @
56dc7982
...
...
@@ -1207,16 +1207,20 @@ void Converter::convertDateTime(
const
sal_Unicode
zero
(
'0'
);
const
sal_Unicode
tee
(
'T'
);
if
(
i_rDateTime
.
Year
<
1000
)
{
sal_Int32
const
nYear
(
abs
(
i_rDateTime
.
Year
));
if
(
i_rDateTime
.
Year
<
0
)
{
i_rBuffer
.
append
(
dash
);
// negative
}
if
(
nYear
<
1000
)
{
i_rBuffer
.
append
(
zero
);
}
if
(
i_rDateTime
.
Year
<
100
)
{
if
(
n
Year
<
100
)
{
i_rBuffer
.
append
(
zero
);
}
if
(
i_rDateTime
.
Year
<
10
)
{
if
(
n
Year
<
10
)
{
i_rBuffer
.
append
(
zero
);
}
i_rBuffer
.
append
(
static_cast
<
sal_Int32
>
(
i_rDateTime
.
Year
)
).
append
(
dash
);
i_rBuffer
.
append
(
nYear
).
append
(
dash
);
if
(
i_rDateTime
.
Month
<
10
)
{
i_rBuffer
.
append
(
zero
);
}
...
...
@@ -1330,6 +1334,7 @@ bool Converter::convertDateOrDateTime(
bool
&
rbDateTime
,
const
OUString
&
rString
)
{
bool
bSuccess
=
true
;
bool
isNegative
(
false
);
const
OUString
string
=
rString
.
trim
().
toAsciiUpperCase
();
sal_Int32
nPos
(
0
);
...
...
@@ -1337,7 +1342,7 @@ bool Converter::convertDateOrDateTime(
{
if
(
sal_Unicode
(
'-'
)
==
string
[
nPos
])
{
//Negative Number
isNegative
=
true
;
++
nPos
;
}
}
...
...
@@ -1530,8 +1535,8 @@ bool Converter::convertDateOrDateTime(
{
if
(
bHaveTime
)
// time is optional
{
// util::DateTime does not support negative years!
rDateTime
.
Year
=
static_cast
<
sal_u
Int16
>
(
nYear
);
rDateTime
.
Year
=
((
isNegative
)
?
(
-
1
)
:
(
+
1
))
*
static_cast
<
sal_
Int16
>
(
nYear
);
rDateTime
.
Month
=
static_cast
<
sal_uInt16
>
(
nMonth
);
rDateTime
.
Day
=
static_cast
<
sal_uInt16
>
(
nDay
);
rDateTime
.
Hours
=
static_cast
<
sal_uInt16
>
(
nHours
);
...
...
@@ -1542,7 +1547,8 @@ bool Converter::convertDateOrDateTime(
}
else
{
rDate
.
Year
=
static_cast
<
sal_uInt16
>
(
nYear
);
rDate
.
Year
=
((
isNegative
)
?
(
-
1
)
:
(
+
1
))
*
static_cast
<
sal_Int16
>
(
nYear
);
rDate
.
Month
=
static_cast
<
sal_uInt16
>
(
nMonth
);
rDate
.
Day
=
static_cast
<
sal_uInt16
>
(
nDay
);
rbDateTime
=
false
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment