Vince's CSV Parser
Loading...
Searching...
No Matches
csv::CSVError Struct Reference

A diagnostic whose text remains valid for the lifetime of the error. More...

#include <csv_error.hpp>

Public Member Functions

 CSVError (CSVErrorCode value, csv::string_view message)
 Copy runtime text, including temporary strings and exception messages.
 
 CSVError (const CSVError &other)
 
 CSVError (CSVError &&other) noexcept
 
CSVError & operator= (const CSVError &other)
 
CSVError & operator= (CSVError &&other) noexcept
 
void set_context (csv::string_view message)
 Replace the context with an owned copy; accepts views into this error.
 
 operator bool () const noexcept
 
void clear () noexcept
 
std::string message () const
 

Static Public Member Functions

static CSVError from_static (CSVErrorCode value, csv::string_view message) noexcept
 Borrow text that must remain valid for the program's lifetime.
 

Public Attributes

CSVErrorCode code = CSVErrorCode::None
 
std::error_code system
 
csv::string_view context
 Diagnostic text; use set_context() to replace it with an owned copy.
 

Detailed Description

A diagnostic whose text remains valid for the lifetime of the error.

Static messages are borrowed; dynamic messages are owned. Copies preserve that lifetime, and moved-from errors are cleared. Success and EOF clear the error without allocating. Explicit errors cover library validation and I/O, not allocation failures or exceptions thrown by user callbacks. Partial progress is not rolled back.

Definition at line 94 of file csv_error.hpp.

Constructor & Destructor Documentation

◆ CSVError() [1/3]

csv::CSVError::CSVError ( CSVErrorCode  value,
csv::string_view  message 
)
inline

Copy runtime text, including temporary strings and exception messages.

Definition at line 102 of file csv_error.hpp.

◆ CSVError() [2/3]

csv::CSVError::CSVError ( const CSVError &  other)
inline

Definition at line 105 of file csv_error.hpp.

◆ CSVError() [3/3]

csv::CSVError::CSVError ( CSVError &&  other)
inlinenoexcept

Definition at line 109 of file csv_error.hpp.

Member Function Documentation

◆ clear()

void csv::CSVError::clear ( )
inlinenoexcept

Definition at line 152 of file csv_error.hpp.

◆ from_static()

static CSVError csv::CSVError::from_static ( CSVErrorCode  value,
csv::string_view  message 
)
inlinestaticnoexcept

Borrow text that must remain valid for the program's lifetime.

Definition at line 133 of file csv_error.hpp.

◆ message()

std::string csv::CSVError::message ( ) const
inline

Definition at line 158 of file csv_error.hpp.

◆ operator bool()

csv::CSVError::operator bool ( ) const
inlineexplicitnoexcept

Definition at line 151 of file csv_error.hpp.

◆ operator=() [1/2]

CSVError & csv::CSVError::operator= ( const CSVError &  other)
inline

Definition at line 114 of file csv_error.hpp.

◆ operator=() [2/2]

CSVError & csv::CSVError::operator= ( CSVError &&  other)
inlinenoexcept

Definition at line 121 of file csv_error.hpp.

◆ set_context()

void csv::CSVError::set_context ( csv::string_view  message)
inline

Replace the context with an owned copy; accepts views into this error.

Definition at line 141 of file csv_error.hpp.

Member Data Documentation

◆ code

CSVErrorCode csv::CSVError::code = CSVErrorCode::None

Definition at line 95 of file csv_error.hpp.

◆ context

csv::string_view csv::CSVError::context

Diagnostic text; use set_context() to replace it with an owned copy.

Definition at line 98 of file csv_error.hpp.

◆ system

std::error_code csv::CSVError::system

Definition at line 96 of file csv_error.hpp.


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