PageRenderTime 61ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/llinventoryclipboard.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 86 lines | 28 code | 15 blank | 43 comment | 0 complexity | 771a299d767cf552d912ac13436f08e3 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llinventoryclipboard.h
  3. * @brief LLInventoryClipboard class header file
  4. *
  5. * $LicenseInfo:firstyear=2002&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLINVENTORYCLIPBOARD_H
  27. #define LL_LLINVENTORYCLIPBOARD_H
  28. #include "lldarray.h"
  29. #include "lluuid.h"
  30. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  31. // Class LLInventoryClipboard
  32. //
  33. // This class is used to cut/copy/paste inventory items around the
  34. // world. This class is accessed through a singleton (only one
  35. // inventory clipboard for now) which can be referenced using the
  36. // instance() method.
  37. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  38. class LLInventoryClipboard
  39. {
  40. public:
  41. // calling this before main() is undefined
  42. static LLInventoryClipboard& instance() { return sInstance; }
  43. // this method adds to the current list.
  44. void add(const LLUUID& object);
  45. // this stores a single inventory object
  46. void store(const LLUUID& object);
  47. // this method stores an array of objects
  48. void store(const LLDynamicArray<LLUUID>& inventory_objects);
  49. void cut(const LLUUID& object);
  50. // this method gets the objects in the clipboard by copying them
  51. // into the array provided.
  52. void retrieve(LLDynamicArray<LLUUID>& inventory_objects) const;
  53. // this method empties out the clipboard
  54. void reset();
  55. // returns true if the clipboard has something pasteable in it.
  56. BOOL hasContents() const;
  57. bool isCutMode() const { return mCutMode; }
  58. protected:
  59. static LLInventoryClipboard sInstance;
  60. LLDynamicArray<LLUUID> mObjects;
  61. bool mCutMode;
  62. public:
  63. // please don't actually call these
  64. LLInventoryClipboard();
  65. ~LLInventoryClipboard();
  66. private:
  67. // please don't implement these
  68. LLInventoryClipboard(const LLInventoryClipboard&);
  69. LLInventoryClipboard& operator=(const LLInventoryClipboard&);
  70. };
  71. #endif // LL_LLINVENTORYCLIPBOARD_H