diff options
Diffstat (limited to 'krecipes/src/datablocks/mixednumber.cpp')
-rw-r--r-- | krecipes/src/datablocks/mixednumber.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/krecipes/src/datablocks/mixednumber.cpp b/krecipes/src/datablocks/mixednumber.cpp index bc999f2..9318567 100644 --- a/krecipes/src/datablocks/mixednumber.cpp +++ b/krecipes/src/datablocks/mixednumber.cpp @@ -9,16 +9,16 @@ ***************************************************************************/ #include "mixednumber.h" -#include <qregexp.h> +#include <ntqregexp.h> #include <kglobal.h> #include <klocale.h> #include <kdebug.h> -QString beautify( const QString &num ) +TQString beautify( const TQString &num ) { - QString copy( num ); - copy.remove( QRegExp( QString( "(%1){0,1}0+$" ).arg( QRegExp::escape( KGlobal::locale() ->decimalSymbol() ) ) ) ); + TQString copy( num ); + copy.remove( TQRegExp( TQString( "(%1){0,1}0+$" ).arg( TQRegExp::escape( KGlobal::locale() ->decimalSymbol() ) ) ) ); return copy; } @@ -95,19 +95,19 @@ MixedNumber::MixedNumber( double decimal, double precision ) : MixedNumber::~MixedNumber() {} -int MixedNumber::getNumerator( const QString &input, int space_index, int slash_index, bool *ok ) +int MixedNumber::getNumerator( const TQString &input, int space_index, int slash_index, bool *ok ) { return input.mid( space_index + 1, slash_index - space_index - 1 ).toInt( ok ); } -int MixedNumber::getDenominator( const QString &input, int slash_index, bool *ok ) +int MixedNumber::getDenominator( const TQString &input, int slash_index, bool *ok ) { return input.mid( slash_index + 1, input.length() ).toInt( ok ); } -MixedNumber MixedNumber::fromString( const QString &str, bool *ok, bool locale_aware ) +MixedNumber MixedNumber::fromString( const TQString &str, bool *ok, bool locale_aware ) { - QString input = str.stripWhiteSpace(); + TQString input = str.stripWhiteSpace(); if ( input.isEmpty() ) { if ( ok ) { *ok = true; @@ -129,7 +129,7 @@ MixedNumber MixedNumber::fromString( const QString &str, bool *ok, bool locale_a if ( space_index == -1 ) { if ( slash_index == -1 ) //input contains no fractional part { - QString decimal_symbol = ( locale_aware ) ? locale->decimalSymbol() : "."; + TQString decimal_symbol = ( locale_aware ) ? locale->decimalSymbol() : "."; if ( input.endsWith( decimal_symbol ) ) { if ( ok ) { @@ -215,29 +215,29 @@ MixedNumber MixedNumber::fromString( const QString &str, bool *ok, bool locale_a return MixedNumber( whole, numerator, denominator ); } -QString MixedNumber::toString( Format format, bool locale_aware ) const +TQString MixedNumber::toString( Format format, bool locale_aware ) const { if ( format == DecimalFormat ) { if ( locale_aware ) return beautify( locale->formatNumber( toDouble(), 5 ) ); else - return QString::number( toDouble() ); + return TQString::number( toDouble() ); } if ( m_numerator == 0 && m_whole == 0 ) - return QString( "0" ); + return TQString( "0" ); - QString result; + TQString result; if ( m_whole != 0 ) { - result += QString::number( m_whole ); + result += TQString::number( m_whole ); if ( m_numerator != 0 ) result += " "; } if ( m_numerator != 0 ) - result += QString::number( m_numerator ) + "/" + QString::number( m_denominator ); + result += TQString::number( m_numerator ) + "/" + TQString::number( m_denominator ); return result; } |