aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llinventory
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llinventory')
-rw-r--r--linden/indra/llinventory/files.lst1
-rw-r--r--linden/indra/llinventory/lleconomy.cpp2
-rw-r--r--linden/indra/llinventory/lleconomy.h2
-rw-r--r--linden/indra/llinventory/llinventory.cpp225
-rw-r--r--linden/indra/llinventory/llinventory.h58
-rw-r--r--linden/indra/llinventory/llinventory.vcproj9
-rw-r--r--linden/indra/llinventory/llinventorytype.cpp222
-rw-r--r--linden/indra/llinventory/llinventorytype.h94
-rw-r--r--linden/indra/llinventory/llparcel.cpp20
-rw-r--r--linden/indra/llinventory/llparcel.h10
-rw-r--r--linden/indra/llinventory/llpermissions.cpp8
11 files changed, 358 insertions, 293 deletions
diff --git a/linden/indra/llinventory/files.lst b/linden/indra/llinventory/files.lst
index c96cd03..b918b06 100644
--- a/linden/indra/llinventory/files.lst
+++ b/linden/indra/llinventory/files.lst
@@ -1,6 +1,7 @@
1llinventory/llcategory.cpp 1llinventory/llcategory.cpp
2llinventory/lleconomy.cpp 2llinventory/lleconomy.cpp
3llinventory/llinventory.cpp 3llinventory/llinventory.cpp
4llinventory/llinventorytype.cpp
4llinventory/lllandmark.cpp 5llinventory/lllandmark.cpp
5llinventory/llnotecard.cpp 6llinventory/llnotecard.cpp
6llinventory/llparcel.cpp 7llinventory/llparcel.cpp
diff --git a/linden/indra/llinventory/lleconomy.cpp b/linden/indra/llinventory/lleconomy.cpp
index 837acfe..e3e909b 100644
--- a/linden/indra/llinventory/lleconomy.cpp
+++ b/linden/indra/llinventory/lleconomy.cpp
@@ -32,6 +32,8 @@
32#include "message.h" 32#include "message.h"
33#include "v3math.h" 33#include "v3math.h"
34 34
35LLGlobalEconomy *gGlobalEconomy = NULL;
36
35LLGlobalEconomy::LLGlobalEconomy() 37LLGlobalEconomy::LLGlobalEconomy()
36: mObjectCount( -1 ), 38: mObjectCount( -1 ),
37 mObjectCapacity( -1 ), 39 mObjectCapacity( -1 ),
diff --git a/linden/indra/llinventory/lleconomy.h b/linden/indra/llinventory/lleconomy.h
index b381663..acda67e 100644
--- a/linden/indra/llinventory/lleconomy.h
+++ b/linden/indra/llinventory/lleconomy.h
@@ -133,4 +133,6 @@ private:
133 133
134}; 134};
135 135
136extern LLGlobalEconomy* gGlobalEconomy;
137
136#endif 138#endif
diff --git a/linden/indra/llinventory/llinventory.cpp b/linden/indra/llinventory/llinventory.cpp
index 85fc47f..93c480e 100644
--- a/linden/indra/llinventory/llinventory.cpp
+++ b/linden/indra/llinventory/llinventory.cpp
@@ -40,8 +40,6 @@
40 40
41#include "llsdutil.h" 41#include "llsdutil.h"
42 42
43#include "llsdutil.h"
44
45///---------------------------------------------------------------------------- 43///----------------------------------------------------------------------------
46/// exported functions 44/// exported functions
47///---------------------------------------------------------------------------- 45///----------------------------------------------------------------------------
@@ -67,187 +65,8 @@ static const std::string INV_CREATION_DATE_LABEL("created_at");
67const U8 TASK_INVENTORY_ITEM_KEY = 0; 65const U8 TASK_INVENTORY_ITEM_KEY = 0;
68const U8 TASK_INVENTORY_ASSET_KEY = 1; 66const U8 TASK_INVENTORY_ASSET_KEY = 1;
69 67
70const LLUUID MAGIC_ID("3c115e51-04f4-523c-9fa6-98aff1034730"); 68const LLUUID MAGIC_ID("3c115e51-04f4-523c-9fa6-98aff1034730");
71
72// helper function which returns true if inventory type and asset type
73// are potentially compatible. For example, an attachment must be an
74// object, but a wearable can be a bodypart or clothing asset.
75bool inventory_and_asset_types_match(
76 LLInventoryType::EType inventory_type,
77 LLAssetType::EType asset_type);
78
79 69
80///----------------------------------------------------------------------------
81/// Class LLInventoryType
82///----------------------------------------------------------------------------
83
84// Unlike asset type names, not limited to 8 characters.
85// Need not match asset type names.
86static const char* INVENTORY_TYPE_NAMES[LLInventoryType::IT_COUNT] =
87{
88 "texture", // 0
89 "sound",
90 "callcard",
91 "landmark",
92 NULL,
93 NULL, // 5
94 "object",
95 "notecard",
96 "category",
97 "root",
98 "script", // 10
99 NULL,
100 NULL,
101 NULL,
102 NULL,
103 "snapshot", // 15
104 NULL,
105 "attach",
106 "wearable",
107 "animation",
108 "gesture", // 20
109};
110
111// This table is meant for decoding to human readable form. Put any
112// and as many printable characters you want in each one.
113// See also LLAssetType::mAssetTypeHumanNames
114static const char* INVENTORY_TYPE_HUMAN_NAMES[LLInventoryType::IT_COUNT] =
115{
116 "texture", // 0
117 "sound",
118 "calling card",
119 "landmark",
120 NULL,
121 NULL, // 5
122 "object",
123 "note card",
124 "folder",
125 "root",
126 "script", // 10
127 NULL,
128 NULL,
129 NULL,
130 NULL,
131 "snapshot", // 15
132 NULL,
133 "attachment",
134 "wearable",
135 "animation",
136 "gesture", // 20
137};
138
139// Maps asset types to the default inventory type for that kind of asset.
140// Thus, "Lost and Found" is a "Category"
141static const LLInventoryType::EType
142DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] =
143{
144 LLInventoryType::IT_TEXTURE, // AT_TEXTURE
145 LLInventoryType::IT_SOUND, // AT_SOUND
146 LLInventoryType::IT_CALLINGCARD, // AT_CALLINGCARD
147 LLInventoryType::IT_LANDMARK, // AT_LANDMARK
148 LLInventoryType::IT_LSL, // AT_SCRIPT
149 LLInventoryType::IT_WEARABLE, // AT_CLOTHING
150 LLInventoryType::IT_OBJECT, // AT_OBJECT
151 LLInventoryType::IT_NOTECARD, // AT_NOTECARD
152 LLInventoryType::IT_CATEGORY, // AT_CATEGORY
153 LLInventoryType::IT_ROOT_CATEGORY, // AT_ROOT_CATEGORY
154 LLInventoryType::IT_LSL, // AT_LSL_TEXT
155 LLInventoryType::IT_LSL, // AT_LSL_BYTECODE
156 LLInventoryType::IT_TEXTURE, // AT_TEXTURE_TGA
157 LLInventoryType::IT_WEARABLE, // AT_BODYPART
158 LLInventoryType::IT_CATEGORY, // AT_TRASH
159 LLInventoryType::IT_CATEGORY, // AT_SNAPSHOT_CATEGORY
160 LLInventoryType::IT_CATEGORY, // AT_LOST_AND_FOUND
161 LLInventoryType::IT_SOUND, // AT_SOUND_WAV
162 LLInventoryType::IT_NONE, // AT_IMAGE_TGA
163 LLInventoryType::IT_NONE, // AT_IMAGE_JPEG
164 LLInventoryType::IT_ANIMATION, // AT_ANIMATION
165 LLInventoryType::IT_GESTURE, // AT_GESTURE
166};
167
168static const int MAX_POSSIBLE_ASSET_TYPES = 2;
169static const LLAssetType::EType
170INVENTORY_TO_ASSET_TYPE[LLInventoryType::IT_COUNT][MAX_POSSIBLE_ASSET_TYPES] =
171{
172 { LLAssetType::AT_TEXTURE, LLAssetType::AT_NONE }, // IT_TEXTURE
173 { LLAssetType::AT_SOUND, LLAssetType::AT_NONE }, // IT_SOUND
174 { LLAssetType::AT_CALLINGCARD, LLAssetType::AT_NONE }, // IT_CALLINGCARD
175 { LLAssetType::AT_LANDMARK, LLAssetType::AT_NONE }, // IT_LANDMARK
176 { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
177 { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
178 { LLAssetType::AT_OBJECT, LLAssetType::AT_NONE }, // IT_OBJECT
179 { LLAssetType::AT_NOTECARD, LLAssetType::AT_NONE }, // IT_NOTECARD
180 { LLAssetType::AT_NONE, LLAssetType::AT_NONE }, // IT_CATEGORY
181 { LLAssetType::AT_NONE, LLAssetType::AT_NONE }, // IT_ROOT_CATEGORY
182 { LLAssetType::AT_LSL_TEXT, LLAssetType::AT_LSL_BYTECODE }, // IT_LSL
183 { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
184 { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
185 { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
186 { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
187 { LLAssetType::AT_TEXTURE, LLAssetType::AT_NONE }, // IT_SNAPSHOT
188 { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
189 { LLAssetType::AT_OBJECT, LLAssetType::AT_NONE }, // IT_ATTACHMENT
190 { LLAssetType::AT_CLOTHING, LLAssetType::AT_BODYPART }, // IT_WEARABLE
191 { LLAssetType::AT_ANIMATION, LLAssetType::AT_NONE }, // IT_ANIMATION
192 { LLAssetType::AT_GESTURE, LLAssetType::AT_NONE }, // IT_GESTURE
193};
194
195// static
196const char* LLInventoryType::lookup(EType type)
197{
198 if((type >= 0) && (type < IT_COUNT))
199 {
200 return INVENTORY_TYPE_NAMES[S32(type)];
201 }
202 else
203 {
204 return NULL;
205 }
206}
207
208// static
209LLInventoryType::EType LLInventoryType::lookup(const char* name)
210{
211 for(S32 i = 0; i < IT_COUNT; ++i)
212 {
213 if((INVENTORY_TYPE_NAMES[i])
214 && (0 == strcmp(name, INVENTORY_TYPE_NAMES[i])))
215 {
216 // match
217 return (EType)i;
218 }
219 }
220 return IT_NONE;
221}
222
223// XUI:translate
224// translation from a type to a human readable form.
225// static
226const char* LLInventoryType::lookupHumanReadable(EType type)
227{
228 if((type >= 0) && (type < IT_COUNT))
229 {
230 return INVENTORY_TYPE_HUMAN_NAMES[S32(type)];
231 }
232 else
233 {
234 return NULL;
235 }
236}
237
238// return the default inventory for the given asset type.
239// static
240LLInventoryType::EType LLInventoryType::defaultForAssetType(LLAssetType::EType asset_type)
241{
242 if((asset_type >= 0) && (asset_type < LLAssetType::AT_COUNT))
243 {
244 return DEFAULT_ASSET_FOR_INV_TYPE[S32(asset_type)];
245 }
246 else
247 {
248 return IT_NONE;
249 }
250}
251 70
252///---------------------------------------------------------------------------- 71///----------------------------------------------------------------------------
253/// Class LLInventoryObject 72/// Class LLInventoryObject
@@ -351,10 +170,6 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream)
351 { 170 {
352 input_stream.getline(buffer, MAX_STRING); 171 input_stream.getline(buffer, MAX_STRING);
353 sscanf(buffer, " %254s %254s", keyword, valuestr); /* Flawfinder: ignore */ 172 sscanf(buffer, " %254s %254s", keyword, valuestr); /* Flawfinder: ignore */
354 if(!keyword)
355 {
356 continue;
357 }
358 if(0 == strcmp("{",keyword)) 173 if(0 == strcmp("{",keyword))
359 { 174 {
360 continue; 175 continue;
@@ -722,10 +537,6 @@ BOOL LLInventoryItem::importFile(FILE* fp)
722 { 537 {
723 fgets(buffer, MAX_STRING, fp); 538 fgets(buffer, MAX_STRING, fp);
724 sscanf(buffer, " %254s %254s", keyword, valuestr); /* Flawfinder: ignore */ 539 sscanf(buffer, " %254s %254s", keyword, valuestr); /* Flawfinder: ignore */
725 if(!keyword)
726 {
727 continue;
728 }
729 if(0 == strcmp("{",keyword)) 540 if(0 == strcmp("{",keyword))
730 { 541 {
731 continue; 542 continue;
@@ -927,10 +738,6 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
927 buffer, 738 buffer,
928 " %254s %254s", 739 " %254s %254s",
929 keyword, valuestr); 740 keyword, valuestr);
930 if(!keyword)
931 {
932 continue;
933 }
934 if(0 == strcmp("{",keyword)) 741 if(0 == strcmp("{",keyword))
935 { 742 {
936 continue; 743 continue;
@@ -1419,7 +1226,8 @@ void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size)
1419 } 1226 }
1420 else 1227 else
1421 { 1228 {
1422 llerrs << "unpackBinaryBucket failed. item_buffer or bin_bucket is Null." << llendl; 1229 llerrs << "unpackBinaryBucket failed. item_buffer or bin_bucket is Null." << llendl;
1230 delete[] item_buffer;
1423 return; 1231 return;
1424 } 1232 }
1425 item_buffer[bin_bucket_size] = '\0'; 1233 item_buffer[bin_bucket_size] = '\0';
@@ -1588,10 +1396,6 @@ BOOL LLInventoryCategory::importFile(FILE* fp)
1588 buffer, 1396 buffer,
1589 " %254s %254s", 1397 " %254s %254s",
1590 keyword, valuestr); 1398 keyword, valuestr);
1591 if(!keyword)
1592 {
1593 continue;
1594 }
1595 if(0 == strcmp("{",keyword)) 1399 if(0 == strcmp("{",keyword))
1596 { 1400 {
1597 continue; 1401 continue;
@@ -1671,10 +1475,6 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream)
1671 buffer, 1475 buffer,
1672 " %254s %254s", 1476 " %254s %254s",
1673 keyword, valuestr); 1477 keyword, valuestr);
1674 if(!keyword)
1675 {
1676 continue;
1677 }
1678 if(0 == strcmp("{",keyword)) 1478 if(0 == strcmp("{",keyword))
1679 { 1479 {
1680 continue; 1480 continue;
@@ -1739,25 +1539,6 @@ BOOL LLInventoryCategory::exportLegacyStream(std::ostream& output_stream, BOOL)
1739/// Local function definitions 1539/// Local function definitions
1740///---------------------------------------------------------------------------- 1540///----------------------------------------------------------------------------
1741 1541
1742bool inventory_and_asset_types_match(
1743 LLInventoryType::EType inventory_type,
1744 LLAssetType::EType asset_type)
1745{
1746 bool rv = false;
1747 if((inventory_type >= 0) && (inventory_type < LLInventoryType::IT_COUNT))
1748 {
1749 for(S32 i = 0; i < MAX_POSSIBLE_ASSET_TYPES; ++i)
1750 {
1751 if(INVENTORY_TO_ASSET_TYPE[inventory_type][i] == asset_type)
1752 {
1753 rv = true;
1754 break;
1755 }
1756 }
1757 }
1758 return rv;
1759}
1760
1761LLSD ll_create_sd_from_inventory_item(LLPointer<LLInventoryItem> item) 1542LLSD ll_create_sd_from_inventory_item(LLPointer<LLInventoryItem> item)
1762{ 1543{
1763 LLSD rv; 1544 LLSD rv;
diff --git a/linden/indra/llinventory/llinventory.h b/linden/indra/llinventory/llinventory.h
index 6e64412..b24fe79 100644
--- a/linden/indra/llinventory/llinventory.h
+++ b/linden/indra/llinventory/llinventory.h
@@ -33,6 +33,7 @@
33 33
34#include "llassetstorage.h" 34#include "llassetstorage.h"
35#include "lldarray.h" 35#include "lldarray.h"
36#include "llinventorytype.h"
36#include "llmemtype.h" 37#include "llmemtype.h"
37#include "llpermissions.h" 38#include "llpermissions.h"
38#include "llsaleinfo.h" 39#include "llsaleinfo.h"
@@ -51,63 +52,6 @@ enum
51 MAX_INVENTORY_BUFFER_SIZE = 1024 52 MAX_INVENTORY_BUFFER_SIZE = 1024
52}; 53};
53 54
54//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55// Class LLInventoryType
56//
57// Class used to encapsulate operations around inventory type.
58//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59
60class LLInventoryType
61{
62public:
63 enum EType
64 {
65 IT_TEXTURE = 0,
66 IT_SOUND = 1,
67 IT_CALLINGCARD = 2,
68 IT_LANDMARK = 3,
69 //IT_SCRIPT = 4,
70 //IT_CLOTHING = 5,
71 IT_OBJECT = 6,
72 IT_NOTECARD = 7,
73 IT_CATEGORY = 8,
74 IT_ROOT_CATEGORY = 9,
75 IT_LSL = 10,
76 //IT_LSL_BYTECODE = 11,
77 //IT_TEXTURE_TGA = 12,
78 //IT_BODYPART = 13,
79 //IT_TRASH = 14,
80 IT_SNAPSHOT = 15,
81 //IT_LOST_AND_FOUND = 16,
82 IT_ATTACHMENT = 17,
83 IT_WEARABLE = 18,
84 IT_ANIMATION = 19,
85 IT_GESTURE = 20,
86 IT_COUNT = 21,
87
88 IT_NONE = -1
89 };
90
91 // machine transation between type and strings
92 static EType lookup(const char* name);
93 static const char* lookup(EType type);
94
95 // translation from a type to a human readable form.
96 static const char* lookupHumanReadable(EType type);
97
98 // return the default inventory for the given asset type.
99 static EType defaultForAssetType(LLAssetType::EType asset_type);
100
101private:
102 // don't instantiate or derive one of these objects
103 LLInventoryType( void ) {}
104 ~LLInventoryType( void ) {}
105
106//private:
107// static const char* mInventoryTypeNames[];
108// static const char* mInventoryTypeHumanNames[];
109// static LLInventoryType::EType mInventoryAssetType[];
110};
111 55
112 56
113//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 57//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/linden/indra/llinventory/llinventory.vcproj b/linden/indra/llinventory/llinventory.vcproj
index 1c76808..66c580e 100644
--- a/linden/indra/llinventory/llinventory.vcproj
+++ b/linden/indra/llinventory/llinventory.vcproj
@@ -158,6 +158,9 @@
158 RelativePath=".\llinventory.cpp"> 158 RelativePath=".\llinventory.cpp">
159 </File> 159 </File>
160 <File 160 <File
161 RelativePath=".\llinventorytype.cpp">
162 </File>
163 <File
161 RelativePath=".\lllandmark.cpp"> 164 RelativePath=".\lllandmark.cpp">
162 </File> 165 </File>
163 <File 166 <File
@@ -193,6 +196,9 @@
193 RelativePath=".\llinventory.h"> 196 RelativePath=".\llinventory.h">
194 </File> 197 </File>
195 <File 198 <File
199 RelativePath=".\llinventorytype.h">
200 </File>
201 <File
196 RelativePath=".\lllandmark.h"> 202 RelativePath=".\lllandmark.h">
197 </File> 203 </File>
198 <File 204 <File
@@ -228,6 +234,9 @@
228 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" 234 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
229 UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> 235 UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
230 </Filter> 236 </Filter>
237 <File
238 RelativePath=".\files.lst">
239 </File>
231 </Files> 240 </Files>
232 <Globals> 241 <Globals>
233 </Globals> 242 </Globals>
diff --git a/linden/indra/llinventory/llinventorytype.cpp b/linden/indra/llinventory/llinventorytype.cpp
new file mode 100644
index 0000000..96dfb5e
--- /dev/null
+++ b/linden/indra/llinventory/llinventorytype.cpp
@@ -0,0 +1,222 @@
1/**
2 * @file llinventorytype.cpp
3 * @brief Inventory item type, more specific than an asset type.
4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 *
7 * Second Life Viewer Source Code
8 * The source code in this file ("Source Code") is provided by Linden Lab
9 * to you under the terms of the GNU General Public License, version 2.0
10 * ("GPL"), unless you have obtained a separate licensing agreement
11 * ("Other License"), formally executed by you and Linden Lab. Terms of
12 * the GPL can be found in doc/GPL-license.txt in this distribution, or
13 * online at http://secondlife.com/developers/opensource/gplv2
14 *
15 * There are special exceptions to the terms and conditions of the GPL as
16 * it is applied to this Source Code. View the full text of the exception
17 * in the file doc/FLOSS-exception.txt in this software distribution, or
18 * online at http://secondlife.com/developers/opensource/flossexception
19 *
20 * By copying, modifying or distributing this software, you acknowledge
21 * that you have read and understood your obligations described above,
22 * and agree to abide by those obligations.
23 *
24 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
25 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
26 * COMPLETENESS OR PERFORMANCE.
27 */
28
29#include "linden_common.h"
30
31#include "llinventorytype.h"
32
33///----------------------------------------------------------------------------
34/// Class LLInventoryType
35///----------------------------------------------------------------------------
36
37// Unlike asset type names, not limited to 8 characters.
38// Need not match asset type names.
39static const char* INVENTORY_TYPE_NAMES[LLInventoryType::IT_COUNT] =
40{
41 "texture", // 0
42 "sound",
43 "callcard",
44 "landmark",
45 NULL,
46 NULL, // 5
47 "object",
48 "notecard",
49 "category",
50 "root",
51 "script", // 10
52 NULL,
53 NULL,
54 NULL,
55 NULL,
56 "snapshot", // 15
57 NULL,
58 "attach",
59 "wearable",
60 "animation",
61 "gesture", // 20
62};
63
64// This table is meant for decoding to human readable form. Put any
65// and as many printable characters you want in each one.
66// See also LLAssetType::mAssetTypeHumanNames
67static const char* INVENTORY_TYPE_HUMAN_NAMES[LLInventoryType::IT_COUNT] =
68{
69 "texture", // 0
70 "sound",
71 "calling card",
72 "landmark",
73 NULL,
74 NULL, // 5
75 "object",
76 "note card",
77 "folder",
78 "root",
79 "script", // 10
80 NULL,
81 NULL,
82 NULL,
83 NULL,
84 "snapshot", // 15
85 NULL,
86 "attachment",
87 "wearable",
88 "animation",
89 "gesture", // 20
90};
91
92// Maps asset types to the default inventory type for that kind of asset.
93// Thus, "Lost and Found" is a "Category"
94static const LLInventoryType::EType
95DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] =
96{
97 LLInventoryType::IT_TEXTURE, // AT_TEXTURE
98 LLInventoryType::IT_SOUND, // AT_SOUND
99 LLInventoryType::IT_CALLINGCARD, // AT_CALLINGCARD
100 LLInventoryType::IT_LANDMARK, // AT_LANDMARK
101 LLInventoryType::IT_LSL, // AT_SCRIPT
102 LLInventoryType::IT_WEARABLE, // AT_CLOTHING
103 LLInventoryType::IT_OBJECT, // AT_OBJECT
104 LLInventoryType::IT_NOTECARD, // AT_NOTECARD
105 LLInventoryType::IT_CATEGORY, // AT_CATEGORY
106 LLInventoryType::IT_ROOT_CATEGORY, // AT_ROOT_CATEGORY
107 LLInventoryType::IT_LSL, // AT_LSL_TEXT
108 LLInventoryType::IT_LSL, // AT_LSL_BYTECODE
109 LLInventoryType::IT_TEXTURE, // AT_TEXTURE_TGA
110 LLInventoryType::IT_WEARABLE, // AT_BODYPART
111 LLInventoryType::IT_CATEGORY, // AT_TRASH
112 LLInventoryType::IT_CATEGORY, // AT_SNAPSHOT_CATEGORY
113 LLInventoryType::IT_CATEGORY, // AT_LOST_AND_FOUND
114 LLInventoryType::IT_SOUND, // AT_SOUND_WAV
115 LLInventoryType::IT_NONE, // AT_IMAGE_TGA
116 LLInventoryType::IT_NONE, // AT_IMAGE_JPEG
117 LLInventoryType::IT_ANIMATION, // AT_ANIMATION
118 LLInventoryType::IT_GESTURE, // AT_GESTURE
119};
120
121static const int MAX_POSSIBLE_ASSET_TYPES = 2;
122static const LLAssetType::EType
123INVENTORY_TO_ASSET_TYPE[LLInventoryType::IT_COUNT][MAX_POSSIBLE_ASSET_TYPES] =
124{
125 { LLAssetType::AT_TEXTURE, LLAssetType::AT_NONE }, // IT_TEXTURE
126 { LLAssetType::AT_SOUND, LLAssetType::AT_NONE }, // IT_SOUND
127 { LLAssetType::AT_CALLINGCARD, LLAssetType::AT_NONE }, // IT_CALLINGCARD
128 { LLAssetType::AT_LANDMARK, LLAssetType::AT_NONE }, // IT_LANDMARK
129 { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
130 { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
131 { LLAssetType::AT_OBJECT, LLAssetType::AT_NONE }, // IT_OBJECT
132 { LLAssetType::AT_NOTECARD, LLAssetType::AT_NONE }, // IT_NOTECARD
133 { LLAssetType::AT_NONE, LLAssetType::AT_NONE }, // IT_CATEGORY
134 { LLAssetType::AT_NONE, LLAssetType::AT_NONE }, // IT_ROOT_CATEGORY
135 { LLAssetType::AT_LSL_TEXT, LLAssetType::AT_LSL_BYTECODE }, // IT_LSL
136 { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
137 { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
138 { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
139 { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
140 { LLAssetType::AT_TEXTURE, LLAssetType::AT_NONE }, // IT_SNAPSHOT
141 { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
142 { LLAssetType::AT_OBJECT, LLAssetType::AT_NONE }, // IT_ATTACHMENT
143 { LLAssetType::AT_CLOTHING, LLAssetType::AT_BODYPART }, // IT_WEARABLE
144 { LLAssetType::AT_ANIMATION, LLAssetType::AT_NONE }, // IT_ANIMATION
145 { LLAssetType::AT_GESTURE, LLAssetType::AT_NONE }, // IT_GESTURE
146};
147
148// static
149const char* LLInventoryType::lookup(EType type)
150{
151 if((type >= 0) && (type < IT_COUNT))
152 {
153 return INVENTORY_TYPE_NAMES[S32(type)];
154 }
155 else
156 {
157 return NULL;
158 }
159}
160
161// static
162LLInventoryType::EType LLInventoryType::lookup(const char* name)
163{
164 for(S32 i = 0; i < IT_COUNT; ++i)
165 {
166 if((INVENTORY_TYPE_NAMES[i])
167 && (0 == strcmp(name, INVENTORY_TYPE_NAMES[i])))
168 {
169 // match
170 return (EType)i;
171 }
172 }
173 return IT_NONE;
174}
175
176// XUI:translate
177// translation from a type to a human readable form.
178// static
179const char* LLInventoryType::lookupHumanReadable(EType type)
180{
181 if((type >= 0) && (type < IT_COUNT))
182 {
183 return INVENTORY_TYPE_HUMAN_NAMES[S32(type)];
184 }
185 else
186 {
187 return NULL;
188 }
189}
190
191// return the default inventory for the given asset type.
192// static
193LLInventoryType::EType LLInventoryType::defaultForAssetType(LLAssetType::EType asset_type)
194{
195 if((asset_type >= 0) && (asset_type < LLAssetType::AT_COUNT))
196 {
197 return DEFAULT_ASSET_FOR_INV_TYPE[S32(asset_type)];
198 }
199 else
200 {
201 return IT_NONE;
202 }
203}
204
205bool inventory_and_asset_types_match(
206 LLInventoryType::EType inventory_type,
207 LLAssetType::EType asset_type)
208{
209 bool rv = false;
210 if((inventory_type >= 0) && (inventory_type < LLInventoryType::IT_COUNT))
211 {
212 for(S32 i = 0; i < MAX_POSSIBLE_ASSET_TYPES; ++i)
213 {
214 if(INVENTORY_TO_ASSET_TYPE[inventory_type][i] == asset_type)
215 {
216 rv = true;
217 break;
218 }
219 }
220 }
221 return rv;
222}
diff --git a/linden/indra/llinventory/llinventorytype.h b/linden/indra/llinventory/llinventorytype.h
new file mode 100644
index 0000000..7d34c87
--- /dev/null
+++ b/linden/indra/llinventory/llinventorytype.h
@@ -0,0 +1,94 @@
1/**
2 * @file llinventorytype.h
3 * @brief Inventory item type, more specific than an asset type.
4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 *
7 * Second Life Viewer Source Code
8 * The source code in this file ("Source Code") is provided by Linden Lab
9 * to you under the terms of the GNU General Public License, version 2.0
10 * ("GPL"), unless you have obtained a separate licensing agreement
11 * ("Other License"), formally executed by you and Linden Lab. Terms of
12 * the GPL can be found in doc/GPL-license.txt in this distribution, or
13 * online at http://secondlife.com/developers/opensource/gplv2
14 *
15 * There are special exceptions to the terms and conditions of the GPL as
16 * it is applied to this Source Code. View the full text of the exception
17 * in the file doc/FLOSS-exception.txt in this software distribution, or
18 * online at http://secondlife.com/developers/opensource/flossexception
19 *
20 * By copying, modifying or distributing this software, you acknowledge
21 * that you have read and understood your obligations described above,
22 * and agree to abide by those obligations.
23 *
24 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
25 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
26 * COMPLETENESS OR PERFORMANCE.
27 */
28
29#ifndef LLINVENTORYTYPE_H
30#define LLINVENTORYTYPE_H
31
32#include "llassettype.h"
33
34//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35// Class LLInventoryType
36//
37// Class used to encapsulate operations around inventory type.
38//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
39
40class LLInventoryType
41{
42public:
43 enum EType
44 {
45 IT_TEXTURE = 0,
46 IT_SOUND = 1,
47 IT_CALLINGCARD = 2,
48 IT_LANDMARK = 3,
49 //IT_SCRIPT = 4,
50 //IT_CLOTHING = 5,
51 IT_OBJECT = 6,
52 IT_NOTECARD = 7,
53 IT_CATEGORY = 8,
54 IT_ROOT_CATEGORY = 9,
55 IT_LSL = 10,
56 //IT_LSL_BYTECODE = 11,
57 //IT_TEXTURE_TGA = 12,
58 //IT_BODYPART = 13,
59 //IT_TRASH = 14,
60 IT_SNAPSHOT = 15,
61 //IT_LOST_AND_FOUND = 16,
62 IT_ATTACHMENT = 17,
63 IT_WEARABLE = 18,
64 IT_ANIMATION = 19,
65 IT_GESTURE = 20,
66 IT_COUNT = 21,
67
68 IT_NONE = -1
69 };
70
71 // machine transation between type and strings
72 static EType lookup(const char* name);
73 static const char* lookup(EType type);
74
75 // translation from a type to a human readable form.
76 static const char* lookupHumanReadable(EType type);
77
78 // return the default inventory for the given asset type.
79 static EType defaultForAssetType(LLAssetType::EType asset_type);
80
81private:
82 // don't instantiate or derive one of these objects
83 LLInventoryType( void );
84 ~LLInventoryType( void );
85};
86
87// helper function which returns true if inventory type and asset type
88// are potentially compatible. For example, an attachment must be an
89// object, but a wearable can be a bodypart or clothing asset.
90bool inventory_and_asset_types_match(
91 LLInventoryType::EType inventory_type,
92 LLAssetType::EType asset_type);
93
94#endif
diff --git a/linden/indra/llinventory/llparcel.cpp b/linden/indra/llinventory/llparcel.cpp
index c37a4d6..5b2052f 100644
--- a/linden/indra/llinventory/llparcel.cpp
+++ b/linden/indra/llinventory/llparcel.cpp
@@ -1214,6 +1214,24 @@ BOOL LLParcel::exportStream(std::ostream& output_stream)
1214 return TRUE; 1214 return TRUE;
1215} 1215}
1216 1216
1217// virtual
1218LLSD LLParcel::asLLSD() const
1219{
1220 LLSD p;
1221 p["parcel-id"] = getID();
1222 p["name"] = getName();
1223 p["desc"] = getDesc();
1224 p["owner-id"] = getOwnerID();
1225 p["group-id"] = getGroupID();
1226 p["group-owned"] = (bool)getIsGroupOwned();
1227 p["auction-id"] = (S32)getAuctionID();
1228 p["snapshot-id"] = getSnapshotID();
1229 p["authorized-buyer-id"] = getAuthorizedBuyerID();
1230 p["sale-price"] = getSalePrice();
1231 p["parcel-flags"] = (S32)getParcelFlags();
1232 // NOTE: This list is incomplete, as this is used only for search. JC
1233 return p;
1234}
1217 1235
1218// Assumes we are in a block "ParcelData" 1236// Assumes we are in a block "ParcelData"
1219void LLParcel::packMessage(LLMessageSystem* msg) 1237void LLParcel::packMessage(LLMessageSystem* msg)
@@ -1786,7 +1804,7 @@ const char* category_to_ui_string(LLParcel::ECategory category)
1786 else 1804 else
1787 { 1805 {
1788 // C_ANY = -1 , but the "Any" string is at the end of the list 1806 // C_ANY = -1 , but the "Any" string is at the end of the list
1789 index = ((S32) LLParcel::C_COUNT) + 1; 1807 index = ((S32) LLParcel::C_COUNT);
1790 } 1808 }
1791 return PARCEL_CATEGORY_UI_STRING[index]; 1809 return PARCEL_CATEGORY_UI_STRING[index];
1792} 1810}
diff --git a/linden/indra/llinventory/llparcel.h b/linden/indra/llinventory/llparcel.h
index 29e393a..cc20182 100644
--- a/linden/indra/llinventory/llparcel.h
+++ b/linden/indra/llinventory/llparcel.h
@@ -246,6 +246,7 @@ public:
246 BOOL importStream(std::istream& input_stream); 246 BOOL importStream(std::istream& input_stream);
247 BOOL importAccessEntry(std::istream& input_stream, LLAccessEntry* entry); 247 BOOL importAccessEntry(std::istream& input_stream, LLAccessEntry* entry);
248 BOOL exportStream(std::ostream& output_stream); 248 BOOL exportStream(std::ostream& output_stream);
249 virtual LLSD asLLSD() const;
249 250
250 void packMessage(LLMessageSystem* msg); 251 void packMessage(LLMessageSystem* msg);
251 void unpackMessage(LLMessageSystem* msg); 252 void unpackMessage(LLMessageSystem* msg);
@@ -274,7 +275,7 @@ public:
274 BOOL removeFromBanList(const LLUUID& agent_id); 275 BOOL removeFromBanList(const LLUUID& agent_id);
275 276
276 // ACCESSORS 277 // ACCESSORS
277 const LLUUID& getID() { return mID; } 278 const LLUUID& getID() const { return mID; }
278 const char* getName() const { return mName.c_str(); } 279 const char* getName() const { return mName.c_str(); }
279 const char* getDesc() const { return mDesc.c_str(); } 280 const char* getDesc() const { return mDesc.c_str(); }
280 const char* getMusicURL() const { return mMusicURL.c_str(); } 281 const char* getMusicURL() const { return mMusicURL.c_str(); }
@@ -283,14 +284,13 @@ public:
283 const U8 getMediaAutoScale() const { return mMediaAutoScale; } 284 const U8 getMediaAutoScale() const { return mMediaAutoScale; }
284 S32 getLocalID() const { return mLocalID; } 285 S32 getLocalID() const { return mLocalID; }
285 const LLUUID& getOwnerID() const { return mOwnerID; } 286 const LLUUID& getOwnerID() const { return mOwnerID; }
286 const LLUUID& getGroupID() const { return mGroupID; } 287 const LLUUID& getGroupID() const { return mGroupID; }
287 //const char* getGroupName() const { return mGroupName.c_str(); }
288 S32 getPassPrice() const { return mPassPrice; } 288 S32 getPassPrice() const { return mPassPrice; }
289 F32 getPassHours() const { return mPassHours; } 289 F32 getPassHours() const { return mPassHours; }
290 BOOL getIsGroupOwned() const { return mGroupOwned; } 290 BOOL getIsGroupOwned() const { return mGroupOwned; }
291 291
292 U32 getAuctionID() { return mAuctionID; } 292 U32 getAuctionID() const { return mAuctionID; }
293 bool isInEscrow() const { return mInEscrow; } 293 bool isInEscrow() const { return mInEscrow; }
294 294
295 BOOL isPublic() const; 295 BOOL isPublic() const;
296 296
diff --git a/linden/indra/llinventory/llpermissions.cpp b/linden/indra/llinventory/llpermissions.cpp
index 86ab57c..ae4360a 100644
--- a/linden/indra/llinventory/llpermissions.cpp
+++ b/linden/indra/llinventory/llpermissions.cpp
@@ -531,10 +531,6 @@ BOOL LLPermissions::importFile(FILE* fp)
531 buffer, 531 buffer,
532 " %255s %255s", 532 " %255s %255s",
533 keyword, valuestr); 533 keyword, valuestr);
534 if (!keyword)
535 {
536 continue;
537 }
538 if (!strcmp("{", keyword)) 534 if (!strcmp("{", keyword))
539 { 535 {
540 continue; 536 continue;
@@ -669,10 +665,6 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream)
669 buffer, 665 buffer,
670 " %255s %255s", 666 " %255s %255s",
671 keyword, valuestr); 667 keyword, valuestr);
672 if (!keyword)
673 {
674 continue;
675 }
676 if (!strcmp("{", keyword)) 668 if (!strcmp("{", keyword))
677 { 669 {
678 continue; 670 continue;