class
ReaderContents
Reader base serves as a base class for various file readers. It does generic low-level I/O, e.g., opening and closing a file, and associated error handling.
Derived classes
- class ASCMeshReader
- ASCMeshReader : tk::
Reader. - class GmshMeshReader
- class HyperMeshReader
- HyperMeshReader : tk::
Reader. - class NetgenMeshReader
- NetgenMeshReader : tk::
Reader. - class RDGFLOMeshReader
- RDGFLOMeshReader : tk::
Reader. - class STLTxtMeshReader
- STLTxtMeshReader : tk::
Reader. - class UGRIDMeshReader
- UGRIDMeshReader : tk::
Reader.
Constructors, destructors, conversion operators
Public functions
- void read(char* data, std::streamsize count)
- auto firstline() -> std::string
- Return first line (for detection of file type based on header)
- auto lines() -> std::vector<std::string>
- Read file and return a string for each line.
- auto line(std::size_t lineNum) -> std::string
- Read a given line from file.
Protected variables
- const std::string m_filename
- File name.
- std::ifstream m_inFile
- File input stream.
Function documentation
tk:: Reader:: Reader(const std::string& filename,
std::ios_base::openmode mode = std::ifstream::in) explicit
Constructor: Acquire file handle.
Parameters | |
---|---|
filename in | Name of file to open for reading |
mode in | Open mode, see http://en.cppreference.com/w/cpp/io/ios_ |
void tk:: Reader:: read(char* data,
std::streamsize count)
Parameters | |
---|---|
data in | Buffer to read to |
count in | Number of characters to read |
Unformatted read
std::string tk:: Reader:: firstline()
Return first line (for detection of file type based on header)
Returns | First line read from file. This can be used for detection of file type based on header. |
---|
std::vector<std::string> tk:: Reader:: lines()
Read file and return a string for each line.
Returns | A std::vector< std::string >, a string for each line of a file. |
---|
std::string tk:: Reader:: line(std::size_t lineNum)
Read a given line from file.
Parameters | |
---|---|
lineNum in | Line number to read from file |
Returns | Line read from file at line given |