GnuCash
2.6.99
|
CSV import GUI. More...
Go to the source code of this file.
Data Structures | |
struct | GncCsvStr |
struct | GncCsvTransLine |
struct | GncCsvParseData |
Enumerations | |
enum | GncCsvColumnType { GNC_CSV_NONE, GNC_CSV_DATE, GNC_CSV_NUM, GNC_CSV_DESCRIPTION, GNC_CSV_NOTES, GNC_CSV_ACCOUNT, GNC_CSV_DEPOSIT, GNC_CSV_WITHDRAWAL, GNC_CSV_BALANCE, GNC_CSV_NUM_COL_TYPES } |
enum | GncCsvErrorType { GNC_CSV_FILE_OPEN_ERR, GNC_CSV_ENCODING_ERR } |
Functions | |
GncCsvParseData * | gnc_csv_new_parse_data (void) |
void | gnc_csv_parse_data_free (GncCsvParseData *parse_data) |
int | gnc_csv_load_file (GncCsvParseData *parse_data, const char *filename, GError **error) |
int | gnc_csv_convert_encoding (GncCsvParseData *parse_data, const char *encoding, GError **error) |
int | gnc_csv_parse (GncCsvParseData *parse_data, gboolean guessColTypes, GError **error) |
int | gnc_csv_parse_to_trans (GncCsvParseData *parse_data, Account *account, gboolean redo_errors) |
time64 | parse_date (const char *date_str, int format) |
Variables | |
const int | num_currency_formats |
const gchar * | currency_format_user [] |
const int | num_date_formats |
const gchar * | date_format_user [] |
gchar * | gnc_csv_column_type_strs [] |
enum GncCsvColumnType |
Enumeration for column types. These are the different types of columns that can exist in a CSV/Fixed-Width file. There should be no two columns with the same type except for the GNC_CSV_NONE type.
Definition at line 41 of file gnc-csv-model.h.
enum GncCsvErrorType |
Enumeration for error types. These are the different types of errors that various functions used for the CSV/Fixed-Width importer can have.
Definition at line 56 of file gnc-csv-model.h.
int gnc_csv_convert_encoding | ( | GncCsvParseData * | parse_data, |
const char * | encoding, | ||
GError ** | error | ||
) |
Converts raw file data using a new encoding. This function must be called after gnc_csv_load_file only if gnc_csv_load_file guessed the wrong encoding.
parse_data | Data that is being parsed |
encoding | Encoding that data should be translated using |
error | Will point to an error on failure |
Definition at line 403 of file gnc-csv-model.c.
int gnc_csv_load_file | ( | GncCsvParseData * | parse_data, |
const char * | filename, | ||
GError ** | error | ||
) |
Loads a file into a GncCsvParseData. This is the first function that must be called after createing a new GncCsvParseData. If this fails because the file couldn't be opened, no more functions can be called on the parse data until this succeeds (or until it fails because of an encoding guess error). If it fails because the encoding could not be guessed, gnc_csv_convert_encoding must be called until it succeeds.
parse_data | Data that is being parsed |
filename | Name of the file that should be opened |
error | Will contain an error if there is a failure |
Definition at line 443 of file gnc-csv-model.c.
GncCsvParseData* gnc_csv_new_parse_data | ( | void | ) |
Constructor for GncCsvParseData.
Definition at line 324 of file gnc-csv-model.c.
int gnc_csv_parse | ( | GncCsvParseData * | parse_data, |
gboolean | guessColTypes, | ||
GError ** | error | ||
) |
Parses a file into cells. This requires having an encoding that works (see gnc_csv_convert_encoding). parse_data->options should be set according to how the user wants before calling this function. (Note: this function must be called with guessColTypes as TRUE before it is ever called with it as FALSE.) (Note: if guessColTypes is TRUE, all the column types will be GNC_CSV_NONE right now.)
parse_data | Data that is being parsed |
guessColTypes | TRUE to guess what the types of columns are based on the cell contents |
error | Will contain an error if there is a failure |
Definition at line 498 of file gnc-csv-model.c.
void gnc_csv_parse_data_free | ( | GncCsvParseData * | parse_data | ) |
Destructor for GncCsvParseData.
parse_data | Parse data whose memory will be freed |
Definition at line 350 of file gnc-csv-model.c.
int gnc_csv_parse_to_trans | ( | GncCsvParseData * | parse_data, |
Account * | account, | ||
gboolean | redo_errors | ||
) |
Creates a list of transactions from parsed data. Transactions that could be created from rows are placed in parse_data->transactions; rows that fail are placed in parse_data->error_lines. (Note: there is no way for this function to "fail," i.e. it only returns 0, so it may be changed to a void function in the future.)
parse_data | Data that is being parsed |
account | Account with which transactions are created |
redo_errors | TRUE to convert only error data, FALSE for all data |
Definition at line 1015 of file gnc-csv-model.c.
time64 parse_date | ( | const char * | date_str, |
int | format | ||
) |
Parses a string into a date, given a format. This function requires only knowing the order in which the year, month and day appear. For example, 01-02-2003 will be parsed the same way as 01/02/2003.
date_str | The string containing a date being parsed |
format | An index specifying a format in date_format_user |
Definition at line 313 of file gnc-csv-model.c.