certik / yaml-cpp

Automatically exported from code.google.com/p/yaml-cpp
MIT License
0 stars 0 forks source link

Emitter support clearing of m_buffer #258

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
A previously reported issue (Issue 160: Support incremental reading and 
writing) requested the ability to do "incremental" writes to support a 
streaming type use case. To accommodate for this the API was expanded to allow 
an external stream to store content.  Would it be possible to extend the API 
and add a method like 'Emmiter::clearContent()' which would ultimately call 
ostream_wrapper::m_buffer.clear() and preserve all the other state?  This 
extension would allow library users which need to emit to an in memory buffer 
to avoid the copy behavior provided by 'ostringstream::str()'.  Also after this 
string is copied/consumed the ostringstream must be emptied for the next 
sequence of data with 'ostringstream::str(empty_string)' which includes more 
copying and re-sizing when more content is emitted into it.

Original issue reported on code.google.com by scott.k....@gmail.com on 31 Aug 2014 at 4:04

GoogleCodeExporter commented 9 years ago

Original comment by jbe...@gmail.com on 31 Aug 2014 at 3:59

GoogleCodeExporter commented 9 years ago
It may also be beneficial to have a 'Emitter::data()' method to go along with 
this.  This method would be the same as 'Emitter::c_str()' except would not 
append a null character on to the end.

Original comment by scott.k....@gmail.com on 1 Sep 2014 at 2:44