26 #if ! defined (octave_file_info_h)
27 #define octave_file_info_h 1
29 #include "octave-config.h"
45 : m_file_buf (), m_offsets (), m_timestamp (static_cast<OCTAVE_TIME_T> (0))
49 : m_file_buf (
text), m_offsets (get_line_offsets (m_file_buf)),
50 m_timestamp (timestamp)
54 : m_file_buf (snarf_file (fname)),
55 m_offsets (get_line_offsets (m_file_buf)),
68 get_lines (std::size_t
line, std::size_t num_lines)
const;
70 std::size_t
num_lines ()
const {
return m_offsets.size (); }
72 std::string
text ()
const {
return m_file_buf; }
74 std::vector<std::size_t>
line_offsets ()
const {
return m_offsets; }
76 sys::time
timestamp ()
const {
return m_timestamp; }
78 std::size_t
size ()
const {
return m_file_buf.length (); }
83 std::string m_file_buf;
86 std::vector<std::size_t> m_offsets;
88 sys::time m_timestamp;
91 static OCTAVE_API std::string snarf_file (
const std::string& fname);
94 get_line_offsets (
const std::string& buf);
97 OCTAVE_END_NAMESPACE(
octave)
file_info(const file_info &)=default
std::vector< std::size_t > line_offsets() const
std::size_t num_lines() const
file_info(const std::string &text, const sys::time ×tamp)
sys::time timestamp() const
file_info(const std::string &fname)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn