Core Library  1.7.0.0
Library containing core utilities and tools for threading, networking, logging, INI and CSV file management etc.
core_lib::csv_grid::Cell Class Referencefinal

Class defining a single cell within a row of the grid. More...

#include <CsvGridCell.h>

Public Member Functions

 Cell ()=default
 Default constructor.
 
 Cell (const Cell &)=default
 Copy constructor.
 
 Cell (Cell &&)=default
 Move constructor.
 
 Cell (const std::string &value)
 Initializing constructor. More...
 
 Cell (int32_t value)
 Initializing constructor. More...
 
 Cell (int64_t value)
 Initializing constructor. More...
 
 Cell (float value)
 Initializing constructor. More...
 
 Cell (double value)
 Initializing constructor. More...
 
 Cell (long double value)
 Initializing constructor. More...
 
 ~Cell ()=default
 Destructor.
 
Celloperator= (const Cell &)=default
 Copy assignment operator.
 
Celloperator= (Cell &&)=default
 Move assignment operator.
 
Celloperator= (const std::string &rhs)
 Value assignment operator. More...
 
Celloperator= (int32_t rhs)
 Value assignment operator. More...
 
Celloperator= (int64_t rhs)
 Value assignment operator. More...
 
Celloperator= (float rhs)
 Value assignment operator. More...
 
Celloperator= (double rhs)
 Value assignment operator. More...
 
Celloperator= (long double rhs)
 Value assignment operator. More...
 
std::string Value () const
 Value method. More...
 
 operator std::string () const
 Cast operator. More...
 
 operator int32_t () const
 Cast operator. More...
 
 operator int64_t () const
 Cast operator. More...
 
 operator float () const
 Cast operator. More...
 
 operator double () const
 Cast operator. More...
 
 operator long double () const
 Cast operator. More...
 
int32_t ToInt32Def (int32_t defval=0) const NO_EXCEPT_
 Conversion function. More...
 
int64_t ToInt64Def (int64_t defval=0) const NO_EXCEPT_
 Conversion function. More...
 
float ToFloatDef (float defval=0.0f) const NO_EXCEPT_
 Conversion function. More...
 
double ToDoubleDef (double defval=0.0) const NO_EXCEPT_
 Conversion function. More...
 
long double ToLongDoubleDef (long double defval=0.0L) const NO_EXCEPT_
 Conversion function. More...
 

Private Attributes

std::string m_value {}
 The cell's value data memeber.
 

Detailed Description

Class defining a single cell within a row of the grid.

This class provides the definition of the interface for a cell within a row in the grid. A cell can be thought of as the value in a given column index within the grid.

Constructor & Destructor Documentation

◆ Cell() [1/6]

core_lib::csv_grid::Cell::Cell ( const std::string &  value)
explicit

Initializing constructor.

Parameters
[in]value- The initial value.

Initialise the cell with a string.

◆ Cell() [2/6]

core_lib::csv_grid::Cell::Cell ( int32_t  value)
explicit

Initializing constructor.

Parameters
[in]value- The initial value.

Initialise the cell with a 32bit integer value.

◆ Cell() [3/6]

core_lib::csv_grid::Cell::Cell ( int64_t  value)
explicit

Initializing constructor.

Parameters
[in]value- The initial value.

Initialise the cell with a 64bit integer value.

◆ Cell() [4/6]

core_lib::csv_grid::Cell::Cell ( float  value)
explicit

Initializing constructor.

Parameters
[in]value- The initial value.

Initialise the cell with a single precision floating point value.

◆ Cell() [5/6]

core_lib::csv_grid::Cell::Cell ( double  value)
explicit

Initializing constructor.

Parameters
[in]value- The initial value.

Initialise the cell with a double precision floating point value.

◆ Cell() [6/6]

core_lib::csv_grid::Cell::Cell ( long double  value)
explicit

Initializing constructor.

Parameters
[in]value- The initial value.

Initialise the cell with a long double precision floating point value.

Member Function Documentation

◆ operator double()

core_lib::csv_grid::Cell::operator double ( ) const

Cast operator.

Cast the cell to a double.

Note
If the cell's value cannot be cast to a double then a boost::bad_lexical_cast exception is thrown.

◆ operator float()

core_lib::csv_grid::Cell::operator float ( ) const

Cast operator.

Cast the cell to a float.

