Vince's CSV Parser
Loading...
Searching...
No Matches
csv::DataFrameRow< KeyType > Class Template Reference

Public Member Functions

 DataFrameRow ()
 Default constructor (creates an unbound proxy).
 
 DataFrameRow (const CSVRow *_row, DataFrame< KeyType > *_frame, size_t _row_index, RowOverlay *_edits, const KeyType *_key)
 Construct a mutable DataFrameRow wrapper.
 
 DataFrameRow (const CSVRow *_row, const DataFrame< KeyType > *_frame, size_t _row_index, const RowOverlay *_edits, const KeyType *_key)
 Construct a read-only DataFrameRow wrapper.
 
DataFrameCell operator[] (const std::string &col)
 Access a field by column name, preserving edit support.
 
DataFrameCell operator[] (size_t n)
 Access a field by position, preserving edit support.
 
DataFrameCell operator[] (const std::string &col) const
 Access a field by column name, checking edits first.
 
DataFrameCell operator[] (size_t n) const
 Access a field by position, checking edits first.
 
DataFrameCell try_field (size_t index, CSVError &error)
 Checked cell access.
 
DataFrameCell try_field (size_t index, CSVError &error) const
 
DataFrameCell try_field (const std::string &name, CSVError &error)
 
DataFrameCell try_field (const std::string &name, CSVError &error) const
 
bool try_erase (CSVError &error)
 
bool is_valid () const noexcept
 Whether the proxy is bound.
 
size_t size () const
 Get the number of visible fields in the row.
 
bool empty () const
 Check if the row is empty.
 
const std::vector< std::string > & get_col_names () const
 Get column names.
 
const CSVRow & get_underlying_row () const
 Get the underlying CSVRow without applying cell edits or column visibility.
 
const KeyType & key () const
 Get the key for this row (only valid for keyed DataFrames).
 
bool erase ()
 Delete this row from the parent DataFrame.
 
 operator std::vector< std::string > () const
 Convert to vector of strings for CSVWriter compatibility.
 
std::string to_json (const std::vector< std::string > &subset={}) const
 Convert to JSON.
 
std::string try_to_json (const std::vector< std::string > &subset, CSVError &error) const
 Serialize selected visible columns, reporting lookup and physical-row bounds errors.
 
std::string to_json_array (const std::vector< std::string > &subset={}) const
 Convert to JSON array.
 
std::string try_to_json_array (const std::vector< std::string > &subset, CSVError &error) const
 Serialize selected visible columns, reporting lookup and physical-row bounds errors.
 
auto to_sv_range () const
 Convert this DataFrameRow into a std::ranges::input_range of strings, respecting the sparse overlay (edited values take precedence).
 

Detailed Description

template<typename KeyType>
class csv::DataFrameRow< KeyType >

Definition at line 15 of file data_frame_row.hpp.

Constructor & Destructor Documentation

◆ DataFrameRow() [1/3]

template<typename KeyType >
csv::DataFrameRow< KeyType >::DataFrameRow ( )
inline

Default constructor (creates an unbound proxy).

Definition at line 18 of file data_frame_row.hpp.

◆ DataFrameRow() [2/3]

template<typename KeyType >
csv::DataFrameRow< KeyType >::DataFrameRow ( const CSVRow *  _row,
DataFrame< KeyType > *  _frame,
size_t  _row_index,
RowOverlay *  _edits,
const KeyType *  _key 
)
inline

Construct a mutable DataFrameRow wrapper.

Definition at line 21 of file data_frame_row.hpp.

◆ DataFrameRow() [3/3]

template<typename KeyType >
csv::DataFrameRow< KeyType >::DataFrameRow ( const CSVRow *  _row,
const DataFrame< KeyType > *  _frame,
size_t  _row_index,
const RowOverlay *  _edits,
const KeyType *  _key 
)
inline

Construct a read-only DataFrameRow wrapper.

Definition at line 30 of file data_frame_row.hpp.

Member Function Documentation

◆ empty()

template<typename KeyType >
bool csv::DataFrameRow< KeyType >::empty ( ) const
inline

Check if the row is empty.

Definition at line 98 of file data_frame_row.hpp.

◆ erase()

template<typename KeyType >
bool csv::DataFrameRow< KeyType >::erase ( )
inline

Delete this row from the parent DataFrame.

Structural mutation invalidates outstanding row and cell proxies.

Definition at line 116 of file data_frame_row.hpp.

◆ get_col_names()

template<typename KeyType >
const std::vector< std::string > & csv::DataFrameRow< KeyType >::get_col_names ( ) const
inline

Get column names.

Definition at line 101 of file data_frame_row.hpp.

◆ get_underlying_row()

template<typename KeyType >
const CSVRow & csv::DataFrameRow< KeyType >::get_underlying_row ( ) const
inline

Get the underlying CSVRow without applying cell edits or column visibility.

