Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
FCsvParser Struct Reference

#include <CsvParser.h>

+ Collaboration diagram for FCsvParser:

Public Types

typedef TArray< TArray< const TCHAR * > > FRows
 

Public Member Functions

 FCsvParser (FString InSourceString)
 
const FRowsGetRows () const
 

Private Types

enum struct  EParseResult { EndOfCell , EndOfRow , EndOfString }
 

Private Member Functions

 FCsvParser (const FCsvParser &)
 
FCsvParseroperator= (const FCsvParser &)
 
void ParseRows ()
 
EParseResult ParseRow ()
 
EParseResult ParseCell ()
 
int8 MeasureNewLine (const TCHAR *At)
 

Private Attributes

FString SourceString
 
TCHAR * BufferStart
 
const TCHAR * ReadAt
 
FRows Rows
 

Detailed Description

A simple, efficient csv parser

Definition at line 10 of file CsvParser.h.

Member Typedef Documentation

◆ FRows

Definition at line 12 of file CsvParser.h.

Member Enumeration Documentation

◆ EParseResult

Internal enum to control parsing progress

Enumerator
EndOfCell 
EndOfRow 
EndOfString 

Definition at line 37 of file CsvParser.h.

Constructor & Destructor Documentation

◆ FCsvParser() [1/2]

FCsvParser::FCsvParser ( FString InSourceString)

Construct with a string. Takes a copy because the parser tramples over the file to create null-terminated cell strings Avoid a copy by passing overship of the source string with MoveTemp()

◆ FCsvParser() [2/2]

FCsvParser::FCsvParser ( const FCsvParser & )
private

Non copyable - has pointers to itself

Member Function Documentation

◆ GetRows()

const FRows & FCsvParser::GetRows ( ) const
inline

Const access to the parsed rows Rows are stored as arrays of parsed, null-terminated cell-strings. Object (and contained strings) is valid for the lifetime of the parser.

Definition at line 26 of file CsvParser.h.

◆ MeasureNewLine()

int8 FCsvParser::MeasureNewLine ( const TCHAR * At)
private

Helper to measure the size of a new line at the current read position

◆ operator=()

FCsvParser & FCsvParser::operator= ( const FCsvParser & )
private

◆ ParseCell()

EParseResult FCsvParser::ParseCell ( )
private

Parse a cell at the current read position

◆ ParseRow()

EParseResult FCsvParser::ParseRow ( )
private

Parse a single row at the current read position

◆ ParseRows()

void FCsvParser::ParseRows ( )
private

Parse all the rows in the source data

Member Data Documentation

◆ BufferStart

TCHAR* FCsvParser::BufferStart
private

Fixed pointer to the start of the buffer

Definition at line 54 of file CsvParser.h.

◆ ReadAt

const TCHAR* FCsvParser::ReadAt
private

Current parser read position

Definition at line 57 of file CsvParser.h.

◆ Rows

FRows FCsvParser::Rows
private

Array of cell string arrays

Definition at line 60 of file CsvParser.h.

◆ SourceString

FString FCsvParser::SourceString
private

Raw csv buffer, sliced and diced by the parser

Definition at line 51 of file CsvParser.h.


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