diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-29 16:05:55 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-29 16:05:55 +0000 |
commit | 87a016680e3677da3993f333561e79eb0cead7d5 (patch) | |
tree | cbda2b4df8b8ee0d8d1617e6c75bec1e3ee0ccba /microbe/microbe.cpp | |
parent | 6ce3d1ad09c1096b5ed3db334e02859e45d5c32b (diff) | |
download | ktechlab-87a016680e3677da3993f333561e79eb0cead7d5.tar.gz ktechlab-87a016680e3677da3993f333561e79eb0cead7d5.zip |
TQt4 port ktechlab
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktechlab@1238801 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'microbe/microbe.cpp')
-rw-r--r-- | microbe/microbe.cpp | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/microbe/microbe.cpp b/microbe/microbe.cpp index d94cba7..847dc88 100644 --- a/microbe/microbe.cpp +++ b/microbe/microbe.cpp @@ -26,7 +26,7 @@ #include <kdebug.h> #include <klocale.h> -#include <qfile.h> +#include <tqfile.h> #include <iostream> using namespace std; @@ -56,7 +56,7 @@ Microbe::Microbe() { for ( unsigned col = 0; col < 6; ++col ) { - m_aliasList[ QString("Keypad_%1_%2").arg(row+1).arg(col+1) ] = QString::number( bv[row][col] ); + m_aliasList[ TQString("Keypad_%1_%2").tqarg(row+1).tqarg(col+1) ] = TQString::number( bv[row][col] ); } } @@ -70,12 +70,12 @@ Microbe::~Microbe() } -QString Microbe::compile( const QString & url, bool showSource, bool optimize ) +TQString Microbe::compile( const TQString & url, bool showSource, bool optimize ) { - QFile file( url ); + TQFile file( url ); if( file.open( IO_ReadOnly ) ) { - QTextStream stream(&file); + TQTextStream stream(&file); unsigned line = 0; while( !stream.atEnd() ) m_program += SourceLine( stream.readLine(), url, line++ ); @@ -84,7 +84,7 @@ QString Microbe::compile( const QString & url, bool showSource, bool optimize ) } else { - m_errorReport += i18n("Could not open file '%1'\n").arg(url); + m_errorReport += i18n("Could not open file '%1'\n").tqarg(url); return 0; } @@ -134,8 +134,8 @@ void Microbe::simplifyProgram() SourceLineList::const_iterator end = m_program.end(); for ( SourceLineList::const_iterator it = m_program.begin(); it != end; ++it ) { - QString code = (*it).text(); - QString simplifiedLine; + TQString code = (*it).text(); + TQString simplifiedLine; if ( commentType == SingleLine ) commentType = None; @@ -144,7 +144,7 @@ void Microbe::simplifyProgram() for ( unsigned i = 0; i < l; ++i ) { - QChar c = code[i]; + TQChar c = code[i]; switch ( c ) { case '/': @@ -207,16 +207,16 @@ void Microbe::simplifyProgram() } -void Microbe::compileError( MistakeType type, const QString & context, const SourceLine & sourceLine ) +void Microbe::compileError( MistakeType type, const TQString & context, const SourceLine & sourceLine ) { - QString message; + TQString message; switch (type) { case UnknownStatement: message = i18n("Unknown statement"); break; case InvalidPort: - message = i18n("Port '%1' is not supported by target PIC").arg(context); + message = i18n("Port '%1' is not supported by target PIC").tqarg(context); break; case UnassignedPin: message = i18n("Pin identifier was not followed by '='"); @@ -225,19 +225,19 @@ void Microbe::compileError( MistakeType type, const QString & context, const Sou message = i18n("Pin state can only be 'high' or 'low'"); break; case UnassignedPort: - message = i18n("Invalid token '%1'. Port identifier should be followed by '='").arg(context); + message = i18n("Invalid token '%1'. Port identifier should be followed by '='").tqarg(context); break; case UnexpectedStatementBeforeBracket: message = i18n("Unexpected statement before '{'"); break; case MismatchedBrackets: - message = i18n("Mismatched brackets in expression '%1'").arg(context); + message = i18n("Mismatched brackets in expression '%1'").tqarg(context); break; case InvalidEquals: message = i18n("Invalid '=' found in expression"); break; case ReservedKeyword: - message = i18n("Reserved keyword '%1' cannot be a variable name.").arg(context); + message = i18n("Reserved keyword '%1' cannot be a variable name.").tqarg(context); break; case ConsecutiveOperators: message = i18n("Nothing between operators"); @@ -249,10 +249,10 @@ void Microbe::compileError( MistakeType type, const QString & context, const Sou if ( context.isEmpty() ) message = i18n("Unknown variable"); else - message = i18n("Unknown variable '%1'").arg(context); + message = i18n("Unknown variable '%1'").tqarg(context); break; case UnopenableInclude: - message = i18n("Could not open include file '%1'").arg(context); + message = i18n("Could not open include file '%1'").tqarg(context); break; case DivisionByZero: message = i18n("Division by zero"); @@ -267,7 +267,7 @@ void Microbe::compileError( MistakeType type, const QString & context, const Sou message = i18n("Delay must be a positive constant value"); break; case HighLowExpected: - message = i18n("'high' or 'low' expected after pin expression '%1'").arg(context); + message = i18n("'high' or 'low' expected after pin expression '%1'").tqarg(context); break; case InvalidComparison: message = i18n("Comparison operator in '%1' is not recognized"); @@ -285,7 +285,7 @@ void Microbe::compileError( MistakeType type, const QString & context, const Sou message = i18n("Extra tokens at end of line"); break; case FixedStringExpected: - message = i18n("Expected '%1'").arg(context); + message = i18n("Expected '%1'").tqarg(context); break; case PinListExpected: message = i18n("Pin list expected"); @@ -300,19 +300,19 @@ void Microbe::compileError( MistakeType type, const QString & context, const Sou message = i18n("Interrupt already definied"); break; case ReadOnlyVariable: - message = i18n("Variable '%1' is read only").arg(context); + message = i18n("Variable '%1' is read only").tqarg(context); break; case WriteOnlyVariable: - message = i18n("Variable '%1' is write only").arg(context); + message = i18n("Variable '%1' is write only").tqarg(context); break; case InvalidPinMapSize: message = i18n("Invalid pin list size"); break; case VariableRedefined: - message = i18n("Variable '%1' is already defined").arg(context); + message = i18n("Variable '%1' is already defined").tqarg(context); break; case InvalidVariableName: - message = i18n("'%1' is not a valid variable name").arg(context); + message = i18n("'%1' is not a valid variable name").tqarg(context); break; case VariableExpected: message = i18n("Variable expected"); @@ -323,15 +323,15 @@ void Microbe::compileError( MistakeType type, const QString & context, const Sou } - m_errorReport += QString("%1:%2:Error [%3] %4\n") - .arg( sourceLine.url() ) - .arg( sourceLine.line()+1 ) - .arg( type ) - .arg( message ); + m_errorReport += TQString("%1:%2:Error [%3] %4\n") + .tqarg( sourceLine.url() ) + .tqarg( sourceLine.line()+1 ) + .tqarg( type ) + .tqarg( message ); } -bool Microbe::isValidVariableName( const QString & variableName ) +bool Microbe::isValidVariableName( const TQString & variableName ) { if ( variableName.isEmpty() ) return false; @@ -359,7 +359,7 @@ void Microbe::addVariable( const Variable & variable ) } -Variable Microbe::variable( const QString & name ) const +Variable Microbe::variable( const TQString & name ) const { VariableList::const_iterator end = m_variables.end(); for ( VariableList::const_iterator it = m_variables.begin(); it != end; ++it ) @@ -371,7 +371,7 @@ Variable Microbe::variable( const QString & name ) const } -bool Microbe::isVariableKnown( const QString & name ) const +bool Microbe::isVariableKnown( const TQString & name ) const { return variable(name).type() != Variable::invalidType; } @@ -384,41 +384,41 @@ void Microbe::addDelayRoutineWanted( unsigned routine ) } -void Microbe::addAlias( const QString & name, const QString & dest ) +void Microbe::addAlias( const TQString & name, const TQString & dest ) { m_aliasList[name] = dest; } -QString Microbe::alias( const QString & alias ) const +TQString Microbe::alias( const TQString & alias ) const { // If the string is an alias, return the real string, // otherwise just return the alias as that is the real string. - AliasMap::const_iterator it = m_aliasList.find(alias); + AliasMap::const_iterator it = m_aliasList.tqfind(alias); if ( it != m_aliasList.constEnd() ) return it.data(); return alias; } -void Microbe::setInterruptUsed(const QString &interruptName) +void Microbe::setInterruptUsed(const TQString &interruptName) { // Don't add it again if it is already in the list - if ( m_usedInterrupts.contains( interruptName ) ) + if ( m_usedInterrupts.tqcontains( interruptName ) ) return; m_usedInterrupts.append(interruptName); } -bool Microbe::isInterruptUsed( const QString & interruptName ) +bool Microbe::isInterruptUsed( const TQString & interruptName ) { - return m_usedInterrupts.contains( interruptName ); + return m_usedInterrupts.tqcontains( interruptName ); } -QString Microbe::dest() const +TQString Microbe::dest() const { - return QString("__op%1").arg(m_dest); + return TQString("__op%1").tqarg(m_dest); } @@ -445,7 +445,7 @@ void Microbe::resetDest() //BEGIN class SourceLine -SourceLine::SourceLine( const QString & text, const QString & url, int line ) +SourceLine::SourceLine( const TQString & text, const TQString & url, int line ) { m_text = text; m_url = url; @@ -459,9 +459,9 @@ SourceLine::SourceLine() } -QStringList SourceLine::toStringList( const SourceLineList & lines ) +TQStringList SourceLine::toStringList( const SourceLineList & lines ) { - QStringList joined; + TQStringList joined; SourceLineList::const_iterator end = lines.end(); for ( SourceLineList::const_iterator it = lines.begin(); it != end; ++it ) joined << (*it).text(); |