1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
#ifndef RECURSE_CONTEXT_HPP
#define RECURSE_CONTEXT_HPP
#include <QtGlobal>
#include <QVariant>
#include <QHash>
#include "request.hpp"
#include "response.hpp"
class Context
{
public:
Request request;
Response response;
//!
//! \brief set
//! Set data into context that can be passed around
//!
//! \param QString key of the data
//! \param QString value of the data
//! \return Context chainable
//!
Context &set(const QString &key, const QVariant &value)
{
m_data[key] = value;
return *this;
}
//!
//! \brief get
//! Get data from context
//!
//! \param QString key of the data
//! \return QString value of the data
//!
QVariant get(const QString &key) const
{
return m_data[key];
}
//!
//! \brief data
//! expose key/value data of *void pointer to allow any type of data
//!
QHash<QString, void *> data;
private:
//!
//! \brief m_data
//! Context data holder
//!
QHash<QString, QVariant> m_data;
};
#endif
|