Use row conversion to obtain the current visible values.

Definition at line 106 of file data_frame_row.hpp.

◆ is_valid()

template<typename KeyType >
bool csv::DataFrameRow< KeyType >::is_valid ( ) const
inlinenoexcept

Whether the proxy is bound.

Structural mutation still invalidates proxies.

Definition at line 92 of file data_frame_row.hpp.

◆ key()

template<typename KeyType >
const KeyType & csv::DataFrameRow< KeyType >::key ( ) const
inline

Get the key for this row (only valid for keyed DataFrames).

Definition at line 109 of file data_frame_row.hpp.

◆ operator std::vector< std::string >()

template<typename KeyType >
csv::DataFrameRow< KeyType >::operator std::vector< std::string > ( ) const
inline

Convert to vector of strings for CSVWriter compatibility.

Definition at line 126 of file data_frame_row.hpp.

◆ operator[]() [1/4]

template<typename KeyType >
DataFrameCell csv::DataFrameRow< KeyType >::operator[] ( const std::string &  col)
inline

Access a field by column name, preserving edit support.

Definition at line 40 of file data_frame_row.hpp.

◆ operator[]() [2/4]

template<typename KeyType >
DataFrameCell csv::DataFrameRow< KeyType >::operator[] ( const std::string &  col) const
inline

Access a field by column name, checking edits first.

Definition at line 54 of file data_frame_row.hpp.

◆ operator[]() [3/4]

template<typename KeyType >
DataFrameCell csv::DataFrameRow< KeyType >::operator[] ( size_t  n)
inline

Access a field by position, preserving edit support.

Definition at line 47 of file data_frame_row.hpp.

◆ operator[]() [4/4]

template<typename KeyType >
DataFrameCell csv::DataFrameRow< KeyType >::operator[] ( size_t  n) const
inline

Access a field by position, checking edits first.

Definition at line 61 of file data_frame_row.hpp.

◆ size()

template<typename KeyType >
size_t csv::DataFrameRow< KeyType >::size ( ) const
inline

Get the number of visible fields in the row.

Definition at line 95 of file data_frame_row.hpp.

◆ to_json()

template<typename KeyType >
std::string csv::DataFrameRow< KeyType >::to_json ( const std::vector< std::string > &  subset = {}) const
inline

Convert to JSON.

Definition at line 140 of file data_frame_row.hpp.

◆ to_json_array()

template<typename KeyType >
std::string csv::DataFrameRow< KeyType >::to_json_array ( const std::vector< std::string > &  subset = {}) const
inline

Convert to JSON array.

Definition at line 160 of file data_frame_row.hpp.

◆ to_sv_range()

template<typename KeyType >
auto csv::DataFrameRow< KeyType >::to_sv_range ( ) const
inline

Convert this DataFrameRow into a std::ranges::input_range of strings, respecting the sparse overlay (edited values take precedence).

Note
Requires C++20 or later.

Definition at line 183 of file data_frame_row.hpp.

◆ try_erase()

template<typename KeyType >
bool csv::DataFrameRow< KeyType >::try_erase ( CSVError &  error)
inline

Definition at line 84 of file data_frame_row.hpp.

◆ try_field() [1/4]

template<typename KeyType >
DataFrameCell csv::DataFrameRow< KeyType >::try_field ( const std::string &  name,
CSVError &  error 
)
inline

Definition at line 75 of file data_frame_row.hpp.

◆ try_field() [2/4]

template<typename KeyType >
DataFrameCell csv::DataFrameRow< KeyType >::try_field ( const std::string &  name,
CSVError &  error 
) const
inline

Definition at line 79 of file data_frame_row.hpp.

◆ try_field() [3/4]

template<typename KeyType >
DataFrameCell csv::DataFrameRow< KeyType >::try_field ( size_t  index,
CSVError &  error 
)
inline

Checked cell access.

Failure returns an unbound, read-only cell.

Definition at line 67 of file data_frame_row.hpp.

◆ try_field() [4/4]

template<typename KeyType >
DataFrameCell csv::DataFrameRow< KeyType >::try_field ( size_t  index,
CSVError &  error 
) const
inline

Definition at line 71 of file data_frame_row.hpp.

◆ try_to_json()

template<typename KeyType >
std::string csv::DataFrameRow< KeyType >::try_to_json ( const std::vector< std::string > &  subset,
CSVError &  error 
) const
inline

Serialize selected visible columns, reporting lookup and physical-row bounds errors.

Definition at line 150 of file data_frame_row.hpp.

◆ try_to_json_array()

template<typename KeyType >
std::string csv::DataFrameRow< KeyType >::try_to_json_array ( const std::vector< std::string > &  subset,
CSVError &  error 
) const
inline

Serialize selected visible columns, reporting lookup and physical-row bounds errors.

Definition at line 170 of file data_frame_row.hpp.


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