wex  v21.04.0
Public Member Functions | List of all members
wex::ex_stream Class Reference

Uses a stream for ex mode processing. More...

#include <wex/ex-stream.h>

Inheritance diagram for wex::ex_stream:
Inheritance graph
[legend]

Public Member Functions

 ex_stream (wex::stc *stc)
 Constructor.
 
 ~ex_stream ()
 Destructor.
 
bool erase (const addressrange &range)
 Deletes the range.
 
bool find (const std::string &text, int find_flags=-1, bool find_next=true) override
 Finds line containing text and puts on stc. More...
 
int get_context_lines () const
 Returns context lines.
 
int get_current_line () const
 Returns current line no.
 
int get_line_count () const override
 Returns number of lines, or LINE_COUNT_UNKNOWN if not yet known.
 
int get_line_count_request () override
 Returns number of lines.
 
void goto_line (int no) override
 Gets specified line, and puts on stc.
 
bool insert_text (const address &address, const std::string &text, loc_t loc=INSERT_BEFORE)
 Inserts text at specified address.
 
bool is_modified () const
 Returns true if stream is modified;.
 
bool join (const addressrange &range)
 Joins all lines in the range.
 
bool marker_add (char marker, int line)
 Sets marker.
 
bool marker_delete (char marker)
 Deletes marker.
 
int marker_line (char marker) const
 Returns line for marker.
 
void stream (file &f)
 Sets the streams. More...
 
bool substitute (const addressrange &range, const data::substitute &data)
 Substitutes within the range find by replace.
 
bool write ()
 Writes working stream to file.
 
bool write (const addressrange &range, const std::string &file, bool append=false)
 Writes range to file.
 

Detailed Description

Uses a stream for ex mode processing.

Line numbers are stc line numbers, so start at line 0. All modifications are done in the temp file, and copied to the work file upon changing. If you ask for a write, the work file is copied to the original file.

Member Function Documentation

◆ find()

bool wex::ex_stream::find ( const std::string &  text,
int  find_flags = -1,
bool  find_next = true 
)
overridevirtual

Finds line containing text and puts on stc.

The text is interpreted as regex, and search is forward.

Implements wex::core::text_window.

◆ stream()

void wex::ex_stream::stream ( file f)

Sets the streams.

Puts first line on stc. This must be called before the other methods.