diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2016-09-15 12:27:28 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2016-10-11 13:56:22 +0200 |
commit | 9fa4eff9be5e440099517a522a83e20debaf2955 (patch) | |
tree | 6ac23f08cb1902fb021bf470144e213df0b4b886 /include | |
parent | ed646dc595b2ee5248b0994a2b44a7a5a7bfbbd5 (diff) |
profilesafe: Enhancements to BackupFileHelper
Added helper class to allow easy creation/deployment
of backups of a file. It works like a 'stack' of backups,
supports easy add/remove/delete of last entry (LIFO).
Added some work top allow opening dialogs in DeInit
under linux.
Change-Id: Idacec97ec2f097af9bd22a8a67b410c7677d17f1
Diffstat (limited to 'include')
-rw-r--r-- | include/comphelper/backupfilehelper.hxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/comphelper/backupfilehelper.hxx b/include/comphelper/backupfilehelper.hxx index 3061254615ae..f407d2b8815c 100644 --- a/include/comphelper/backupfilehelper.hxx +++ b/include/comphelper/backupfilehelper.hxx @@ -14,6 +14,7 @@ #include <comphelper/comphelperdllapi.h> #include <rtl/ustring.hxx> +#include <osl/file.hxx> namespace comphelper { @@ -51,6 +52,15 @@ namespace comphelper osl::File maBaseFile; bool mbBaseFileIsOpen; + // internal flag if _exit() was called already - a hint to evtl. + // not create copies of potentially not well-defined data. This + // may be used in destructors of static instances - which unfortunately + // get called on WNT but not on linux. Thus I thought about encapsulating + // in some '#ifdefs', but it's just more safe to always do it and + // allows to add a SAL_WARN when one of these destructors is called + // after _exit() + static bool mbExitWasCalled; + // internal upper limit (max) of allowed backups static sal_uInt16 mnMaxAllowedBackups; @@ -69,6 +79,10 @@ namespace comphelper */ BackupFileHelper(const OUString& rBaseURL, sal_uInt16 nNumBackups = 5); + // allow to set flag when app had to call _exit() + static void setExitWasCalled(); + static bool getExitWasCalled(); + /** tries to create a new backup, if there is none yet, or if the * last differs from the base file. It will then put a new verion * on the 'stack' of copies and evtl. delete the oldest backup. |