29 m_fileName =
"{std::istream}";
39 auto ifs = std::make_shared<std::ifstream>();
41 ifs->open(fil.c_str());
63 std::istringstream buf;
79 std::getline(*m_in, lin);
82 if (lin.empty())
continue;
102 bool filter_MATLAB_comments,
bool filter_C_comments,
103 bool filter_SH_comments)
105 m_filter_MATLAB_comments = filter_MATLAB_comments;
106 m_filter_C_comments = filter_C_comments;
107 m_filter_SH_comments = filter_SH_comments;
void rewind()
Reset the read pointer to the beginning of the file.
#define ASSERT_(f)
Defines an assertion mechanism.
size_t getCurrentLineNumber() const
Return the line number of the last line returned with getNextLine.
void open(const std::string &fil)
Open a file (an alternative to the constructor with a file name)
bool getNextLine(std::string &out_str)
Reads from the file and return the next (non-comment) line, as a std::string.
void enableCommentFilters(bool filter_MATLAB_comments, bool filter_C_comments, bool filter_SH_comments)
Enable/disable filtering of lines starting with "%", "//" or "#", respectively.
CTextFileLinesParser()=default
Default constructor; should call open() at some moment later.
bool strStarts(const std::string &str, const std::string &subStr)
Return true if "str" starts with "subStr" (case sensitive)
std::string trim(const std::string &str)
Removes leading and trailing spaces.
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
void close()
Close the file (no need to call it normally, the file is closed upon destruction) ...