Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

ht_ltextfile Class Reference

#include <textfile.h>

Inheritance diagram for ht_ltextfile:

ht_textfile ht_layer_streamfile ht_streamfile ht_stream ht_info_textfile Terminal List of all members.

Public Member Functions

void init (ht_streamfile *streamfile, bool own_streamfile, ht_syntax_lexer *lexer)
virtual void done ()
virtual void copy_to (ht_stream *stream)
virtual int extend (UINT newsize)
virtual UINT get_size ()
virtual void pstat (pstat_t *s)
virtual UINT read (void *buf, UINT size)
virtual void set_layered (ht_streamfile *streamfile)
virtual int seek (FILEOFS offset)
virtual FILEOFS tell ()
virtual int truncate (UINT newsize)
virtual int vcntl (UINT cmd, va_list vargs)
virtual UINT write (const void *buf, UINT size)
virtual bool convert_ofs2line (FILEOFS o, UINT *line, UINT *pofs)
virtual bool convert_line2ofs (UINT line, UINT pofs, FILEOFS *o)
virtual void delete_lines (UINT line, UINT count)
virtual void delete_chars (UINT line, UINT ofs, UINT count)
virtual bool get_char (UINT line, char *ch, UINT pos)
virtual bool getline (UINT line, UINT pofs, void *buf, UINT buflen, UINT *retlen, lexer_state *state)
virtual UINT getlinelength (UINT line)
virtual void insert_lines (UINT before, UINT count, void **line_ends, int *lineendlens)
virtual void insert_chars (UINT line, UINT ofs, void *chars, UINT len)
virtual bool has_line (UINT line)
virtual UINT linecount ()
virtual void set_layered_assume (ht_streamfile *streamfile, bool changes_applied)
virtual void set_lexer (ht_syntax_lexer *lexer)

Protected Member Functions

void cache_invd ()
void cache_flush ()
void dirty_nofs (UINT line)
void dirty_parse (UINT line)
UINT find_linelen_forwd (byte *buf, UINT maxbuflen, FILEOFS ofs, int *le_len)
virtual ht_ltextfile_linefetch_line (UINT line)
ht_ltextfile_linefetch_line_nofs_ok (UINT line)
ht_ltextfile_linefetch_line_into_memory (UINT line)
UINT getlinelength_i (ht_ltextfile_line *e)
bool is_dirty_nofs (UINT line)
bool is_dirty_parse (UINT line)
byte * match_lineend_forwd (byte *buf, UINT buflen, int *le_len)
lexer_state next_instate (UINT line)
FILEOFS next_nofs (ht_ltextfile_line *l)
void split_line (UINT a, UINT pos, void *line_end, int line_end_len)
void update_nofs (UINT line)
void update_parse (UINT line)
void reread ()

Protected Attributes

FILEOFS ofs
ht_clistlines
ht_clistorig_lines
ht_syntax_lexerlexer
UINT first_parse_dirty_line
UINT first_nofs_dirty_line
bool dirty

Member Function Documentation

void ht_ltextfile::cache_flush  )  [protected]
 

Definition at line 170 of file textfile.cc.

Referenced by vcntl().

void ht_ltextfile::cache_invd  )  [protected]
 

Definition at line 156 of file textfile.cc.

References ht_clist::append(), ht_clist::count(), dirty, dirty_parse(), ht_clist::empty(), ht_clist::get(), lines, orig_lines, and UINT.

Referenced by set_layered_assume(), and vcntl().

bool ht_ltextfile::convert_line2ofs UINT  line,
UINT  pofs,
FILEOFS o
[virtual]
 

Implements ht_textfile.

Definition at line 174 of file textfile.cc.

References fetch_line_nofs_ok(), FILEOFS, getlinelength_i(), ht_ltextfile_line::nofs, and UINT.

Referenced by get_size().

bool ht_ltextfile::convert_ofs2line FILEOFS  o,
UINT line,
UINT pofs
[virtual]
 

Implements ht_textfile.

Definition at line 190 of file textfile.cc.

References assert, fetch_line_nofs_ok(), FILEOFS, linecount(), ht_ltextfile_line::nofs, and UINT.

