r16218 - gnucash/branches/csv-import/src/import-export/csv - Made comments take advantage of doxygen, also added some comments to

Benjamin Sperisen lasindi at cvs.gnucash.org
Wed Jun 27 04:14:01 EDT 2007


Author: lasindi
Date: 2007-06-27 04:13:58 -0400 (Wed, 27 Jun 2007)
New Revision: 16218
Trac: http://svn.gnucash.org/trac/changeset/16218

Modified:
   gnucash/branches/csv-import/src/import-export/csv/gnc-csv-import.c
   gnucash/branches/csv-import/src/import-export/csv/gnc-csv-import.h
   gnucash/branches/csv-import/src/import-export/csv/gnc-csv-model.c
   gnucash/branches/csv-import/src/import-export/csv/gnc-csv-model.h
Log:
Made comments take advantage of doxygen, also added some comments to 
gnc-csv-model.c and gnc-csv-model.h. Renamed several variables to have 
more intuitive meanings and removed redundant comments. Also got rid 
of static variable in gnc-csv-import.c's encoding_selected function.


Modified: gnucash/branches/csv-import/src/import-export/csv/gnc-csv-import.c
===================================================================
--- gnucash/branches/csv-import/src/import-export/csv/gnc-csv-import.c	2007-06-26 22:58:50 UTC (rev 16217)
+++ gnucash/branches/csv-import/src/import-export/csv/gnc-csv-import.c	2007-06-27 08:13:58 UTC (rev 16218)
@@ -16,11 +16,8 @@
  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
  * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
 \********************************************************************/
-/** @addtogroup Import_Export
-    @{ */
-/** @internal
-    @file gnc-csv-import.c
-    @brief Csv import module code
+/** @file gnc-csv-import.c
+    @brief CSV Import GUI code
     @author Copyright (c) 2007 Benny Sperisen <lasindi at gmail.com>
 */
 #include "config.h"
@@ -48,86 +45,97 @@
 
 static QofLogModule log_module = GNC_MOD_IMPORT;
 
-/* These are the different types of checkbuttons that the user can
- * click to configure separators in a delimited file. */
+/** Enumeration for separator checkbutton types. These are the
+ * different types of checkbuttons that the user can click to
+ * configure separators in a delimited file. */
 enum SEP_BUTTON_TYPES {SEP_SPACE, SEP_TAB, SEP_COMMA, SEP_COLON, SEP_SEMICOLON, SEP_HYPHEN,
                        SEP_NUM_OF_TYPES};
 
-/* This struct contains all of the data relevant to the preview dialog
- * that lets the user configure an import. */
+/** Data for the preview dialog. This struct contains all of the data
+ * relevant to the preview dialog that lets the user configure an
+ * import. */
 typedef struct
 {
-  GncCsvParseData* parse_data; /* The actual data */
-  GladeXML* xml; /* The Glade file that contains the dialog. */
-  GtkDialog* dialog; /* The dialog */
-  GtkTreeView* treeview; /* The treeview containing the data */
-  GtkTreeView* ctreeview; /* The treeview containing the column types */
-  GtkCheckButton* sep_buttons[SEP_NUM_OF_TYPES]; /* Checkbuttons for common separators */
-  GtkCheckButton* custom_cbutton; /* The checkbutton for a custom separator */
-  GtkEntry* custom_entry; /* The entry for custom separators */
-  gboolean approved; /* This is FALSE until the user clicks "OK". */
+  GncCsvParseData* parse_data; /**< The actual data we are previewing */
+  GtkDialog* dialog;
+  GladeXML* xml; /**< The Glade file that contains the dialog. */
+  GtkTreeView* treeview; /**< The treeview containing the data */
+  GtkTreeView* ctreeview; /**< The treeview containing the column types */
+  GtkCheckButton* sep_buttons[SEP_NUM_OF_TYPES]; /**< Checkbuttons for common separators */
+  GtkCheckButton* custom_cbutton; /**< The checkbutton for a custom separator */
+  GtkEntry* custom_entry; /**< The entry for custom separators */
+  gboolean encoding_selected_called; /**< Before encoding_selected is first called, this is FALSE.
+                                      * (See description of encoding_selected.) */
+  gboolean approved; /**< This is FALSE until the user clicks "OK". */
 } GncCsvPreview;
 
 static void gnc_csv_preview_treeview(GncCsvPreview* preview, gboolean notEmpty);
 
