~ubuntu-branches/ubuntu/wily/tora/wily-proposed

« back to all changes in this revision

Viewing changes to src/tohtml.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Meskes
  • Date: 2009-04-07 13:16:05 UTC
  • mfrom: (1.2.7 upstream) (3.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090407131605-u422yigfv7jgg0l0
Tags: 2.0.0-3
* Cleaned up packaging a little bit.
* Added homepage information to control file.
* Bumped Standards-Version to 3.8.1.
* Released to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****
2
 
*
3
 
* TOra - An Oracle Toolkit for DBA's and developers
4
 
* Copyright (C) 2003-2005 Quest Software, Inc
5
 
* Portions Copyright (C) 2005 Other Contributors
6
 
7
 
* This program is free software; you can redistribute it and/or
8
 
* modify it under the terms of the GNU General Public License
9
 
* as published by the Free Software Foundation;  only version 2 of
10
 
* the License is valid for this program.
11
 
12
 
* This program is distributed in the hope that it will be useful,
13
 
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
* GNU General Public License for more details.
16
 
17
 
* You should have received a copy of the GNU General Public License
18
 
* along with this program; if not, write to the Free Software
19
 
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20
 
*
21
 
*      As a special exception, you have permission to link this program
22
 
*      with the Oracle Client libraries and distribute executables, as long
23
 
*      as you follow the requirements of the GNU GPL in regard to all of the
24
 
*      software in the executable aside from Oracle client libraries.
25
 
*
26
 
*      Specifically you are not permitted to link this program with the
27
 
*      Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech.
28
 
*      And you are not permitted to distribute binaries compiled against
29
 
*      these libraries without written consent from Quest Software, Inc.
30
 
*      Observe that this does not disallow linking to the Qt Free Edition.
31
 
*
32
 
*      You may link this product with any GPL'd Qt library such as Qt/Free
33
 
*
34
 
* All trademarks belong to their respective owners.
35
 
*
36
 
*****/
 
1
 
 
2
/* BEGIN_COMMON_COPYRIGHT_HEADER
 
3
 *
 
4
 * TOra - An Oracle Toolkit for DBA's and developers
 
5
 * 
 
6
 * Shared/mixed copyright is held throughout files in this product
 
7
 * 
 
8
 * Portions Copyright (C) 2000-2001 Underscore AB
 
9
 * Portions Copyright (C) 2003-2005 Quest Software, Inc.
 
10
 * Portions Copyright (C) 2004-2008 Numerous Other Contributors
 
11
 * 
 
12
 * This program is free software; you can redistribute it and/or
 
13
 * modify it under the terms of the GNU General Public License
 
14
 * as published by the Free Software Foundation;  only version 2 of
 
15
 * the License is valid for this program.
 
16
 * 
 
17
 * This program is distributed in the hope that it will be useful,
 
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
20
 * GNU General Public License for more details.
 
21
 * 
 
22
 * You should have received a copy of the GNU General Public License
 
23
 * along with this program; if not, write to the Free Software
 
24
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
25
 * 
 
26
 *      As a special exception, you have permission to link this program
 
27
 *      with the Oracle Client libraries and distribute executables, as long
 
28
 *      as you follow the requirements of the GNU GPL in regard to all of the
 
29
 *      software in the executable aside from Oracle client libraries.
 
30
 * 
 
31
 *      Specifically you are not permitted to link this program with the
 
32
 *      Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech.
 
33
 *      And you are not permitted to distribute binaries compiled against
 
34
 *      these libraries. 
 
35
 * 
 
36
 *      You may link this product with any GPL'd Qt library.
 
37
 * 
 
38
 * All trademarks belong to their respective owners.
 
39
 *
 
40
 * END_COMMON_COPYRIGHT_HEADER */
37
41
 
38
42
#ifndef TOHTML_H
39
43
#define TOHTML_H
43
47
#include <map>
44
48
 
45
49
#include <qstring.h>
46
 
#include <qcstring.h>
47
50
 
48
51
#define TO_HTML_MAX_QUAL 100
49
52
 
64
67
</pre>
65
68
 */
66
69
 
 
70
class QChar;
 
71
 
67
72
class toHtml
68
73
{
69
74
    /** Actual data of file.
70
75
     */
71
 
    char *Data;
 
76
    QString Data;
72
77
    /** Length of the data.
73
78
     */
74
 
    size_t Length;
 
79
    int Length;
75
80
    /** Current position in data.
76
81
     */
77
 
    size_t Position;
 
82
    int Position;
78
83
 
79
84
    /** Last character that was at the end of text written over by call to @ref mid.
80
85
     * This is a real cludge, but what don't you do for performance.
81
86
     */
82
 
    char LastChar;
 
87
    QChar LastChar;
83
88
 
84
89
    /** List of qualifiers for tab. This is not a list because of performance as well.
85
90
     * Not really a lot of memory wasted this way, in fact it is probably more efficient
89
94
    {
90
95
        /** Name of qualifier. Always lowercase, points into @ref Data.
91
96
         */
92
 
        const char *Name;
 
97
        QString Name;
93
98
        /** Value of qualifier. Points into @ref Data.
94
99
         */
95
 
        const char *Value;
 
100
        QString Value;
96
101
    }
97
102
    Qualifiers[TO_HTML_MAX_QUAL];
98
103
 
107
112
    bool Open;
108
113
    /** Name of tag. NULL terminated, points into @ref Data.
109
114
     */
110
 
    const char *Tag;
 
115
    QString Tag;
111
116
    /** Text if not tag. NULL terminated, points into @ref Data.
112
117
     */
113
 
    const char *Text;
 
118
    QString Text;
114
119
 
115
120
    /** Walk forward in @ref Data until not whitespace.
116
121
     */
121
126
     * @param size Size of string to extract.
122
127
     * @return Pointer to string (Points into @ref Data)
123
128
     */
124
 
    const char *mid(size_t start, size_t size);
 
129
    QString mid(int start, int size);
125
130
public:
126
131
    /** Create a HTML parser.
127
132
     * @param data Data to parse.
128
133
     */
129
 
    toHtml(const QCString &data);
 
134
    toHtml(const QString &data);
130
135
    ~toHtml();
131
136
 
132
137
    /** Read the next token which can be either a open tag, close tag or text.
142
147
     * @param name Name of qualifier in lowercase.
143
148
     * @return Value of qualifier or NULL.
144
149
     */
145
 
    const char *value(const QCString &name);
 
150
    QString value(const QString &name);
146
151
    /** Return true if current token is a tag.
147
152
     * @return True if tag.
148
153
     */
163
168
     * @return The parsed text.
164
169
     */
165
170
 
166
 
    QCString text(void);
 
171
    QString text(void);
167
172
 
168
173
    /** Get name of tag in lowercase. Only valid if @ref isTag returns true.
169
174
     * @return Name of tag (Excluding / if close tag).
170
175
     */
171
 
    const char *tag(void)
 
176
    QString tag(void)
172
177
    {
173
178
        return Tag;
174
179
    }
182
187
     * @param data Data to search.
183
188
     * @param str Substring to search for in data.
184
189
     */
185
 
    static bool search(const QCString &data, const QString &str);
 
190
    static bool search(const QString &data, const QString &str);
186
191
 
187
192
    /** Escape text to be HTML.
188
193
     */