Commit Graph

17929 Commits

Author SHA1 Message Date
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
Mechtilde
02d9065db6 msgmerge with gnucash-2.6.15.pot 2017-02-12 09:48:45 +01:00
Mechtilde
bcffaea86e translation tip_of_the_day 2017-02-12 09:43:13 +01:00
fell
b78d7c72ce Improve comment about available languages 2017-02-12 00:02:33 +01:00
fell
260f1ba312 Set a separate translator comment to avoid pulling the whole file header
comment in POT

Follow up of commit 7432ba8
2017-02-10 22:52:02 +01:00
fell
cfdaa073a1 Fix german language tag
found by i18nspector
2017-02-10 21:48:14 +01:00
fell
2ac3ddec9c Update PACKAGE_BUGREPORT, set PACKAGE_URL
We prefer bugzilla entries over emails
2017-02-10 21:31:52 +01:00
Geert Janssens
2d451801e9 One more stab at properly discovering gtest/gmock
My previous attempt made wrong assumptions on the
way source files got included in the mock tree.
2017-02-08 17:16:58 +01:00
Geert Janssens
1241b71770 Fix cmake's gmock handling to work with Fedora packages
Similar checks were already in configure.ac for the autotools variant
2017-02-06 11:10:41 +01:00
John Ralls
93301cd285 Make gnc_dbi_safe_sync_all safer.
Creates a new safe_sync function in struct provider and a new
gnc_db_do_safe_sync_all function with the guts of gnc_dbi_do_safe_sync_all.
The last calls the provider’s safe_sync function, which for SQLite3 and
PGSql wraps the call to gnc_dbi_do_safe_sync_all 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.

Add a gnc_dbi_check_and_rollback_failed_save() to restore the database
after a failed safe_save; this is performed at the next connection.
2017-02-04 17:36:09 -08:00
John Ralls
a70637f34d Move the transaction-lock on obtaining the database lock earlier.
So that opening/creating the table is included. Also modify the condition
to reduce code nesting.
2017-02-04 17:24:32 -08:00
John Ralls
979e6397c1 Add SAVEPOINT support to enable nested gnc_dbi_transaction calls. 2017-02-04 09:50:50 -08:00
John Ralls
db73c39bf1 Extract static gnc_dbi_transaction functions.
To enable local calls (as opposed to just virtual calls via
GncDbiSqlConnection) and replace all direct transaction queries with the
new functions.
2017-02-04 09:41:45 -08:00
Geert Janssens
659c96eb1b Optionally locate boost via environment variable BOOST_ROOT
This was already the case for our autotools based build
and simplifies the build setup for our Windows build system.
2017-02-02 18:48:15 +01:00
Geert Janssens
4fdacb9b2a Fix building gtest library on mingw
See https://github.com/google/googletest/issues/893
2017-02-02 18:31:54 +01:00
Geert Janssens
0a8d7a2142 Make google test framework a mandatory build dependency
All c++ unit tests will be written with it, and testing
should be possible out of the box.
We could make it optional, but then lots of tests will
be skipped. This creates an illusion of all tests passing
while many are simply not run. This confusion should be
avoided.
This change depends on a second commit for the windows build
in the gnucash-on-windows repository. This commit will be
pushed at the same time.
2017-02-02 17:20:43 +01:00
DIG
b682fe6b43 Small updates for Russian translation 2017-02-02 09:28:45 +01:00
Geert Janssens
aeb04e1d9d Fake change to test mail script on code.gnucash.org 2017-02-01 22:25:44 +01:00