[Libreoffice-commits] .: svl/prj svl/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Fri Feb 25 07:44:43 PST 2011
svl/prj/build.lst | 2 -
svl/source/numbers/zformat.cxx | 79 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 80 insertions(+), 1 deletion(-)
New commits:
commit b237b8d1b20ee06e20407de27a198a9a8a0ca011
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Fri Feb 25 10:43:33 2011 -0500
Added i18npool as dependency to svl, the unit test now depends on it.
diff --git a/svl/prj/build.lst b/svl/prj/build.lst
index 8d121c7..b89cde5 100644
--- a/svl/prj/build.lst
+++ b/svl/prj/build.lst
@@ -1,4 +1,4 @@
-sl svl : l10n rsc offuh ucbhelper unotools cppu cppuhelper comphelper sal sot NULL
+sl svl : i18npool l10n rsc offuh ucbhelper unotools cppu cppuhelper comphelper sal sot NULL
sl svl usr1 - all svl_mkout NULL
sl svl\inc nmake - all svl_inc NULL
sl svl\unx\source\svdde nmake - u svl_usdde svl_inc NULL
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 461fac7..f5f1ec3 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -57,6 +57,48 @@
#include <cmath>
+#include <stdio.h>
+#include <string>
+#include <sys/time.h>
+
+namespace {
+
+class StackPrinter
+{
+public:
+ explicit StackPrinter(const char* msg) :
+ msMsg(msg)
+ {
+ fprintf(stdout, "%s: --begin\n", msMsg.c_str());
+ mfStartTime = getTime();
+ }
+
+ ~StackPrinter()
+ {
+ double fEndTime = getTime();
+ fprintf(stdout, "%s: --end (duration: %g sec)\n", msMsg.c_str(), (fEndTime-mfStartTime));
+ }
+
+ void printTime(int line) const
+ {
+ double fEndTime = getTime();
+ fprintf(stdout, "%s: --(%d) (duration: %g sec)\n", msMsg.c_str(), line, (fEndTime-mfStartTime));
+ }
+
+private:
+ double getTime() const
+ {
+ timeval tv;
+ gettimeofday(&tv, NULL);
+ return tv.tv_sec + tv.tv_usec / 1000000.0;
+ }
+
+ ::std::string msMsg;
+ double mfStartTime;
+};
+
+}
+
using namespace svt;
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
@@ -605,6 +647,9 @@ SvNumberformat::SvNumberformat(String& rString,
nNewStandardDefined(0),
bStarFlag( FALSE )
{
+ StackPrinter __stack_printer__("SvNumberformat::SvNumberformat");
+ fprintf(stdout, "SvNumberformat::SvNumberformat: str = '%s'\n",
+ rtl::OUStringToOString(rString, RTL_TEXTENCODING_UTF8).getStr());
// If the group (AKA thousand) separator is a Non-Breaking Space (French)
// replace all occurrences by a simple space.
// The tokens will be changed to the LocaleData separator again later on.
@@ -4245,6 +4290,8 @@ String SvNumberformat::GetMappedFormatstring(
const NfKeywordTable& rKeywords, const LocaleDataWrapper& rLocWrp,
BOOL bDontQuote ) const
{
+ StackPrinter __stack_printer__("SvNumberformat::GetMappedFormatstring");
+
String aStr;
BOOL bDefault[4];
// 1 subformat matches all if no condition specified,
@@ -4283,6 +4330,7 @@ String SvNumberformat::GetMappedFormatstring(
int nSub = 0; // subformats delimited so far
for ( int n=0; n<4; n++ )
{
+ fprintf(stdout, "SvNumberformat::GetMappedFormatstring: n = %d\n", n);
if ( n > 0 )
nSem++;
@@ -4303,6 +4351,9 @@ String SvNumberformat::GetMappedFormatstring(
}
}
+ fprintf(stdout, "SvNumberformat::GetMappedFormatstring: str = '%s' (%d)\n",
+ rtl::OUStringToOString(aStr, RTL_TEXTENCODING_UTF8).getStr(), __LINE__);
+
const String& rColorName = NumFor[n].GetColorName();
if ( rColorName.Len() )
{
@@ -4329,6 +4380,9 @@ String SvNumberformat::GetMappedFormatstring(
aPrefix += 't'; // must be lowercase, otherwise taken as literal
}
+ fprintf(stdout, "SvNumberformat::GetMappedFormatstring: str = '%s' (%d)\n",
+ rtl::OUStringToOString(aStr, RTL_TEXTENCODING_UTF8).getStr(), __LINE__);
+
USHORT nAnz = NumFor[n].GetnAnz();
if ( nSem && (nAnz || aPrefix.Len()) )
{
@@ -4338,8 +4392,16 @@ String SvNumberformat::GetMappedFormatstring(
bDefault[nSub] = FALSE;
}
+ fprintf(stdout, "SvNumberformat::GetMappedFormatstring: prefix = '%s'\n",
+ rtl::OUStringToOString(aPrefix, RTL_TEXTENCODING_UTF8).getStr());
+
if ( aPrefix.Len() )
+ {
aStr += aPrefix;
+ }
+
+ fprintf(stdout, "SvNumberformat::GetMappedFormatstring: str = '%s' (%d)\n",
+ rtl::OUStringToOString(aStr, RTL_TEXTENCODING_UTF8).getStr(), __LINE__);
if ( nAnz )
{
@@ -4350,29 +4412,41 @@ String SvNumberformat::GetMappedFormatstring(
if ( 0 <= pType[j] && pType[j] < NF_KEYWORD_ENTRIES_COUNT )
{
aStr += rKeywords[pType[j]];
+ fprintf(stdout, "SvNumberformat::GetMappedFormatstring: str = '%s' (%d)\n",
+ rtl::OUStringToOString(aStr, RTL_TEXTENCODING_UTF8).getStr(), __LINE__);
if( NF_KEY_NNNN == pType[j] )
+ {
aStr += rLocWrp.getLongDateDayOfWeekSep();
+ fprintf(stdout, "SvNumberformat::GetMappedFormatstring: str = '%s' (%d)\n",
+ rtl::OUStringToOString(aStr, RTL_TEXTENCODING_UTF8).getStr(), __LINE__);
+ }
}
else
{
switch ( pType[j] )
{
case NF_SYMBOLTYPE_DECSEP :
+ fprintf(stdout, "SvNumberformat::GetMappedFormatstring: decimal sep\n");
aStr += rLocWrp.getNumDecimalSep();
break;
case NF_SYMBOLTYPE_THSEP :
+ fprintf(stdout, "SvNumberformat::GetMappedFormatstring: thousand sep\n");
aStr += rLocWrp.getNumThousandSep();
break;
case NF_SYMBOLTYPE_DATESEP :
+ fprintf(stdout, "SvNumberformat::GetMappedFormatstring: date sep\n");
aStr += rLocWrp.getDateSep();
break;
case NF_SYMBOLTYPE_TIMESEP :
+ fprintf(stdout, "SvNumberformat::GetMappedFormatstring: time sep\n");
aStr += rLocWrp.getTimeSep();
break;
case NF_SYMBOLTYPE_TIME100SECSEP :
+ fprintf(stdout, "SvNumberformat::GetMappedFormatstring: time100sec sep\n");
aStr += rLocWrp.getTime100SecSep();
break;
case NF_SYMBOLTYPE_STRING :
+ fprintf(stdout, "SvNumberformat::GetMappedFormatstring: string\n");
if( bDontQuote )
aStr += pStr[j];
else if ( pStr[j].Len() == 1 )
@@ -4388,17 +4462,22 @@ String SvNumberformat::GetMappedFormatstring(
}
break;
default:
+ fprintf(stdout, "SvNumberformat::GetMappedFormatstring: default\n");
aStr += pStr[j];
}
}
}
}
+ fprintf(stdout, "SvNumberformat::GetMappedFormatstring: str = '%s' (%d)\n",
+ rtl::OUStringToOString(aStr, RTL_TEXTENCODING_UTF8).getStr(), __LINE__);
}
for ( ; nSub<4 && bDefault[nSub]; ++nSub )
{ // append empty subformats
aStr += ';';
}
+ fprintf(stdout, "SvNumberformat::GetMappedFormatstring: str = '%s'\n",
+ rtl::OUStringToOString(aStr, RTL_TEXTENCODING_UTF8).getStr());
return aStr;
}
More information about the Libreoffice-commits
mailing list