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))
48 file_info (
const std::string& text,
const sys::time& timestamp)
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 (
void)
const {
return m_offsets.size (); }
72 std::string
text (
void)
const {
return m_file_buf; }
74 std::vector<std::size_t>
line_offsets (
void)
const {
return m_offsets; }
76 sys::time
timestamp (
void)
const {
return m_timestamp; }
78 std::size_t
size (
void)
const {
return m_file_buf.length (); }
91 static OCTAVE_API std::string snarf_file (
const std::string& fname);
94 get_line_offsets (
const std::string& buf);
sys::time timestamp(void) const
std::size_t size(void) const
std::string text(void) const
file_info(const file_info &)=default
std::size_t num_lines(void) const
std::vector< std::size_t > m_offsets
file_info(const std::string &text, const sys::time ×tamp)
std::vector< std::size_t > line_offsets(void) const
file_info(const std::string &fname)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
static std::string get_line(FILE *fp)