MythTV master
mythuiutils.h
Go to the documentation of this file.
1#ifndef MYTHUIUTILS_H_
2#define MYTHUIUTILS_H_
3
4#include <cstdlib>
5
6#include "mythuiexp.h"
7
8class QString;
9class MythUIType;
10
12{
13 static bool Child(const MythUIType *container, const QString &child_name);
14 static bool Container(const QString &child_name);
15};
16
18{
19 static bool Child(const MythUIType *container, const QString &child_name);
20 static bool Container(const QString &child_name);
21};
22
23template <typename ErrorDispatch = ETPrintWarning>
25{
26 template <typename ContainerType, typename UIType>
27 static bool Assign(ContainerType *container, UIType *&item,
28 const QString &name, bool *err = nullptr) // NOLINT(readability-non-const-parameter)
29 {
30 if (!container)
31 {
32 if (err)
33 *err |= ErrorDispatch::Container(name);
34 else
35 ErrorDispatch::Container(name);
36 return true;
37 }
38
39 item = dynamic_cast<UIType *>(container->GetChild(name));
40
41 if (item)
42 return false;
43
44 if (err)
45 *err |= ErrorDispatch::Child(container, name);
46 else
47 ErrorDispatch::Child(container, name);
48 return true;
49 }
50};
51
54
55#endif
The base class on which all widgets and screens are based.
Definition: mythuitype.h:86
#define MUI_PUBLIC
Definition: mythuiexp.h:9
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
Definition: mythuiutils.h:27