~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to kspread/valueparser.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2006-04-20 21:38:53 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060420213853-j5lxluqvymxt2zny
Tags: 1:1.5.0-0ubuntu2
UbuntuĀ uploadĀ 

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 
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.
19
19
*/
20
20
 
21
21
#ifndef KSPREAD_VALUEPARSER
24
24
#include <qdatetime.h>
25
25
 
26
26
#include "kspread_global.h"
27
 
#include "kspread_value.h"
28
27
 
29
 
class KSpreadCell;
30
28
class KLocale;
31
29
 
32
 
namespace KSpread {
33
 
 
 
30
namespace KSpread
 
31
{
 
32
class Cell;
 
33
class Value;
34
34
 
35
35
/**
36
36
The ValueParser parses a text input from the user, generating
37
 
KSpreadValue in the desired format.
 
37
Value in the desired format.
38
38
*/
39
39
 
40
40
class ValueParser {
45
45
  KLocale* locale();
46
46
  
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);
49
49
 
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);
52
52
  
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);
57
57
 protected:
58
58
 
59
59
  KLocale* parserLocale;
60
60
 
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);
67
67
  
68
68
  /** converts a string to a date/time value */
69
69
  QDateTime readTime (const QString & intstr, bool withSeconds, bool *ok,
70
70
      bool & duration);
71
71
 
 
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;