Arcane  v4.1.3.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
ConvertInternal.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 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/* ConvertInternal.h (C) 2000-2026 */
9/* */
10/* Fonctions pour convertir une chaîne de caractère en un type donné. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCCORE_BASE_INTERNAL_CONVERTINTERNAL_H
13#define ARCCORE_BASE_INTERNAL_CONVERTINTERNAL_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane::Convert::Impl
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
29class ARCCORE_BASE_EXPORT ConvertPolicy
30{
31 public:
32
42 static void setUseFromChars(bool v) { m_use_from_chars = v; }
43 static bool isUseFromChars() { return m_use_from_chars; }
44
46 static void setVerbosity(Int32 v) { m_verbosity = v; }
47 static bool verbosity() { return m_verbosity; }
48
56 static void setUseSameConvertForAllReal(bool v)
57 {
58 m_use_same_convert_for_all_real = v;
59 }
60 static bool isUseSameConvertForAllReal()
61 {
62 return m_use_same_convert_for_all_real;
63 }
64
65 private:
66
67 static Int32 m_verbosity;
68 static bool m_use_from_chars;
69 static bool m_use_same_convert_for_all_real;
70};
71
72/*---------------------------------------------------------------------------*/
73/*---------------------------------------------------------------------------*/
77class ARCCORE_BASE_EXPORT StringViewToDoubleConverter
78{
79 public:
80
82 static Int64 _getDoubleValue(double& v, StringView s);
83};
84
85/*---------------------------------------------------------------------------*/
86/*---------------------------------------------------------------------------*/
94class ARCCORE_BASE_EXPORT StringViewToIntegral
95{
96 public:
97
98 static bool getValue(double& v, StringView s);
99 static bool getValue(int& v, StringView s);
100 static bool getValue(long& v, StringView s);
101 static bool getValue(long long& v, StringView s);
102 static bool getValue(bool& v, StringView s);
103};
104
105/*---------------------------------------------------------------------------*/
106/*---------------------------------------------------------------------------*/
107
108extern "C++" ARCCORE_BASE_EXPORT StringView
109_removeLeadingSpaces(StringView s, Int64 pos = 0);
110
111/*---------------------------------------------------------------------------*/
112/*---------------------------------------------------------------------------*/
113
114} // namespace Arcane::Convert::Impl
115
116/*---------------------------------------------------------------------------*/
117/*---------------------------------------------------------------------------*/
118
119#endif
120
Déclarations des types de la composante 'base' de Arccore.
Informations sur le comportement des méthodes de conversion.
static void setUseFromChars(bool v)
Indique si on utilise 'std::from_chars' pour convertir les chaînes de caractères en un type numérique...
static void setUseSameConvertForAllReal(bool v)
static void setVerbosity(Int32 v)
Positionne le niveau de verbosité pour les fonctions de conversion.
Classe pour convertir une 'StringView' en 'double'.
static Int64 _getDoubleValueWithFromChars(double &v, StringView s)
Converti une chaîne de caractères en un double.
static Int64 _getDoubleValue(double &v, StringView s)
Converti s en un double.
Classe pour convertir une 'StringView' en un type intégral.
Vue sur une chaîne de caractères UTF-8.
Definition StringView.h:47
std::int64_t Int64
Type entier signé sur 64 bits.
std::int32_t Int32
Type entier signé sur 32 bits.