ECPropertyEntry.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 ECPROPERTYENTRY_H
  18. #define ECPROPERTYENTRY_H
  19. #include <kopano/zcdefs.h>
  20. #include <mapidefs.h>
  21. #include <mapicode.h>
  22. #include "ECInvariantChecker.h"
  23. // C++ class to represent a property in the property list.
  24. class ECProperty _kc_final {
  25. public:
  26. ECProperty(const ECProperty &Property);
  27. ECProperty(const SPropValue *);
  28. ~ECProperty();
  29. HRESULT CopyFrom(const SPropValue *);
  30. HRESULT CopyTo(LPSPropValue lpsProp, void *lpBase, ULONG ulPropTag);
  31. HRESULT CopyToByRef(LPSPropValue lpsProp) const;
  32. bool operator==(const ECProperty &property) const;
  33. SPropValue GetMAPIPropValRef(void) const;
  34. ULONG GetSize() const { return ulSize; }
  35. ULONG GetPropTag() const { return ulPropTag; }
  36. DWORD GetLastError() const { return dwLastError; }
  37. DECL_INVARIANT_CHECK
  38. private:
  39. DECL_INVARIANT_GUARD(ECProperty)
  40. HRESULT CopyFromInternal(const SPropValue *);
  41. ULONG ulSize;
  42. ULONG ulPropTag;
  43. union __UPV Value;
  44. DWORD dwLastError;
  45. };
  46. // A class representing a property we have in-memory, a list of which is held by ECMAPIProp
  47. // Deleting a property just sets the property as deleted
  48. class ECPropertyEntry _kc_final {
  49. public:
  50. ECPropertyEntry(ULONG ulPropTag);
  51. ECPropertyEntry(ECProperty *property);
  52. ~ECPropertyEntry();
  53. HRESULT HrSetProp(ECProperty *property);
  54. HRESULT HrSetProp(const SPropValue *);
  55. HRESULT HrSetClean();
  56. ECProperty * GetProperty() { return lpProperty; }
  57. ULONG GetPropTag() const { return ulPropTag; }
  58. void DeleteProperty();
  59. BOOL FIsDirty() const { return fDirty; }
  60. BOOL FIsLoaded() const { return lpProperty != NULL; }
  61. DECL_INVARIANT_CHECK
  62. private:
  63. DECL_INVARIANT_GUARD(ECPropertyEntry)
  64. ECProperty *lpProperty;
  65. ULONG ulPropTag;
  66. BOOL fDirty = true;
  67. };
  68. #endif