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 <QMetaMethod>
9
10// MythTV
12
14using HTTPMethodPtr = std::shared_ptr<MythHTTPMetaMethod>;
15using HTTPMethods = std::map<QString,HTTPMethodPtr>;
16using HTTPProperties = std::map<int,int>;
17
19{
20 public:
21 static HTTPMethodPtr Create (int Index, QMetaMethod& Method, int RequestTypes,
22 const QString& ReturnName = {}, bool Slot = true);
23 static void* CreateParameter (void* Parameter, int Type, const QString& Value);
24 static QVariant CreateReturnValue (int Type, void* Value);
25
26 bool m_valid { false };
27 bool m_protected { false };
28 int m_index { 0 };
29 int m_requestTypes { HTTPUnknown };
30 QMetaMethod m_method;
31 std::vector<QString> m_names;
32 std::vector<int> m_types;
34
35 protected:
36 MythHTTPMetaMethod(int Index, QMetaMethod& Method, int RequestTypes,
37 const QString& ReturnName, bool Slot);
38
39 private:
40 Q_DISABLE_COPY(MythHTTPMetaMethod)
41
42 static bool ValidReturnType(int Type)
43 {
44 return (Type != QMetaType::UnknownType && Type != QMetaType::Void);
45 }
46
47 static bool ToBool(const QString& Value)
48 {
49 if (Value.compare("1", Qt::CaseInsensitive) == 0)
50 return true;
51 if (Value.compare("y", Qt::CaseInsensitive) == 0)
52 return true;
53 if (Value.compare("true", Qt::CaseInsensitive) == 0)
54 return true;
55 return false;
56 }
57};
58
59#endif
std::vector< int > m_types
static bool ToBool(const QString &Value)
std::vector< QString > m_names
#define MBASE_PUBLIC
Definition: mythbaseexp.h:15
std::map< QString, HTTPMethodPtr > HTTPMethods
std::map< int, int > HTTPProperties
std::shared_ptr< MythHTTPMetaMethod > HTTPMethodPtr
@ HTTPUnknown
Definition: mythhttptypes.h:92