-/* Event handler for when one of the separator checkbuttons is clicked. */
-static void sep_button_clicked(GtkCheckButton* widget, GncCsvPreview* preview)
+/** Event handler for separator changes. This function is called
+ * whenever one of the widgets for configuring the separators (the
+ * separator checkbuttons or the custom separator entry) is
+ * changed.
+ * @param widget The widget that was changed
+ * @param preview The data that is being configured
+ */
+static void sep_button_clicked(GtkWidget* widget, GncCsvPreview* preview)
 {
-  /* The stock separator charactors */
-  char* sep_chars[] = {" ", "\t", ",", ":", ";", "-"};
-  /* A list of all the separators that have been checked. */
-  GSList* separators = NULL;
   int i;
+  char* stock_separator_characters[] = {" ", "\t", ",", ":", ";", "-"};
+  GSList* checked_separators = NULL;
 
-  /* Go through each of the separator buttons. */
+  /* Add the corresponding characters to checked_separators for each
+   * button that is checked. */
   for(i = 0; i < SEP_NUM_OF_TYPES; i++)
   {
-    /* If this button is checked, add the corresponding character to
-     * the separators list. */
     if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(preview->sep_buttons[i])))
-      separators = g_slist_append(separators, sep_chars[i]);
+      checked_separators = g_slist_append(checked_separators, stock_separator_characters[i]);
   }
 
-  /* If the custom button is checked ... */
+  /* Add the custom separator if the user checked its button. */
   if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(preview->custom_cbutton)))
   {
-    /* ... get the separator string from the custom entry ... */
     char* custom_sep = (char*)gtk_entry_get_text(preview->custom_entry);
-    if(custom_sep[0] != '\0') /* ... and if it isn't blank add it to the separators list. */
-      separators = g_slist_append(separators, custom_sep);
+    if(custom_sep[0] != '\0') /* Don't add a blank separator (bad things will happen!). */
+      checked_separators = g_slist_append(checked_separators, custom_sep);
   }
 
-  /* Set the parse options using the separators list. */
-  stf_parse_options_csv_set_separators(preview->parse_data->options, NULL, separators);
-  g_slist_free(separators); /* Free the separators list. */
+  /* Set the parse options using the checked_separators list. */
+  stf_parse_options_csv_set_separators(preview->parse_data->options, NULL, checked_separators);
+  g_slist_free(checked_separators);
 
   /* TODO Handle error */
   gnc_csv_parse(preview->parse_data, FALSE, NULL);
   gnc_csv_preview_treeview(preview, TRUE);
 }
 
-/* Event handler for a new encoding being selected. */
+/** Event handler for a new encoding. This is called when the user
+ * selects a new encoding; the data is reparsed and shown to the
+ * user.
+ * @param selector The widget the user uses to select a new encoding
+ * @param encoding The encoding that the user selected
+ * @param preview The data that is being configured
+ */
 static void encoding_selected(GOCharmapSel* selector, const char* encoding,
                               GncCsvPreview* preview)
 {
   /* This gets called twice everytime a new encoding is selected. The
    * second call actually passes the correct data; thus, we only do
    * something the second time this is called. */
-  static gboolean second_call = FALSE;
 
   /* If this is the second time the function is called ... */
-  if(second_call)
+  if(preview->encoding_selected_called)
   {
     GError* error = NULL;
     /* TODO Handle errors and comment */
-    gnc_csv_convert_enc(preview->parse_data, encoding);
+    gnc_csv_convert_encoding(preview->parse_data, encoding);
     gnc_csv_parse(preview->parse_data, FALSE, &error);
     gnc_csv_preview_treeview(preview, TRUE);
-    second_call = FALSE;
+    preview->encoding_selected_called = FALSE;
   }
   else /* If this is the first call of the function ... */
   {
-    second_call = TRUE; /* ... set the flag and wait for the next call. */
+    preview->encoding_selected_called = TRUE; /* ... set the flag and wait for the next call. */
   }
 }
 
@@ -137,7 +145,12 @@
                                                         "Description",
                                                         "Amount"};
 
