English Français

Documentation / Manuel développeur

Modules disponibles

Calibration,  DataServer,  Launcher,  MetaModelOptim,  Modeler,  Optimizer,  ReLauncher,  Reliability,  ReOptimizer,  Sampler,  Sensitivity,  UncertModeler,  XmlProblem,   Uranie / Launcher: TamponTexte.h Source File
Uranie / Launcher v4.9.0
/* @license-end */
TamponTexte.h
Go to the documentation of this file.
1
2// Copyright (C) 2013-2024 CEA/DES
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU Lesser General Public License as published
6// by the Free Software Foundation, either version 3 of the License, or any
7// later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU Lesser General Public License for more details.
13//
14// You should have received a copy of the GNU Lesser General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
18// $Id$
19// $Author$
20// $Date$
21// $Revision$
22// $State$
24
41#ifndef TAMPONTEXTE_H
42#define TAMPONTEXTE_H
43
44#include <stdlib.h>
45#include <string>
46#include <iostream>
47#include <vector>
48
49#include "Launcher.h"
50
51#ifndef WIN32
52#define USE_COLORED_CONSOLE
53#endif
54
56{
57 std::string _message;
58 TamponTexteError(const std::string& st)
59 {
60 _message = st;
61 }
63 {
64#ifdef USE_COLORED_CONSOLE
65 std::cout <<"\033[31m"<< _message << "\033[0m" << std::endl;
66#else
67 std::cout << _message << std::endl;
68#endif
69 }
70};
71
73{
74public:
75 TamponTexte(const char*, int dummy = 0);
76 void ecrit(const char* nom = 0);
77 const char* champLigne(int ifield, int iline);
78 const char* champ(int ifield);
79 std::string ligne(int iline);
80 void initSeparateurs(const char*);
81 void initFieldSeparateur(const char*);
82 void initCarCommentaires(const char*);
84 void elimineBlancs();
85 bool estVide() const;
86 int nombreLignes();
87 int nombreChamps();
88 int nombreChampsLigne(int);
89 void remplaceChamp(int, const char*);
90 const char*nom() const;
91
92private:
93 bool _blog;
94 std::vector<std::string> _separators;
95 std::string _cFieldSeparator;
96 std::vector<std::string> _comments;
97 std::string _buffer;
98 std::string _name;
99 void replaceAll(std::string& buffer, const std::string& str1,
100 const std::string& str2);
101};
102
103#endif
TamponTExte contains basic tools for handling strings in data file manipulations.
Definition TamponTexte.h:73
void ecrit(const char *nom=0)
Definition TamponTexte.cxx:441
void initFieldSeparateur(const char *)
Definition TamponTexte.cxx:182
void replaceAll(std::string &buffer, const std::string &str1, const std::string &str2)
Definition TamponTexte.cxx:470
int nombreChampsLigne(int)
Definition TamponTexte.cxx:356
void initCarCommentaires(const char *)
Definition TamponTexte.cxx:192
std::string _cFieldSeparator
Definition TamponTexte.h:95
std::vector< std::string > _comments
Definition TamponTexte.h:96
bool _blog
Definition TamponTexte.h:93
void elimineBlancs()
Definition TamponTexte.cxx:227
std::string _buffer
Definition TamponTexte.h:97
const char * champLigne(int ifield, int iline)
Definition TamponTexte.cxx:89
void remplaceChamp(int, const char *)
Definition TamponTexte.cxx:387
std::string ligne(int iline)
Definition TamponTexte.cxx:143
void initSeparateurs(const char *)
Definition TamponTexte.cxx:169
int nombreChamps()
Definition TamponTexte.cxx:275
std::vector< std::string > _separators
Definition TamponTexte.h:94
std::string _name
Definition TamponTexte.h:98
int nombreLignes()
Definition TamponTexte.cxx:263
void elimineCommentaires()
Definition TamponTexte.cxx:206
bool estVide() const
Definition TamponTexte.cxx:256
const char * nom() const
Definition TamponTexte.cxx:71
const char * champ(int ifield)
Definition TamponTexte.cxx:305
Definition TamponTexte.h:56
TamponTexteError(const std::string &st)
Definition TamponTexte.h:58
std::string _message
Definition TamponTexte.h:57
void printMessage()
Definition TamponTexte.h:62