Note
If the cell's value cannot be cast to a float then a boost::bad_lexical_cast exception is thrown.

◆ operator int32_t()

core_lib::csv_grid::Cell::operator int32_t ( ) const

Cast operator.

Cast the cell to a 32bit integer.

Note
If the cell's value cannot be cast to a 32bit integer then a boost::bad_lexical_cast exception is thrown.

◆ operator int64_t()

core_lib::csv_grid::Cell::operator int64_t ( ) const

Cast operator.

Cast the cell to a 64bit integer.

Note
If the cell's value cannot be cast to a 64bit integer then a boost::bad_lexical_cast exception is thrown.

◆ operator long double()

core_lib::csv_grid::Cell::operator long double ( ) const

Cast operator.

Cast the cell to a long double.

Note
If the cell's value cannot be cast to a long double then a boost::bad_lexical_cast exception is thrown.

◆ operator std::string()

core_lib::csv_grid::Cell::operator std::string ( ) const

Cast operator.

Returns
Modified Cell object.

Cast the cell to a string.

◆ operator=() [1/6]

Cell & core_lib::csv_grid::Cell::operator= ( const std::string &  rhs)

Value assignment operator.

Parameters
[in]rhs- The value to assign.
Returns
Modified Cell object.

Assign to a string.

◆ operator=() [2/6]

Cell & core_lib::csv_grid::Cell::operator= ( int32_t  rhs)

Value assignment operator.

Parameters
[in]rhs- The value to assign.
Returns
Modified Cell object.

Assign to a 32bit integer value.

◆ operator=() [3/6]

Cell & core_lib::csv_grid::Cell::operator= ( int64_t  rhs)

Value assignment operator.

Parameters
[in]rhs- The value to assign.
Returns
Modified Cell object.

Assign to a 64bit integer value.

◆ operator=() [4/6]

Cell & core_lib::csv_grid::Cell::operator= ( float  rhs)

Value assignment operator.

Parameters
[in]rhs- The value to assign.
Returns
Modified Cell object.

Assign to a single precision floating point value.

◆ operator=() [5/6]

Cell & core_lib::csv_grid::Cell::operator= ( double  rhs)

Value assignment operator.

Parameters
[in]rhs- The value to assign.
Returns
Modified Cell object.

Assign to a double precision floating point value.

◆ operator=() [6/6]

Cell & core_lib::csv_grid::Cell::operator= ( long double  rhs)

Value assignment operator.

Parameters
[in]rhs- The value to assign.
Returns
Modified Cell object.

Assign to a long double precision floating point value.

◆ ToDoubleDef()

double core_lib::csv_grid::Cell::ToDoubleDef ( double  defval = 0.0) const

Conversion function.

Parameters
[in]defval- The default value to return in case of a failure.
Returns
Cell value as a double.

Convert the cell to a double and if this cannot be performed safely return the default value instead.

◆ ToFloatDef()

float core_lib::csv_grid::Cell::ToFloatDef ( float  defval = 0.0f) const

Conversion function.

Parameters
[in]defval- The default value to return in case of a failure.
Returns
Cell value as a float.

Convert the cell to a float and if this cannot be performed safely return the default value instead.

◆ ToInt32Def()

int32_t core_lib::csv_grid::Cell::ToInt32Def ( int32_t  defval = 0) const

Conversion function.

Parameters
[in]defval- The default value to return in case of a failure.
Returns
Cell value as a 32bit integer.

Convert the cell to a 32bit integer and if this cannot be performed safely return the default value instead.

◆ ToInt64Def()

int64_t core_lib::csv_grid::Cell::ToInt64Def ( int64_t  defval = 0) const

Conversion function.

Parameters
[in]defval- The default value to return in case of a failure.
Returns
Cell value as a 64bit integer.

Convert the cell to a 64bit integer and if this cannot be performed safely return the default value instead.

◆ ToLongDoubleDef()

long double core_lib::csv_grid::Cell::ToLongDoubleDef ( long double  defval = 0.0L) const

Conversion function.

Parameters
[in]defval- The default value to return in case of a failure.
Returns
Cell value as a long double.

Convert the cell to a long double and if this cannot be performed safely return the default value instead.

◆ Value()

std::string core_lib::csv_grid::Cell::Value ( ) const

Value method.

Returns
Get the underlying std::string value of the Cell.

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