Class the reads .lha file, parses them and create a LHAFileData containing all blocks with their elements.
More...
#include <lha.h>
|
|
static bool | verbose = false |
| | Tells if warning messages must be printed during the read of .lha files.
|
| |
|
| static std::string | nextLine (std::ifstream &in) |
| | Reads a line in in and removes comments (with '#'). More...
|
| |
| static std::vector< std::string > | split (std::string const &line) |
| | Splits a string into pieces, separating by space and line break. More...
|
| |
| static bool | isBlockLine (std::vector< std::string > const &line) |
| | Tells if a line (vector of string) is a block line. More...
|
| |
| static bool | isPositiveInteger (std::string const &str) |
| | Tells if a string corresponds to a positive integer. More...
|
| |
| static bool | isNumber (std::string const &str) |
| | Tells if a string corresponds to a number, integer or floating point (standard or scientific notation). More...
|
| |
| static bool | isValueLine (std::vector< std::string > const &line) |
| | Tells if a line contains a value. More...
|
| |
| static LHAElement | readValue (std::vector< std::string > const &line) |
| | Reads a line and returns the LHAElement corresponding to it. More...
|
| |
Class the reads .lha file, parses them and create a LHAFileData containing all blocks with their elements.
◆ isBlockLine()
| bool mty::lha::Reader::isBlockLine |
( |
std::vector< std::string > const & |
line | ) |
|
|
staticprivate |
Tells if a line (vector of string) is a block line.
A line is considered as the beginning of a block if there is at least two words and the first is exactly (case-sensitive) "BLOCK".
- Parameters
-
- Returns
- True if the line is a block definition.
-
False else.
◆ isNumber()
| bool mty::lha::Reader::isNumber |
( |
std::string const & |
str | ) |
|
|
staticprivate |
Tells if a string corresponds to a number, integer or floating point (standard or scientific notation).
- Parameters
-
- Returns
- True if the string is a number.
-
False else.
◆ isPositiveInteger()
| bool mty::lha::Reader::isPositiveInteger |
( |
std::string const & |
str | ) |
|
|
staticprivate |
Tells if a string corresponds to a positive integer.
- Parameters
-
- Returns
- True if the string is a positive integer.
-
False else.
◆ isValueLine()
| bool mty::lha::Reader::isValueLine |
( |
std::vector< std::string > const & |
line | ) |
|
|
staticprivate |
Tells if a line contains a value.
This function considers that the line defines a value if words befire the last are positive integers (there must be at least one) and if the last is a number.
- Parameters
-
- Returns
- True if the line is the definition of a value.
- See also
- isPositiveInteger(), isNumber()
◆ nextLine()
| std::string mty::lha::Reader::nextLine |
( |
std::ifstream & |
in | ) |
|
|
staticprivate |
Reads a line in in and removes comments (with '#').
- Parameters
-
- Returns
- A string with the next line in the file with comments removed.
◆ readFile() [1/2]
| LHAFileData mty::lha::Reader::readFile |
( |
std::string const & |
fileName | ) |
|
|
static |
Reads a .lha file and returns its data.
- Parameters
-
| fileName | Name of the file. |
- Returns
- A LHAFileData object containing the file data, block by block.
◆ readFile() [2/2]
| LHAFileData mty::lha::Reader::readFile |
( |
std::ifstream & |
in | ) |
|
|
static |
Reads a .lha file and returns its data.
- Parameters
-
| in | Input file stream for the .lha file. |
- Returns
- A LHAFileData object containing the file data, block by block.
◆ readValue()
| LHAElement mty::lha::Reader::readValue |
( |
std::vector< std::string > const & |
line | ) |
|
|
staticprivate |
Reads a line and returns the LHAElement corresponding to it.
This function must only be called if isValueLine() returns true for it. Otherwise it is undefined behaviour.
- Parameters
-
- Returns
- The corresponding LHAElement, including ids and the value.
- See also
- LHAElement, isValueLine()
◆ split()
| std::vector< std::string > mty::lha::Reader::split |
( |
std::string const & |
line | ) |
|
|
staticprivate |
Splits a string into pieces, separating by space and line break.
- Parameters
-
- Returns
- The splitted line, in a std::vector.
The documentation for this class was generated from the following files:
- include/lha.h
- src/lha.cpp