ECMultiStoreTable.cpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #include <new>
  18. #include <kopano/platform.h>
  19. #include "ECDatabase.h"
  20. #include <mapidefs.h>
  21. #include "ECSecurity.h"
  22. #include "ECSessionManager.h"
  23. #include "ECMultiStoreTable.h"
  24. #include "ECSession.h"
  25. #include "ECMAPI.h"
  26. #include <kopano/stringutil.h>
  27. namespace KC {
  28. ECMultiStoreTable::ECMultiStoreTable(ECSession *lpSession, unsigned int ulObjType, unsigned int ulFlags, const ECLocale &locale) : ECStoreObjectTable(lpSession, 0, NULL, 0, ulObjType, ulFlags, 0, locale) {
  29. }
  30. ECRESULT ECMultiStoreTable::Create(ECSession *lpSession, unsigned int ulObjType, unsigned int ulFlags, const ECLocale &locale, ECMultiStoreTable **lppTable)
  31. {
  32. *lppTable = new(std::nothrow) ECMultiStoreTable(lpSession, ulObjType, ulFlags, locale);
  33. if (*lppTable == nullptr)
  34. return KCERR_NOT_ENOUGH_MEMORY;
  35. (*lppTable)->AddRef();
  36. return erSuccess;
  37. }
  38. ECRESULT ECMultiStoreTable::SetEntryIDs(ECListInt *lplObjectList) {
  39. ECRESULT er = erSuccess;
  40. m_lstObjects = *lplObjectList;
  41. return er;
  42. }
  43. ECRESULT ECMultiStoreTable::Load() {
  44. ECRESULT er = erSuccess;
  45. ECListIntIterator i;
  46. sObjectTableKey sRowItem;
  47. Clear();
  48. for (i = m_lstObjects.begin(); i != m_lstObjects.end(); ++i)
  49. UpdateRow(ECKeyTable::TABLE_ROW_ADD, *i, 0);
  50. return er;
  51. }
  52. } /* namespace */