KiCad PCB EDA Suite
Loading...
Searching...
No Matches
table_io.h File Reference
#include <wx/string.h>
#include <optional>
#include <vector>

Go to the source code of this file.

Functions

std::optional< std::vector< std::vector< wxString > > > ReadTableFromFileOrClipboard (EDA_BASE_FRAME &aFrame, bool aFromFile)
 Read a CSV/TSV table from a file selected via a dialog (aFromFile) or from the system clipboard.
 
void WriteTableToFileOrClipboard (const wxString &aToFile, const std::vector< std::vector< wxString > > &aTable)
 Write aTable as CSV to aToFile (if non-empty) or to the system clipboard.
 

Function Documentation

◆ ReadTableFromFileOrClipboard()

std::optional< std::vector< std::vector< wxString > > > ReadTableFromFileOrClipboard ( EDA_BASE_FRAME & aFrame,
bool aFromFile )

Read a CSV/TSV table from a file selected via a dialog (aFromFile) or from the system clipboard.

Returns
the parsed table, or std::nullopt if the user cancelled the file dialog or the data could not be decoded.

Definition at line 34 of file table_io.cpp.

References _, KIPLATFORM::UI::AllowNetworkFileSystems(), AutoDecodeCSV(), FILEEXT::CsvTsvFileWildcard(), GetTabularDataFromClipboard(), path, SafeReadFile(), and table.

Referenced by DIALOG_FP_EDIT_PAD_TABLE::OnImportButtonClick(), and DIALOG_LIB_EDIT_PIN_TABLE::OnImportButtonClick().

◆ WriteTableToFileOrClipboard()

void WriteTableToFileOrClipboard ( const wxString & aToFile,
const std::vector< std::vector< wxString > > & aTable )

Write aTable as CSV to aToFile (if non-empty) or to the system clipboard.

Definition at line 66 of file table_io.cpp.

References SaveTabularDataToClipboard(), and CSV_WRITER::WriteLines().

Referenced by DIALOG_FP_EDIT_PAD_TABLE::OnExportButtonClick(), and DIALOG_LIB_EDIT_PIN_TABLE::OnExportButtonClick().