class Poco::LineEndingConverterStreamBuf
Overview
This stream buffer performs line ending conversion on text streams. Moreā¦
#include <LineEndingConverter.h> class LineEndingConverterStreamBuf: public Poco::BasicUnbufferedStreamBuf { public: // construction LineEndingConverterStreamBuf(std::istream& istr); LineEndingConverterStreamBuf(std::ostream& ostr); // methods void setNewLine(const std::string& newLineCharacters); const std::string& getNewLine() const; protected: // methods virtual int readFromDevice(); int writeToDevice(char c); };
Inherited Members
public: // methods virtual int_type overflow(int_type c); virtual int_type underflow(); virtual int_type uflow(); virtual int_type pbackfail(int_type c); virtual std::streamsize xsgetn( char_type* p, std::streamsize count ); protected: // typedefs typedef std::basic_streambuf<ch, tr> Base; typedef std::basic_ios<ch, tr> IOS; typedef ch char_type; typedef tr char_traits; typedef Base::int_type int_type; typedef Base::pos_type pos_type; typedef Base::off_type off_type; typedef IOS::openmode openmode; // methods static int_type charToInt(char_type c);
Detailed Documentation
This stream buffer performs line ending conversion on text streams.
The converter can convert from and to the Unix (LF), Mac (CR) and DOS/Windows/Network (CF-LF) endings.
Any newline sequence in the source will be replaced by the target newline sequence.
Construction
LineEndingConverterStreamBuf(std::istream& istr)
Creates the LineEndingConverterStreamBuf and connects it to the given input stream.
LineEndingConverterStreamBuf(std::ostream& ostr)
Creates the LineEndingConverterStreamBuf and connects it to the given output stream.
Methods
void setNewLine(const std::string& newLineCharacters)
Sets the target line ending for the converter.
Possible values are:
* NEWLINE_DEFAULT (whatever is appropriate for the current platform) * NEWLINE_CRLF (Windows), * NEWLINE_LF (Unix), * NEWLINE_CR (Macintosh)
In theory, any character sequence can be used as newline sequence. In practice, however, only the above three make sense.
const std::string& getNewLine() const
Returns the line ending currently in use.