# HG changeset patch # User John W. Eaton # Date 1560188679 18000 # Node ID 92ba3434f0b0f48dc1c94e8574c6019e48003cef # Parent 58bdc2d984818211ed409b1ef2d6def22892cfcb style fixes and member variable updates for oct-stdstrm.h * oct-stdstrm.h: Use m_ prefix and clearer names for member variables. Style fixes. diff -r 58bdc2d98481 -r 92ba3434f0b0 libinterp/corefcn/oct-stdstrm.h --- a/libinterp/corefcn/oct-stdstrm.h Sat Jun 08 21:17:03 2019 -0700 +++ b/libinterp/corefcn/oct-stdstrm.h Mon Jun 10 12:44:39 2019 -0500 @@ -42,8 +42,8 @@ = octave::mach_info::native_float_format (), const std::string& encoding = "utf-8", typename BUF_T::close_fcn cf = BUF_T::file_close) - : octave::base_stream (m, ff, encoding), nm (n), md (m), - s (f ? new STREAM_T (f, cf) : nullptr), fnum (fid) + : octave::base_stream (m, ff, encoding), m_name (n), m_mode (m), + m_stream (f ? new STREAM_T (f, cf) : nullptr), fnum (fid) { } // No copying! @@ -55,48 +55,66 @@ // Position a stream at OFFSET relative to ORIGIN. int seek (off_t offset, int origin) - { return s ? s->seek (offset, origin) : -1; } + { + return m_stream ? m_stream->seek (offset, origin) : -1; + } // Return current stream position. - off_t tell (void) { return s ? s->tell () : -1; } + off_t tell (void) { return m_stream ? m_stream->tell () : -1; } // Return nonzero if EOF has been reached on this stream. - bool eof (void) const { return s ? s->eof () : true; } + bool eof (void) const { return m_stream ? m_stream->eof () : true; } // The name of the file. - std::string name (void) const { return nm; } + std::string name (void) const { return m_name; } - std::istream * input_stream (void) { return (md & std::ios::in) ? s : nullptr; } + std::istream * input_stream (void) + { + return (m_mode & std::ios::in) ? m_stream : nullptr; + } - std::ostream * output_stream (void) { return (md & std::ios::out) ? s : nullptr; } + std::ostream * output_stream (void) + { + return (m_mode & std::ios::out) ? m_stream : nullptr; + } // FIXME: should not have to cast away const here. BUF_T * rdbuf (void) const - { return s ? (const_cast (s))->rdbuf () : nullptr; } + { + return m_stream ? (const_cast (m_stream))->rdbuf () : nullptr; + } int file_number (void) const { return fnum; } - bool bad (void) const { return s ? s->bad () : true; } + bool bad (void) const { return m_stream ? m_stream->bad () : true; } - void clear (void) { if (s) s->clear (); } + void clear (void) + { + if (m_stream) + m_stream->clear (); + } - void do_close (void) { if (s) s->stream_close (); } + void do_close (void) + { + if (m_stream) + m_stream->stream_close (); + } protected: - std::string nm; + std::string m_name; - std::ios::openmode md; + std::ios::openmode m_mode; - STREAM_T *s; + STREAM_T *m_stream; // The file number associated with this file. int fnum; - ~octave_tstdiostream (void) { delete s; } + ~octave_tstdiostream (void) { delete m_stream; } }; class