diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kformula/fsparser.cc | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kformula/fsparser.cc')
-rw-r--r-- | kformula/fsparser.cc | 228 |
1 files changed, 114 insertions, 114 deletions
diff --git a/kformula/fsparser.cc b/kformula/fsparser.cc index 4b7f1c88..3d425a16 100644 --- a/kformula/fsparser.cc +++ b/kformula/fsparser.cc @@ -17,7 +17,7 @@ * Boston, MA 02110-1301, USA. */ -#include <qptrlist.h> +#include <tqptrlist.h> #include <kdebug.h> #include <klocale.h> @@ -36,7 +36,7 @@ public: ParserNode() { debugCount++; } virtual ~ParserNode() { debugCount--; } //virtual void output( ostream& ) = 0; - virtual void buildXML( QDomDocument& doc, QDomElement element ) = 0; + virtual void buildXML( TQDomDocument& doc, TQDomElement element ) = 0; virtual bool isSimple() { return false; } static int debugCount; @@ -46,36 +46,36 @@ int ParserNode::debugCount = 0; class PrimaryNode : public ParserNode { public: - PrimaryNode( QString primary ) : m_primary( primary ), m_functionName( false ) {} + PrimaryNode( TQString primary ) : m_primary( primary ), m_functionName( false ) {} //virtual void output( ostream& stream ) { stream << "PrimaryNode {" << m_primary << "}" << endl; } - virtual void buildXML( QDomDocument& doc, QDomElement element ); + virtual void buildXML( TQDomDocument& doc, TQDomElement element ); virtual bool isSimple() { return true; } - void setUnicode( QChar unicode ) { m_unicode = unicode; } + void setUnicode( TQChar tqunicode ) { m_tqunicode = tqunicode; } void setFunctionName( bool functionName ) { m_functionName = functionName; } - QString primary() const { return m_primary; } + TQString primary() const { return m_primary; } private: - QString m_primary; - QChar m_unicode; + TQString m_primary; + TQChar m_tqunicode; bool m_functionName; }; -void PrimaryNode::buildXML( QDomDocument& doc, QDomElement element ) +void PrimaryNode::buildXML( TQDomDocument& doc, TQDomElement element ) { - if ( m_unicode != QChar::null ) { - QDomElement de = doc.createElement( "TEXT" ); - de.setAttribute( "CHAR", QString( m_unicode ) ); + if ( m_tqunicode != TQChar::null ) { + TQDomElement de = doc.createElement( "TEXT" ); + de.setAttribute( "CHAR", TQString( m_tqunicode ) ); de.setAttribute( "SYMBOL", "3" ); element.appendChild( de ); } else { if ( m_functionName ) { - QDomElement namesequence = doc.createElement( "NAMESEQUENCE" ); + TQDomElement namesequence = doc.createElement( "NAMESEQUENCE" ); element.appendChild( namesequence ); element = namesequence; } for ( uint i = 0; i < m_primary.length(); i++ ) { - QDomElement de = doc.createElement( "TEXT" ); - de.setAttribute( "CHAR", QString( m_primary[i] ) ); + TQDomElement de = doc.createElement( "TEXT" ); + de.setAttribute( "CHAR", TQString( m_primary[i] ) ); element.appendChild( de ); } } @@ -85,14 +85,14 @@ class UnaryMinus : public ParserNode { public: UnaryMinus( ParserNode* primary ) : m_primary( primary ) {} ~UnaryMinus() { delete m_primary; } - virtual void buildXML( QDomDocument& doc, QDomElement element ); + virtual void buildXML( TQDomDocument& doc, TQDomElement element ); private: ParserNode* m_primary; }; -void UnaryMinus::buildXML( QDomDocument& doc, QDomElement element ) +void UnaryMinus::buildXML( TQDomDocument& doc, TQDomElement element ) { - QDomElement de = doc.createElement( "TEXT" ); + TQDomElement de = doc.createElement( "TEXT" ); de.setAttribute( "CHAR", "-" ); element.appendChild( de ); m_primary->buildXML( doc, element ); @@ -100,7 +100,7 @@ void UnaryMinus::buildXML( QDomDocument& doc, QDomElement element ) class OperatorNode : public ParserNode { public: - OperatorNode( QString type, ParserNode* lhs, ParserNode* rhs ) + OperatorNode( TQString type, ParserNode* lhs, ParserNode* rhs ) : m_type( type ), m_lhs( lhs ), m_rhs( rhs ) {} ~OperatorNode() { delete m_rhs; delete m_lhs; } // virtual void output( ostream& stream ) { @@ -108,64 +108,64 @@ public: // m_lhs->output( stream ); stream << m_type; m_rhs->output( stream ); // stream << "}" << endl; } protected: - QString m_type; + TQString m_type; ParserNode* m_lhs; ParserNode* m_rhs; }; class AssignNode : public OperatorNode { public: - AssignNode( QString type, ParserNode* lhs, ParserNode* rhs ) : OperatorNode( type, lhs, rhs ) {} - virtual void buildXML( QDomDocument& doc, QDomElement element ); + AssignNode( TQString type, ParserNode* lhs, ParserNode* rhs ) : OperatorNode( type, lhs, rhs ) {} + virtual void buildXML( TQDomDocument& doc, TQDomElement element ); }; -void AssignNode::buildXML( QDomDocument& doc, QDomElement element ) +void AssignNode::buildXML( TQDomDocument& doc, TQDomElement element ) { m_lhs->buildXML( doc, element ); - QDomElement de = doc.createElement( "TEXT" ); - de.setAttribute( "CHAR", QString( m_type ) ); + TQDomElement de = doc.createElement( "TEXT" ); + de.setAttribute( "CHAR", TQString( m_type ) ); element.appendChild( de ); m_rhs->buildXML( doc, element ); } class ExprNode : public OperatorNode { public: - ExprNode( QString type, ParserNode* lhs, ParserNode* rhs ) : OperatorNode( type, lhs, rhs ) {} - virtual void buildXML( QDomDocument& doc, QDomElement element ); + ExprNode( TQString type, ParserNode* lhs, ParserNode* rhs ) : OperatorNode( type, lhs, rhs ) {} + virtual void buildXML( TQDomDocument& doc, TQDomElement element ); }; -void ExprNode::buildXML( QDomDocument& doc, QDomElement element ) +void ExprNode::buildXML( TQDomDocument& doc, TQDomElement element ) { m_lhs->buildXML( doc, element ); - QDomElement de = doc.createElement( "TEXT" ); - de.setAttribute( "CHAR", QString( m_type ) ); + TQDomElement de = doc.createElement( "TEXT" ); + de.setAttribute( "CHAR", TQString( m_type ) ); element.appendChild( de ); m_rhs->buildXML( doc, element ); } class TermNode : public OperatorNode { public: - TermNode( QString type, ParserNode* lhs, ParserNode* rhs ) : OperatorNode( type, lhs, rhs ) {} - virtual void buildXML( QDomDocument& doc, QDomElement element ); + TermNode( TQString type, ParserNode* lhs, ParserNode* rhs ) : OperatorNode( type, lhs, rhs ) {} + virtual void buildXML( TQDomDocument& doc, TQDomElement element ); }; -void TermNode::buildXML( QDomDocument& doc, QDomElement element ) +void TermNode::buildXML( TQDomDocument& doc, TQDomElement element ) { if ( m_type == "*" ) { m_lhs->buildXML( doc, element ); - QDomElement de = doc.createElement( "TEXT" ); - de.setAttribute( "CHAR", QString( m_type ) ); + TQDomElement de = doc.createElement( "TEXT" ); + de.setAttribute( "CHAR", TQString( m_type ) ); element.appendChild( de ); m_rhs->buildXML( doc, element ); } else { - QDomElement fraction = doc.createElement( "FRACTION" ); - QDomElement numerator = doc.createElement( "NUMERATOR" ); - QDomElement sequence = doc.createElement( "SEQUENCE" ); + TQDomElement fraction = doc.createElement( "FRACTION" ); + TQDomElement numerator = doc.createElement( "NUMERATOR" ); + TQDomElement sequence = doc.createElement( "SEQUENCE" ); m_lhs->buildXML( doc, sequence ); numerator.appendChild( sequence ); fraction.appendChild( numerator ); - QDomElement denominator = doc.createElement( "DENOMINATOR" ); + TQDomElement denominator = doc.createElement( "DENOMINATOR" ); sequence = doc.createElement( "SEQUENCE" ); m_rhs->buildXML( doc, sequence ); denominator.appendChild( sequence ); @@ -177,20 +177,20 @@ void TermNode::buildXML( QDomDocument& doc, QDomElement element ) class PowerNode : public OperatorNode { public: - PowerNode( QString type, ParserNode* lhs, ParserNode* rhs ) : OperatorNode( type, lhs, rhs ) {} - virtual void buildXML( QDomDocument& doc, QDomElement element ); + PowerNode( TQString type, ParserNode* lhs, ParserNode* rhs ) : OperatorNode( type, lhs, rhs ) {} + virtual void buildXML( TQDomDocument& doc, TQDomElement element ); }; -void PowerNode::buildXML( QDomDocument& doc, QDomElement element ) +void PowerNode::buildXML( TQDomDocument& doc, TQDomElement element ) { - QDomElement index = doc.createElement( "INDEX" ); - QDomElement content = doc.createElement( "CONTENT" ); - QDomElement sequence = doc.createElement( "SEQUENCE" ); + TQDomElement index = doc.createElement( "INDEX" ); + TQDomElement content = doc.createElement( "CONTENT" ); + TQDomElement sequence = doc.createElement( "SEQUENCE" ); content.appendChild( sequence ); index.appendChild( content ); if ( !m_lhs->isSimple() ) { - QDomElement bracket = doc.createElement( "BRACKET" ); + TQDomElement bracket = doc.createElement( "BRACKET" ); bracket.setAttribute( "LEFT", '(' ); bracket.setAttribute( "RIGHT", ')' ); sequence.appendChild( bracket ); @@ -203,14 +203,14 @@ void PowerNode::buildXML( QDomDocument& doc, QDomElement element ) } m_lhs->buildXML( doc, sequence ); if ( m_type == "_" ) { - QDomElement lowerRight = doc.createElement( "LOWERRIGHT" ); + TQDomElement lowerRight = doc.createElement( "LOWERRIGHT" ); sequence = doc.createElement( "SEQUENCE" ); m_rhs->buildXML( doc, sequence ); lowerRight.appendChild( sequence ); index.appendChild( lowerRight ); } else { - QDomElement upperRight = doc.createElement( "UPPERRIGHT" ); + TQDomElement upperRight = doc.createElement( "UPPERRIGHT" ); sequence = doc.createElement( "SEQUENCE" ); m_rhs->buildXML( doc, sequence ); upperRight.appendChild( sequence ); @@ -222,24 +222,24 @@ void PowerNode::buildXML( QDomDocument& doc, QDomElement element ) class FunctionNode : public ParserNode { public: - FunctionNode( PrimaryNode* name, QPtrList<ParserNode>& args ) : m_name( name ), m_args( args ) { + FunctionNode( PrimaryNode* name, TQPtrList<ParserNode>& args ) : m_name( name ), m_args( args ) { m_args.setAutoDelete( true ); } ~FunctionNode() { delete m_name; } //virtual void output( ostream& stream ); - virtual void buildXML( QDomDocument& doc, QDomElement element ); + virtual void buildXML( TQDomDocument& doc, TQDomElement element ); private: - void buildSymbolXML( QDomDocument& doc, QDomElement element, KFormula::SymbolType type ); + void buildSymbolXML( TQDomDocument& doc, TQDomElement element, KFormula::SymbolType type ); PrimaryNode* m_name; - QPtrList<ParserNode> m_args; + TQPtrList<ParserNode> m_args; }; -void FunctionNode::buildSymbolXML( QDomDocument& doc, QDomElement element, KFormula::SymbolType type ) +void FunctionNode::buildSymbolXML( TQDomDocument& doc, TQDomElement element, KFormula::SymbolType type ) { - QDomElement symbol = doc.createElement( "SYMBOL" ); + TQDomElement symbol = doc.createElement( "SYMBOL" ); symbol.setAttribute( "TYPE", type ); - QDomElement content = doc.createElement( "CONTENT" ); - QDomElement sequence = doc.createElement( "SEQUENCE" ); + TQDomElement content = doc.createElement( "CONTENT" ); + TQDomElement sequence = doc.createElement( "SEQUENCE" ); m_args.at( 0 )->buildXML( doc, sequence ); content.appendChild( sequence ); symbol.appendChild( content ); @@ -247,13 +247,13 @@ void FunctionNode::buildSymbolXML( QDomDocument& doc, QDomElement element, KForm ParserNode* lowerLimit = m_args.at( m_args.count()-2 ); ParserNode* upperLimit = m_args.at( m_args.count()-1 ); - QDomElement lower = doc.createElement( "LOWER" ); + TQDomElement lower = doc.createElement( "LOWER" ); sequence = doc.createElement( "SEQUENCE" ); lowerLimit->buildXML( doc, sequence ); lower.appendChild( sequence ); symbol.appendChild( lower ); - QDomElement upper = doc.createElement( "UPPER" ); + TQDomElement upper = doc.createElement( "UPPER" ); sequence = doc.createElement( "SEQUENCE" ); upperLimit->buildXML( doc, sequence ); upper.appendChild( sequence ); @@ -262,25 +262,25 @@ void FunctionNode::buildSymbolXML( QDomDocument& doc, QDomElement element, KForm element.appendChild( symbol ); } -void FunctionNode::buildXML( QDomDocument& doc, QDomElement element ) +void FunctionNode::buildXML( TQDomDocument& doc, TQDomElement element ) { if ( ( m_name->primary() == "sqrt" ) && ( m_args.count() == 1 ) ) { - QDomElement root = doc.createElement( "ROOT" ); - QDomElement content = doc.createElement( "CONTENT" ); - QDomElement sequence = doc.createElement( "SEQUENCE" ); + TQDomElement root = doc.createElement( "ROOT" ); + TQDomElement content = doc.createElement( "CONTENT" ); + TQDomElement sequence = doc.createElement( "SEQUENCE" ); m_args.at( 0 )->buildXML( doc, sequence ); content.appendChild( sequence ); root.appendChild( content ); element.appendChild( root ); } else if ( ( m_name->primary() == "pow" ) && ( m_args.count() == 2 ) ) { - QDomElement index = doc.createElement( "INDEX" ); - QDomElement content = doc.createElement( "CONTENT" ); - QDomElement sequence = doc.createElement( "SEQUENCE" ); + TQDomElement index = doc.createElement( "INDEX" ); + TQDomElement content = doc.createElement( "CONTENT" ); + TQDomElement sequence = doc.createElement( "SEQUENCE" ); m_args.at( 0 )->buildXML( doc, sequence ); content.appendChild( sequence ); index.appendChild( content ); - QDomElement upperRight = doc.createElement( "UPPERRIGHT" ); + TQDomElement upperRight = doc.createElement( "UPPERRIGHT" ); sequence = doc.createElement( "SEQUENCE" ); m_args.at( 1 )->buildXML( doc, sequence ); upperRight.appendChild( sequence ); @@ -301,16 +301,16 @@ void FunctionNode::buildXML( QDomDocument& doc, QDomElement element ) } else { m_name->buildXML( doc, element ); - QDomElement bracket = doc.createElement( "BRACKET" ); + TQDomElement bracket = doc.createElement( "BRACKET" ); bracket.setAttribute( "LEFT", '(' ); bracket.setAttribute( "RIGHT", ')' ); - QDomElement content = doc.createElement( "CONTENT" ); - QDomElement sequence = doc.createElement( "SEQUENCE" ); + TQDomElement content = doc.createElement( "CONTENT" ); + TQDomElement sequence = doc.createElement( "SEQUENCE" ); for ( uint i = 0; i < m_args.count(); i++ ) { m_args.at( i )->buildXML( doc, sequence ); if ( i < m_args.count()-1 ) { - QDomElement de = doc.createElement( "TEXT" ); + TQDomElement de = doc.createElement( "TEXT" ); de.setAttribute( "CHAR", "," ); sequence.appendChild( de ); } @@ -332,25 +332,25 @@ void FunctionNode::buildXML( QDomDocument& doc, QDomElement element ) class RowNode : public ParserNode { public: - RowNode( QPtrList<ParserNode> row ) : m_row( row ) { m_row.setAutoDelete( true ); } + RowNode( TQPtrList<ParserNode> row ) : m_row( row ) { m_row.setAutoDelete( true ); } //virtual void output( ostream& stream ); - virtual void buildXML( QDomDocument& doc, QDomElement element ); + virtual void buildXML( TQDomDocument& doc, TQDomElement element ); uint columns() const { return m_row.count(); } void setRequiredColumns( uint requiredColumns ) { m_requiredColumns = requiredColumns; } private: - QPtrList<ParserNode> m_row; + TQPtrList<ParserNode> m_row; uint m_requiredColumns; }; -void RowNode::buildXML( QDomDocument& doc, QDomElement element ) +void RowNode::buildXML( TQDomDocument& doc, TQDomElement element ) { for ( uint i = 0; i < m_requiredColumns; i++ ) { - QDomElement sequence = doc.createElement( "SEQUENCE" ); + TQDomElement sequence = doc.createElement( "SEQUENCE" ); if ( i < m_row.count() ) { m_row.at( i )->buildXML( doc, sequence ); } else { - QDomElement de = doc.createElement( "TEXT" ); + TQDomElement de = doc.createElement( "TEXT" ); de.setAttribute( "CHAR", "0" ); sequence.appendChild( de ); } @@ -372,35 +372,35 @@ void RowNode::buildXML( QDomDocument& doc, QDomElement element ) class MatrixNode : public ParserNode { public: - MatrixNode( QPtrList<RowNode> rows ) : m_rows( rows ) { m_rows.setAutoDelete( true ); } + MatrixNode( TQPtrList<RowNode> rows ) : m_rows( rows ) { m_rows.setAutoDelete( true ); } //virtual void output( ostream& stream ); - virtual void buildXML( QDomDocument& doc, QDomElement element ); + virtual void buildXML( TQDomDocument& doc, TQDomElement element ); virtual bool isSimple() { return true; } uint columns(); uint rows() { return m_rows.count(); } private: - QPtrList<RowNode> m_rows; + TQPtrList<RowNode> m_rows; }; uint MatrixNode::columns() { uint columns = 0; for ( uint i = 0; i < m_rows.count(); i++ ) { - columns = QMAX( columns, m_rows.at( i )->columns() ); + columns = TQMAX( columns, m_rows.at( i )->columns() ); } return columns; } -void MatrixNode::buildXML( QDomDocument& doc, QDomElement element ) +void MatrixNode::buildXML( TQDomDocument& doc, TQDomElement element ) { - QDomElement bracket = doc.createElement( "BRACKET" ); + TQDomElement bracket = doc.createElement( "BRACKET" ); bracket.setAttribute( "LEFT", '(' ); bracket.setAttribute( "RIGHT", ')' ); - QDomElement content = doc.createElement( "CONTENT" ); - QDomElement sequence = doc.createElement( "SEQUENCE" ); + TQDomElement content = doc.createElement( "CONTENT" ); + TQDomElement sequence = doc.createElement( "SEQUENCE" ); uint cols = columns(); - QDomElement matrix = doc.createElement( "MATRIX" ); + TQDomElement matrix = doc.createElement( "MATRIX" ); matrix.setAttribute( "ROWS", m_rows.count() ); matrix.setAttribute( "COLUMNS", cols ); for ( uint i = 0; i < m_rows.count(); i++ ) { @@ -427,7 +427,7 @@ void MatrixNode::buildXML( QDomDocument& doc, QDomElement element ) // } -FormulaStringParser::FormulaStringParser( const KFormula::SymbolTable& symbolTable, QString formula ) +FormulaStringParser::FormulaStringParser( const KFormula::SymbolTable& symbolTable, TQString formula ) : m_symbolTable( symbolTable ), m_formula( formula ), pos( 0 ), line( 1 ), column( 1 ), m_newlineIsSpace( true ) { @@ -441,18 +441,18 @@ FormulaStringParser::~FormulaStringParser() } } -QDomDocument FormulaStringParser::parse() +TQDomDocument FormulaStringParser::parse() { nextToken(); head = parseAssign(); //head->output( cout ); if ( !eol() ) { - error( QString( i18n( "Aborted parsing at %1:%2" ) ).arg( line ).arg( column ) ); + error( TQString( i18n( "Aborted parsing at %1:%2" ) ).tqarg( line ).tqarg( column ) ); } - QDomDocument doc = KFormula::Document::createDomDocument(); - QDomElement root = doc.documentElement(); - QDomElement de = doc.createElement( "FORMULA" ); + TQDomDocument doc = KFormula::Document::createDomDocument(); + TQDomElement root = doc.documentElement(); + TQDomElement de = doc.createElement( "FORMULA" ); // here comes the current version of FormulaElement //de.setAttribute( "VERSION", "4" ); head->buildXML( doc, de ); @@ -468,7 +468,7 @@ ParserNode* FormulaStringParser::parseAssign() for ( ;; ) { switch ( currentType ) { case ASSIGN: { - QString c = current; + TQString c = current; nextToken(); lhs = new AssignNode( c, lhs, parseExpr() ); break; @@ -486,7 +486,7 @@ ParserNode* FormulaStringParser::parseExpr() switch ( currentType ) { case PLUS: case SUB: { - QString c = current; + TQString c = current; nextToken(); lhs = new ExprNode( c, lhs, parseTerm() ); break; @@ -504,7 +504,7 @@ ParserNode* FormulaStringParser::parseTerm() switch ( currentType ) { case MUL: case DIV: { - QString c = current; + TQString c = current; nextToken(); lhs = new TermNode( c, lhs, parsePower() ); break; @@ -522,7 +522,7 @@ ParserNode* FormulaStringParser::parsePower() switch ( currentType ) { case INDEX: case POW: { - QString c = current; + TQString c = current; nextToken(); lhs = new PowerNode( c, lhs, parsePrimary() ); break; @@ -543,11 +543,11 @@ ParserNode* FormulaStringParser::parsePrimary() } case NAME: { PrimaryNode* node = new PrimaryNode( current ); - node->setUnicode( m_symbolTable.unicode( current ) ); + node->setUnicode( m_symbolTable.tqunicode( current ) ); nextToken(); if ( currentType == LP ) { nextToken(); - QPtrList<ParserNode> args; + TQPtrList<ParserNode> args; args.setAutoDelete( false ); while ( ( currentType != EOL ) && ( currentType != RP ) ) { ParserNode* node = parseExpr(); @@ -556,7 +556,7 @@ ParserNode* FormulaStringParser::parsePrimary() nextToken(); } } - expect( RP, QString( i18n( "'%3' expected at %1:%2" ) ).arg( line ).arg( column ).arg( ")" ) ); + expect( RP, TQString( i18n( "'%3' expected at %1:%2" ) ).tqarg( line ).tqarg( column ).tqarg( ")" ) ); node->setFunctionName( true ); return new FunctionNode( node, args ); } @@ -571,20 +571,20 @@ ParserNode* FormulaStringParser::parsePrimary() case LP: { nextToken(); ParserNode* node = parseExpr(); - expect( RP, QString( i18n( "'%3' expected at %1:%2" ) ).arg( line ).arg( column ).arg( ")" ) ); + expect( RP, TQString( i18n( "'%3' expected at %1:%2" ) ).tqarg( line ).tqarg( column ).tqarg( ")" ) ); return node; } case LB: { nextToken(); - QPtrList<RowNode> rows; + TQPtrList<RowNode> rows; rows.setAutoDelete( false ); bool innerBrackets = currentType == LB; m_newlineIsSpace = innerBrackets; while ( ( currentType != EOL ) && ( currentType != RB ) ) { if ( innerBrackets ) { - expect( LB, QString( i18n( "'%3' expected at %1:%2" ) ).arg( line ).arg( column ).arg( "[" ) ); + expect( LB, TQString( i18n( "'%3' expected at %1:%2" ) ).tqarg( line ).tqarg( column ).tqarg( "[" ) ); } - QPtrList<ParserNode> row; + TQPtrList<ParserNode> row; row.setAutoDelete( false ); while ( ( currentType != EOL ) && ( currentType != RB ) && ( innerBrackets || ( currentType != SEMIC && currentType != NEWLINE ) ) ) { @@ -594,7 +594,7 @@ ParserNode* FormulaStringParser::parsePrimary() } } if ( innerBrackets ) { - expect( RB, QString( i18n( "'%3' expected at %1:%2" ) ).arg( line ).arg( column ).arg( "]" ) ); + expect( RB, TQString( i18n( "'%3' expected at %1:%2" ) ).tqarg( line ).tqarg( column ).tqarg( "]" ) ); if ( currentType == COMMA ) { nextToken(); } @@ -605,20 +605,20 @@ ParserNode* FormulaStringParser::parsePrimary() nextToken(); } else { - expect( SEMIC, QString( i18n( "'%3' expected at %1:%2" ) ).arg( line ).arg( column ).arg( ";" ) ); + expect( SEMIC, TQString( i18n( "'%3' expected at %1:%2" ) ).tqarg( line ).tqarg( column ).tqarg( ";" ) ); } } } rows.append( new RowNode( row ) ); } m_newlineIsSpace = true; - expect( RB, QString( i18n( "'%3' expected at %1:%2" ) ).arg( line ).arg( column ).arg( "]" ) ); + expect( RB, TQString( i18n( "'%3' expected at %1:%2" ) ).tqarg( line ).tqarg( column ).tqarg( "]" ) ); MatrixNode* node = new MatrixNode( rows ); if ( node->columns() == 0 ) { - error( QString( i18n( "Null columns in Matrix at %1:%2" ) ).arg( line ).arg( column ) ); + error( TQString( i18n( "Null columns in Matrix at %1:%2" ) ).tqarg( line ).tqarg( column ) ); } if ( node->rows() == 0 ) { - error( QString( i18n( "Null rows in Matrix at %1:%2" ) ).arg( line ).arg( column ) ); + error( TQString( i18n( "Null rows in Matrix at %1:%2" ) ).tqarg( line ).tqarg( column ) ); } return node; } @@ -628,12 +628,12 @@ ParserNode* FormulaStringParser::parsePrimary() return node; } default: - error( QString( i18n( "Unexpected token at %1:%2" ) ).arg( line ).arg( column ) ); + error( TQString( i18n( "Unexpected token at %1:%2" ) ).tqarg( line ).tqarg( column ) ); return new PrimaryNode( "?" ); } } -void FormulaStringParser::expect( TokenType type, QString msg ) +void FormulaStringParser::expect( TokenType type, TQString msg ) { if ( currentType == type ) { nextToken(); @@ -643,7 +643,7 @@ void FormulaStringParser::expect( TokenType type, QString msg ) } } -QString FormulaStringParser::nextToken() +TQString FormulaStringParser::nextToken() { // We skip any ' or " so that we can parse string literals. while ( !eol() && ( m_formula[pos].isSpace() || @@ -665,7 +665,7 @@ QString FormulaStringParser::nextToken() } if ( eol() ) { currentType = EOL; - return QString::null; + return TQString(); } if ( m_formula[pos].isDigit() || m_formula[pos] == '.' ) { uint begin = pos; @@ -762,7 +762,7 @@ void FormulaStringParser::readNumber() readDigits(); if ( pos < m_formula.length()-1 ) { - QChar ch = m_formula[pos]; + TQChar ch = m_formula[pos]; // Look for a dot. if ( ch == '.' ) { @@ -773,7 +773,7 @@ void FormulaStringParser::readNumber() readDigits(); } else if ( !digitsBeforeDot ) { - error( QString( i18n( "A single '.' is not a number at %1:%2" ) ).arg( line ).arg( column ) ); + error( TQString( i18n( "A single '.' is not a number at %1:%2" ) ).tqarg( line ).tqarg( column ) ); return; } } @@ -822,7 +822,7 @@ void FormulaStringParser::readDigits() } } -void FormulaStringParser::error( QString err ) +void FormulaStringParser::error( TQString err ) { kdDebug( KFormula::DEBUGID ) << err << " (" << currentType << "; " << current << ")" << endl; m_errorList.push_back( err ); |