Implement flat bayes kvp

The bayes data are stored in the KVP store. Before this commit, they are
stored under /import-map-bayes/<token>/<account guid>/count (where count
is the datum that "matters" in bayes matching).

The problem with this is that any token including the kvp delimiter
(currently '/') gets divided, and is not found correctly during bayes
kvp searching. The quickest solution to this is to replace all "/"
characters with some other character. That has been done, along with a
re-structuring of the bayes matching code to take advantage of c++
features to make the code more concise and readable.

Also modified some test functions to fix leaks and double-frees: the
same kvp value can't be in the kvp tree twice.

Also, when I added code to clean up after the tests, some things started
breaking due to double-delete. Apparently const_cast was hiding some
programming errors. Really? You don't say? When giving a GUID* to KvpValue,
the latter takes ownership of the former.
This commit is contained in:
lmat
2017-10-19 15:42:32 -04:00
parent 08aa0104ef
commit b3667c76fc
11 changed files with 595 additions and 533 deletions

View File

@@ -1454,6 +1454,10 @@ void gnc_account_delete_map_entry (Account *acc, char *full_category, gboolean e
*/
void gnc_account_imap_convert_bayes (QofBook *book);
/** Change the bayes imap entries from a nested representation to a flat representation.
*/
void gnc_account_imap_convert_flat (QofBook *);
/** @} */