summaryrefslogtreecommitdiffstats
path: root/src/tools/uic/utils.h
blob: d8a563c0c67aea5025c3a6a501cb22be6b95c64e (plain)
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
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#ifndef UTILS_H
#define UTILS_H

#include "ui4.h"
#include <qstring.h>
#include <qlist.h>
#include <qhash.h>

QT_BEGIN_NAMESPACE

inline bool toBool(const QString &str)
{ return str.toLower() == QLatin1StringView("true"); }

inline QString toString(const DomString *str)
{ return str ? str->text() : QString(); }

inline QHash<QString, DomProperty *> propertyMap(const QList<DomProperty *> &properties)
{
    QHash<QString, DomProperty *> map;
    for (DomProperty *p : properties)
         map.insert(p->attributeName(), p);
    return map;
}

QT_END_NAMESPACE

#endif // UTILS_H