Referenced by read(), ht_info_textfile::set_node(), and write().

void ht_ltextfile::copy_to ht_stream stream  )  [virtual]
 

Reimplemented from ht_layer_streamfile.

Definition at line 218 of file textfile.cc.

References buf, byte, malloc(), read(), STREAM_COPYBUF_SIZE, UINT, and ht_stream::write().

void ht_ltextfile::delete_chars UINT  line,
UINT  ofs,
UINT  count
[virtual]
 

Implements ht_textfile.

Definition at line 242 of file textfile.cc.

References dirty, dirty_nofs(), dirty_parse(), fetch_line_into_memory(), ht_ltextfile_line::in_memory, malloc(), and UINT.

Referenced by split_line().

void ht_ltextfile::delete_lines UINT  line,
UINT  count
[virtual]
 

Implements ht_textfile.

Definition at line 264 of file textfile.cc.

References ht_list::del_multiple(), dirty, dirty_nofs(), dirty_parse(), lines, and UINT.

void ht_ltextfile::dirty_nofs UINT  line  )  [protected]
 

Definition at line 277 of file textfile.cc.

References first_nofs_dirty_line, and UINT.

Referenced by delete_chars(), delete_lines(), insert_chars(), and insert_lines().

void ht_ltextfile::dirty_parse UINT  line  )  [protected]
 

Definition at line 272 of file textfile.cc.

References first_parse_dirty_line, and UINT.

Referenced by cache_invd(), delete_chars(), delete_lines(), insert_chars(), insert_lines(), and set_lexer().

void ht_ltextfile::done  )  [virtual]
 

Reimplemented from ht_layer_streamfile.

Reimplemented in ht_info_textfile, and Terminal.

Definition at line 147 of file textfile.cc.

References ht_clist::destroy(), ht_layer_streamfile::done(), lines, and orig_lines.

Referenced by Terminal::done(), ht_info_textfile::done(), and ht_aviewer::showComments().

int ht_ltextfile::extend UINT  newsize  )  [virtual]
 

Reimplemented from ht_layer_streamfile.

Definition at line 282 of file textfile.cc.

References UINT.

ht_ltextfile_line * ht_ltextfile::fetch_line UINT  line  )  [protected, virtual]
 

Reimplemented in ht_info_textfile.

Definition at line 288 of file textfile.cc.

References ht_clist::get(), lines, and UINT.

Referenced by ht_info_textfile::fetch_line(), fetch_line_into_memory(), fetch_line_nofs_ok(), get_char(), getline(), getlinelength(), has_line(), insert_chars(), insert_lines(), read(), update_nofs(), and update_parse().

ht_ltextfile_line * ht_ltextfile::fetch_line_into_memory UINT  line  )  [protected]
 

Definition at line 335 of file textfile.cc.

References fetch_line(), ht_ltextfile_line::in_memory, ht_ltextfile_line::is_in_memory, malloc(), ht_ltextfile_line::on_disk, ht_stream::read(), ht_streamfile::seek(), and UINT.

Referenced by delete_chars(), and insert_chars().

ht_ltextfile_line * ht_ltextfile::fetch_line_nofs_ok UINT  line  )  [protected]
 

Definition at line 293 of file textfile.cc.

References fetch_line(), is_dirty_nofs(), UINT, and update_nofs().

Referenced by convert_line2ofs(), convert_ofs2line(), and set_layered_assume().

UINT ht_ltextfile::find_linelen_forwd byte *  buf,
UINT  maxbuflen,
FILEOFS  ofs,
int *  le_len
[protected]
 

Definition at line 299 of file textfile.cc.

References buf, byte, FILEOFS, len, match_lineend_forwd(), ht_stream::read(), ht_streamfile::seek(), TEXTFILE_MAX_LINEENDLEN, TEXTFILE_MAX_LINELEN, TEXTFILE_READSIZE, and UINT.

Referenced by reread().

bool ht_ltextfile::get_char UINT  line,
char *  ch,
UINT  pos
[virtual]
 

Implements ht_textfile.

Definition at line 360 of file textfile.cc.

