Archiver.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright 2005 - 2016 Zarafa and its licensors
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Affero General Public License, version 3,
  6. * as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU Affero General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Affero General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. *
  16. */
  17. #ifndef ARCHIVER_H_INCLUDED
  18. #define ARCHIVER_H_INCLUDED
  19. #include <memory>
  20. #include <kopano/zcdefs.h>
  21. #include "ArchiveManage.h" // for ArchiveManagePtr
  22. namespace KC {
  23. class ECConfig;
  24. #define ARCHIVE_RIGHTS_ERROR (unsigned)-1
  25. #define ARCHIVE_RIGHTS_ABSENT (unsigned)-2
  26. struct configsetting_t;
  27. class _kc_export Archiver {
  28. public:
  29. typedef std::unique_ptr<Archiver> auto_ptr_type;
  30. enum {
  31. RequireConfig = 0x00000001,
  32. AttachStdErr = 0x00000002,
  33. InhibitErrorLogging = 0x40000000 // To silence Init errors in the unit test.
  34. };
  35. enum eLogType {
  36. DefaultLog = 0,
  37. LogOnly = 1
  38. };
  39. static const char *GetConfigPath(void);
  40. _kc_hidden static const configsetting_t *GetConfigDefaults(void);
  41. static eResult Create(auto_ptr_type *);
  42. _kc_hidden virtual ~Archiver(void) _kc_impdtor;
  43. _kc_hidden virtual eResult Init(const char *app_name, const char *config, const configsetting_t *extra_opts = nullptr, unsigned int flags = 0) = 0;
  44. _kc_hidden virtual eResult GetControl(ArchiveControlPtr *, bool force_cleanup = false) = 0;
  45. _kc_hidden virtual eResult GetManage(const TCHAR *user, ArchiveManagePtr *) = 0;
  46. _kc_hidden virtual eResult AutoAttach(unsigned int flags) = 0;
  47. _kc_hidden virtual ECConfig *GetConfig(void) const = 0;
  48. _kc_hidden virtual ECLogger *GetLogger(eLogType which = DefaultLog) const = 0;
  49. protected:
  50. _kc_hidden Archiver(void) {};
  51. };
  52. typedef Archiver::auto_ptr_type ArchiverPtr;
  53. } /* namespace */
  54. #endif // !defined ARCHIVER_H_INCLUDED