-rw-r--r-- | noncore/net/mailit/textparser.h | 74 | ||||
-rw-r--r-- | noncore/unsupported/mailit/textparser.h | 74 |
2 files changed, 74 insertions, 74 deletions
diff --git a/noncore/net/mailit/textparser.h b/noncore/net/mailit/textparser.h index 016effb..c5e88a0 100644 --- a/noncore/net/mailit/textparser.h +++ b/noncore/net/mailit/textparser.h | |||
@@ -5,81 +5,81 @@ | |||
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qobject.h> | 20 | #include <qobject.h> |
21 | #include <qstring.h> | 21 | #include <qstring.h> |
22 | 22 | ||
23 | #ifndef TEXTPARSER_H | 23 | #ifndef TEXTPARSER_H |
24 | #define TEXTPARSER_H | 24 | #define TEXTPARSER_H |
25 | 25 | ||
26 | enum t_strType { Word, Number}; | 26 | enum t_strType { Word, Number}; |
27 | enum t_lineType {NewLine, LastLine}; | 27 | enum t_lineType {NewLine, LastLine}; |
28 | 28 | ||
29 | const uint MAX_ELEMENTS = 200; //Should be dynamic | 29 | const uint MAX_ELEMENTS = 200; //Should be dynamic |
30 | const uint MAX_LINES = 500; //Should be dynamic | 30 | const uint MAX_LINES = 500; //Should be dynamic |
31 | 31 | ||
32 | struct t_splitElm | 32 | struct t_splitElm |
33 | { | 33 | { |
34 | QChar separator; | 34 | QChar separator; |
35 | int strType; | 35 | int strType; |
36 | QString str; | 36 | QString str; |
37 | }; | 37 | }; |
38 | 38 | ||
39 | struct t_splitLine | 39 | struct t_splitLine |
40 | { | 40 | { |
41 | t_lineType lineType; | 41 | t_lineType lineType; |
42 | QString str; //a bit redundant... | 42 | QString str; //a bit redundant... |
43 | t_splitElm elm[MAX_ELEMENTS]; | 43 | t_splitElm elm[MAX_ELEMENTS]; |
44 | int elmCount; | 44 | int elmCount; |
45 | }; | 45 | }; |
46 | 46 | ||
47 | class TextParser: public QObject | 47 | class TextParser: public QObject |
48 | { | 48 | { |
49 | Q_OBJECT | 49 | Q_OBJECT |
50 | 50 | ||
51 | public: | 51 | public: |
52 | TextParser(QString in, QString lineBreak); | 52 | TextParser(QString in, QString lineBreak); |
53 | TextParser(QString in, QString lineBreak, QString sep); | 53 | TextParser(QString in, QString lineBreak, QString sep); |
54 | int find(QString target, QChar sep, int pos, bool upperCase); | 54 | int find(QString target, QChar sep, int pos, bool upperCase); |
55 | int elmCount(); | 55 | int elmCount(); |
56 | QChar separatorAt(int pos); | 56 | QChar separatorAt(int pos); |
57 | QChar nextSeparator(); | 57 | QChar nextSeparator(); |
58 | bool hasNextSeparator(); | 58 | bool hasNextSeparator(); |
59 | QString wordAt(int pos); | 59 | QString wordAt(int pos); |
60 | QString nextWord(); | 60 | QString nextWord(); |
61 | bool hasNextWord(); | 61 | bool hasNextWord(); |
62 | QString getString(int *pos, QChar stop, bool lineEnd = false); | 62 | QString getString(int *pos, QChar stop, bool lineEnd); |
63 | QString getNextLine(); | 63 | QString getNextLine(); |
64 | bool hasNextLine(); | 64 | bool hasNextLine(); |
65 | int endLinePos(int pos); | 65 | int endLinePos(int pos); |
66 | 66 | ||
67 | private: | 67 | private: |
68 | void init(); | 68 | void init(); |
69 | void createSeparators(); | 69 | void createSeparators(); |
70 | t_splitLine nextLine(); | 70 | t_splitLine nextLine(); |
71 | void split(); | 71 | void split(); |
72 | t_splitLine splitLine(t_splitLine line); | 72 | t_splitLine splitLine(t_splitLine line); |
73 | bool isSeparator(QChar chr); | 73 | bool isSeparator(QChar chr); |
74 | t_splitLine splitDone[MAX_LINES]; | 74 | t_splitLine splitDone[MAX_LINES]; |
75 | int getLineReference(int pos, int *line, int *inLinePos); | 75 | int getLineReference(int pos, int *line, int *inLinePos); |
76 | 76 | ||
77 | int lineCount, linePos, totalElmCount; | 77 | int lineCount, linePos, totalElmCount; |
78 | int separatorPos, wordPos; | 78 | int separatorPos, wordPos; |
79 | QString data, separators, lineSep; | 79 | QString data, separators, lineSep; |
80 | int sepAtLine, sepAtPosElm; | 80 | int sepAtLine, sepAtPosElm; |
81 | int wordAtLine, wordAtPosElm; | 81 | int wordAtLine, wordAtPosElm; |
82 | int atLine, atPosElm; | 82 | int atLine, atPosElm; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | #endif | 85 | #endif |
diff --git a/noncore/unsupported/mailit/textparser.h b/noncore/unsupported/mailit/textparser.h index 016effb..c5e88a0 100644 --- a/noncore/unsupported/mailit/textparser.h +++ b/noncore/unsupported/mailit/textparser.h | |||
@@ -5,81 +5,81 @@ | |||
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qobject.h> | 20 | #include <qobject.h> |
21 | #include <qstring.h> | 21 | #include <qstring.h> |
22 | 22 | ||
23 | #ifndef TEXTPARSER_H | 23 | #ifndef TEXTPARSER_H |
24 | #define TEXTPARSER_H | 24 | #define TEXTPARSER_H |
25 | 25 | ||
26 | enum t_strType { Word, Number}; | 26 | enum t_strType { Word, Number}; |
27 | enum t_lineType {NewLine, LastLine}; | 27 | enum t_lineType {NewLine, LastLine}; |
28 | 28 | ||
29 | const uint MAX_ELEMENTS = 200; //Should be dynamic | 29 | const uint MAX_ELEMENTS = 200; //Should be dynamic |
30 | const uint MAX_LINES = 500; //Should be dynamic | 30 | const uint MAX_LINES = 500; //Should be dynamic |
31 | 31 | ||
32 | struct t_splitElm | 32 | struct t_splitElm |
33 | { | 33 | { |
34 | QChar separator; | 34 | QChar separator; |
35 | int strType; | 35 | int strType; |
36 | QString str; | 36 | QString str; |
37 | }; | 37 | }; |
38 | 38 | ||
39 | struct t_splitLine | 39 | struct t_splitLine |
40 | { | 40 | { |
41 | t_lineType lineType; | 41 | t_lineType lineType; |
42 | QString str; //a bit redundant... | 42 | QString str; //a bit redundant... |
43 | t_splitElm elm[MAX_ELEMENTS]; | 43 | t_splitElm elm[MAX_ELEMENTS]; |
44 | int elmCount; | 44 | int elmCount; |
45 | }; | 45 | }; |
46 | 46 | ||
47 | class TextParser: public QObject | 47 | class TextParser: public QObject |
48 | { | 48 | { |
49 | Q_OBJECT | 49 | Q_OBJECT |
50 | 50 | ||
51 | public: | 51 | public: |
52 | TextParser(QString in, QString lineBreak); | 52 | TextParser(QString in, QString lineBreak); |
53 | TextParser(QString in, QString lineBreak, QString sep); | 53 | TextParser(QString in, QString lineBreak, QString sep); |
54 | int find(QString target, QChar sep, int pos, bool upperCase); | 54 | int find(QString target, QChar sep, int pos, bool upperCase); |
55 | int elmCount(); | 55 | int elmCount(); |
56 | QChar separatorAt(int pos); | 56 | QChar separatorAt(int pos); |
57 | QChar nextSeparator(); | 57 | QChar nextSeparator(); |
58 | bool hasNextSeparator(); | 58 | bool hasNextSeparator(); |
59 | QString wordAt(int pos); | 59 | QString wordAt(int pos); |
60 | QString nextWord(); | 60 | QString nextWord(); |
61 | bool hasNextWord(); | 61 | bool hasNextWord(); |
62 | QString getString(int *pos, QChar stop, bool lineEnd = false); | 62 | QString getString(int *pos, QChar stop, bool lineEnd); |
63 | QString getNextLine(); | 63 | QString getNextLine(); |
64 | bool hasNextLine(); | 64 | bool hasNextLine(); |
65 | int endLinePos(int pos); | 65 | int endLinePos(int pos); |
66 | 66 | ||
67 | private: | 67 | private: |
68 | void init(); | 68 | void init(); |
69 | void createSeparators(); | 69 | void createSeparators(); |
70 | t_splitLine nextLine(); | 70 | t_splitLine nextLine(); |
71 | void split(); | 71 | void split(); |
72 | t_splitLine splitLine(t_splitLine line); | 72 | t_splitLine splitLine(t_splitLine line); |
73 | bool isSeparator(QChar chr); | 73 | bool isSeparator(QChar chr); |
74 | t_splitLine splitDone[MAX_LINES]; | 74 | t_splitLine splitDone[MAX_LINES]; |
75 | int getLineReference(int pos, int *line, int *inLinePos); | 75 | int getLineReference(int pos, int *line, int *inLinePos); |
76 | 76 | ||
77 | int lineCount, linePos, totalElmCount; | 77 | int lineCount, linePos, totalElmCount; |
78 | int separatorPos, wordPos; | 78 | int separatorPos, wordPos; |
79 | QString data, separators, lineSep; | 79 | QString data, separators, lineSep; |
80 | int sepAtLine, sepAtPosElm; | 80 | int sepAtLine, sepAtPosElm; |
81 | int wordAtLine, wordAtPosElm; | 81 | int wordAtLine, wordAtPosElm; |
82 | int atLine, atPosElm; | 82 | int atLine, atPosElm; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | #endif | 85 | #endif |