Clarification for APIs for third phase- dataupdater

Ralf Habacker ralf.habacker at freenet.de
Sun Sep 6 23:21:31 BST 2020


Am 27.08.20 um 14:53 schrieb Prasun Kumar:
> Hi Ralf,
>
>     A static function in the class AccountNumberCheck::updateDatabase(),
>     which  updates the database when called by the client and returns the
>     state of operation e.g
>
>       bool AccountNumberCheck::updateDatabase()
>
>  
> As suggested here:
> https://mail.kde.org/pipermail/kde-finance-apps/2020-May/000835.html
> I have added an API to update databases as a class, 'DataUpdater'. I
> have created a separate class for this
> as the downloading code is too big to put in one method considering
> modularity and also since these methods were
> independent of the AccountNumberCheck class. The only required method
> I see now is the bankdata_dir() for downloaded
> file installation but since it's a static method, it can be accessed
> without any AccountNumberCheck object.

As bankdata_dir() points to a read only location (by default
/usr/share/ktoblzcheck/ on unix like os), there is some work required to
provide a writeable location, where the updater can save the download
files and ktoblzcheck can read downloaded bankdata files. The rule is to
search the writeable location first and then, if no file has been found,
the readonly location.

The writeable location would be on unix like os: /home/xxx/.local/share
and on windows: C:\users\xxx\.local\share where C:\users\xxx can be
retrieved from the USERPROFILE environment variable.

> Also, since the class is in the same header file, a client doesn't
> need to import extra headers, however, they would surely
> need to create a DataUpdater object.
This looks good except the fact, that there are implementation details
in the public header, which would better to placed into a private class
following the hints mentioned at https://herbsutter.com/gotw/_100/.
>
Regards

Ralf

> On Thu, 27 Aug 2020 at 12:29, Ralf Habacker <ralf.habacker at freenet.de
> <mailto:ralf.habacker at freenet.de>> wrote:
>
>     Am 18.08.20 um 06:54 schrieb Prasun Kumar:
>     > Hi mentors,
>     > I have incorporated most of your suggestions into the project
>     and I am
>     > working on the few left.
>     >
>     > The remaining milestones in the proposed project are the
>     creation of API
>     > to integrate the
>     > databases into other applications and the additional subtask of a
>     > download API to fetch
>     > updated databases from a server.
>     >
>     > The downloading API's flow is somewhat clear to me but it would be
>     > helpful to have some pointers
>     > for the first API.
>     >
>
>     A static function in the class AccountNumberCheck::updateDatabase(),
>     which  updates the database when called by the client and returns the
>     state of operation e.g
>
>       bool AccountNumberCheck::updateDatabase()
>
>     or
>
>     typedef enum {} UpdateState;
>
>     UpdateState AccountNumberCheck::updateDatabase();
>
>
>     Regards
>     Ralf
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-finance-apps/attachments/20200907/89f280c1/attachment.htm>


More information about the Kde-finance-apps mailing list