Documentation / Developer's manual
Available modules
Calibration,  DataServer,  Launcher,  MetaModelOptim,  Modeler,  Optimizer,  ReLauncher,  Reliability,  ReOptimizer,  Sampler,  Sensitivity,  UncertModeler,  XmlProblem,  
Uranie / Launcher v4.9.0
|
TamponTExte contains basic tools for handling strings in data file manipulations. More...
#include <TamponTexte.h>
Public Member Functions | |
TamponTexte (const char *, int dummy=0) | |
void | ecrit (const char *nom=0) |
const char * | champLigne (int ifield, int iline) |
const char * | champ (int ifield) |
std::string | ligne (int iline) |
void | initSeparateurs (const char *) |
void | initFieldSeparateur (const char *) |
void | initCarCommentaires (const char *) |
void | elimineCommentaires () |
void | elimineBlancs () |
bool | estVide () const |
int | nombreLignes () |
int | nombreChamps () |
int | nombreChampsLigne (int) |
void | remplaceChamp (int, const char *) |
const char * | nom () const |
Private Member Functions | |
void | replaceAll (std::string &buffer, const std::string &str1, const std::string &str2) |
Private Attributes | |
bool | _blog |
std::vector< std::string > | _separators |
std::string | _cFieldSeparator |
std::vector< std::string > | _comments |
std::string | _buffer |
std::string | _name |
Detailed Description
TamponTExte contains basic tools for handling strings in data file manipulations.
TamponTexte comes as a replacement for the CLUB equivalent class
Constructor & Destructor Documentation
◆ TamponTexte()
TamponTexte::TamponTexte | ( | const char * | filename, |
int | dummy = 0 |
||
) |
Creates a TamponTexte object by reading a file and storing it in the working buffer
- Parameters
-
filename name of the ascii file read for the buffer dummy unused param in order to reproduce the club syntax
References _buffer, _cFieldSeparator, _name, and TamponTexteError::printMessage().
Member Function Documentation
◆ champ()
const char * TamponTexte::champ | ( | int | ifield | ) |
- Parameters
-
ifield token number (1-indexing)
- Returns
- token Parses the buffer with separators (" ", "\n" and "\t" being default) as delimiters.
References _buffer, _cFieldSeparator, _separators, TamponTexteError::printMessage(), and replaceAll().
Referenced by ClassImp(), and ClassImp().
◆ champLigne()
const char * TamponTexte::champLigne | ( | int | ifield, |
int | iline | ||
) |
- Parameters
-
iline line number ifield field number
- Returns
- field retrieves the field designated by a (field, line) double (with 1-indexing)
For instance, on file : aa bb cc dd ee ff
champLigne (1,3) will return "ee"
References _buffer, _cFieldSeparator, _separators, TamponTexteError::printMessage(), and replaceAll().
Referenced by ClassImp(), ClassImp(), and ClassImp().
◆ ecrit()
void TamponTexte::ecrit | ( | const char * | name = 0 | ) |
- Parameters
-
name file name for writing the buffer (default : input file)
References _buffer, _name, and TamponTexteError::printMessage().
Referenced by ClassImp(), and ClassImp().
◆ elimineBlancs()
void TamponTexte::elimineBlancs | ( | ) |
Deletes lines with white caracters only.
References _buffer.
Referenced by ClassImp(), ClassImp(), and ClassImp().
◆ elimineCommentaires()
void TamponTexte::elimineCommentaires | ( | ) |
Eliminates comments. Lines starting with comments will be entirely removed. For lines with a comment symbol in the middle, the line will be deleted after the comment symbol.
References _buffer, and _comments.
Referenced by ClassImp(), ClassImp(), ClassImp(), and ClassImp().
◆ estVide()
bool TamponTexte::estVide | ( | ) | const |
References _buffer.
Referenced by ClassImp(), ClassImp(), ClassImp(), ClassImp(), and ClassImp().
◆ initCarCommentaires()
void TamponTexte::initCarCommentaires | ( | const char * | comment | ) |
Defines comment symbols
- Parameters
-
comment list of chars for symbols starting comments
References _comments.
Referenced by ClassImp(), ClassImp(), ClassImp(), ClassImp(), and ClassImp().
◆ initFieldSeparateur()
void TamponTexte::initFieldSeparateur | ( | const char * | separator | ) |
Adds a separator character to the separator list used for parsing tokens
References _cFieldSeparator.
Referenced by ClassImp(), ClassImp(), ClassImp(), ClassImp(), and ClassImp().
◆ initSeparateurs()
void TamponTexte::initSeparateurs | ( | const char * | separator | ) |
Adds a separator character to the separator list used for parsing tokens
References _separators.
Referenced by ClassImp(), ClassImp(), ClassImp(), ClassImp(), and ClassImp().
◆ ligne()
std::string TamponTexte::ligne | ( | int | iline | ) |
References _buffer, and TamponTexteError::printMessage().
Referenced by ClassImp().
◆ nom()
const char * TamponTexte::nom | ( | ) | const |
References _name.
Referenced by ClassImp(), and ClassImp().
◆ nombreChamps()
int TamponTexte::nombreChamps | ( | ) |
- Returns
- number of tokens in the buffer
References _buffer, and _cFieldSeparator.
Referenced by ClassImp(), and ClassImp().
◆ nombreChampsLigne()
int TamponTexte::nombreChampsLigne | ( | int | iline | ) |
- Parameters
-
iline line number (0-indexing)
- Returns
- number of tokens on line iline
References _buffer, _cFieldSeparator, _separators, and replaceAll().
Referenced by ClassImp(), ClassImp(), and ClassImp().
◆ nombreLignes()
int TamponTexte::nombreLignes | ( | ) |
- Returns
- number of lines in the buffer
References _buffer.
Referenced by ClassImp(), ClassImp(), and ClassImp().
◆ remplaceChamp()
void TamponTexte::remplaceChamp | ( | int | itoken, |
const char * | replace | ||
) |
- Parameters
-
itoken token number (0-indexing) replace string for replacement Replaces token number itoken with string replace
References _buffer, _cFieldSeparator, _separators, and replaceAll().
Referenced by ClassImp(), and ClassImp().
◆ replaceAll()
|
private |
Replace all occurrences of str1 by str2 in buffer
- Parameters
-
buffer string to perform the replacement str1 string to be replaced by str2 str2 string that replaces str1
Referenced by champ(), champLigne(), nombreChampsLigne(), and remplaceChamp().
Member Data Documentation
◆ _blog
|
private |
◆ _buffer
|
private |
Referenced by champ(), champLigne(), ecrit(), elimineBlancs(), elimineCommentaires(), estVide(), ligne(), nombreChamps(), nombreChampsLigne(), nombreLignes(), remplaceChamp(), and TamponTexte().
◆ _cFieldSeparator
|
private |
Referenced by champ(), champLigne(), initFieldSeparateur(), nombreChamps(), nombreChampsLigne(), remplaceChamp(), and TamponTexte().
◆ _comments
|
private |
Referenced by elimineCommentaires(), and initCarCommentaires().
◆ _name
|
private |
Referenced by ecrit(), nom(), and TamponTexte().
◆ _separators
|
private |
Referenced by champ(), champLigne(), initSeparateurs(), nombreChampsLigne(), and remplaceChamp().