33 #ifndef __H__UG__COMMON__UTIL__BASE64_FILE_WRITER__
34 #define __H__UG__COMMON__UTIL__BASE64_FILE_WRITER__
102 const std::ios_base::openmode mode = (std::ios_base::out |
103 std::ios_base::trunc));
112 void open(
const char *filename,
113 const std::ios_base::openmode mode = std::ios_base::out );
150 template <
typename T>
File writer allowing selective base64 encoding of arbitrary data.
Definition: base64_file_writer.h:75
std::stringstream m_inBuffer
Internal input buffer for the encoder.
Definition: base64_file_writer.h:164
void dispatch(const T &value)
Writes given data to the output file and encodes it if Base64FileWriter::base64 is set.
Definition: base64_file_writer.cpp:182
Base64FileWriter()
Definition: base64_file_writer.cpp:130
Base64FileWriter & operator<<(const std::string &str)
void close()
Closes the file writer properly and encodes any remaining buffer content.
Definition: base64_file_writer.cpp:312
void assertFileOpen()
Check on readiness of the file stream.
Definition: base64_file_writer.cpp:216
size_t m_lastInputByteSize
Definition: base64_file_writer.h:169
size_t m_numBytesWritten
Definition: base64_file_writer.h:179
Base64FileWriter & operator<<(const fmtflag format)
Switch between normal and base64 encoded output.
Definition: base64_file_writer.cpp:70
std::fstream m_fStream
File stream to write everything to.
Definition: base64_file_writer.h:156
fmtflag format() const
gets the current set format
Definition: base64_file_writer.cpp:66
std::vector< char > m_tmpBuff
Definition: base64_file_writer.h:174
fmtflag m_currFormat
Current write format (base64 or normal)
Definition: base64_file_writer.h:160
void flushInputBuffer(bool force=false)
Flushes input buffer.
Definition: base64_file_writer.cpp:223
fmtflag
Format flags to enable deactivation of base64 encoding selectivly.
Definition: base64_file_writer.h:81
~Base64FileWriter()
Destructor, which properly flushs encoder's internal buffer and closes file stream.
Definition: base64_file_writer.cpp:149
void open(const char *filename, const std::ios_base::openmode mode=std::ios_base::out)
Definition: base64_file_writer.cpp:155
Base64FileWriter(const char *filename, const std::ios_base::openmode mode=(std::ios_base::out|std::ios_base::trunc))
Constructor with name of file to write to.
@ base64_binary
encode given values in binary base64
Definition: base64_file_writer.h:85
@ base64_ascii
enables base64 encoding of all following data until Base64FileWriter::normal is set
Definition: base64_file_writer.h:83
@ normal
behaves as usual std::ofstream
Definition: base64_file_writer.h:87