Arcane
v3.16.4.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
XmlNodeIterator.h
1
// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2
//-----------------------------------------------------------------------------
3
// Copyright 2000-2025 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4
// See the top-level COPYRIGHT file for details.
5
// SPDX-License-Identifier: Apache-2.0
6
//-----------------------------------------------------------------------------
7
/*---------------------------------------------------------------------------*/
8
/* XmlNodeIterator.h (C) 2000-2025 */
9
/* */
10
/* Iterator sur les noeuds d'un arbre DOM. */
11
/*---------------------------------------------------------------------------*/
12
#ifndef ARCANE_CORE_XMLNODEITERATOR_H
13
#define ARCANE_CORE_XMLNODEITERATOR_H
14
/*---------------------------------------------------------------------------*/
15
/*---------------------------------------------------------------------------*/
16
17
#include "arcane/core/XmlNode.h"
18
19
#include <iterator>
20
21
/*---------------------------------------------------------------------------*/
22
/*---------------------------------------------------------------------------*/
23
24
namespace
Arcane
25
{
26
27
/*---------------------------------------------------------------------------*/
28
/*---------------------------------------------------------------------------*/
29
30
class
XmlNodeConstIterator
31
{
32
public
:
33
34
typedef
std::bidirectional_iterator_tag iterator_category;
35
typedef
XmlNode
value_type;
36
typedef
int
difference_type;
37
typedef
XmlNode
* pointer;
38
typedef
XmlNode
& reference;
39
40
public
:
41
42
XmlNodeConstIterator(
const
XmlNode
& node)
43
: m_node(node)
44
{}
45
XmlNodeConstIterator()
46
: m_node()
47
{}
48
49
public
:
50
51
void
operator++() { ++m_node; }
52
void
operator--() { --m_node; }
53
const
XmlNode
& operator*()
const
{
return
m_node; }
54
const
XmlNode
* operator->()
const
{
return
&m_node; }
55
56
protected
:
57
58
XmlNode
m_node;
59
};
60
61
/*---------------------------------------------------------------------------*/
62
/*---------------------------------------------------------------------------*/
63
64
class
XmlNodeIterator
65
:
public
XmlNodeConstIterator
66
{
67
public
:
68
69
XmlNodeIterator(
const
XmlNode
& node)
70
: XmlNodeConstIterator(node)
71
{}
72
XmlNodeIterator() {}
73
74
public
:
75
76
const
XmlNode
& operator*()
const
{
return
m_node; }
77
const
XmlNode
* operator->()
const
{
return
&m_node; }
78
XmlNode
& operator*() {
return
m_node; }
79
XmlNode
* operator->() {
return
&m_node; }
80
};
81
82
/*---------------------------------------------------------------------------*/
83
/*---------------------------------------------------------------------------*/
84
85
inline
bool
86
operator==(
const
XmlNodeConstIterator
& n1,
const
XmlNodeConstIterator
& n2)
87
{
88
return
*n1 == *n2;
89
}
90
91
inline
bool
92
operator!=(
const
XmlNodeConstIterator& n1,
const
XmlNodeConstIterator& n2)
93
{
94
return
*n1 != *n2;
95
}
96
97
/*---------------------------------------------------------------------------*/
98
/*---------------------------------------------------------------------------*/
99
100
inline
XmlNodeIterator
XmlNode::
101
begin
()
102
{
103
return
XmlNode(m_rm, m_node.firstChild());
104
}
105
106
inline
XmlNodeIterator
XmlNode::
107
end
()
108
{
109
return
XmlNode(m_rm);
110
}
111
112
inline
XmlNodeConstIterator
XmlNode::
113
begin
()
const
114
{
115
return
XmlNode(m_rm, m_node.firstChild());
116
}
117
118
inline
XmlNodeConstIterator
XmlNode::
119
end
()
const
120
{
121
return
XmlNode(m_rm);
122
}
123
124
/*---------------------------------------------------------------------------*/
125
/*---------------------------------------------------------------------------*/
126
/*!
127
* \brief Itérateur sur les fils d'un noeud \a from de nom \a ref_name.
128
*/
129
class
XmlNodeNameIterator
130
{
131
public
:
132
133
XmlNodeNameIterator(
const
XmlNode
& from,
const
String
& ref_name);
134
XmlNodeNameIterator(
const
XmlNode
& from,
const
char
* ref_name);
135
bool
operator()()
const
{
return
!m_current.null(); }
136
void
operator++() { _findNextValid(
false
); }
137
const
XmlNode
& operator*()
const
{
return
m_current; }
138
const
XmlNode
* operator->()
const
{
return
&m_current; }
139
XmlNode
& operator*() {
return
m_current; }
140
XmlNode
* operator->() {
return
&m_current; }
141
142
private
:
143
144
XmlNode
m_parent;
145
XmlNode
m_current;
146
String
m_ref_name;
147
148
private
:
149
150
void
_findNextValid(
bool
is_init);
151
};
152
153
/*---------------------------------------------------------------------------*/
154
/*---------------------------------------------------------------------------*/
155
156
}
// namespace Arcane
157
158
/*---------------------------------------------------------------------------*/
159
/*---------------------------------------------------------------------------*/
160
161
#endif
162
Arcane::String
Chaîne de caractères unicode.
Definition
arccore/src/base/arccore/base/String.h:70
Arcane::XmlNodeConstIterator
Definition
XmlNodeIterator.h:31
Arcane::XmlNodeIterator
Definition
XmlNodeIterator.h:66
Arcane::XmlNode
Noeud d'un arbre DOM.
Definition
XmlNode.h:51
Arcane::XmlNode::end
iterator end()
Retourne un iterateur sur le premier élément après la fin du tableau.
Definition
XmlNodeIterator.h:107
Arcane::XmlNode::begin
iterator begin()
Retourne un iterateur sur le premier élément du tableau.
Definition
XmlNodeIterator.h:101
Arcane
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Definition
AbstractCaseDocumentVisitor.cc:20
arcane
core
XmlNodeIterator.h
Généré le Lundi 16 Juin 2025 03:14:34 pour Arcane par
1.13.2