blob: f32a2bc88923dc05db39f0b09107679c9e63e914 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/*
This file is part of the KDE project
Copyright (C) 2001 Ewald Snel <ewald@rambo.its.tudelft.nl>
Copyright (C) 2001 Tomasz Grobelny <grotk@poczta.onet.pl>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#ifndef __RTFIMPORT_TOKENIZER_H__
#define __RTFIMPORT_TOKENIZER_H__
#include <tqcstring.h>
#include <tqfile.h>
/// This class represents the tokenizer and the token
class RTFTokenizer
{
public:
enum TokenType { OpenGroup, CloseGroup, ControlWord, PlainText, BinaryData };
RTFTokenizer();
/**
* Open tokenizer from file.
* @param in the input file
*/
void open( TQFile *in );
/**
* Reads the next token.
*/
void next();
// token data
/// plain text or control word/symbol
char *text;
TokenType type;
/// numeric parameter
int value;
/// token has a (numeric) parameter
bool hasParam;
public:
/// Binary data (of \\bin keyword)
TQByteArray binaryData;
// tokenizer (private) data
private:
int nextChar();
TQFile *infile;
TQByteArray fileBuffer;
TQCString tokenText;
uchar *fileBufferPtr;
uchar *fileBufferEnd;
};
#endif
|