summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mailit/textparser.h74
-rw-r--r--noncore/unsupported/mailit/textparser.h74
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
@@ -26,60 +26,60 @@
26enum t_strType { Word, Number}; 26enum t_strType { Word, Number};
27enum t_lineType {NewLine, LastLine}; 27enum t_lineType {NewLine, LastLine};
28 28
29 const uint MAX_ELEMENTS = 200; //Should be dynamic 29const uint MAX_ELEMENTS = 200; //Should be dynamic
30 const uint MAX_LINES = 500; //Should be dynamic 30const uint MAX_LINES = 500; //Should be dynamic
31 31
32struct t_splitElm 32struct 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
39struct t_splitLine 39struct 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
47class TextParser: public QObject 47class TextParser: public QObject
48{ 48{
49 Q_OBJECT 49 Q_OBJECT
50 50
51public: 51public:
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
67private: 67private:
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
@@ -26,60 +26,60 @@
26enum t_strType { Word, Number}; 26enum t_strType { Word, Number};
27enum t_lineType {NewLine, LastLine}; 27enum t_lineType {NewLine, LastLine};
28 28
29 const uint MAX_ELEMENTS = 200; //Should be dynamic 29const uint MAX_ELEMENTS = 200; //Should be dynamic
30 const uint MAX_LINES = 500; //Should be dynamic 30const uint MAX_LINES = 500; //Should be dynamic
31 31
32struct t_splitElm 32struct 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
39struct t_splitLine 39struct 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
47class TextParser: public QObject 47class TextParser: public QObject
48{ 48{
49 Q_OBJECT 49 Q_OBJECT
50 50
51public: 51public:
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
67private: 67private:
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