wex v24.10.0
Public Types | Public Member Functions | Static Public Member Functions | List of all members
wex::address Class Reference

Offers an address class to be used by vi address ranges. More...

#include <wex/ex/address.h>

Public Types

enum class  address_t { IS_BEGIN , IS_END , IS_SINGLE }
 The kind of address this one is. More...
 

Public Member Functions

 address ()=default
 Default constructor.
 
 address (ex *ex, const std::string &address=std::string())
 Constructor for an address from a line string.
 
 address (ex *ex, int line)
 Constructor for an address from a line number.
 
int get_line (int start_pos=-1) const
 Converts the address to a line number.
 
bool marker_add (char marker) const
 Marks this address.
 
bool marker_delete () const
 Deletes marker (if this address concerns a marker).
 
bool parse (const command_parser &cp)
 Parses this address based on command parser.
 
const std::string regex_commands () const
 Supported 1addr commands.
 
address_t type () const
 Return type of address.
 

Static Public Member Functions

static bool flags_supported (const std::string &flags)
 Returns true if flags are supported (for adjust window, and addressrange print).
 

Detailed Description

Offers an address class to be used by vi address ranges.

Member Enumeration Documentation

◆ address_t

enum class wex::address::address_t
strong

The kind of address this one is.

Enumerator
IS_BEGIN 

part of range, the begin

IS_END 

part of range, the end

IS_SINGLE 

not part of range

Constructor & Destructor Documentation

◆ address() [1/2]

wex::address::address ( ex * ex,
const std::string & address = std::string() )
explicit

Constructor for an address from a line string.

Parameters
exthe ex (or vi) component
addressthe address, being a string containing:
  • a normal line number
  • a defined marker, like 'x, or '<: begin of selection and '>: end of selection
  • $ : last line
  • . : current line
  • or a combination of these, using + or -
  • or empty, call set_line afterwards

◆ address() [2/2]

wex::address::address ( ex * ex,
int line )
explicit

Constructor for an address from a line number.

Parameters
exthe ex (or vi) component
linethe address

Member Function Documentation

◆ get_line()

int wex::address::get_line ( int start_pos = -1) const

Converts the address to a line number.

This is the vi line number, so subtract 1 for stc line number. Returns 0 on error in address. Default it uses current position to start determine line number, you can specify another pos as well.

◆ parse()

bool wex::address::parse ( const command_parser & cp)

Parses this address based on command parser.

Returns true if command is valid.