References fetch_line(), ht_ltextfile_line::in_memory, ht_ltextfile_line::is_in_memory, ht_ltextfile_line::on_disk, ht_stream::read(), ht_streamfile::seek(), and UINT.

UINT ht_ltextfile::get_size  )  [virtual]
 

Reimplemented from ht_layer_streamfile.

Definition at line 352 of file textfile.cc.

References convert_line2ofs(), FILEOFS, getlinelength(), linecount(), and UINT.

Referenced by TerminalViewer::handlemsg(), pstat(), and Terminal::update().

bool ht_ltextfile::getline UINT  line,
UINT  pofs,
void *  buf,
UINT  buflen,
UINT retlen,
lexer_state state
[virtual]
 

Implements ht_textfile.

Definition at line 381 of file textfile.cc.

References buf, fetch_line(), ht_ltextfile_line::in_memory, ht_ltextfile_line::instate, is_dirty_nofs(), is_dirty_parse(), ht_ltextfile_line::is_in_memory, lexer_state, ht_ltextfile_line::on_disk, ht_stream::read(), ht_streamfile::seek(), UINT, update_nofs(), and update_parse().

Referenced by next_instate(), ht_aviewer::showComments(), and split_line().

UINT ht_ltextfile::getlinelength UINT  line  )  [virtual]
 

Implements ht_textfile.

Definition at line 427 of file textfile.cc.

References fetch_line(), getlinelength_i(), and UINT.

Referenced by get_size(), and split_line().

UINT ht_ltextfile::getlinelength_i ht_ltextfile_line e  )  [protected]
 

Definition at line 433 of file textfile.cc.

References ht_ltextfile_line::in_memory, ht_ltextfile_line::is_in_memory, ht_ltextfile_line::on_disk, and UINT.

Referenced by convert_line2ofs(), and getlinelength().

bool ht_ltextfile::has_line UINT  line  )  [virtual]
 

Implements ht_textfile.

Definition at line 504 of file textfile.cc.

References fetch_line(), NULL, and UINT.

void ht_ltextfile::init ht_streamfile streamfile,
bool  own_streamfile,
ht_syntax_lexer lexer
 

Reimplemented in ht_info_textfile.

Definition at line 130 of file textfile.cc.

References dirty, first_nofs_dirty_line, first_parse_dirty_line, ht_layer_streamfile::get_error(), ht_clist::init(), ht_stream::init(), lexer, linecount(), lines, ofs, orig_lines, and reread().

Referenced by ht_app::create_window_file_text(), ht_app::handlemsg(), and ht_aviewer::showComments().

void ht_ltextfile::insert_chars UINT  line,
UINT  ofs,
void *  chars,
UINT  len
[virtual]
 

Implements ht_textfile.

Definition at line 472 of file textfile.cc.

References dirty, dirty_nofs(), dirty_parse(), fetch_line(), fetch_line_into_memory(), ht_ltextfile_line::in_memory, ht_ltextfile_line::is_in_memory, len, malloc(), ht_ltextfile_line::on_disk, and UINT.

Referenced by split_line(), and write().

void ht_ltextfile::insert_lines UINT  before,
UINT  count,
void **  line_ends,
int *  lineendlens
[virtual]
 

Implements ht_textfile.

Definition at line 445 of file textfile.cc.

References dirty, dirty_nofs(), dirty_parse(), fetch_line(), ht_ltextfile_line::in_memory, ht_clist::insert_before(), ht_ltextfile_line::instate, ht_ltextfile_line::is_in_memory, ht_ltextfile_line::lineend, ht_ltextfile_line::lineendlen, lines, malloc(), ht_ltextfile_line::nofs, ht_ltextfile_line::on_disk, and UINT.

Referenced by split_line().

bool ht_ltextfile::is_dirty_nofs UINT  line  )  [protected]
 

Definition at line 509 of file textfile.cc.

References first_nofs_dirty_line, and UINT.

Referenced by fetch_line_nofs_ok(), and getline().

bool ht_ltextfile::is_dirty_parse UINT  line  )  [protected]
 

Definition at line 514 of file textfile.cc.

References first_parse_dirty_line, and UINT.

