Arcane  v3.15.3.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
ValueConvertInternal.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/* ValueConvertInternal.h (C) 2000-2025 */
9/* */
10/* Fonctions pour convertir une chaîne de caractère en un type donné. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_UTILS_INTERNAL_VALUECONVERTINTERNAL_H
13#define ARCANE_UTILS_INTERNAL_VALUECONVERTINTERNAL_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/Array.h"
18#include "arcane/utils/String.h"
19#include "arcane/utils/ValueConvert.h"
20
21#include <iostream>
22
23/*---------------------------------------------------------------------------*/
24/*---------------------------------------------------------------------------*/
25
26namespace Arcane
27{
28
29/*---------------------------------------------------------------------------*/
30/*---------------------------------------------------------------------------*/
31
32template <typename T> inline bool
33builtInGetArrayValueFromStream(Array<T>& v, std::istream& sbuf)
34{
35 T read_val = T();
36 if (!sbuf.eof())
37 sbuf >> ws;
38 while (!sbuf.eof()) {
39 sbuf >> read_val;
40 if (sbuf.fail() || sbuf.bad())
41 return true;
42 v.add(read_val);
43 sbuf >> ws;
44 }
45 return false;
46}
47
48/*---------------------------------------------------------------------------*/
49/*---------------------------------------------------------------------------*/
50
51template <typename T> inline bool
52builtInGetArrayValue(Array<T>& v, StringView s)
53{
54 impl::StringViewInputStream svis(s);
55 std::istream& sbuf = svis.stream();
56 return builtInGetArrayValueFromStream(v, sbuf);
57}
58
59/*---------------------------------------------------------------------------*/
60/*---------------------------------------------------------------------------*/
61
62namespace impl
63{
73 extern "C++" ARCANE_UTILS_EXPORT void
74 arcaneSetIsValueConvertUseFromChars(bool v);
75
77 extern "C++" ARCANE_UTILS_EXPORT void
78 arcaneSetValueConvertVerbosity(Int32 v);
79
87 extern "C++" ARCANE_UTILS_EXPORT void
88 arcaneSetUseSameValueConvertForAllReal(bool v);
89} // namespace impl
90
91/*---------------------------------------------------------------------------*/
92/*---------------------------------------------------------------------------*/
93
94} // End namespace Arcane
95
96/*---------------------------------------------------------------------------*/
97/*---------------------------------------------------------------------------*/
98
99#endif
100
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:149
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-