CSVAsyncTask๏
Inherits: RefCounted < Object
Asynchronous CSV and DSV load/save task.
Description๏
CSVAsyncTask runs CSV or DSV load/save work on a background thread. Use the static constructors to configure a task, call start(), then poll state or wait with wait_to_finish(). Load tasks expose rows with get_rows() and get_table().
Methods๏
void |
cancel() |
get_error() const |
|
get_progress() const |
|
get_rows() const |
|
get_table() const |
|
is_cancelled() const |
|
is_done() const |
|
is_running() const |
|
load_csv(path: String, delimiter: String = ",", headers: bool = false, cast_fields: bool = true, options: Dictionary = {}) static |
|
load_dsv(path: String, delimiter: String = ",", options: Dictionary = {}) static |
|
save_csv(path: String, rows: Array, delimiter: String = ",", headers: bool = false, options: Dictionary = {}) static |
|
save_dsv(path: String, rows: Array, delimiter: String = ",") static |
|
start() |
|
void |
Signals๏
cancelled() ๐
Emitted when the task finishes due to cancellation.
completed() ๐
Emitted when the task finishes successfully.
Emitted when the task fails.
progress_changed(progress: float) ๐
Emitted when task progress changes.
Method Descriptions๏
void cancel() ๐
Requests cancellation. The task stops between row operations.
Returns the task error message, or an empty string when no error occurred.
float get_progress() const ๐
Returns progress in the range 0.0 to 1.0.
Returns loaded rows for load tasks. Save tasks return an empty array.
CSVTable get_table() const ๐
Returns loaded rows wrapped in a CSVTable.
bool is_cancelled() const ๐
Returns true if the task finished due to cancellation.
Returns true when the task has finished, failed, or been cancelled.
Returns true while the background thread is active.
CSVAsyncTask load_csv(path: String, delimiter: String = ",", headers: bool = false, cast_fields: bool = true, options: Dictionary = {}) static ๐
Creates a task that loads typed CSV rows from path.
CSVAsyncTask load_dsv(path: String, delimiter: String = ",", options: Dictionary = {}) static ๐
Creates a task that loads raw DSV rows from path.
CSVAsyncTask save_csv(path: String, rows: Array, delimiter: String = ",", headers: bool = false, options: Dictionary = {}) static ๐
Creates a task that saves CSV rows to path. options may include header_names, color_as_hex, and hex_include_alpha.
CSVAsyncTask save_dsv(path: String, rows: Array, delimiter: String = ",") static ๐
Creates a task that saves raw DSV rows to path.
Starts the background task.
void wait_to_finish() ๐
Blocks until the background thread finishes. This is useful for tests or command-line workflows.