I am learning the QT examples.
When I go into the Codec example,
tools/codecs/mainwindow.cpp
I found line 91 the object QTextCodec 's subclass is created, but I can't find where it has been deleted,
will it cause memory leackage ?
QString sortKey
= codec
->name
().
toUpper();
int rank;
if (sortKey.startsWith("UTF-8")) {
rank = 1;
} else if (sortKey.startsWith("UTF-16")) {
rank = 2;
} else if (iso8859RegExp.exactMatch(sortKey)) {
if (iso8859RegExp.cap(1).size() == 1)
rank = 3;
else
rank = 4;
} else {
rank = 5;
}
sortKey.
prepend(QChar('0' + rank
));
codecMap.insert(sortKey, codec);
}
foreach (int mib, QTextCodec::availableMibs()) {
QTextCodec *codec = QTextCodec::codecForMib(mib);
QString sortKey = codec->name().toUpper();
int rank;
if (sortKey.startsWith("UTF-8")) {
rank = 1;
} else if (sortKey.startsWith("UTF-16")) {
rank = 2;
} else if (iso8859RegExp.exactMatch(sortKey)) {
if (iso8859RegExp.cap(1).size() == 1)
rank = 3;
else
rank = 4;
} else {
rank = 5;
}
sortKey.prepend(QChar('0' + rank));
codecMap.insert(sortKey, codec);
}
To copy to clipboard, switch view to plain text mode
Bookmarks