Arcane
v3.14.10.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-2022 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-2018 */
9
/* */
10
/* Iterator sur les noeuds d'un arbre DOM. */
11
/*---------------------------------------------------------------------------*/
12
#ifndef ARCANE_XMLNODEITERATOR_H
13
#define ARCANE_XMLNODEITERATOR_H
14
/*---------------------------------------------------------------------------*/
15
/*---------------------------------------------------------------------------*/
16
17
#include "arcane/XmlNode.h"
18
19
#include <iterator>
20
21
/*---------------------------------------------------------------------------*/
22
/*---------------------------------------------------------------------------*/
23
24
ARCANE_BEGIN_NAMESPACE
25
26
/*---------------------------------------------------------------------------*/
27
/*---------------------------------------------------------------------------*/
28
29
class
IRessourceMng;
30
31
/*---------------------------------------------------------------------------*/
32
/*---------------------------------------------------------------------------*/
33
34
class
XmlNodeConstIterator
35
{
36
public
:
37
typedef
std::bidirectional_iterator_tag iterator_category;
38
typedef
XmlNode
value_type
;
39
typedef
int
difference_type;
40
typedef
XmlNode
*
pointer
;
41
typedef
XmlNode
&
reference
;
42
public
:
43
XmlNodeConstIterator
(
const
XmlNode
& node)
44
: m_node(node) {}
45
XmlNodeConstIterator
()
46
: m_node() {}
47
public
:
48
void
operator++() { ++m_node; }
49
void
operator--() { --m_node; }
50
const
XmlNode
& operator* ()
const
{
return
m_node; }
51
const
XmlNode
* operator->()
const
{
return
&m_node; }
52
protected
:
53
XmlNode
m_node;
54
};
55
56
class
XmlNodeIterator
57
:
public
XmlNodeConstIterator
58
{
59
public
:
60
XmlNodeIterator
(
const
XmlNode
& node)
61
:
XmlNodeConstIterator
(node) {}
62
XmlNodeIterator
() {}
63
public
:
64
const
XmlNode
& operator* ()
const
{
return
m_node; }
65
const
XmlNode
* operator->()
const
{
return
&m_node; }
66
XmlNode
& operator* () {
return
m_node; }
67
XmlNode
* operator->() {
return
&m_node; }
68
};
69
70
/*---------------------------------------------------------------------------*/
71
/*---------------------------------------------------------------------------*/
72
73
inline
bool
74
operator==(
const
XmlNodeConstIterator
& n1,
const
XmlNodeConstIterator
& n2)
75
{
76
return
*n1==*n2;
77
}
78
79
inline
bool
80
operator!=(
const
XmlNodeConstIterator& n1,
const
XmlNodeConstIterator& n2)
81
{
82
return
*n1!=*n2;
83
}
84
85
/*---------------------------------------------------------------------------*/
86
/*---------------------------------------------------------------------------*/
87
88
inline
XmlNodeIterator
XmlNode::
89
begin()
90
{
91
return
XmlNode
(m_rm,m_node.firstChild());
92
}
93
94
inline
XmlNodeIterator
XmlNode::
95
end()
96
{
97
return
XmlNode
(m_rm);
98
}
99
100
inline
XmlNodeConstIterator
XmlNode::
101
begin()
const
102
{
103
return
XmlNode
(m_rm,m_node.firstChild());
104
}
105
106
inline
XmlNodeConstIterator
XmlNode::
107
end()
const
108
{
109
return
XmlNode
(m_rm);
110
}
111
112
/*---------------------------------------------------------------------------*/
113
/*---------------------------------------------------------------------------*/
114
/*!
115
* \brief Itérateur sur les fils d'un noeud \a from de nom \a ref_name.
116
*/
117
class
XmlNodeNameIterator
118
{
119
public
:
120
XmlNodeNameIterator
(
const
XmlNode
& from,
const
String
& ref_name);
121
XmlNodeNameIterator
(
const
XmlNode
& from,
const
char
* ref_name);
122
bool
operator()()
const
{
return
!m_current.null(); }
123
void
operator++() { _findNextValid(
false
); }
124
const
XmlNode
&
operator*
()
const
{
return
m_current; }
125
const
XmlNode
* operator->()
const
{
return
&m_current; }
126
XmlNode
&
operator*
() {
return
m_current; }
127
XmlNode
* operator->() {
return
&m_current; }
128
private
:
129
XmlNode
m_parent;
130
XmlNode
m_current;
131
String
m_ref_name;
132
private
:
133
void
_findNextValid(
bool
is_init);
134
};
135
136
/*---------------------------------------------------------------------------*/
137
/*---------------------------------------------------------------------------*/
138
139
ARCANE_END_NAMESPACE
140
141
/*---------------------------------------------------------------------------*/
142
/*---------------------------------------------------------------------------*/
143
144
#endif
145
Arcane::XmlNodeConstIterator
Definition
XmlNodeIterator.h:35
Arcane::XmlNodeIterator
Definition
XmlNodeIterator.h:58
Arcane::XmlNodeNameIterator
Itérateur sur les fils d'un noeud from de nom ref_name.
Definition
XmlNodeIterator.h:118
Arcane::XmlNode
Noeud d'un arbre DOM.
Definition
XmlNode.h:51
Arccore::String
Chaîne de caractères unicode.
Definition
arccore/src/base/arccore/base/String.h:70
Arcane::operator*
Real2 operator*(Real sca, const Real2Proxy &vec)
Multiplication par un scalaire.
Definition
Real2Proxy.h:241
arcane
core
XmlNodeIterator.h
Généré le Lundi 18 Novembre 2024 02:56:51 pour Arcane par
1.9.8