14#include "arcane/std/internal/IosFile.h"
16#include "arcane/utils/Iostream.h"
17#include "arcane/utils/IOException.h"
18#include "arcane/utils/ITraceMng.h"
33 return m_stream->eof();
40getNextLine(
const char* comment_char)
42 while (m_stream->good()) {
43 m_stream->getline(m_buf,
sizeof(m_buf) - 1);
46 if (m_buf[0] ==
'\n' || m_buf[0] ==
'\r')
48 bool is_comment =
true;
52 for (
int i = 0; is_comment && i < IOS_BFR_SZE && m_buf[i] !=
'\0'; ++i) {
53 if (!isspace(m_buf[i])) {
54 is_comment = (m_buf[i] == *comment_char);
61 for (
int i = 0; i < IOS_BFR_SZE && m_buf[i] !=
'\0'; ++i) {
63 if (m_buf[i] ==
'\n' || m_buf[i] ==
'\r') {
71 throw IOException(
"IosFile::getNexLine()",
"Unexpected EndOfFile");
80 return getNextLine(
nullptr);
90 (*m_stream) >> ws >> v;
93 throw IOException(
"IosFile::getReal()",
"Bad Real");
103 (*m_stream) >> ws >> v;
104 if (m_stream->good())
106 throw IOException(
"IosFile::getInteger()",
"Bad Integer");
116 (*m_stream) >> ws >> v;
117 if (m_stream->good())
119 throw IOException(
"IosFile::getInteger()",
"Bad Int64");
126lookForString(
const String& str)
128 const char* bfr = getNextLine();
130 std::istringstream iline(bfr);
134 return isEqualString(got, str);
141checkString(
const String& current_value,
const String& expected_value)
143 String current_value_low = current_value.lower();
144 String expected_value_low = expected_value.lower();
146 if (current_value_low != expected_value_low) {
147 String s =
"Expecting chain '" + expected_value +
"', found '" + current_value +
"'";
148 throw IOException(
"IosFile::checkString()", s);
156checkString(
const String& current_value,
const String& expected_value1,
const String& expected_value2)
158 String current_value_low = current_value.lower();
159 String expected_value1_low = expected_value1.lower();
160 String expected_value2_low = expected_value2.lower();
162 if (current_value_low != expected_value1_low && current_value_low != expected_value2_low) {
163 String s =
"Expecting chain '" + expected_value1 +
"' or '" + expected_value2 +
"', found '" + current_value +
"'";
164 throw IOException(
"IosFile::checkString()", s);
172isEqualString(
const String& current_value,
const String& expected_value)
174 String current_value_low = current_value.lower();
175 String expected_value_low = expected_value.lower();
176 return (current_value_low == expected_value_low);
Lecteur des fichiers de maillage via la bibliothèque LIMA.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Int32 Integer
Type représentant un entier.