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 
13 class MythHTTPMetaMethod;
14 using HTTPMethodPtr = std::shared_ptr<MythHTTPMetaMethod>;
15 using HTTPMethods = std::map<QString,HTTPMethodPtr>;
16 using 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
MythHTTPMetaMethod
Definition: mythhttpmetamethod.h:18
HTTPMethods
std::map< QString, HTTPMethodPtr > HTTPMethods
Definition: mythhttpmetamethod.h:15
MythHTTPMetaMethod::ToBool
static bool ToBool(const QString &Value)
Definition: mythhttpmetamethod.h:47
MBASE_PUBLIC
#define MBASE_PUBLIC
Definition: mythbaseexp.h:15
HTTPProperties
std::map< int, int > HTTPProperties
Definition: mythhttpmetamethod.h:16
mythhttptypes.h
MythHTTPMetaMethod::m_names
std::vector< QString > m_names
Definition: mythhttpmetamethod.h:31
HTTPUnknown
@ HTTPUnknown
Definition: mythhttptypes.h:91
MythHTTPMetaMethod::m_method
QMetaMethod m_method
Definition: mythhttpmetamethod.h:30
MythHTTPMetaMethod::m_returnTypeName
QString m_returnTypeName
Definition: mythhttpmetamethod.h:33
HTTPMethodPtr
std::shared_ptr< MythHTTPMetaMethod > HTTPMethodPtr
Definition: mythhttpmetamethod.h:14
MythHTTPMetaMethod::m_types
std::vector< int > m_types
Definition: mythhttpmetamethod.h:32