Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::FullLinePosition Class Reference

Keeps track of start and end of line positions in regard to the CSV file. More...

Collaboration diagram for duckdb::FullLinePosition:

Public Member Functions

template<class T>
string ReconstructCurrentLine (bool &first_char_nl, T &buffer_handles, bool reconstruct_line) const
 Reconstructs the current line to be used in error messages.

Static Public Member Functions

static void SanitizeError (string &value)

Public Attributes

LinePosition begin
LinePosition end

Detailed Description

Keeps track of start and end of line positions in regard to the CSV file.

Constructor & Destructor Documentation

◆ FullLinePosition()

duckdb::FullLinePosition::FullLinePosition ( )
inline
167617{};

Member Function Documentation

◆ SanitizeError()

void duckdb::FullLinePosition::SanitizeError ( string & value)
static
169502 {
169503 std::vector<char> char_array(value.begin(), value.end());
169504 char_array.push_back('\0'); // Null-terminate the character array
169505 Utf8Proc::MakeValid(&char_array[0], char_array.size());
169506 value = {char_array.begin(), char_array.end() - 1};
169507}
static void MakeValid(char *s, size_t len, char special_flag='?')
Makes Invalid Unicode valid by replacing invalid parts with a given character.
Definition duckdb.cpp:507342

◆ ReconstructCurrentLine()

template<class T>
string duckdb::FullLinePosition::ReconstructCurrentLine ( bool & first_char_nl,
T & buffer_handles,
bool reconstruct_line ) const
inline

Reconstructs the current line to be used in error messages.

167623 {
167624 if (!reconstruct_line || begin == end) {
167625 return {};
167626 }
167627 string result;
167628 if (end.buffer_idx == begin.buffer_idx || begin.buffer_pos == begin.buffer_size) {
167629 idx_t buffer_idx = end.buffer_idx;
167630 if (buffer_handles.find(buffer_idx) == buffer_handles.end()) {
167631 return {};
167632 }
167633 idx_t start_pos = begin.buffer_pos == begin.buffer_size ? 0 : begin.buffer_pos;
167634 auto buffer = buffer_handles[buffer_idx]->Ptr();
167635 first_char_nl = buffer[start_pos] == '\n' || buffer[start_pos] == '\r';
167636 for (idx_t i = start_pos + first_char_nl; i < end.buffer_pos; i++) {
167637 result += buffer[i];
167638 }
167639 } else {
167640 if (buffer_handles.find(begin.buffer_idx) == buffer_handles.end() ||
167641 buffer_handles.find(end.buffer_idx) == buffer_handles.end()) {
167642 return {};
167643 }
167644 if (begin.buffer_pos >= begin.buffer_size) {
167645 throw InternalException("CSV reader: buffer pos out of range for buffer");
167646 }
167647 auto first_buffer = buffer_handles[begin.buffer_idx]->Ptr();
167648 auto first_buffer_size = buffer_handles[begin.buffer_idx]->actual_size;
167649 auto second_buffer = buffer_handles[end.buffer_idx]->Ptr();
167650 first_char_nl = first_buffer[begin.buffer_pos] == '\n' || first_buffer[begin.buffer_pos] == '\r';
167651 for (idx_t i = begin.buffer_pos + first_char_nl; i < first_buffer_size; i++) {
167652 result += first_buffer[i];
167653 }
167654 for (idx_t i = 0; i < end.buffer_pos; i++) {
167655 result += second_buffer[i];
167656 }
167657 }
167658 // sanitize borked line
167659 SanitizeError(result);
167660 return result;
167661 }
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237
Here is the caller graph for this function:

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