aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerinventory.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llviewerinventory.h
parentREADME.txt (diff)
downloadmeta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/newview/llviewerinventory.h')
-rw-r--r--linden/indra/newview/llviewerinventory.h272
1 files changed, 272 insertions, 0 deletions
diff --git a/linden/indra/newview/llviewerinventory.h b/linden/indra/newview/llviewerinventory.h
new file mode 100644
index 0000000..3e81f90
--- /dev/null
+++ b/linden/indra/newview/llviewerinventory.h
@@ -0,0 +1,272 @@
1/**
2 * @file llviewerinventory.h
3 * @brief Declaration of the inventory bits that only used on the viewer.
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#ifndef LL_LLVIEWERINVENTORY_H
29#define LL_LLVIEWERINVENTORY_H
30
31#include "llinventory.h"
32#include "llframetimer.h"
33#include "llwearable.h"
34
35//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
36// Class LLViewerInventoryItem
37//
38// An inventory item represents something that the current user has in
39// their inventory.
40//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41
42class LLViewerInventoryItem : public LLInventoryItem
43{
44public:
45 typedef LLDynamicArray<LLPointer<LLViewerInventoryItem> > item_array_t;
46
47protected:
48 ~LLViewerInventoryItem( void ); // ref counted
49
50public:
51 // construct a complete viewer inventory item
52 LLViewerInventoryItem(const LLUUID& uuid, const LLUUID& parent_uuid,
53 const LLPermissions& permissions,
54 const LLUUID& asset_uuid,
55 LLAssetType::EType type,
56 LLInventoryType::EType inv_type,
57 const LLString& name,
58 const LLString& desc,
59 const LLSaleInfo& sale_info,
60 U32 flags,
61 S32 creation_date_utc);
62
63 // construct a viewer inventory item which has the minimal amount
64 // of information to use in the UI.
65 LLViewerInventoryItem(
66 const LLUUID& item_id,
67 const LLUUID& parent_id,
68 const char* name,
69 LLInventoryType::EType inv_type);
70
71 // construct an invalid and incomplete viewer inventory item.
72 // usually useful for unpacking or importing or what have you.
73 // *NOTE: it is important to call setComplete() if you expect the
74 // operations to provide all necessary information.
75 LLViewerInventoryItem();
76 // Create a copy of an inventory item from a pointer to another item
77 // Note: Because InventoryItems are ref counted,
78 // reference copy (a = b) is prohibited
79 LLViewerInventoryItem(const LLViewerInventoryItem* other);
80 LLViewerInventoryItem(const LLInventoryItem* other);
81
82 virtual void copy(const LLViewerInventoryItem* other);
83 virtual void copy(const LLInventoryItem* other);
84
85 // construct a new clone of this item - it creates a new viewer
86 // inventory item using the copy constructor, and returns it.
87 // It is up to the caller to delete (unref) the item.
88 virtual void clone(LLPointer<LLViewerInventoryItem>& newitem) const;
89
90 // virtual methods
91 virtual void removeFromServer( void );
92 virtual void updateParentOnServer(BOOL restamp) const;
93 virtual void updateServer(BOOL is_new) const;
94 void fetchFromServer(void) const;
95
96 //virtual void packMessage(LLMessageSystem* msg) const;
97 virtual BOOL unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0);
98 virtual BOOL importFile(FILE* fp);
99 virtual BOOL importLegacyStream(std::istream& input_stream);
100
101 // file handling on the viewer. These are not meant for anything
102 // other than cacheing.
103 bool exportFileLocal(FILE* fp) const;
104 bool importFileLocal(FILE* fp);
105
106 // new methods
107 BOOL isComplete() const { return mIsComplete; }
108 void setComplete(BOOL complete) { mIsComplete = complete; }
109 //void updateAssetOnServer() const;
110
111 virtual void packMessage(LLMessageSystem* msg) const;
112 virtual void setTransactionID(const LLTransactionID& transaction_id);
113 struct comparePointers
114 {
115 bool operator()(const LLPointer<LLViewerInventoryItem>& a, const LLPointer<LLViewerInventoryItem>& b)
116 {
117 return a->getName().compare(b->getName()) < 0;
118 }
119 };
120 LLTransactionID getTransactionID() const { return mTransactionID; }
121
122protected:
123 BOOL mIsComplete;
124 LLTransactionID mTransactionID;
125};
126
127
128//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
129// Class LLViewerInventoryCategory
130//
131// An instance of this class represents a category of inventory
132// items. Users come with a set of default categories, and can create
133// new ones as needed.
134//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
135
136class LLViewerInventoryCategory : public LLInventoryCategory
137{
138public:
139 typedef LLDynamicArray<LLPointer<LLViewerInventoryCategory> > cat_array_t;
140
141protected:
142 ~LLViewerInventoryCategory();
143
144public:
145 LLViewerInventoryCategory(const LLUUID& uuid, const LLUUID& parent_uuid,
146 LLAssetType::EType preferred_type,
147 const LLString& name,
148 const LLUUID& owner_id);
149 LLViewerInventoryCategory(const LLUUID& owner_id);
150 // Create a copy of an inventory category from a pointer to another category
151 // Note: Because InventoryCategorys are ref counted, reference copy (a = b)
152 // is prohibited
153 LLViewerInventoryCategory(const LLViewerInventoryCategory* other);
154 virtual void copy(const LLViewerInventoryCategory* other);
155
156 virtual void removeFromServer();
157 virtual void updateParentOnServer(BOOL restamp_children) const;
158 virtual void updateServer(BOOL is_new) const;
159 //virtual BOOL unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0);
160
161 const LLUUID& getOwnerID() const { return mOwnerID; }
162
163 // Version handling
164 enum { VERSION_UNKNOWN = -1, VERSION_INITIAL = 1 };
165 S32 getVersion() const { return mVersion; }
166 void setVersion(S32 version) { mVersion = version; }
167
168 // Returns true if a fetch was issued.
169 bool fetchDescendents();
170
171 // used to help make cacheing more robust - for example, if
172 // someone is getting 4 packets but logs out after 3. the viewer
173 // may never know the cache is wrong.
174 enum { DESCENDENT_COUNT_UNKNOWN = -1 };
175 S32 getDescendentCount() const { return mDescendentCount; }
176 void setDescendentCount(S32 descendents) { mDescendentCount = descendents; }
177
178 // file handling on the viewer. These are not meant for anything
179 // other than cacheing.
180 bool exportFileLocal(FILE* fp) const;
181 bool importFileLocal(FILE* fp);
182
183protected:
184 LLUUID mOwnerID;
185 S32 mVersion;
186 S32 mDescendentCount;
187 LLFrameTimer mDescendentsRequested;
188};
189
190class LLInventoryCallback : public LLRefCount
191{
192public:
193 virtual ~LLInventoryCallback() {}
194 virtual void fire(const LLUUID& inv_item) = 0;
195};
196
197class WearOnAvatarCallback : public LLInventoryCallback
198{
199 void fire(const LLUUID& inv_item);
200};
201
202class LLViewerJointAttachment;
203
204class RezAttachmentCallback : public LLInventoryCallback
205{
206public:
207 RezAttachmentCallback(LLViewerJointAttachment *attachmentp);
208 ~RezAttachmentCallback();
209 void fire(const LLUUID& inv_item);
210private:
211 LLViewerJointAttachment* mAttach;
212};
213
214class ActivateGestureCallback : public LLInventoryCallback
215{
216public:
217 void fire(const LLUUID& inv_item);
218};
219
220// misc functions
221//void inventory_reliable_callback(void**, S32 status);
222
223class LLInventoryCallbackManager
224{
225public:
226 LLInventoryCallbackManager();
227 ~LLInventoryCallbackManager();
228
229 void fire(U32 callback_id, const LLUUID& item_id);
230 U32 registerCB(LLPointer<LLInventoryCallback> cb);
231private:
232 std::map<U32, LLPointer<LLInventoryCallback> > mMap;
233 U32 mLastCallback;
234};
235extern LLInventoryCallbackManager gInventoryCallbacks;
236
237
238#define NOT_WEARABLE (EWearableType)0
239
240void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id,
241 const LLUUID& parent, const LLTransactionID& transaction_id,
242 const std::string& name,
243 const std::string& desc, LLAssetType::EType asset_type,
244 LLInventoryType::EType inv_type, EWearableType wtype,
245 U32 next_owner_perm,
246 LLPointer<LLInventoryCallback> cb);
247
248/**
249 * @brief Securely create a new inventory item by copying from another.
250 */
251void copy_inventory_item(
252 const LLUUID& agent_id,
253 const LLUUID& current_owner,
254 const LLUUID& item_id,
255 const LLUUID& parent_id,
256 const std::string& new_name,
257 LLPointer<LLInventoryCallback> cb);
258
259void move_inventory_item(
260 const LLUUID& agent_id,
261 const LLUUID& session_id,
262 const LLUUID& item_id,
263 const LLUUID& parent_id,
264 const std::string& new_name,
265 LLPointer<LLInventoryCallback> cb);
266
267void copy_inventory_from_notecard(const LLUUID& object_id,
268 const LLUUID& notecard_inv_id,
269 const LLInventoryItem *src);
270
271
272#endif // LL_LLVIEWERINVENTORY_H