Arcane  v3.16.4.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
DomUtils.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/* DomUtils.h (C) 2000-2025 */
9/* */
10/* Fonctions utilitaires divers concernant le DOM. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_DOMUTILS_H
13#define ARCANE_CORE_DOMUTILS_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/core/Dom.h"
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21/*
22 * Les méthodes de ce fichier sont internes à Arcane et ne doivent
23 * pas être utilisées ailleurs.
24 */
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28namespace Arcane::domutils
29{
30
31/*---------------------------------------------------------------------------*/
32/*---------------------------------------------------------------------------*/
33
34// Si le noeud est un élément, retourne la concaténation de ses fils textes,
35// sinon, retourn nodeValue().
36// Utiliser textContext() à la place
37extern "C++" ARCANE_DEPRECATED_260 ARCANE_CORE_EXPORT String
38textValue(const dom::Node& node);
39
40// Utiliser textContext() à la place
41extern "C++" ARCANE_DEPRECATED_260 ARCANE_CORE_EXPORT void
42textValue(dom::Node& node, const String& new_value);
43
44extern "C++" ARCANE_CORE_EXPORT String
45textContent(const dom::Node& node);
46
47extern "C++" ARCANE_CORE_EXPORT void
48textContent(dom::Node& node, const String& new_value);
49
50extern "C++" ARCANE_CORE_EXPORT dom::Element
51createElement(const dom::Node& parent, const String& name, const String& value);
52
53extern "C++" ARCANE_CORE_EXPORT String
54attrValue(const dom::Node& node, const String& attr_name);
55
56extern "C++" ARCANE_CORE_EXPORT void
57setAttr(const dom::Element& node, const String& name, const String& value);
58
59extern "C++" ARCANE_CORE_EXPORT dom::Node
60childNode(const dom::Node& parent, const String& child_name);
61
62extern "C++" ARCANE_CORE_EXPORT dom::Node
63nodeFromXPath(const dom::Node& context_node, const String& xpath_expr);
64
65extern "C++" ARCANE_DEPRECATED_260 ARCANE_CORE_EXPORT bool
66saveDocument(std::ostream& istr, const dom::Document&, int indent_level = -1);
67
68extern "C++" ARCANE_CORE_EXPORT bool
69saveDocument(ByteArray& bytes, const dom::Document&, int indent_level = -1);
70
71extern "C++" ARCANE_CORE_EXPORT IXmlDocumentHolder*
72createXmlDocument();
73
74/*---------------------------------------------------------------------------*/
75/*---------------------------------------------------------------------------*/
76/*!
77 * \internal
78 * Itérateur sur les fils d'un noeud \a from de nom \a ref_name.
79 */
80class ARCANE_CORE_EXPORT NameIterator
81{
82 public:
83
84 NameIterator(const dom::Node& from, const String& ref_name);
85 //NameIterator(const dom::Node& from,const char* ref_name);
86 bool operator()() const { return !m_current._null(); }
87 void operator++() { _findNextValid(false); }
88 const dom::Node& operator*() const { return m_current; }
89 const dom::Node* operator->() const { return &m_current; }
90
91 private:
92
93 dom::Node m_parent;
94 dom::Node m_current;
95 dom::DOMString m_ref_name;
96
97 private:
98
99 void _findNextValid(bool is_init);
100};
101
102/*---------------------------------------------------------------------------*/
103/*---------------------------------------------------------------------------*/
104
105} // namespace Arcane::domutils
106
107/*---------------------------------------------------------------------------*/
108/*---------------------------------------------------------------------------*/
109
110#endif
111
Chaîne de caractères unicode.
Array< Byte > ByteArray
Tableau dynamique à une dimension de caractères.
Definition UtilsTypes.h:208