wex v24.04.0
Public Member Functions | Static Public Member Functions | List of all members
wex::addressrange Class Reference

Offers an address range for vi (ex). More...

#include <wex/ex/addressrange.h>

Public Member Functions

 addressrange (ex *ex, int lines=1)
 Constructor for a range from current position extending with number of lines.
 
 addressrange (ex *ex, int begin_line, int end_line)
 Constructor for a range with specified begin and end line.
 
 addressrange (ex *ex, const std::string &range)
 Constructor for a range (including visual range).
 
auto & begin () const
 Returns begin address.
 
bool copy (const address &destination) const
 Copies range to destination.
 
auto & end () const
 Returns end address.
 
bool erase () const
 Deletes range.
 
auto & find_indicator () const
 Returns find indicator.
 
exget_ex () const
 Returns ex component.
 
bool is_ok () const
 Is this range ok.
 
bool is_selection () const
 Is the begin and address '< and '>.
 
bool join () const
 joins range.
 
bool parse (const command_parser &cp, info_message_t &msg)
 Parses this addressrange based on command parser.
 
const std::string regex_commands () const
 Supported 2addr commands.
 
bool shift_left () const
 Shifts the specified lines to the start of the line.
 
bool shift_right () const
 Shifts the specified lines away from the start of the line.
 
bool yank (char name='0') const
 Yanks range to register, default to yank register.
 

Static Public Member Functions

static auto & data ()
 Returns substitute data.
 

Detailed Description

Offers an address range for vi (ex).

Constructor & Destructor Documentation

◆ addressrange() [1/3]

wex::addressrange::addressrange ( ex * ex,
int lines = 1 )
explicit

Constructor for a range from current position extending with number of lines.

Parameters
exthe ex (or vi) component
lineslines 1 is current line only lines 0 is illegal

◆ addressrange() [2/3]

wex::addressrange::addressrange ( ex * ex,
int begin_line,
int end_line )
explicit

Constructor for a range with specified begin and end line.

Parameters
exthe ex (or vi) component
begin_linebegin line
end_lineend line

◆ addressrange() [3/3]

wex::addressrange::addressrange ( ex * ex,
const std::string & range )
explicit

Constructor for a range (including visual range).

Parameters
exthe ex (or vi) component
rangethe range, being a string containing:
  • . : current line
  • % : entire document
  • * : current screen visible area
  • x,y : range from begin x and end y address.
  • : (empty), the range is empty

Member Function Documentation

◆ parse()

bool wex::addressrange::parse ( const command_parser & cp,
info_message_t & msg )

Parses this addressrange based on command parser.

Returns true if command is valid.

Parameters
cpthe command parser
msgextra information in case command failed