|
Biorbd Release_1.13.0
|
Wrapper for the an std::ifstream with increased capacities. More...
#include <IfStream.h>
Public Member Functions | |
| IfStream () | |
| Construct IfStream. | |
| IfStream (const Path &path, std::ios_base::openmode mode) | |
| Construct IfStream. | |
| IfStream (const char *path, std::ios_base::openmode mode) | |
| Construct IfStream. | |
| bool | open (const Path &path, std::ios_base::openmode mode) |
| Open the file. | |
| bool | read (String &text) |
| Read a word in the file skipping the word if it is c-like commented. | |
| bool | readAWord (String &text) |
| Read a word in the file. | |
| bool | read (int &val) |
| Read an integer in the file. | |
| bool | read (bool &val) |
| Read an boolean in the file. | |
| bool | read (size_t &val) |
| Read an unsigned integer in the file. | |
| bool | read (double &val) |
| Read an double in the file. | |
| bool | read (double &result, const std::map< Equation, double > &variables) |
| Read and evaluate an equation. | |
| bool | readFromBinary (char *output, int n_elements) |
| Read a certain amounts of bits in binary. | |
| bool | readFromBinary (float &result) |
| Read a float in binary file. | |
| bool | readFromBinary (Vector3d &v) |
| Read a 3d vector (three floats) in binary file. | |
| bool | readSpecificTag (const String &tag, String &text) |
| Advance in the file to a specific tag. | |
| bool | reachSpecificTag (const String &tag, size_t maxTag=-1) |
| Advance in the file to a specific tag. | |
| int | countTagsInAConsecutiveLines (const String &tag) |
| Counts the number of consecutive lines starting with the same tag and then brings it back to the initial position. | |
| void | getline (String &text) |
| Read a whole line. | |
| void | resetCursor () |
| Reset the file cursor to the 0 position. | |
| bool | close () |
| Close the file. | |
| bool | eof () |
| Return if the file is at the end. | |
Protected Attributes | |
| std::shared_ptr< bool > | m_isOpen |
| If file is open. | |
| char | m_floatBuffer [sizeof(float)] |
| Buffer for reading float in binaries. | |
Wrapper for the an std::ifstream with increased capacities.
Definition at line 20 of file IfStream.h.
| utils::IfStream::IfStream | ( | ) |
Construct IfStream.
Definition at line 14 of file IfStream.cpp.
| utils::IfStream::IfStream | ( | const 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 20 of file IfStream.cpp.
| 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 29 of file IfStream.cpp.
| bool utils::IfStream::close | ( | ) |
| int utils::IfStream::countTagsInAConsecutiveLines | ( | const 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 80 of file IfStream.cpp.
| bool utils::IfStream::eof | ( | ) |
Return if the file is at the end.
Definition at line 225 of file IfStream.cpp.
| void utils::IfStream::getline | ( | utils::String & | text | ) |
Read a whole line.
| text | The text read (output) |
Definition at line 210 of file IfStream.cpp.
| bool utils::IfStream::open | ( | const 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 utils::IfStream::reachSpecificTag | ( | const String & | tag, |
| size_t | maxTag = -1 ) |
Advance in the file to a specific tag.
| tag | The tag to reach |
| maxTag | The number of element to read before giving up |
Definition at line 58 of file IfStream.cpp.
| bool utils::IfStream::read | ( | bool & | val | ) |
Read an boolean in the file.
| val | The value read (output) |
Definition at line 203 of file IfStream.cpp.
| bool utils::IfStream::read | ( | double & | result, |
| const std::map< Equation, double > & | variables ) |
Read and evaluate an equation.
| result | The number read (output) |
| variables | The variable set |
Definition at line 137 of file IfStream.cpp.
| bool utils::IfStream::read | ( | double & | val | ) |
Read an double in the file.
| val | The number read (output) |
Definition at line 127 of file IfStream.cpp.
| bool utils::IfStream::read | ( | int & | val | ) |
Read an integer in the file.
| val | The number read (output) |
Definition at line 191 of file IfStream.cpp.
| bool utils::IfStream::read | ( | size_t & | val | ) |
Read an unsigned integer in the file.
| val | The number read (output) |
Definition at line 197 of file IfStream.cpp.
| bool utils::IfStream::read | ( | 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 101 of file IfStream.cpp.
| bool utils::IfStream::readAWord | ( | utils::String & | text | ) |
Read a word in the file.
| text | The text read (output) |
Definition at line 123 of file IfStream.cpp.
| bool utils::IfStream::readFromBinary | ( | char * | output, |
| int | n_elements ) |
Read a certain amounts of bits in binary.
| output | Where the result is store |
| n_elements | Number of bits to read |
Definition at line 152 of file IfStream.cpp.
| bool utils::IfStream::readFromBinary | ( | float & | result | ) |
Read a float in binary file.
| result | The float to put the result into |
Definition at line 157 of file IfStream.cpp.
| bool utils::IfStream::readFromBinary | ( | utils::Vector3d & | v | ) |
Read a 3d vector (three floats) in binary file.
| v | The vector to put the result into |
Definition at line 163 of file IfStream.cpp.
| bool utils::IfStream::readSpecificTag | ( | const String & | tag, |
| 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.
| void utils::IfStream::resetCursor | ( | ) |
Reset the file cursor to the 0 position.
Definition at line 214 of file IfStream.cpp.
|
protected |
Buffer for reading float in binaries.
Definition at line 189 of file IfStream.h.
|
protected |
If file is open.
Definition at line 188 of file IfStream.h.