26 #if defined (HAVE_CONFIG_H)
52 while (eol > 0 && eol > bol
62 std::deque<std::string>
65 std::deque<std::string>
retval;
82 (*current_liboctave_error_handler) (
"no such file, '%s'", fname.c_str ());
84 size_t sz = fs.
size ();
87 std::ios::in | std::ios::binary);
91 std::string buf (sz+1, 0);
93 file.read (&buf[0], sz+1);
96 (*current_liboctave_error_handler)
97 (
"error reading file %s", fname.c_str ());
108 std::deque<size_t> tmp_offsets;
110 tmp_offsets.push_back (0);
112 size_t len = buf.length ();
114 for (
size_t i = 0; i <
len; i++)
118 if (c ==
'\r' && ++i <
len)
123 tmp_offsets.push_back (i+1);
125 tmp_offsets.push_back (i);
128 tmp_offsets.push_back (i+1);
131 tmp_offsets.push_back (
len-1);
133 size_t n = tmp_offsets.size ();
135 std::vector<size_t>
retval (
n);
137 for (
auto& elt : tmp_offsets)
size_t num_lines(void) const
std::string get_line(size_t line) const
std::deque< std::string > get_lines(size_t line, size_t num_lines) const
static std::string snarf_file(const std::string &fname)
std::vector< size_t > m_offsets
static std::vector< size_t > get_line_offsets(const std::string &buf)
std::ifstream ifstream(const std::string &filename, const std::ios::openmode mode)
octave_value::octave_value(const Array< char > &chm, char type) return retval