File: context.hpp

package info (click to toggle)
libqt5qxlsx 1.4.4-1.1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 15,304 kB
  • sloc: cpp: 17,870; ansic: 4,644; python: 15; makefile: 4
file content (58 lines) | stat: -rw-r--r-- 1,074 bytes parent folder | download
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