-/* Event handler for the "OK" button being clicked on the dialog. */
+/** Event handler for the "OK" button. When "OK" is clicked, this
+ * function updates the parse data with the user's column type
+ * configuration and closes the preview dialog.
+ * @param widget The "OK" button
+ * @param preview The data that is being configured
+ */
 static void ok_button_clicked(GtkWidget* widget, GncCsvPreview* preview)
 {
   /* Shorten the column_types identifier. */
@@ -178,14 +191,23 @@
   preview->approved = TRUE; /* The user has wants to do the import. */
 }
 
-/* Event handler for the "Cancel" dialog being clicked on the dialog. */
+/** Event handler for the "Cancel" button. When the user clicks
+ * "Cancel", the dialog is simply closed.
+ * @param widget The "Cancel" button
+ * @param preview The data that is being configured
+ */
 static void cancel_button_clicked(GtkWidget* widget, GncCsvPreview* preview)
 {
-  /* Simply close the dialog. */
   gtk_widget_hide((GtkWidget*)(preview->dialog));
 }
 
-/* Event handler for the treeview being resized. */
+/** Event handler for the data treeview being resized. When the data
+ * treeview is resized, the column types treeview's columns are also resized to
+ * match.
+ * @param widget The data treeview
+ * @param allocation The size of the data treeview
+ * @param preview The data that is being configured
+ */
 static void treeview_resized(GtkWidget* widget, GtkAllocation* allocation, GncCsvPreview* preview)
 {
   /* ncols is the number of columns in the data. */
@@ -209,9 +231,17 @@
   }
 }
 
-/* Event handler for the user selecting a new column type. */
-static void column_type_edited(GtkCellRenderer *renderer, gchar *path,
-                               gchar *new_text, GncCsvPreview* preview)
+/** Event handler for the user selecting a new column type. When the
+ * user selects a new column type, that column's text must be changed
+ * to that selection, and any other columns containing that selection
+ * must be changed to "None" because we don't allow duplicates.
+ * @param renderer The renderer of the column the user changed
+ * @param path There is only 1 row in preview->ctreeview, so this is always 0.
+ * @param new_text The text the user selected
+ * @param preview The data that is being configured
+ */
+static void column_type_edited(GtkCellRenderer* renderer, gchar* path,
+                               gchar* new_text, GncCsvPreview* preview)
 {
   /* ncols is the number of columns in the data. */
   int i, ncols = preview->parse_data->column_types->len;
@@ -233,7 +263,7 @@
     GList* rend_list = gtk_tree_view_column_get_cell_renderers(col);
     /* rend_list has only one entry, which we put in col_renderer. */
     col_renderer = rend_list->data;
-    g_list_free(rend_list); /* Free rend_list since we don't need it anymore. */
+    g_list_free(rend_list);
 
     /* If this is not the column that was edited ... */
     if(col_renderer != renderer)
@@ -263,7 +293,9 @@
   }
 }
 
-/* Constructor for GncCsvPreview. */
+/** Constructor for GncCsvPreview.
+ * @return A new GncCsvPreview* ready for use.
+ */
 static GncCsvPreview* gnc_csv_preview_new()
 {
   int i;
@@ -337,13 +369,20 @@
   /* Load the column type treeview. */
   preview->ctreeview = (GtkTreeView*)(glade_xml_get_widget(preview->xml, "ctreeview"));
 
+  /* This is TRUE only after encoding_selected is called, so we must
+   * set it initially to FALSE. */
+  preview->encoding_selected_called = FALSE;
+
   /* TODO Free stuff */
   preview->approved = FALSE; /* This is FALSE until the user clicks "OK". */
 
   return preview;
 }
 
-/* Function for destroying a preview when we're done with it. */
+/** Destructor for GncCsvPreview. This does not free
+ * preview->parse_data, which must be freed separately.
+ * @param preview The preview whose memory is freed.
+ */
 static void gnc_csv_preview_free(GncCsvPreview* preview)
 {
   g_object_unref(preview->xml);
@@ -446,10 +485,14 @@
   /* TODO free cstore and ctstore */
 }
 
