MythTV master
mythhttpmetamethod.h
Go to the documentation of this file.
1#ifndef MYTHHTTPMETAMETHOD_H
2#define MYTHHTTPMETAMETHOD_H
3
4// Std
5#include <memory>
6
7// Qt
8#include <QChar> // Fix Qt6 GCC SFINAE warning
9#include <QMetaMethod>
10
11// MythTV
13
15using HTTPMethodPtr = std::shared_ptr<MythHTTPMetaMethod>;
16using HTTPMethods = std::map<QString,HTTPMethodPtr>;
17using HTTPProperties = std::map<int,int>;
18
20{
21 public:
22 static HTTPMethodPtr Create (int Index, QMetaMethod& Method, int RequestTypes,
23 const QString& ReturnName = {}, bool Slot = true);
24 static void* CreateParameter (void* Parameter, int Type, const QString& Value);
25 static QVariant CreateReturnValue (int Type, void* Value);
26
27 bool m_valid { false };
28 bool m_protected { false };
29 int m_index { 0 };
30 int m_requestTypes { HTTPUnknown };
31 QMetaMethod m_method;
32 std::vector<QString> m_names;
33 std::vector<int> m_types;
35
36 protected:
37 MythHTTPMetaMethod(int Index, QMetaMethod& Method, int RequestTypes,
38 const QString& ReturnName, bool Slot);
39
40 private:
41 Q_DISABLE_COPY(MythHTTPMetaMethod)
42
43 static bool ValidReturnType(int Type)
44 {
45 return (Type != QMetaType::UnknownType && Type != QMetaType::Void);
46 }
47
48 static bool ToBool(const QString& Value)
49 {
50 if (Value.compare("1", Qt::CaseInsensitive) == 0)
51 return true;
52 if (Value.compare("y", Qt::CaseInsensitive) == 0)
53 return true;
54 if (Value.compare("true", Qt::CaseInsensitive) == 0)
55 return true;
56 return false;
57 }
58};
59
60#endif
std::vector< int > m_types
static bool ToBool(const QString &Value)
std::vector< QString > m_names
#define MBASE_PUBLIC
Definition: mythbaseexp.h:8
std::map< QString, HTTPMethodPtr > HTTPMethods
std::map< int, int > HTTPProperties
std::shared_ptr< MythHTTPMetaMethod > HTTPMethodPtr
@ HTTPUnknown
Definition: mythhttptypes.h:92