[Dar-libdar_api] Re: archive methods?
For full, incremental, compressed and encrypted backups or archives
Brought to you by:
edrusb
|
From: Denis C. <dar...@fr...> - 2004-07-17 14:20:37
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Johnathan Burchill wrote: | Hi Denis, Hello Johnathan, | | Now that libdar uses the "archive" class, what is the possibility of having | the various libdar operations implemented as methods of the archive class? | | Instead of | | libdar::archive *theArchive; | | libdar::open( theArchive, ...) | libdar::test( theArchive, ...) | etc. | | what about having | | libdar::archive *theArchive( path, basename, etc.) | | theArchive->open(); | theArchive->test(); | | Have you considered this? yes, I did. I even intially wanted to implement things this way. | I'm not sure what this would accomplish, besides | quite a bit of possibly unnecessary code rewriting. I don't think there is too much code rewriting for that be possible. | It just ocurred to me | that an archive is the main object for libdar, and the usual way in c++ is | to implement functions as methods. yes, I agree. | | Please enlighten me if I am off base here. I'm not sure that I've thought | this through very much. Sorry in advance if this has been documented | elsewhere. In fact, if I did not do this way, is to keep API a set of normal functions, for those who could call libdar from a program written in C, Pascal, or any other language. Of course some of the arguments are objects. But, for a non C++ programmer it is maybe more intuitive to use a pure C function than a method on an object. This is the reason why I did not moved op_create and other methods as members of archive class. Another problem is the _noexcept variants of API calls. In particular the open_archive_noexcept() call which would correspond to a constructor for the archive class. constructor do not return error, so if it is not possible to throw exception to report an error, how would it be possible to report an error during the archive object construction ? OK, one could make a fake constructor, that do nothing real, and a open_archive_noexcept() method that (as it is now a normal method), can return an error code status, but, I don't see much more interest compared to normal functions. any objections ? comments ? ;-) | | Cheers, | JB | Cheers, Denis. P.S.: Johnathan, I cannot figure out how to find your public key. It is not on your web site (there is old obsolete one only), nor it is on any key servers I tried. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFA+TY6pC5CI8gYGlIRAiwaAJ9y6KrSZRM1YOEtjzE+WKz8hqXQkQCeI4GW lZj52GTaJKQ3gXrF7xT9uBI= =I0Tl -----END PGP SIGNATURE----- |