<commit_before>
#include "typedatabase.h"
#include "../customtypes.h"

#include <QDebug>

#include <qfile.h>
#include <qfileinfo.h>
#include <qxml.h>
#include "handler.h"
#include "../reporthandler.h"
#include "../main.h"

static void addRemoveFunctionToTemplates(TypeDatabase *db);

TypeDatabase::TypeDatabase() : m_suppressWarnings(true), m_includeEclipseWarnings(false) {
    addType(new StringTypeEntry("QString"));

    StringTypeEntry *e = new StringTypeEntry("QLatin1String");
    e->setPreferredConversion(false);
    addType(e);

    // We need the generator to perform type conversion in C++ with the
    //  construct:
    // QString qstring = QString("string"); QStringRef(&qstring)"
    //  not with:
    // (const QStringRef &)QString("string")
    StringRefTypeEntry *sr = new StringRefTypeEntry("QStringRef");
    addType(sr);
    // TODO: Use of StringRefTypeEntry for QXmlStreamStringRef has not been tested,
    //  I am sure the previous code would cause a crash.
    sr = new StringRefTypeEntry("QXmlStreamStringRef");
    sr->setPreferredConversion(false);
    addType(sr);

    addType(new CharTypeEntry("QChar"));

    CharTypeEntry *c = new CharTypeEntry("QLatin1Char");
    c->setPreferredConversion(false);
    addType(c);

    {
        VariantTypeEntry *qvariant = new VariantTypeEntry("QVariant");
        qvariant->setCodeGeneration(TypeEntry::GenerateNothing);
        addType(qvariant);
    }

    {
        JObjectWrapperTypeEntry *wrapper = new JObjectWrapperTypeEntry("JObjectWrapper");
        wrapper->setCodeGeneration(TypeEntry::GenerateNothing);
        addType(wrapper);
    }

    addType(new ThreadTypeEntry());
    addType(new VoidTypeEntry());<commit_msg>(split) Bug#224 don't allow String -> QStringRef conversion.<commit_after>
#include "typedatabase.h"
#include "../customtypes.h"

#include <QDebug>

#include <qfile.h>
#include <qfileinfo.h>
#include <qxml.h>
#include "handler.h"
#include "../reporthandler.h"
#include "../main.h"

static void addRemoveFunctionToTemplates(TypeDatabase *db);

TypeDatabase::TypeDatabase() : m_suppressWarnings(true), m_includeEclipseWarnings(false) {
    addType(new StringTypeEntry("QString"));

    StringTypeEntry *e = new StringTypeEntry("QLatin1String");
    e->setPreferredConversion(false);
    addType(e);

    // We need the generator to perform type conversion in C++ with the
    //  construct:
    // QString qstring = QString("string"); QStringRef(&qstring)"
    //  not with:
    // (const QStringRef &)QString("string")
    StringRefTypeEntry *sr = new StringRefTypeEntry("QStringRef");
    sr->setPreferredConversion(false);
    addType(sr);
    // TODO: Use of StringRefTypeEntry for QXmlStreamStringRef has not been tested,
    //  I am sure the previous code would cause a crash.
    sr = new StringRefTypeEntry("QXmlStreamStringRef");
    sr->setPreferredConversion(false);
    addType(sr);

    addType(new CharTypeEntry("QChar"));

    CharTypeEntry *c = new CharTypeEntry("QLatin1Char");
    c->setPreferredConversion(false);
    addType(c);

    {
        VariantTypeEntry *qvariant = new VariantTypeEntry("QVariant");
        qvariant->setCodeGeneration(TypeEntry::GenerateNothing);
        addType(qvariant);
    }

    {
        JObjectWrapperTypeEntry *wrapper = new JObjectWrapperTypeEntry("JObjectWrapper");
        wrapper->setCodeGeneration(TypeEntry::GenerateNothing);
        addType(wrapper);
    }

    addType(new ThreadTypeEntry());
    addType(new VoidTypeEntry());
{'fraction_non_alphanumeric': 0.12729357798165136, 'fraction_numerical': 0.0020068807339449542, 'mean_word_length': 4.1308823529411764, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3199534', 'n_tokens_mistral': 1069, 'n_tokens_neox': 1046, 'n_words': 226}