parser.h

来自「linux qt资料」· C头文件 代码 · 共 57 行

H
57
字号
#ifndef PARSER_H#define PARSER_H#include <qstring.h>class ParsedArray{public:    ParsedArray(int numRows, int numCols);    ~ParsedArray();    enum Type { Unknown, Error, String, Number };    Type type( int row, int col );        QString calc( int row, int col, bool *ok=0);    bool recalc( int row, int col );    QString stringVal( int row, int col );    double  doubleVal( int row, int col );    int  intVal( int row, int col ) { return (int) doubleVal(row,col); }        QString     rawText( int row, int col );    void        setText( int row, int col, QString ); //shallow copyprivate:    struct Data    {	QString text;	Type   type;	double val;    };    Data *data;    int numCols;    int numRows;    Data *current;    short index; // opt: later const char *    char getc();    void putback();    Type parseExpr( double & );    Type parseTerm( double & );    Type parseFactor( double & );    Type parseRef( double & );    Type parseNumber( double & );    Type parseInt( int & );        int idx( int r, int c ) const { return c+r*numCols; }    bool isValid( int r, int c ) const     { return (uint) r < (uint) numRows && (uint) c < (uint) numCols; } //Ugle};#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?