-/* This function is used to let the user preview and configure the
- * data parsed from the file. It doesn't return until the user clicks
- * "OK" or "Cancel" on the dialog. It returns 0 if the user approved
- * the import and 1 if the user didn't. */
+/** A function that lets the user preview a file's data. This function
+ * is used to let the user preview and configure the data parsed from
+ * the file. It doesn't return until the user clicks "OK" or "Cancel"
+ * on the dialog.
+ * @param preview The GUI for previewing the data
+ * @param parse_data The data we want to preview
+ * @return 0 if the user approved the import; 1 if the user didn't.
+ */
 static int gnc_csv_preview(GncCsvPreview* preview, GncCsvParseData* parse_data)
 {
   /* Set the preview's parse_data to the one we're getting passed. */
@@ -468,7 +511,7 @@
     return 1;
 }
 
-/* The function that actually imports a CSV/Fixed-Width file. */
+/** Lets the user import a CSV/Fixed-Width file. */
 /* TODO Comment this function. */
 void gnc_file_csv_import(void)
 {
@@ -545,8 +588,9 @@
     /* Copy all of the transactions to the importer GUI. */
     while(transactions != NULL)
     {
+      GncCsvTransLine* trans_line = transactions->data;
       gnc_gen_trans_list_add_trans(gnc_csv_importer_gui,
-                                   (Transaction*)(transactions->data));
+                                   (Transaction*)(trans_line->trans));
       transactions = g_list_next(transactions);
     }
     /* Let the user load those transactions into the account. */
@@ -558,5 +602,3 @@
     g_free(selected_filename);
   }
 }
-
-/** @} */

Modified: gnucash/branches/csv-import/src/import-export/csv/gnc-csv-import.h
===================================================================
--- gnucash/branches/csv-import/src/import-export/csv/gnc-csv-import.h	2007-06-26 22:58:50 UTC (rev 16217)
+++ gnucash/branches/csv-import/src/import-export/csv/gnc-csv-import.h	2007-06-27 08:13:58 UTC (rev 16218)
@@ -17,7 +17,7 @@
  * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
 \********************************************************************/
  /** @file
-     @brief Csv import module interface
+     @brief CSV import GUI
      *
      gnc-csv-import.h
      @author Copyright (c) 2007 Benny Sperisen <lasindi at gmail.com>

Modified: gnucash/branches/csv-import/src/import-export/csv/gnc-csv-model.c
===================================================================
--- gnucash/branches/csv-import/src/import-export/csv/gnc-csv-model.c	2007-06-26 22:58:50 UTC (rev 16217)
+++ gnucash/branches/csv-import/src/import-export/csv/gnc-csv-model.c	2007-06-27 08:13:58 UTC (rev 16218)
@@ -14,9 +14,9 @@
 #include <fcntl.h>
 #include <stdlib.h>
 
-#include <stdio.h> /* Get rid of this */
-
-/* Returns a set of sensible defaults for parsing CSV files. */
+/** A set of sensible defaults for parsing CSV files. 
+ * @return StfParseOptions_t* for parsing a file with comma separators
+ */
 static StfParseOptions_t* default_parse_options(void)
 {
   StfParseOptions_t* options = stf_parse_options_new();
@@ -26,9 +26,7 @@
 }
 
 /* TODO This will be replaced by something more sophisticated. */
-time_t parse_date(const char* date_str);
-
-time_t parse_date(const char* date_str)
+static time_t parse_date(const char* date_str)
 {
   struct tm retvalue;
   char mstr[3], dstr[3], ystr[3];
@@ -48,7 +46,11 @@
   return mktime(&retvalue);
 }
 
