xlnt
Public Member Functions | Static Public Member Functions | List of all members
xlnt::range_reference Class Reference

A range_reference describes a rectangular area of a worksheet with positive width and height defined by a top-left and bottom-right corner. More...

#include <range_reference.hpp>

Public Member Functions

 range_reference ()
 Constructs a range reference equal to A1:A1 More...
 
 range_reference (const std::string &range_string)
 Constructs a range reference equivalent to the provided range_string in the form top_left:bottom_right. More...
 
 range_reference (const char *range_string)
 Constructs a range reference equivalent to the provided range_string in the form top_left:bottom_right. More...
 
 range_reference (const cell_reference &start, const cell_reference &end)
 Constructs a range reference from cell references indicating top left and bottom right coordinates of the range. More...
 
 range_reference (column_t column_index_start, row_t row_index_start, column_t column_index_end, row_t row_index_end)
 Constructs a range reference from column and row indices. More...
 
bool is_single_cell () const
 Returns true if the range has a width and height of 1 cell. More...
 
std::size_t width () const
 Returns the number of columns encompassed by this range. More...
 
std::size_t height () const
 Returns the number of rows encompassed by this range. More...
 
cell_reference top_left () const
 Returns the coordinate of the top left cell of this range. More...
 
cell_reference top_right () const
 Returns the coordinate of the top right cell of this range. More...
 
cell_reference bottom_left () const
 Returns the coordinate of the bottom left cell of this range. More...
 
cell_reference bottom_right () const
 Returns the coordinate of the bottom right cell of this range. More...
 
range_reference make_offset (int column_offset, int row_offset) const
 Returns a new range reference with the same width and height as this range but shifted by the given number of columns and rows. More...
 
std::string to_string () const
 Returns a string representation of this range. More...
 
bool contains (const cell_reference &ref) const
 Returns true if the given cell reference is within the bounds of this range reference. More...
 
bool operator== (const range_reference &comparand) const
 Returns true if this range is equivalent to the other range. More...
 
bool operator== (const std::string &reference_string) const
 Returns true if this range is equivalent to the string representation of the other range. More...
 
bool operator== (const char *reference_string) const
 Returns true if this range is equivalent to the string representation of the other range. More...
 
bool operator!= (const range_reference &comparand) const
 Returns true if this range is not equivalent to the other range. More...
 
bool operator!= (const std::string &reference_string) const
 Returns true if this range is not equivalent to the string representation of the other range. More...
 
bool operator!= (const char *reference_string) const
 Returns true if this range is not equivalent to the string representation of the other range. More...
 

Static Public Member Functions

static range_reference make_absolute (const range_reference &relative_reference)
 Converts relative reference coordinates to absolute coordinates (B12 -> $B$12) More...
 

Detailed Description

A range_reference describes a rectangular area of a worksheet with positive width and height defined by a top-left and bottom-right corner.

Constructor & Destructor Documentation

◆ range_reference() [1/5]

xlnt::range_reference::range_reference ( )

Constructs a range reference equal to A1:A1

◆ range_reference() [2/5]

xlnt::range_reference::range_reference ( const std::string &  range_string)
explicit

Constructs a range reference equivalent to the provided range_string in the form top_left:bottom_right.

◆ range_reference() [3/5]

xlnt::range_reference::range_reference ( const char *  range_string)
explicit

Constructs a range reference equivalent to the provided range_string in the form top_left:bottom_right.

◆ range_reference() [4/5]

xlnt::range_reference::range_reference ( const cell_reference start,
const cell_reference end 
)

Constructs a range reference from cell references indicating top left and bottom right coordinates of the range.

◆ range_reference() [5/5]

xlnt::range_reference::range_reference ( column_t  column_index_start,
row_t  row_index_start,
column_t  column_index_end,
row_t  row_index_end 
)

Constructs a range reference from column and row indices.

Member Function Documentation

◆ bottom_left()

cell_reference xlnt::range_reference::bottom_left ( ) const

Returns the coordinate of the bottom left cell of this range.

◆ bottom_right()

cell_reference xlnt::range_reference::bottom_right ( ) const

Returns the coordinate of the bottom right cell of this range.

◆ contains()

bool xlnt::range_reference::contains ( const cell_reference ref) const

Returns true if the given cell reference is within the bounds of this range reference.

◆ height()

std::size_t xlnt::range_reference::height ( ) const

Returns the number of rows encompassed by this range.

◆ is_single_cell()

bool xlnt::range_reference::is_single_cell ( ) const

Returns true if the range has a width and height of 1 cell.

◆ make_absolute()

static range_reference xlnt::range_reference::make_absolute ( const range_reference relative_reference)
static

Converts relative reference coordinates to absolute coordinates (B12 -> $B$12)

◆ make_offset()

range_reference xlnt::range_reference::make_offset ( int  column_offset,
int  row_offset 
) const

Returns a new range reference with the same width and height as this range but shifted by the given number of columns and rows.

◆ operator!=() [1/3]

bool xlnt::range_reference::operator!= ( const range_reference comparand) const

Returns true if this range is not equivalent to the other range.

◆ operator!=() [2/3]

bool xlnt::range_reference::operator!= ( const std::string &  reference_string) const

Returns true if this range is not equivalent to the string representation of the other range.

◆ operator!=() [3/3]

bool xlnt::range_reference::operator!= ( const char *  reference_string) const

Returns true if this range is not equivalent to the string representation of the other range.

◆ operator==() [1/3]

bool xlnt::range_reference::operator== ( const range_reference comparand) const

Returns true if this range is equivalent to the other range.

◆ operator==() [2/3]

bool xlnt::range_reference::operator== ( const std::string &  reference_string) const

Returns true if this range is equivalent to the string representation of the other range.

◆ operator==() [3/3]

bool xlnt::range_reference::operator== ( const char *  reference_string) const

Returns true if this range is equivalent to the string representation of the other range.

◆ to_string()

std::string xlnt::range_reference::to_string ( ) const

Returns a string representation of this range.

◆ top_left()

cell_reference xlnt::range_reference::top_left ( ) const

Returns the coordinate of the top left cell of this range.

◆ top_right()

cell_reference xlnt::range_reference::top_right ( ) const

Returns the coordinate of the top right cell of this range.

◆ width()

std::size_t xlnt::range_reference::width ( ) const

Returns the number of columns encompassed by this range.


The documentation for this class was generated from the following file: