00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef HTMLENTITIES_H
00025 #define HTMLENTITIES_H
00026
00027 #include <QtCore/QString>
00028 #include <string>
00029
00030 using namespace std;
00031
00032
00033 struct HtmlEntity
00034 {
00035 const char *name;
00036 quint16 code;
00037 };
00038
00039
00040 class HTML
00041 {
00042 public :
00043
00044
00045
00046
00047 static void decodeStr(QString* str);
00048 static QString* decode(const QString* src);
00049 static QString* decode(const QString& src);
00050 static QString* decode(const char* src);
00051 static QString* decode(const string* src);
00052 static QString* decode(const string& src);
00053
00054
00055
00056
00057
00058 static void encodeStr(QString* str);
00059 static QString* encode(const QString* src);
00060 static QString* encode(const QString& src);
00061 static QString* encode(const char* src);
00062 static QString* encode(const string* src);
00063 static QString* encode(const string& src);
00064
00065
00066
00067
00068
00069 static QChar resolveEntity(const QString &entity);
00070
00071
00072
00073
00074 static QString resolveEntity(quint16 entityCode);
00075
00076
00077 private :
00078
00079 static const int MaxEntities;
00080 static const int FirstEntities;
00081 static const HtmlEntity first[];
00082 static const HtmlEntity entities[];
00083
00084 static const HtmlEntity* end_ent;
00085 static const HtmlEntity* start_ent;
00086 static const HtmlEntity* end_first;
00087 static const HtmlEntity* start_first;
00088
00089 };
00090
00091 #endif