<commit_before>#ifndef TSESSION_H
#define TSESSION_H

#include <QVariant>
#include <QByteArray>
#include <TGlobal>


class T_CORE_EXPORT TSession : public QVariantMap
{
public:
    TSession(const QByteArray &id = QByteArray());
    TSession(const TSession &other);
    TSession &operator=(const TSession &other);

    QByteArray id() const { return sessionId; }
    void reset();
    iterator insert(const QString &key, const QVariant &value);
    const QVariant value(const QString &key) const;
    const QVariant value(const QString &key, const QVariant &defaultValue) const;
    static QByteArray sessionName();

private:
    QByteArray sessionId;

    void clear() {} // disabled
    friend class TSessionCookieStore;
    friend class TActionContext;
};


inline TSession::TSession(const QByteArray &id)
    : sessionId(id)
{ }

inline TSession::TSession(const TSession &other)
    : QVariantMap(*static_cast<const QVariantMap *>(&other)), sessionId(other.sessionId)
{ }

inline TSession &TSession::operator=(const TSession &other)
{
    QVariantMap::operator=(*static_cast<const QVariantMap *>(&other));
    sessionId = other.sessionId;
    return *this;
}

inline TSession::iterator TSession::insert(const QString &key, const QVariant &value)
{
    return QVariantMap::insert(key, value);
}

inline const QVariant TSession::value(const QString &key) const
{
    return QVariantMap::value(key);
}

inline const QVariant TSession::value(const QString &key, const QVariant &defaultValue) const
{
    return QVariantMap::value(key, defaultValue);
}

#endif // TSESSION_H<commit_msg>add remove and take function.<commit_after>#ifndef TSESSION_H
#define TSESSION_H

#include <QVariant>
#include <QByteArray>
#include <TGlobal>


class T_CORE_EXPORT TSession : public QVariantMap
{
public:
    TSession(const QByteArray &id = QByteArray());
    TSession(const TSession &other);
    TSession &operator=(const TSession &other);

    QByteArray id() const { return sessionId; }
    void reset();
    iterator insert(const QString &key, const QVariant &value);
    int remove(const QString &key);
    QVariant take(const QString &key);
    const QVariant value(const QString &key) const;
    const QVariant value(const QString &key, const QVariant &defaultValue) const;
    static QByteArray sessionName();

private:
    QByteArray sessionId;

    void clear() {} // disabled
    friend class TSessionCookieStore;
    friend class TActionContext;
};


inline TSession::TSession(const QByteArray &id)
    : sessionId(id)
{ }

inline TSession::TSession(const TSession &other)
    : QVariantMap(*static_cast<const QVariantMap *>(&other)), sessionId(other.sessionId)
{ }

inline TSession &TSession::operator=(const TSession &other)
{
    QVariantMap::operator=(*static_cast<const QVariantMap *>(&other));
    sessionId = other.sessionId;
    return *this;
}

inline TSession::iterator TSession::insert(const QString &key, const QVariant &value)
{
    return QVariantMap::insert(key, value);
}

inline int TSession::remove(const QString &key)
{
    return QVariantMap::remove(key);
}

inline QVariant TSession::take(const QString &key)
{
    return QVariantMap::take(key);
}

inline const QVariant TSession::value(const QString &key) const
{
    return QVariantMap::value(key);
}

inline const QVariant TSession::value(const QString &key, const QVariant &defaultValue) const
{
    return QVariantMap::value(key, defaultValue);
}

#endif // TSESSION_H
{'fraction_non_alphanumeric': 0.11308139534883721, 'fraction_numerical': 0.0, 'mean_word_length': 5.079505300353357, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '6223449', 'n_tokens_mistral': 1049, 'n_tokens_neox': 1038, 'n_words': 287}