mapi_ptr.h 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 mapi_ptr_INCLUDED
  18. #define mapi_ptr_INCLUDED
  19. #include <kopano/memory.hpp>
  20. #include <mapix.h>
  21. #include <mapispi.h>
  22. #include <edkmdb.h>
  23. #include <edkguid.h>
  24. #include <kopano/IECServiceAdmin.h>
  25. #include <kopano/IECSecurity.h>
  26. #include <kopano/IECSingleInstance.h>
  27. #include <kopano/ECGuid.h>
  28. #include <kopano/mapiguidext.h>
  29. namespace KC {
  30. typedef KCHL::object_ptr<IABContainer, IID_IABContainer> ABContainerPtr;
  31. typedef KCHL::object_ptr<IAddrBook, IID_IAddrBook> AddrBookPtr;
  32. typedef KCHL::object_ptr<IDistList, IID_IDistList> DistListPtr;
  33. typedef KCHL::object_ptr<IECSecurity, IID_IECSecurity> ECSecurityPtr;
  34. typedef KCHL::object_ptr<IECServiceAdmin, IID_IECServiceAdmin> ECServiceAdminPtr;
  35. typedef KCHL::object_ptr<IECSingleInstance, IID_IECSingleInstance> ECSingleInstancePtr;
  36. typedef KCHL::object_ptr<IExchangeManageStore, IID_IExchangeManageStore> ExchangeManageStorePtr;
  37. typedef KCHL::object_ptr<IExchangeModifyTable, IID_IExchangeModifyTable> ExchangeModifyTablePtr;
  38. typedef KCHL::object_ptr<IExchangeExportChanges, IID_IExchangeExportChanges> ExchangeExportChangesPtr;
  39. typedef KCHL::object_ptr<IMAPIAdviseSink, IID_IMAPIAdviseSink> MAPIAdviseSinkPtr;
  40. typedef KCHL::object_ptr<IMAPIContainer, IID_IMAPIContainer> MAPIContainerPtr;
  41. typedef KCHL::object_ptr<IMAPIFolder, IID_IMAPIFolder> MAPIFolderPtr;
  42. typedef KCHL::object_ptr<IMAPIProp, IID_IMAPIProp> MAPIPropPtr;
  43. typedef KCHL::object_ptr<IMAPISession, IID_IMAPISession> MAPISessionPtr;
  44. typedef KCHL::object_ptr<IMAPITable, IID_IMAPITable> MAPITablePtr;
  45. typedef KCHL::object_ptr<IMailUser, IID_IMailUser> MailUserPtr;
  46. typedef KCHL::object_ptr<IMessage, IID_IMessage> MessagePtr;
  47. typedef KCHL::object_ptr<IMsgServiceAdmin, IID_IMsgServiceAdmin> MsgServiceAdminPtr;
  48. typedef KCHL::object_ptr<IMsgStore, IID_IMsgStore> MsgStorePtr;
  49. typedef KCHL::object_ptr<IProfAdmin, IID_IProfAdmin> ProfAdminPtr;
  50. typedef KCHL::object_ptr<IProfSect, IID_IProfSect> ProfSectPtr;
  51. typedef KCHL::object_ptr<IProviderAdmin, IID_IProviderAdmin> ProviderAdminPtr;
  52. typedef KCHL::object_ptr<IUnknown, IID_IUnknown> UnknownPtr;
  53. typedef KCHL::object_ptr<IStream, IID_IStream> StreamPtr;
  54. typedef KCHL::object_ptr<IAttach, IID_IAttachment> AttachPtr;
  55. typedef KCHL::object_ptr<IMAPIGetSession, IID_IMAPIGetSession> MAPIGetSessionPtr;
  56. typedef KCHL::memory_ptr<ECPERMISSION> ECPermissionPtr;
  57. typedef KCHL::memory_ptr<ENTRYID> EntryIdPtr;
  58. typedef KCHL::memory_ptr<ENTRYLIST> EntryListPtr;
  59. typedef KCHL::memory_ptr<MAPIERROR> MAPIErrorPtr;
  60. typedef KCHL::memory_ptr<ROWLIST> RowListPtr;
  61. typedef KCHL::memory_ptr<SPropProblemArray> SPropProblemArrayPtr;
  62. typedef KCHL::memory_ptr<SPropValue> SPropValuePtr;
  63. typedef KCHL::memory_ptr<SPropTagArray> SPropTagArrayPtr;
  64. typedef KCHL::memory_ptr<SRestriction> SRestrictionPtr;
  65. typedef KCHL::memory_ptr<SRow> SRowPtr;
  66. typedef KCHL::memory_ptr<SSortOrderSet> SSortOrderSetPtr;
  67. typedef KCHL::memory_ptr<char> StringPtr;
  68. typedef KCHL::memory_ptr<WCHAR> WStringPtr;
  69. typedef KCHL::memory_ptr<FlagList> FlagListPtr;
  70. typedef KCHL::memory_ptr<SBinary> SBinaryPtr;
  71. typedef KCHL::memory_ptr<BYTE> BytePtr;
  72. typedef KCHL::memory_ptr<MAPINAMEID> MAPINameIdPtr;
  73. typedef KCHL::memory_ptr<ECPERMISSION> ECPermissionArrayPtr;
  74. typedef KCHL::memory_ptr<SPropValue> SPropArrayPtr;
  75. class SRowSetPtr : public KCHL::memory_ptr<SRowSet, KCHL::rowset_delete> {
  76. public:
  77. typedef unsigned int size_type;
  78. SRowSetPtr(void) = default;
  79. SRowSetPtr(SRowSet *p) : KCHL::rowset_ptr(p) {}
  80. SRowSet **operator&(void) { return &~*this; }
  81. size_type size(void) const { return (*this)->cRows; }
  82. const SRow &operator[](size_t i) const { return (*this)->aRow[i]; }
  83. bool empty(void) const { return (*this)->cRows == 0; }
  84. };
  85. } /* namespace */
  86. #endif // ndef mapi_ptr_INCLUDED