Referenced by getline().

UINT ht_ltextfile::linecount  )  [virtual]
 

Implements ht_textfile.

Reimplemented in ht_info_textfile.

Definition at line 519 of file textfile.cc.

References ht_clist::count(), lines, and UINT.

Referenced by convert_ofs2line(), get_size(), init(), ht_info_textfile::set_node(), and ht_aviewer::showComments().

byte * ht_ltextfile::match_lineend_forwd byte *  buf,
UINT  buflen,
int *  le_len
[protected]
 

Definition at line 524 of file textfile.cc.

References buf, byte, NULL, and UINT.

Referenced by find_linelen_forwd(), and write().

lexer_state ht_ltextfile::next_instate UINT  line  )  [protected]
 

Definition at line 541 of file textfile.cc.

References buf, byte, getline(), ht_syntax_lexer::gettoken(), lexer, lexer_state, text_pos::line, text_pos::pofs, TEXTFILE_MAX_LINELEN, and UINT.

Referenced by update_parse().

FILEOFS ht_ltextfile::next_nofs ht_ltextfile_line l  )  [protected]
 

Definition at line 571 of file textfile.cc.

References FILEOFS, ht_ltextfile_line::in_memory, ht_ltextfile_line::is_in_memory, ht_ltextfile_line::lineendlen, ht_ltextfile_line::nofs, and ht_ltextfile_line::on_disk.

Referenced by update_nofs().

void ht_ltextfile::pstat pstat_t s  )  [virtual]
 

Reimplemented from ht_layer_streamfile.

Definition at line 580 of file textfile.cc.

References get_size(), ht_streamfile::pstat(), pstat_t::size, and pstat_t::size_high.

UINT ht_ltextfile::read void *  buf,
UINT  size
[virtual]
 

Reimplemented from ht_layer_streamfile.

Definition at line 587 of file textfile.cc.

References buf, byte, convert_ofs2line(), fetch_line(), FILEOFS, ht_ltextfile_line::in_memory, ht_ltextfile_line::is_in_memory, ht_ltextfile_line::lineend, ht_ltextfile_line::lineendlen, MIN, ofs, ht_ltextfile_line::on_disk, ht_stream::read(), ht_streamfile::seek(), size, tell(), and UINT.

Referenced by copy_to().

void ht_ltextfile::reread  )  [protected]
 

Definition at line 641 of file textfile.cc.

References ht_clist::append(), assert, buf, byte, dirty, ht_clist::empty(), FILEOFS, find_linelen_forwd(), ht_syntax_lexer::getinitstate(), ht_syntax_lexer::gettoken(), ht_ltextfile_line::instate, ht_ltextfile_line::is_in_memory, lexer, lexer_state, text_pos::line, ht_ltextfile_line::lineend, ht_ltextfile_line::lineendlen, lines, ht_ltextfile_line::nofs, ofs, ht_ltextfile_line::on_disk, orig_lines, text_pos::pofs, ht_stream::read(), ht_streamfile::seek(), TEXTFILE_MAX_LINELEN, and UINT.

Referenced by init(), and set_layered().

int ht_ltextfile::seek FILEOFS  offset  )  [virtual]
 

Reimplemented from ht_layer_streamfile.

Definition at line 731 of file textfile.cc.

References FILEOFS, and ofs.

Referenced by TerminalViewer::handlemsg(), and Terminal::update().

void ht_ltextfile::set_layered ht_streamfile streamfile  )  [virtual]
 

Reimplemented from ht_layer_streamfile.

Definition at line 737 of file textfile.cc.

References reread(), and ht_layer_streamfile::set_layered().

void ht_ltextfile::set_layered_assume ht_streamfile streamfile,
bool  changes_applied
[virtual]
 

Implements ht_textfile.

Definition at line 743 of file textfile.cc.

References ht_clist::append(), cache_invd(), ht_clist::count(), ht_clist::empty(), fetch_line_nofs_ok(), ht_ltextfile_line::in_memory, ht_ltextfile_line::is_in_memory, lines, ht_ltextfile_line::nofs, ht_ltextfile_line::on_disk, orig_lines, ht_layer_streamfile::set_layered(), and UINT.

