kspread Library API Documentation

valueparser.h

00001 /* This file is part of the KDE project
00002    Copyright 2004 Tomas Mecir <mecirt@gmail.com>
00003    Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.
00019 */
00020 
00021 #ifndef KSPREAD_VALUEPARSER
00022 #define KSPREAD_VALUEPARSER
00023 
00024 #include <qdatetime.h>
00025 
00026 #include "kspread_global.h"
00027 #include "kspread_value.h"
00028 
00029 class KSpreadCell;
00030 class KLocale;
00031 
00032 namespace KSpread {
00033 
00034 
00040 class ValueParser {
00041  public:
00043   ValueParser (KLocale *locale);
00044   
00045   KLocale* locale();
00046   
00048   void parse (const QString& str, KSpreadCell *cell);
00049 
00051   KSpreadValue parse (const QString &str);
00052   
00053   KSpreadValue tryParseBool (const QString& str, bool *ok = 0);
00054   KSpreadValue tryParseNumber (const QString& str, bool *ok = 0);
00055   KSpreadValue tryParseDate (const QString& str, bool *ok = 0);
00056   KSpreadValue tryParseTime (const QString& str, bool *ok = 0);
00057  protected:
00058  
00059   KLocale* parserLocale;
00060 
00061   // Try to parse the text as a bool/number/date/time/etc.
00062   // Helpers for parse.
00063   bool tryParseBool (const QString& str, KSpreadCell *cell);
00064   bool tryParseNumber (const QString& str, KSpreadCell *cell);
00065   bool tryParseDate (const QString& str, KSpreadCell *cell);
00066   bool tryParseTime (const QString& str, KSpreadCell *cell);
00067   
00069   QDateTime readTime (const QString & intstr, bool withSeconds, bool *ok,
00070       bool & duration);
00071 
00073   int readInt (const QString &str, uint &pos);
00074   FormatType fmtType;
00075 };
00076 
00077 
00078 }  //namespace KSpread
00079 
00080 
00081 #endif  //KSPREAD_VALUEPARSER
00082 
KDE Logo
This file is part of the documentation for kspread Library Version 1.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Feb 13 09:43:38 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003