text_line_reader.h | text_line_reader.h | |||
---|---|---|---|---|
skipping to change at line 32 | skipping to change at line 32 | |||
#include <istream> | #include <istream> | |||
#include <sstream> | #include <sstream> | |||
class TextLineReader | class TextLineReader | |||
{ | { | |||
private: | private: | |||
std::istream& input_stream ; | std::istream& input_stream ; | |||
size_t current_line_number; | size_t current_line_number; | |||
std::string current_line_string ; | std::string current_line_string ; | |||
std::istringstream current_line_stream ; | std::istringstream current_line_stream ; | |||
bool unget_line_active ; | ||||
TextLineReader(const TextLineReader&); | TextLineReader(const TextLineReader&); | |||
TextLineReader& operator=(const TextLineReader&); | TextLineReader& operator=(const TextLineReader&); | |||
public: | public: | |||
TextLineReader(std::istream& _input_stream) ; | TextLineReader(std::istream& _input_stream) ; | |||
size_t line_number() const { return current_line_number ; } | size_t line_number() const { return current_line_number ; } | |||
bool next_line() ; | bool next_line() ; | |||
void unget_line ( const std::string& line ) | ||||
{ | ||||
unget_line_active = true ; | ||||
current_line_string = line ; | ||||
} | ||||
void unget_current_line () { unget_line_active = true; } | ||||
//explicit conversions | ||||
const std::string& line_string() const { return current_line_string; } | const std::string& line_string() const { return current_line_string; } | |||
std::istringstream& line_stream() { return current_line_stream; } | std::istringstream& line_stream() { return current_line_stream; } | |||
//implicit conversions | ||||
operator const std::string& () const { return line_string() ; } | ||||
operator std::string() const { return line_string(); } | ||||
operator std::istream& () { return line_stream(); } | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 3 change blocks. | ||||
0 lines changed or deleted | 15 lines changed or added | |||