PageRenderTime 43ms CodeModel.GetById 19ms app.highlight 4ms RepoModel.GetById 17ms 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
 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
27#ifndef LL_LLINVENTORYCLIPBOARD_H
28#define LL_LLINVENTORYCLIPBOARD_H
29
30#include "lldarray.h"
31#include "lluuid.h"
32
33//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34// Class LLInventoryClipboard
35//
36// This class is used to cut/copy/paste inventory items around the
37// world. This class is accessed through a singleton (only one
38// inventory clipboard for now) which can be referenced using the
39// instance() method.
40//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41
42class LLInventoryClipboard
43{
44public:
45	// calling this before main() is undefined
46	static LLInventoryClipboard& instance() { return sInstance; }
47
48	// this method adds to the current list.
49	void add(const LLUUID& object);
50
51	// this stores a single inventory object
52	void store(const LLUUID& object);
53
54	// this method stores an array of objects
55	void store(const LLDynamicArray<LLUUID>& inventory_objects);
56
57	void cut(const LLUUID& object);
58	// this method gets the objects in the clipboard by copying them
59	// into the array provided.
60	void retrieve(LLDynamicArray<LLUUID>& inventory_objects) const;
61
62	// this method empties out the clipboard
63	void reset();
64
65	// returns true if the clipboard has something pasteable in it.
66	BOOL hasContents() const;
67	bool isCutMode() const { return mCutMode; }
68
69protected:
70	static LLInventoryClipboard sInstance;
71
72	LLDynamicArray<LLUUID> mObjects;
73	bool mCutMode;
74
75public:
76	// please don't actually call these
77	LLInventoryClipboard();
78	~LLInventoryClipboard();
79private:
80	// please don't implement these
81	LLInventoryClipboard(const LLInventoryClipboard&);
82	LLInventoryClipboard& operator=(const LLInventoryClipboard&);
83};
84
85
86#endif // LL_LLINVENTORYCLIPBOARD_H