diff options
Diffstat (limited to 'linden/indra/newview/llinventoryclipboard.cpp')
-rw-r--r-- | linden/indra/newview/llinventoryclipboard.cpp | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/linden/indra/newview/llinventoryclipboard.cpp b/linden/indra/newview/llinventoryclipboard.cpp new file mode 100644 index 0000000..fb16912 --- /dev/null +++ b/linden/indra/newview/llinventoryclipboard.cpp | |||
@@ -0,0 +1,99 @@ | |||
1 | /** | ||
2 | * @file llinventoryclipboard.cpp | ||
3 | * @brief LLInventoryClipboard class implementation | ||
4 | * | ||
5 | * Copyright (c) 2002-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | #include "llviewerprecompiledheaders.h" | ||
29 | |||
30 | #include "llinventoryclipboard.h" | ||
31 | |||
32 | |||
33 | LLInventoryClipboard LLInventoryClipboard::sInstance; | ||
34 | |||
35 | ///---------------------------------------------------------------------------- | ||
36 | /// Local function declarations, constants, enums, and typedefs | ||
37 | ///---------------------------------------------------------------------------- | ||
38 | |||
39 | |||
40 | ///---------------------------------------------------------------------------- | ||
41 | /// Class LLInventoryClipboard | ||
42 | ///---------------------------------------------------------------------------- | ||
43 | |||
44 | LLInventoryClipboard::LLInventoryClipboard() | ||
45 | { | ||
46 | } | ||
47 | |||
48 | LLInventoryClipboard::~LLInventoryClipboard() | ||
49 | { | ||
50 | reset(); | ||
51 | } | ||
52 | |||
53 | void LLInventoryClipboard::add(const LLUUID& object) | ||
54 | { | ||
55 | mObjects.put(object); | ||
56 | } | ||
57 | |||
58 | // this stores a single inventory object | ||
59 | void LLInventoryClipboard::store(const LLUUID& object) | ||
60 | { | ||
61 | reset(); | ||
62 | mObjects.put(object); | ||
63 | } | ||
64 | |||
65 | void LLInventoryClipboard::store(const LLDynamicArray<LLUUID>& inv_objects) | ||
66 | { | ||
67 | reset(); | ||
68 | S32 count = inv_objects.count(); | ||
69 | for(S32 i = 0; i < count; i++) | ||
70 | { | ||
71 | mObjects.put(inv_objects[i]); | ||
72 | } | ||
73 | } | ||
74 | |||
75 | void LLInventoryClipboard::retrieve(LLDynamicArray<LLUUID>& inv_objects) const | ||
76 | { | ||
77 | inv_objects.reset(); | ||
78 | S32 count = mObjects.count(); | ||
79 | for(S32 i = 0; i < count; i++) | ||
80 | { | ||
81 | inv_objects.put(mObjects[i]); | ||
82 | } | ||
83 | } | ||
84 | |||
85 | void LLInventoryClipboard::reset() | ||
86 | { | ||
87 | mObjects.reset(); | ||
88 | } | ||
89 | |||
90 | // returns true if the clipboard has something pasteable in it. | ||
91 | BOOL LLInventoryClipboard::hasContents() const | ||
92 | { | ||
93 | return (mObjects.count() > 0); | ||
94 | } | ||
95 | |||
96 | |||
97 | ///---------------------------------------------------------------------------- | ||
98 | /// Local function definitions | ||
99 | ///---------------------------------------------------------------------------- | ||