Biorbd
|
Wrapper for the an std::ifstream with increased capacities. More...
#include <IfStream.h>
Public Member Functions | |
IfStream () | |
Construct IfStream. | |
IfStream (const biorbd::utils::Path &path, std::ios_base::openmode mode) | |
Construct IfStream. More... | |
IfStream (const char *path, std::ios_base::openmode mode) | |
Construct IfStream. More... | |
bool | open (const biorbd::utils::Path &path, std::ios_base::openmode mode) |
Open the file. More... | |
bool | read (biorbd::utils::String &text) |
Read a word in the file skipping the word if it is c-like commented. More... | |
bool | readAWord (biorbd::utils::String &text) |
Read a word in the file. More... | |
bool | read (int &val) |
Read an integer in the file. More... | |
bool | read (bool &val) |
Read an boolean in the file. More... | |
bool | read (unsigned int &val) |
Read an unsigned integer in the file. More... | |
bool | read (double &val) |
Read an double in the file. More... | |
bool | read (double &result, const std::map< biorbd::utils::Equation, double > &variables) |
Read and evaluate an equation. More... | |
bool | readSpecificTag (const biorbd::utils::String &tag, biorbd::utils::String &text) |
Advance in the file to a specific tag. More... | |
bool | reachSpecificTag (const biorbd::utils::String &tag) |
Advance in the file to a specific tag. More... | |
int | countTagsInAConsecutiveLines (const biorbd::utils::String &tag) |
Counts the number of consecutive lines starting with the same tag and then brings it back to the initial position. More... | |
void | getline (biorbd::utils::String &text) |
Read a whole line. More... | |
bool | close () |
Close the file. | |
bool | eof () |
Return if the file is at the end. More... | |
Protected Attributes | |
std::shared_ptr< bool > | m_isOpen |
If file is open. | |
Wrapper for the an std::ifstream with increased capacities.
Definition at line 16 of file IfStream.h.
biorbd::utils::IfStream::IfStream | ( | const biorbd::utils::Path & | path, |
std::ios_base::openmode | mode = std::ios_base::in |
||
) |
Construct IfStream.
path | The file path to open |
mode | The open mode of "std::ios_base" base |
Definition at line 17 of file IfStream.cpp.
biorbd::utils::IfStream::IfStream | ( | const char * | path, |
std::ios_base::openmode | mode = std::ios_base::in |
||
) |
Construct IfStream.
path | The file path to open |
mode | The open mode of "std::ios_base" base |
Definition at line 27 of file IfStream.cpp.
int biorbd::utils::IfStream::countTagsInAConsecutiveLines | ( | const biorbd::utils::String & | tag | ) |
Counts the number of consecutive lines starting with the same tag and then brings it back to the initial position.
tag | The tag to count |
Definition at line 72 of file IfStream.cpp.
bool biorbd::utils::IfStream::eof | ( | ) |
Return if the file is at the end.
Definition at line 190 of file IfStream.cpp.
void biorbd::utils::IfStream::getline | ( | biorbd::utils::String & | text | ) |
Read a whole line.
text | The text read (output) |
Definition at line 179 of file IfStream.cpp.
bool biorbd::utils::IfStream::open | ( | const biorbd::utils::Path & | path, |
std::ios_base::openmode | mode = std::ios_base::in |
||
) |
Open the file.
path | The file path to open |
mode | The open mode of "std::ios_base" base |
Definition at line 40 of file IfStream.cpp.
bool biorbd::utils::IfStream::reachSpecificTag | ( | const biorbd::utils::String & | tag | ) |
Advance in the file to a specific tag.
tag | The tag to reach |
Definition at line 58 of file IfStream.cpp.
bool biorbd::utils::IfStream::read | ( | biorbd::utils::String & | text | ) |
Read a word in the file skipping the word if it is c-like commented.
text | The text read (output) |
Definition at line 94 of file IfStream.cpp.
bool biorbd::utils::IfStream::read | ( | bool & | val | ) |
Read an boolean in the file.
val | The value read (output) |
Definition at line 171 of file IfStream.cpp.
bool biorbd::utils::IfStream::read | ( | double & | result, |
const std::map< biorbd::utils::Equation, double > & | variables | ||
) |
Read and evaluate an equation.
result | The number read (output) |
variables | The variable set |
Definition at line 129 of file IfStream.cpp.
bool biorbd::utils::IfStream::read | ( | double & | val | ) |
Read an double in the file.
val | The number read (output) |
Definition at line 117 of file IfStream.cpp.
bool biorbd::utils::IfStream::read | ( | int & | val | ) |
Read an integer in the file.
val | The number read (output) |
Definition at line 157 of file IfStream.cpp.
bool biorbd::utils::IfStream::read | ( | unsigned int & | val | ) |
Read an unsigned integer in the file.
val | The number read (output) |
Definition at line 164 of file IfStream.cpp.
bool biorbd::utils::IfStream::readAWord | ( | biorbd::utils::String & | text | ) |
Read a word in the file.
text | The text read (output) |
Definition at line 113 of file IfStream.cpp.
bool biorbd::utils::IfStream::readSpecificTag | ( | const biorbd::utils::String & | tag, |
biorbd::utils::String & | text | ||
) |
Advance in the file to a specific tag.
tag | The tag to reach |
text | The text that follows a tag |
Definition at line 51 of file IfStream.cpp.