summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/plib/pstream.cpp
diff options
context:
space:
mode:
author couriersud <couriersud@gmx.org>2017-01-19 18:05:19 +0100
committer couriersud <couriersud@gmx.org>2017-01-20 22:29:23 +0100
commit4d15501a30d78eecc5011ebdd12a7568954129cb (patch)
treef3364bc26aae7719fb8fa3b153847188446844a7 /src/lib/netlist/plib/pstream.cpp
parent1ae3e29ea3fd90e5df31d52c5d3860fde7f3cbac (diff)
Netlist: code refactoring
Make streams provide binary access only. Use putf8_reader and putf8_writer to actually access streams. Replace some char * parameters with pstring where appropriate. Minor code refactoring and move functionality were it belongs. (nw)
Diffstat (limited to 'src/lib/netlist/plib/pstream.cpp')
-rw-r--r--src/lib/netlist/plib/pstream.cpp58
1 files changed, 35 insertions, 23 deletions
diff --git a/src/lib/netlist/plib/pstream.cpp b/src/lib/netlist/plib/pstream.cpp
index b05d86d7bc5..efbf2aa2374 100644
--- a/src/lib/netlist/plib/pstream.cpp
+++ b/src/lib/netlist/plib/pstream.cpp
@@ -27,28 +27,6 @@ pistream::~pistream()
{
}
-bool pistream::readline(pstring &line)
-{
- char c = 0;
- m_linebuf.clear();
- if (!this->readbyte(c))
- {
- line = "";
- return false;
- }
- while (true)
- {
- if (c == 10)
- break;
- else if (c != 13) /* ignore CR */
- m_linebuf += c;
- if (!this->readbyte(c))
- break;
- }
- line = m_linebuf;
- return true;
-}
-
// -----------------------------------------------------------------------------
// postream: output stream
// -----------------------------------------------------------------------------
@@ -367,9 +345,43 @@ pstream::pos_type pomemstream::vtell()
return m_pos;
}
-pstream_fmt_writer_t::~pstream_fmt_writer_t()
+bool putf8_reader::readline(pstring &line)
{
+ pstring::code_t c = 0;
+ m_linebuf.clear();
+ if (!this->readcode(c))
+ {
+ line = "";
+ return false;
+ }
+ while (true)
+ {
+ if (c == 10)
+ break;
+ else if (c != 13) /* ignore CR */
+ m_linebuf += pstring(c);
+ if (!this->readcode(c))
+ break;
+ }
+ line = m_linebuf;
+ return true;
}
+putf8_fmt_writer::putf8_fmt_writer(postream &strm)
+: pfmt_writer_t()
+, putf8_writer(strm)
+{
+}
+
+putf8_fmt_writer::~putf8_fmt_writer()
+{
+}
+
+void putf8_fmt_writer::vdowrite(const pstring &ls) const
+{
+ write(ls);
+}
+
+
}