LeechCraft
0.6.70-18450-gabe19ee3b0
Modular cross-platform feature rich live environment.
Toggle main menu visibility
Loading...
Searching...
No Matches
domchildrenrange.h
Go to the documentation of this file.
1
/**********************************************************************
2
* LeechCraft - modular cross-platform feature rich internet client.
3
* Copyright (C) 2006-2014 Georg Rudoy
4
*
5
* Distributed under the Boost Software License, Version 1.0.
6
* (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7
**********************************************************************/
8
9
#pragma once
10
11
#include <QDomElement>
12
#include <QString>
13
#include "
sllconfig.h
"
14
15
namespace
LC::Util
16
{
43
* @sa DomDescendants()
44
*/
45
inline
auto
DomChildren
(
const
QDomNode& parent,
const
QString& tag)
46
{
47
struct
Iterator
48
{
49
#pragma GCC diagnostic push
50
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
51
using
difference_type = ptrdiff_t;
52
using
value_type = QDomElement;
53
using
reference = QDomElement&;
54
using
iterator_category = std::forward_iterator_tag;
55
#pragma GCC diagnostic pop
56
57
QDomElement Elem_;
58
const
QString Tag_;
59
60
bool
operator==
(
const
Iterator& other)
const
61
{
62
return
Elem_ == other.Elem_;
63
}
64
65
Iterator& operator++ ()
66
{
67
Elem_ = Elem_.nextSiblingElement (Tag_);
68
return
*
this
;
69
}
70
71
QDomElement& operator* ()
72
{
73
return
Elem_;
74
}
75
};
76
77
struct
Range
78
{
79
const
Iterator Begin_;
80
81
auto
begin ()
const
{
return
Begin_; }
82
auto
end ()
const
{
return
Iterator {}; }
83
};
84
85
auto
firstChild = parent.firstChildElement (tag);
86
return
Range { { firstChild, tag } };
87
}
88
101
UTIL_SLL_API
QVector<QDomElement>
DomDescendants
(
const
QDomElement& parent,
const
QString& tag);
102
}
operator==
auto operator==(const T &left, const T &right)
Definition
common.h:21
LC::Util
Definition
icoreproxy.h:34
LC::Util::DomChildren
auto DomChildren(const QDomNode &parent, const QString &tag)
Creates a range iterating over direct children named tag.
Definition
domchildrenrange.h:43
LC::Util::DomDescendants
QVector< QDomElement > DomDescendants(const QDomElement &parent, const QString &tag)
Creates a vector with all descendants of parent named tag.
Definition
domchildrenrange.cpp:28
sllconfig.h
UTIL_SLL_API
#define UTIL_SLL_API
Definition
sllconfig.h:16
src
util
sll
domchildrenrange.h
Generated by
1.17.0