Commit Graph
17946 Commits
Author SHA1 Message Date
Geert Janssens 1b44310b04 Replace transactions GList with a std::multimap 2017-02-20 17:42:32 +01:00
Geert Janssens d557c01c88 Another round of small c to c++(11) conversions
- prefer c++ data types (auto, bool, int, std::string)
- iterate over vectors instead of accessing via the [] operator
- use boost::{u32}regex instead of directly manipulating a c-string
2017-02-20 17:42:30 +01:00
Geert Janssens 05c187960a Delay the test for a default account until it's needed 2017-02-20 17:42:29 +01:00
Geert Janssens 11ff8273e5 Fix memory management for the temporary trans properties
This is done by wrapping each property in a minimal template class hierarchy
and keep track of each using a std::shared_pointer
2017-02-20 17:42:28 +01:00
Geert Janssens bebc871fe8 Reduce code duplication by reusing trans_add_split 2017-02-20 17:42:24 +01:00
Geert Janssens 42c2f94b38 Fix memory corruption bug 2017-02-20 17:42:23 +01:00
Geert Janssens 2d42bf5920 Refactor TransProperty stuff to a simple void*
Needs more attention for memory management though.
2017-02-20 17:42:22 +01:00
Geert Janssens f26d3cea7d Replace private data structure TransPropertyList with a std::map
This required moving around a few other parameters
- currency_format and date_format will now be passed directly to the function that needs it
- Account is converted into a trans_prop just like all the other columns the user had selected
2017-02-20 17:42:20 +01:00
Geert Janssens 38b0b356e4 Remove fake csv parsing test 2017-02-20 17:42:19 +01:00
Geert Janssens e6d9a614ad Add some polish to csv_import_trans_file_chooser_confirm_cb
- avoid superfluous string copying
- flatten the nested if structures
- set a default file format before attempting to parse
2017-02-20 17:42:18 +01:00
Geert Janssens 8f9b3d322a Prevent c++ name mangling on functions used as callbacks by gtk 2017-02-20 17:42:17 +01:00
Geert Janssens 5c9f9059a1 csv-imp - use enum instead of strings to track user selected column types 2017-02-20 17:42:16 +01:00
Geert Janssens 0b73a56c29 Convert column type to name mapping into a std::map 2017-02-20 17:42:14 +01:00
Geert Janssens 6f15805c0b Adapt assistant for c++ guid changes 2017-02-20 17:42:12 +01:00
Geert Janssens c21cf18847 Refactor csv assistant code to use GncCsvParseData class instead of gnc-csv-model code 2017-02-20 17:42:11 +01:00
Geert Janssens b9646e9b9a Build assistant-csv-trans-import.c(pp) as c++ 2017-02-20 17:42:10 +01:00
Geert Janssens 142fb61724 Introduce parse error state 2017-02-20 17:42:08 +01:00
Geert Janssens 0f6dc53cd1 Small local variable cleanups 2017-02-20 17:42:07 +01:00
Geert Janssens d85de0124c C++ - use std::pair to store tokenized line together with its error message
Also drop a few variables that carry superfluous data and add more c++11 semantics
2017-02-20 17:42:06 +01:00
Geert Janssens 17b2b4668e C++11 Convert unscoped enum into scoped one
As per recommendation 10 in Meyer's Effective Modern C++

This also means the string array with column type names
can no longer be shared between c and c++ code, so
set up a separate one in c++
2017-02-20 17:42:05 +01:00
Geert Janssens 8f9d2ee826 Use more C++11 features
- use iterators to loop and std::find
  This allows us to use 'continue' on the loop in case
  of errors instead of using an ever more indenting if/else
- Use auto where possible
- Use constant iterators where possible
2017-02-20 17:42:03 +01:00
Geert Janssens bcae6628d6 Revert to boost.regex without ICU support
For some reason named capture groups trigger an uninitialized shared_ptr assert
2017-02-20 17:42:02 +01:00
Geert Janssens e95b1e2c16 Redo parse_date function using boost regular expressions 2017-02-20 17:41:58 +01:00
Geert Janssens 533b5eb7be Convert error_lines GList in a vector of strings
Also keep the errors separate from the original data.
Use for loop instead of while.
2017-02-20 17:41:53 +01:00
Geert Janssens cecfe9ecb8 Replace stf based file parser with gnc-tokenizer based one 2017-02-20 17:41:52 +01:00
Geert Janssens ce63d8aab0 Use vector instead of GArray for column_types class member 2017-02-20 17:41:49 +01:00
Geert Janssens 1507ec0c30 Convert GncCsvParseData into a class
This is just an initial conversion. Lots of
work is still needed to get to proper data encapsulation
and using modern c++ semantics
2017-02-20 17:41:48 +01:00
Geert Janssens 3a0f0dff8e csv-imp - copy gnc-csv-model and make it build as c++
This will be the start of a GncCsvImpTrans class that will
manage transaction imports from csv files
2017-02-20 17:41:47 +01:00
Geert Janssens 9ff993bbff Add dummy tokenizer to be used when file format isn't known yet 2017-02-20 17:41:44 +01:00
Geert Janssens c6043ccc23 Add functions to manipulate fixed width column positions 2017-02-20 17:41:43 +01:00
Geert Janssens 48cfbc23d4 Add fixed width file parser based on boost::tokenize
Effective c++ notes:
- explicitly declare special member functions
- explicitly declare overriding functions as override
2017-02-20 17:41:42 +01:00
Geert Janssens efcd266971 Add csv file parser based on boost::tokenize
Effective c++ notes:
- explicitly declare special member functions
- explicitly declare overriding functions as override
2017-02-20 17:41:40 +01:00
Geert Janssens ed7b863d8f Introduce base class for parsing importable files
This base class takes care of the common things like
file opening and character set conversion.
The actual interpretation of the contents will be
delegated to specialized child classes.

