summaryrefslogtreecommitdiffstats
path: root/kcalc/knumber
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-23 01:42:07 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-23 01:42:07 +0000
commita2277b6bc715464e83882b90c2a058139b8a6b54 (patch)
treeab09b14014f59b4d8e2ddd12226aa0b22e4dfc5d /kcalc/knumber
parentd3f79e04b34bd1f70a458b81b28fc8799498c8dc (diff)
downloadtdeutils-a2277b6bc715464e83882b90c2a058139b8a6b54.tar.gz
tdeutils-a2277b6bc715464e83882b90c2a058139b8a6b54.zip
TQt4 port kdeutils
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeutils@1238125 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kcalc/knumber')
-rw-r--r--kcalc/knumber/knumber.cpp16
-rw-r--r--kcalc/knumber/knumber.h8
-rw-r--r--kcalc/knumber/knumber_priv.cpp2
-rw-r--r--kcalc/knumber/tests/knumbertest.cpp4
4 files changed, 15 insertions, 15 deletions
diff --git a/kcalc/knumber/knumber.cpp b/kcalc/knumber/knumber.cpp
index 80bae1f..123fee7 100644
--- a/kcalc/knumber/knumber.cpp
+++ b/kcalc/knumber/knumber.cpp
@@ -276,7 +276,7 @@ static void _inc_by_one(TQString &str, int position)
// Cut off if more digits in fractional part than 'precision'
static void _round(TQString &str, int precision)
{
- int decimalSymbolPos = str.find('.');
+ int decimalSymbolPos = str.tqfind('.');
if (decimalSymbolPos == -1)
if (precision == 0) return;
@@ -312,7 +312,7 @@ static void _round(TQString &str, int precision)
break;
}
- decimalSymbolPos = str.find('.');
+ decimalSymbolPos = str.tqfind('.');
str.truncate(decimalSymbolPos + precision + 1);
// if precision == 0 delete also '.'
@@ -349,7 +349,7 @@ static TQString roundNumber(const TQString &numStr, int precision)
}
-TQString const KNumber::toQString(int width, int prec) const
+TQString const KNumber::toTQString(int width, int prec) const
{
TQString tmp_str;
@@ -360,7 +360,7 @@ TQString const KNumber::toQString(int width, int prec) const
if (width > 0) { //result needs to be cut-off
bool tmp_bool = _fraction_input; // stupid work-around
_fraction_input = false;
- tmp_str = (KNumber("1.0")*(*this)).toQString(width, -1);
+ tmp_str = (KNumber("1.0")*(*this)).toTQString(width, -1);
_fraction_input = tmp_bool;
} else
tmp_str = TQString(_num->ascii());
@@ -369,7 +369,7 @@ TQString const KNumber::toQString(int width, int prec) const
if (_float_output) {
bool tmp_bool = _fraction_input; // stupid work-around
_fraction_input = false;
- tmp_str = (KNumber("1.0")*(*this)).toQString(width, -1);
+ tmp_str = (KNumber("1.0")*(*this)).toTQString(width, -1);
_fraction_input = tmp_bool;
} else { // _float_output == false
if(_splitoffinteger_output) {
@@ -378,9 +378,9 @@ TQString const KNumber::toQString(int width, int prec) const
if (int_part == Zero)
tmp_str = TQString(_num->ascii());
else if (int_part < Zero)
- tmp_str = int_part.toQString() + " " + (int_part - *this)._num->ascii();
+ tmp_str = int_part.toTQString() + " " + (int_part - *this)._num->ascii();
else
- tmp_str = int_part.toQString() + " " + (*this - int_part)._num->ascii();
+ tmp_str = int_part.toTQString() + " " + (*this - int_part)._num->ascii();
} else
tmp_str = TQString(_num->ascii());
@@ -388,7 +388,7 @@ TQString const KNumber::toQString(int width, int prec) const
//result needs to be cut-off
bool tmp_bool = _fraction_input; // stupid work-around
_fraction_input = false;
- tmp_str = (KNumber("1.0")*(*this)).toQString(width, -1);
+ tmp_str = (KNumber("1.0")*(*this)).toTQString(width, -1);
_fraction_input = tmp_bool;
}
}
diff --git a/kcalc/knumber/knumber.h b/kcalc/knumber/knumber.h
index 02fce32..2ca3b5c 100644
--- a/kcalc/knumber/knumber.h
+++ b/kcalc/knumber/knumber.h
@@ -36,8 +36,8 @@ class TQString;
* KNumber is based on the GMP (GNU Multiprecision) library and
* provides transparent support to integer, fractional and floating
* point number. It contains rudimentary error handling, and also
- * includes methods for converting the numbers to QStrings for
- * output, and to read QStrings to obtain a KNumber.
+ * includes methods for converting the numbers to TQStrings for
+ * output, and to read TQStrings to obtain a KNumber.
*
* The different types of numbers that can be represented by objects
* of this class will be described below:
@@ -130,7 +130,7 @@ class KDE_EXPORT KNumber
NumType type(void) const;
/**
- * Set whether the output of numbers (with KNumber::toQString)
+ * Set whether the output of numbers (with KNumber::toTQString)
* should happen as floating point numbers or not. This method has
* in fact only an effect on numbers of type @p
* NumType::FractionType, which can be either displayed as fractions
@@ -179,7 +179,7 @@ class KDE_EXPORT KNumber
* is ignored.
*
*/
- TQString const toQString(int width = -1, int prec = -1) const;
+ TQString const toTQString(int width = -1, int prec = -1) const;
/**
* Compute the absolute value, i.e. @p x.abs() returns the value
diff --git a/kcalc/knumber/knumber_priv.cpp b/kcalc/knumber/knumber_priv.cpp
index 56de7d3..8f69a5d 100644
--- a/kcalc/knumber/knumber_priv.cpp
+++ b/kcalc/knumber/knumber_priv.cpp
@@ -190,7 +190,7 @@ TQString const _knumerror::ascii(int prec) const
case MinusInfinity:
return TQString("-inf");
default:
- return TQString::null;
+ return TQString();
}
}
diff --git a/kcalc/knumber/tests/knumbertest.cpp b/kcalc/knumber/tests/knumbertest.cpp
index e34d94d..0d45355 100644
--- a/kcalc/knumber/tests/knumbertest.cpp
+++ b/kcalc/knumber/tests/knumbertest.cpp
@@ -32,13 +32,13 @@ void checkResult(TQString const &string, KNumber const & result,
{
std::cout << "Testing result of: " << string.ascii() <<
" should give " << desired_string.ascii() << " and gives " <<
- result.toQString(8).ascii() << "....\n";
+ result.toTQString(8).ascii() << "....\n";
std::cout << "The type of the result should be " <<
numtypeToString(desired).ascii() << " and gives " <<
numtypeToString(result.type()).ascii() << ".... ";
if (result.type() == desired &&
- result.toQString(8) == desired_string) {
+ result.toTQString(8) == desired_string) {
std::cout << "OK\n";
return;
}