kdecore: generate entities as C++ code

This commit is contained in:
Ivailo Monev 2015-09-04 01:57:00 +00:00
parent a76f252ce8
commit 3ea6105f77
3 changed files with 716 additions and 688 deletions

View file

@ -21,7 +21,7 @@
#include "kcharsets.h"
#include "kfilterdev.h"
#include "kentities.c"
#include "kentities.cpp"
#include "kconfig.h"
#include "kdebug.h"
@ -484,7 +484,7 @@ public:
// --------------------------------------------------------------------------
KCharsets::KCharsets()
:d(new KCharsetsPrivate(this))
:d(new KCharsetsPrivate(this))
{
}
@ -524,7 +524,7 @@ QChar KCharsets::fromEntity(const QString &str)
}
const QByteArray raw ( str.toLatin1() );
const entity *e = kde_findEntity( raw, raw.length() );
const entity *e = EntitiesHash::kde_findEntity( raw, raw.length() );
if(!e)
{

View file

@ -22,10 +22,19 @@
kentities.gperf: input file to generate a hash table for entities
kentities.c: DO NOT EDIT! generated by the command
"gperf -a -L ANSI-C -E -C -c -o -t -k '*' -Nkde_findEntity -D -Hhash_Entity -Wwordlist_Entity -s 2 kentities.gperf > kentities.c"
"gperf -a -o -t -k '*' -D -Wwordlist_Entity -s 2 kentities.gperf > kentities.cpp"
from kentities.gperf
*/
*/
%}
%language=C++
%readonly-tables
%define class-name EntitiesHash
%define lookup-function-name kde_findEntity
%define hash-function-name hash_Entity
%compare-strncmp
%enum
struct entity {
const char *name;
int code;
@ -144,6 +153,7 @@ delta, 0x03b4
diams, 0x2666
divide, 0x00f7
dol, 0x0024
dollar, 0x0024
eacute, 0x00e9
ecaron, 0x011b
eague, 0x00e9