void ht_ltextfile::set_lexer ht_syntax_lexer lexer  )  [virtual]
 

Implements ht_textfile.

Definition at line 765 of file textfile.cc.

References dirty_parse(), and lexer.

void ht_ltextfile::split_line UINT  a,
UINT  pos,
void *  line_end,
int  line_end_len
[protected]
 

Definition at line 712 of file textfile.cc.

References delete_chars(), getline(), getlinelength(), insert_chars(), insert_lines(), malloc(), NULL, and UINT.

Referenced by write().

FILEOFS ht_ltextfile::tell  )  [virtual]
 

Reimplemented from ht_layer_streamfile.

Definition at line 773 of file textfile.cc.

References FILEOFS, and ofs.

Referenced by read(), and write().

int ht_ltextfile::truncate UINT  newsize  )  [virtual]
 

Reimplemented from ht_layer_streamfile.

Definition at line 778 of file textfile.cc.

References UINT.

void ht_ltextfile::update_nofs UINT  line  )  [protected]
 

Definition at line 812 of file textfile.cc.

References fetch_line(), FILEOFS, first_nofs_dirty_line, next_nofs(), ht_ltextfile_line::nofs, and UINT.

Referenced by fetch_line_nofs_ok(), and getline().

void ht_ltextfile::update_parse UINT  line  )  [protected]
 

Definition at line 784 of file textfile.cc.

References fetch_line(), first_parse_dirty_line, ht_syntax_lexer::getinitstate(), ht_ltextfile_line::instate, lexer, lexer_state, next_instate(), and UINT.

Referenced by getline().

int ht_ltextfile::vcntl UINT  cmd,
va_list  vargs
[virtual]
 

Reimplemented from ht_layer_streamfile.

Definition at line 835 of file textfile.cc.

References cache_flush(), cache_invd(), dirty, FCNTL_MODS_CLEAR_DIRTY, FCNTL_MODS_FLUSH, FCNTL_MODS_INVD, FCNTL_MODS_IS_DIRTY, FILEOFS, UINT, and ht_layer_streamfile::vcntl().

UINT ht_ltextfile::write const void *  buf,
UINT  size
[virtual]
 

Reimplemented from ht_layer_streamfile.

Reimplemented in Terminal.

Definition at line 861 of file textfile.cc.

References buf, byte, convert_ofs2line(), FILEOFS, insert_chars(), match_lineend_forwd(), ofs, size, split_line(), tell(), and UINT.

Referenced by Terminal::write().


Member Data Documentation

bool ht_ltextfile::dirty [protected]
 

Definition at line 108 of file textfile.h.

Referenced by cache_invd(), delete_chars(), delete_lines(), init(), insert_chars(), insert_lines(), reread(), and vcntl().

UINT ht_ltextfile::first_nofs_dirty_line [protected]
 

Definition at line 107 of file textfile.h.

Referenced by dirty_nofs(), init(), is_dirty_nofs(), and update_nofs().

UINT ht_ltextfile::first_parse_dirty_line [protected]
 

Definition at line 106 of file textfile.h.

Referenced by dirty_parse(), init(), is_dirty_parse(), and update_parse().

ht_syntax_lexer* ht_ltextfile::lexer [protected]
 

Definition at line 105 of file textfile.h.

Referenced by init(), next_instate(), reread(), set_lexer(), and update_parse().

ht_clist* ht_ltextfile::lines [protected]
 

Definition at line 103 of file textfile.h.

Referenced by cache_invd(), delete_lines(), done(), fetch_line(), init(), insert_lines(), linecount(), reread(), and set_layered_assume().

FILEOFS ht_ltextfile::ofs [protected]
 

Definition at line 102 of file textfile.h.

Referenced by init(), read(), reread(), seek(), tell(), and write().

ht_clist* ht_ltextfile::orig_lines [protected]
 

Definition at line 104 of file textfile.h.

Referenced by cache_invd(), done(), init(), reread(), and set_layered_assume().


The documentation for this class was generated from the following files:
Generated on Fri May 7 21:16:00 2004 by doxygen 1.3.5