-/* TODO Comment. */
+/** Loads a file into a string.
+ * @param filename Name of the file to open
+ * @param error Passes back the error that occurred, if one occurred.
+ * @return Contents of the file at filename if successful; NULL if an error occurred
+ */
 GncCsvStr file_to_string(const char* filename, GError** error)
 {
   /* The file descriptor for opening the file, a flag indicating
@@ -89,6 +91,9 @@
   return file_str;
 }
 
+/** Constructor for GncCsvParseData.
+ * @return Pointer to a new GncCSvParseData
+ */
 /* TODO Comment */
 GncCsvParseData* gnc_csv_new_parse_data(void)
 {
@@ -103,6 +108,9 @@
   return parse_data;
 }
 
+/** Destructor for GncCsvParseData.
+ * @param parse_data Parse data whose memory will be freed
+ */
 /* TODO Comment */
 void gnc_csv_parse_data_free(GncCsvParseData* parse_data)
 {
@@ -121,12 +129,26 @@
     g_list_free(parse_data->error_lines);
   /* TODO Find out if there's a potential memory leak here. */
   if(parse_data->transactions != NULL)
+  {
+    GList* transactions = parse_data->transactions;
+    do
+    {
+      transactions = g_list_next(transactions);
+    } while(transactions != NULL);
     g_list_free(parse_data->transactions);
+  }
   g_free(parse_data);
 }
 
+/** 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.
+ * @param parse_data Data that is being parsed
+ * @param encoding Encoding that data should be translated using
+ * @return 0 on success, 1 on failure
+ */
 /* TODO Comment */
-int gnc_csv_convert_enc(GncCsvParseData* parse_data, const char* enc)
+int gnc_csv_convert_encoding(GncCsvParseData* parse_data, const char* encoding)
 {
   GError* error;
   gsize bytes_read, bytes_written;
@@ -136,18 +158,29 @@
   }
   parse_data->file_str.begin = g_convert(parse_data->raw_str.begin,
                                          parse_data->raw_str.end - parse_data->raw_str.begin,
-                                         "UTF-8", enc, &bytes_read,
+                                         "UTF-8", encoding, &bytes_read,
                                          &bytes_written, &error);
-  g_debug("using %s got %p\n", enc, parse_data->file_str.begin);
   if(parse_data->file_str.begin == NULL)
   {
     return 1;
   }
   parse_data->file_str.end = parse_data->file_str.begin + bytes_written;
-  parse_data->encoding = (gchar*)enc;
+  parse_data->encoding = (gchar*)encoding;
   return 0;
 }
 
+/** 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.
+ * @param parse_data Data that is being parsed
+ * @param filename Name of the file that should be opened
+ * @param error Will contain an error if there is a failure
+ * @return 0 on success, 1 on failure
+ */
 /* TODO Comment */
 int gnc_csv_load_file(GncCsvParseData* parse_data, const char* filename,
                       GError** error)
@@ -164,7 +197,7 @@
                                 "UTF-8", NULL);
   g_debug("Guessed %s\n", guess_enc);
   /* TODO Handle error */
-  gnc_csv_convert_enc(parse_data, guess_enc);
+  gnc_csv_convert_encoding(parse_data, guess_enc);
   if(parse_data->file_str.begin == NULL)
   {
     g_set_error(error, 0, GNC_CSV_ENCODING_ERR, "Encoding conversion failed.");
@@ -174,6 +207,16 @@
     return 0;
 }
 
+/** 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: if guessColTypes is TRUE, all the column types
+ * will be GNC_CSV_NONE right now.)
+ * @param parse_data Data that is being parsed
+ * @param guessColTypes TRUE to guess what the types of columns are based on the cell contents
+ * @error error Will contain an error if there is a failure
+ * @return 0 on success, 1 on failure
+ */
 /* TODO Comment. */
 /* TODO Should we use 0 for domain and code in errors? */
 int gnc_csv_parse(GncCsvParseData* parse_data, gboolean guessColTypes, GError** error)
@@ -228,6 +271,15 @@
   return 0;
 }
 
+/** 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.)
+ * @param parse_data Data that is being parsed
+ * @param account Account with which transactions are created
+ * @return 0 on success, 1 on failure
+ */
 /* TODO Comment. */
 int gnc_parse_to_trans(GncCsvParseData* parse_data, Account* account)
 {
@@ -294,7 +346,12 @@
       }
     }
     if(noErrors)
-      parse_data->transactions = g_list_append(parse_data->transactions, trans);
+    {
+      GncCsvTransLine* trans_line = g_malloc(sizeof(GncCsvTransLine));
+      trans_line->line_no = i;
+      trans_line->trans = trans;
+      parse_data->transactions = g_list_append(parse_data->transactions, trans_line);
+    }
   }
   return 0;
 }

