15
15
You should have received a copy of the GNU Library General Public License
16
16
along with this library; see the file COPYING.LIB. If not, write to
17
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
Boston, MA 02111-1307, USA.
17
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
* Boston, MA 02110-1301, USA.
21
21
#ifndef KSPREAD_VALUEPARSER
24
24
#include <qdatetime.h>
26
26
#include "kspread_global.h"
27
#include "kspread_value.h"
36
36
The ValueParser parses a text input from the user, generating
37
KSpreadValue in the desired format.
37
Value in the desired format.
40
40
class ValueParser {
47
47
/** try to parse the text in a given cell and set value accordingly */
48
void parse (const QString& str, KSpreadCell *cell);
48
void parse (const QString& str, Cell *cell);
50
50
/** try to parse given text, don't set any cell attributes though */
51
KSpreadValue parse (const QString &str);
51
Value parse (const QString &str);
53
KSpreadValue tryParseBool (const QString& str, bool *ok = 0);
54
KSpreadValue tryParseNumber (const QString& str, bool *ok = 0);
55
KSpreadValue tryParseDate (const QString& str, bool *ok = 0);
56
KSpreadValue tryParseTime (const QString& str, bool *ok = 0);
53
Value tryParseBool (const QString& str, bool *ok = 0);
54
Value tryParseNumber (const QString& str, bool *ok = 0);
55
Value tryParseDate (const QString& str, bool *ok = 0);
56
Value tryParseTime (const QString& str, bool *ok = 0);
59
59
KLocale* parserLocale;
61
61
// Try to parse the text as a bool/number/date/time/etc.
62
62
// Helpers for parse.
63
bool tryParseBool (const QString& str, KSpreadCell *cell);
64
bool tryParseNumber (const QString& str, KSpreadCell *cell);
65
bool tryParseDate (const QString& str, KSpreadCell *cell);
66
bool tryParseTime (const QString& str, KSpreadCell *cell);
63
bool tryParseBool (const QString& str, Cell *cell);
64
bool tryParseNumber (const QString& str, Cell *cell);
65
bool tryParseDate (const QString& str, Cell *cell);
66
bool tryParseTime (const QString& str, Cell *cell);
68
68
/** converts a string to a date/time value */
69
69
QDateTime readTime (const QString & intstr, bool withSeconds, bool *ok,
72
/** a helper function to read numbers and distinguish integers and FPs */
73
double readNumber(const QString &_str, bool * ok, bool * isInt);
72
74
/** a helper function to read integers */
73
75
int readInt (const QString &str, uint &pos);
74
76
FormatType fmtType;