Effective c++ note: explicitly declare special member functions
2017-02-20 17:41:34 +01:00
Geert Janssens 83da518763 Whitespace and spelling corrections 2017-02-20 17:41:32 +01:00
Geert Janssens d57a7ceed2 Look for translatable strings in lib directory as well
The Character Encoding menu imported from goffice comes with many such strings.
I still need to find a nice way to copy the existing translations for them
from goffice directly to gnucash.
2017-02-20 17:41:31 +01:00
Geert Janssens 0dc6fdc79c Use internalized goffice parts in csv-import
The dependency on goffice can't be eliminated completely yet at this point.
The stf library we're currently using to parse csv files depends on it. This
will be fixed in a future commit.
2017-02-20 17:41:30 +01:00
Geert Janssens baf10bb7a5 Fix build issues with goffice imported sources
- Remove unused includes and functions
- Some small cleanups
2017-02-20 17:41:28 +01:00
Geert Janssens d858c7d51d Internalize parts of the goffice code
We're using only a tiny fraction of that library.
Adding it directly in the gnucash source saves a large dependency chain.

Note this is a verbatim copy of these files from
https://github.com/GNOME/goffice/tree/GOFFICE_0_8_17
to preserve a clean link with it's origin.
It will only build correctly after the next commit.
2017-02-20 17:41:27 +01:00
Geert Janssens 20eecb05da Small amendements to gnc-csv-account-map
- add to POTFILES.in
- const correctness fixup (c++ is picky about this)
2017-02-20 17:41:25 +01:00
Geert Janssens 01d31c7171 Yet another tweak to properly find GMOCK sources
The previous logic failed because GMOCK_SRC_DIR is cached. On
subsequent cmake runs FIND_PATH is not invoked again and hence
the first test for GMOCK_SRC_DIR will always succeed and
src is always appended to it to obtain GMOCK_SRC_MAIN_DIR.
This is not what we want, so I have chosen to force a rerun
of FIND_PATH by clearing the cached value of GMOCK_SRC_DIR.
2017-02-20 17:37:52 +01:00
John Ralls 81da2f2495 Silence the no lock table warnings in test-backend-dbi. 2017-02-18 15:33:21 -08:00
John Ralls f7c7b424bd Fix failure to drop the temp numeric table at the end of dbi_library_test. 2017-02-18 15:32:41 -08:00
John Ralls 4bf3713bf0 Make gnc_dbi_safe_sync_all safer.
With SQLite3 and PGSql perform all of the safe_sync actions in a SQL transaction.
Unfortunately MySQL commits the transaction on the first schema-altering
query (CREATE_TABLE in this case) without decrementing sql_savepoint, so
raising an error when we try to release the (non-existent) save point at
the end of writing the tables, so we have to fall back on detecting a failed
safe_sync at the next connection attempt.

Add a GncDbiSqlConnection::check_and_rollback_failed_save() to restore
the database after a failed safe_save; this is performed at the next connection.
2017-02-18 10:25:06 -08:00
sdementen ece859705d add gnc_get_current_session to swig interface 2017-02-18 16:38:46 +01:00
John Ralls c1fa1d2fde Move begin_transaction in lock_database to include checking for the table…
and creating it.
2017-02-16 12:10:56 -08:00
John Ralls 2a2369b297 Add SAVEPOINT support to enable nested gnc_dbi_transaction calls. 2017-02-16 11:09:56 -08:00
John Ralls 9f0b086546 Use the transactional member functions instead of running queries directly. 2017-02-16 11:08:35 -08:00
John Ralls 07eb110db7 Merge branch 'maint' 2017-02-15 15:51:58 -08:00
fell 5eb1fffa7d Review of pull request #125 from Mechtilde 2017-02-14 08:08:09 +01:00
Frank H. Ellenberger 03d6b7c200 Merge pull request #125 from Mechtilde/TranslationDE
Translation de
2017-02-14 05:27:48 +01:00