Modified: gnucash/branches/csv-import/src/import-export/csv/gnc-csv-model.h
===================================================================
--- gnucash/branches/csv-import/src/import-export/csv/gnc-csv-model.h	2007-06-26 22:58:50 UTC (rev 16217)
+++ gnucash/branches/csv-import/src/import-export/csv/gnc-csv-model.h	2007-06-27 08:13:58 UTC (rev 16218)
@@ -1,3 +1,29 @@
+/********************************************************************\
+ * This program is free software; you can redistribute it and/or    *
+ * modify it under the terms of the GNU General Public License as   *
+ * published by the Free Software Foundation; either version 2 of   *
+ * the License, or (at your option) any later version.              *
+ *                                                                  *
+ * This program is distributed in the hope that it will be useful,  *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
+ * GNU General Public License for more details.                     *
+ *                                                                  *
+ * You should have received a copy of the GNU General Public License*
+ * along with this program; if not, contact:                        *
+ *                                                                  *
+ * Free Software Foundation           Voice:  +1-617-542-5942       *
+ * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
+ * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
+\********************************************************************/
+
+/** @file
+     @brief CSV import GUI
+     *
+     gnc-csv-import.h
+     @author Copyright (c) 2007 Benny Sperisen <lasindi at gmail.com>
+ */
+
 #ifndef GNC_CSV_MODEL_H
 #define GNC_CSV_MODEL_H
 
@@ -8,49 +34,66 @@
 
 #include "stf/stf-parse.h"
 
-/* TODO Comment. */
+/** 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. */
 enum GncCsvColumnType {GNC_CSV_NONE,
                        GNC_CSV_DATE,
                        GNC_CSV_DESCRIPTION,
                        GNC_CSV_AMOUNT,
                        GNC_CSV_NUM_COL_TYPES};
 
+/** Enumeration for error types. These are the different types of
+ * errors that various functions used for the CSV/Fixed-Width importer
+ * can have. */
 enum GncCsvErrorType {GNC_CSV_FILE_OPEN_ERR,
                       GNC_CSV_ENCODING_ERR};
 
+/** Struct for containing a string. This struct simply contains
+ * pointers to the beginning and end of a string. We need this because
+ * the STF code that gnc_csv_parse calls requires these pointers. */
 typedef struct
 {
   char* begin;
   char* end;
 } GncCsvStr;
 
+/** Struct pairing a transaction with a line number. This struct is
+ * used to keep the transactions in order. When rows are separated
+ * into "valid" and "error" lists (in case some of the rows have cells
+ * that are unparseable), we want the user to still be able to
+ * "correct" the error list. If we keep the line numbers of valid
+ * transactions, we can then put transactions created from the newly
+ * corrected rows into the right places. */
 typedef struct
 {
   int line_no;
   Transaction* trans;
 } GncCsvTransLine;
 
+/** Struct containing data for parsing a CSV/Fixed-Width file. */
 typedef struct
 {
   gchar* encoding;
-  GncCsvStr raw_str;
-  GncCsvStr file_str;
-  GPtrArray* orig_lines;
-  StfParseOptions_t* options;
-  GArray* column_types;
-  GList* error_lines;
-  GList* transactions;
+  GncCsvStr raw_str; /**> Untouched data from the file as a string */
+  GncCsvStr file_str; /**> raw_str translated into UTF-8 */
+  GPtrArray* orig_lines; /**> file_str parsed into a two-dimensional array of strings */
+  StfParseOptions_t* options; /**> Options controlling how file_str should be parsed */
+  GArray* column_types; /**> Array of values from the GncCsvColumnType enumeration */
+  GList* error_lines; /**> List of pointers to rows in orig_lines that have errors */
+  GList* transactions; /**> List of GncCsvTransLine*s created using orig_lines and column_types */
 } GncCsvParseData;
 
 GncCsvParseData* gnc_csv_new_parse_data(void);
 
 void gnc_csv_parse_data_free(GncCsvParseData* parse_data);
 
-int gnc_csv_convert_enc(GncCsvParseData* parse_data, const char* enc);
-
 int gnc_csv_load_file(GncCsvParseData* parse_data, const char* filename,
                       GError** error);
 
+int gnc_csv_convert_encoding(GncCsvParseData* parse_data, const char* encoding);
+
 int gnc_csv_parse(GncCsvParseData* parse_data, gboolean guessColTypes, GError** error);
 
 int gnc_parse_to_trans(GncCsvParseData* parse_data, Account* account);



More information about the gnucash-changes mailing list