Arcane  v3.15.0.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_VALUECONVERTINTERNAL_H
13#define ARCANE_UTILS_VALUECONVERTINTERNAL_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/Array.h"
18#include "arcane/utils/String.h"
19
20#include <iostream>
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
25namespace Arcane
26{
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31template <typename T> inline bool
32builtInGetArrayValueFromStream(Array<T>& v, std::istream& sbuf)
33{
34 T read_val = T();
35 if (!sbuf.eof())
36 sbuf >> ws;
37 while (!sbuf.eof()) {
38 sbuf >> read_val;
39 if (sbuf.fail() || sbuf.bad())
40 return true;
41 v.add(read_val);
42 sbuf >> ws;
43 }
44 return false;
45}
46
47/*---------------------------------------------------------------------------*/
48/*---------------------------------------------------------------------------*/
49
50template <typename T> inline bool
51builtInGetArrayValue(Array<T>& v, const String& s)
52{
53 std::istringstream sbuf(s.localstr());
54 return builtInGetArrayValueFromStream(v, sbuf);
55}
56
57/*---------------------------------------------------------------------------*/
58/*---------------------------------------------------------------------------*/
59
60namespace impl
61{
71 extern "C++" ARCANE_UTILS_EXPORT void
72 arcaneSetIsValueConvertUseFromChars(bool v);
73
75 extern "C++" ARCANE_UTILS_EXPORT void
76 arcaneSetValueConvertVerbosity(Int32 v);
77} // namespace impl
78
79/*---------------------------------------------------------------------------*/
80/*---------------------------------------------------------------------------*/
81
82} // End namespace Arcane
83
84/*---------------------------------------------------------------------------*/
85/*---------------------------------------------------------------------------*/
86
87#endif
88
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 -*-