Arcane  v3.14.10.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
CaseOptionException.cc
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/* CaseOptionException.cc (C) 2000-2018 */
9/* */
10/* Exception en rapport avec le jeu de données. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/ArcanePrecomp.h"
15
16#include "arcane/utils/Iostream.h"
17#include "arcane/utils/StringBuilder.h"
18
19#include "arcane/CaseOptionException.h"
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24ARCANE_BEGIN_NAMESPACE
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
29CaseOptionException::
30CaseOptionException(const String& where,const String& node_name,
31 const XmlNode& parent)
32: Exception("CaseOptionException",where)
33, m_node_name(node_name)
34, m_parent(parent)
35{
37 sb = "Configuration item:\n\n"
38 " <" + m_parent.xpathFullName() + String("/") + m_node_name;
39 sb += ">\n\n"
40 "can not be found.\n\n"
41 "Make sure the configuration file is valid and up to date "
42 "with the code.\n";
43 m_message = sb.toString();
44 setCollective(true);
45}
46
47/*---------------------------------------------------------------------------*/
48/*---------------------------------------------------------------------------*/
49
51CaseOptionException(const String& where,const String& node_name,
52 const XmlNode& parent,const String& value,
53 const String& type)
54: Exception("CaseOptionException",where)
55, m_node_name(node_name)
56, m_parent(parent)
57, m_value(value)
58, m_type(type)
59{
61 sb = "Configuration item:\n"
62 "<" + m_parent.xpathFullName() + String("/") + m_node_name;
63 sb += "> is not valid.\n"
64 "Unable to cast character chain\n"
65 "`" + m_value + "' to type <" + m_type + ">.\n";
66 m_message = sb.toString();
67 setCollective(true);
68}
69
70/*---------------------------------------------------------------------------*/
71/*---------------------------------------------------------------------------*/
72
74CaseOptionException(const String& where,const String& message,bool is_collective)
75: Exception("CaseOptionException",where)
76, m_message(message)
77{
78 setCollective(is_collective);
79}
80
81/*---------------------------------------------------------------------------*/
82/*---------------------------------------------------------------------------*/
83
85CaseOptionException(const TraceInfo& where,const String& message,bool is_collective)
86: Exception("CaseOptionException",where)
87, m_message(message)
88{
89 setCollective(is_collective);
90}
91
92/*---------------------------------------------------------------------------*/
93/*---------------------------------------------------------------------------*/
94
96CaseOptionException(const CaseOptionException& rhs) ARCANE_NOEXCEPT
97: Exception(rhs)
98, m_node_name(rhs.m_node_name)
99, m_parent(rhs.m_parent)
100, m_value(rhs.m_value)
101, m_type(rhs.m_type)
102, m_message(rhs.m_message)
103{
104}
105
106/*---------------------------------------------------------------------------*/
107/*---------------------------------------------------------------------------*/
108
109CaseOptionException::
110~CaseOptionException() ARCANE_NOEXCEPT
111{
112}
113
114/*---------------------------------------------------------------------------*/
115/*---------------------------------------------------------------------------*/
116
118explain(std::ostream& m) const
119{
120 m << m_message << '\n';
121}
122
123/*---------------------------------------------------------------------------*/
124/*---------------------------------------------------------------------------*/
125
126/*---------------------------------------------------------------------------*/
127/*---------------------------------------------------------------------------*/
128
129ARCANE_END_NAMESPACE
130
131/*---------------------------------------------------------------------------*/
132/*---------------------------------------------------------------------------*/
Exception en rapport avec le jeu de données.
CaseOptionException(const String &where, const String &node_name, const XmlNode &parent, const String &value, const String &type)
Exception lorsqu'une option d'une jeu de données n'est pas valide.
void explain(std::ostream &m) const override
Explique la cause de l'exception dans le flot o.
Noeud d'un arbre DOM.
Definition XmlNode.h:51
String xpathFullName() const
Nom XPath du noeud avec ces ancêtres.
Definition XmlNode.cc:143
Classe de base d'une exception.
void setCollective(bool v)
Positionne l'état collective de l'expression.
Constructeur de chaîne de caractère unicode.
String toString() const
Retourne la chaîne de caractères construite.
Chaîne de caractères unicode.