summaryrefslogtreecommitdiff
path: root/sax
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2008-02-26 13:41:18 +0000
committerOliver Bolte <obo@openoffice.org>2008-02-26 13:41:18 +0000
commite2a08789c2814ca37ac0c3d2320bd79528e06c7f (patch)
tree1f51fd2157e59f29547221ed0153a2e65b7a1c02 /sax
parentbe593b74dac0be5d7d8227b5cdaa03340fef7138 (diff)
INTEGRATION: CWS custommeta (1.2.8); FILE MERGED
2008/02/05 10:47:26 mst 1.2.8.1: - sax/source/tools/converter.cxx: + implement Converter::convertDateTime
Diffstat (limited to 'sax')
-rw-r--r--sax/source/tools/converter.cxx92
1 files changed, 47 insertions, 45 deletions
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index 02ac59ecea22..4f1c7b95212f 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: converter.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: obo $ $Date: 2008-01-10 12:52:53 $
+ * last change: $Author: obo $ $Date: 2008-02-26 14:41:18 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -962,53 +962,55 @@ bool Converter::convertTime( ::com::sun::star::util::DateTime& rDateTime,
/** convert util::DateTime to ISO Date String */
void Converter::convertDateTime(
- ::rtl::OUStringBuffer& rBuffer,
- const com::sun::star::util::DateTime& rDateTime,
- bool bAddTimeIf0AM )
+ ::rtl::OUStringBuffer& i_rBuffer,
+ const com::sun::star::util::DateTime& i_rDateTime,
+ bool i_bAddTimeIf0AM )
{
- OSL_ENSURE( false, "Converter::convertDateTime - not implemented, tools/String needs replacement" );
- (void)rBuffer;
- (void)rDateTime;
- (void)bAddTimeIf0AM;
-#if 0
- String aString( String::CreateFromInt32( rDateTime.Year ) );
- aString += '-';
- if( rDateTime.Month < 10 )
- aString += '0';
- aString += String::CreateFromInt32( rDateTime.Month );
- aString += '-';
- if( rDateTime.Day < 10 )
- aString += '0';
- aString += String::CreateFromInt32( rDateTime.Day );
-
- if( rDateTime.Seconds != 0 ||
- rDateTime.Minutes != 0 ||
- rDateTime.Hours != 0 ||
- bAddTimeIf0AM )
+ const sal_Unicode dash('-');
+ const sal_Unicode col (':');
+ const sal_Unicode dot ('.');
+ const sal_Unicode zero('0');
+ const sal_Unicode tee ('T');
+
+ i_rBuffer.append( static_cast<sal_Int32>(i_rDateTime.Year) ).append(dash);
+ if( i_rDateTime.Month < 10 ) {
+ i_rBuffer.append(zero);
+ }
+ i_rBuffer.append( static_cast<sal_Int32>(i_rDateTime.Month) ).append(dash);
+ if( i_rDateTime.Day < 10 ) {
+ i_rBuffer.append(zero);
+ }
+ i_rBuffer.append( static_cast<sal_Int32>(i_rDateTime.Day) );
+
+ if( i_rDateTime.Seconds != 0 ||
+ i_rDateTime.Minutes != 0 ||
+ i_rDateTime.Hours != 0 ||
+ i_bAddTimeIf0AM )
{
- aString += 'T';
- if( rDateTime.Hours < 10 )
- aString += '0';
- aString += String::CreateFromInt32( rDateTime.Hours );
- aString += ':';
- if( rDateTime.Minutes < 10 )
- aString += '0';
- aString += String::CreateFromInt32( rDateTime.Minutes );
- aString += ':';
- if( rDateTime.Seconds < 10 )
- aString += '0';
- aString += String::CreateFromInt32( rDateTime.Seconds );
- if ( rDateTime.HundredthSeconds > 0)
- {
- aString += '.';
- if (rDateTime.HundredthSeconds < 10)
- aString += '0';
- aString += String::CreateFromInt32( rDateTime.HundredthSeconds );
+ i_rBuffer.append(tee);
+ if( i_rDateTime.Hours < 10 ) {
+ i_rBuffer.append(zero);
+ }
+ i_rBuffer.append( static_cast<sal_Int32>(i_rDateTime.Hours) )
+ .append(col);
+ if( i_rDateTime.Minutes < 10 ) {
+ i_rBuffer.append(zero);
+ }
+ i_rBuffer.append( static_cast<sal_Int32>(i_rDateTime.Minutes) )
+ .append(col);
+ if( i_rDateTime.Seconds < 10 ) {
+ i_rBuffer.append(zero);
+ }
+ i_rBuffer.append( static_cast<sal_Int32>(i_rDateTime.Seconds) );
+ if( i_rDateTime.HundredthSeconds > 0 ) {
+ i_rBuffer.append(dot);
+ if( i_rDateTime.HundredthSeconds < 10 ) {
+ i_rBuffer.append(zero);
+ }
+ i_rBuffer.append(
+ static_cast<sal_Int32>(i_rDateTime.HundredthSeconds) );
}
}
-
- rBuffer.append( aString );
-#endif
}
/** convert ISO Date String to util::DateTime */