summaryrefslogtreecommitdiff
path: root/indra/llinventory
diff options
context:
space:
mode:
authorDon Kjer <don@lindenlab.com>2007-05-02 21:24:47 +0000
committerDon Kjer <don@lindenlab.com>2007-05-02 21:24:47 +0000
commit1c909afe3998778e4cc045c9ab733e8afbf7c25b (patch)
tree75c00a32a8e305280cbec253195d1113d628fc3e /indra/llinventory
parentbc59c04653bf1404e8148a8169208b146a123b28 (diff)
svn merge -r 60342:61148 svn+ssh://svn/svn/linden/branches/maintenance into release
Diffstat (limited to 'indra/llinventory')
-rw-r--r--indra/llinventory/lleconomy.cpp2
-rw-r--r--indra/llinventory/lleconomy.h2
-rw-r--r--indra/llinventory/llinventory.cpp225
-rw-r--r--indra/llinventory/llinventory.h58
-rw-r--r--indra/llinventory/llinventorytype.cpp202
-rw-r--r--indra/llinventory/llinventorytype.h74
-rw-r--r--indra/llinventory/llparcel.cpp20
-rw-r--r--indra/llinventory/llparcel.h10
-rw-r--r--indra/llinventory/llpermissions.cpp8
9 files changed, 308 insertions, 293 deletions
diff --git a/indra/llinventory/lleconomy.cpp b/indra/llinventory/lleconomy.cpp
index f7442380b0..90d7103065 100644
--- a/indra/llinventory/lleconomy.cpp
+++ b/indra/llinventory/lleconomy.cpp
@@ -12,6 +12,8 @@
#include "message.h"
#include "v3math.h"
+LLGlobalEconomy *gGlobalEconomy = NULL;
+
LLGlobalEconomy::LLGlobalEconomy()
: mObjectCount( -1 ),
mObjectCapacity( -1 ),
diff --git a/indra/llinventory/lleconomy.h b/indra/llinventory/lleconomy.h
index c71fc9e6d0..354815cde5 100644
--- a/indra/llinventory/lleconomy.h
+++ b/indra/llinventory/lleconomy.h
@@ -113,4 +113,6 @@ private:
};
+extern LLGlobalEconomy* gGlobalEconomy;
+
#endif
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp
index 6164dae22f..36b7ab0680 100644
--- a/indra/llinventory/llinventory.cpp
+++ b/indra/llinventory/llinventory.cpp
@@ -20,8 +20,6 @@
#include "llsdutil.h"
-#include "llsdutil.h"
-
///----------------------------------------------------------------------------
/// exported functions
///----------------------------------------------------------------------------
@@ -47,187 +45,8 @@ static const std::string INV_CREATION_DATE_LABEL("created_at");
const U8 TASK_INVENTORY_ITEM_KEY = 0;
const U8 TASK_INVENTORY_ASSET_KEY = 1;
-const LLUUID MAGIC_ID("3c115e51-04f4-523c-9fa6-98aff1034730");
-
-// helper function which returns true if inventory type and asset type
-// are potentially compatible. For example, an attachment must be an
-// object, but a wearable can be a bodypart or clothing asset.
-bool inventory_and_asset_types_match(
- LLInventoryType::EType inventory_type,
- LLAssetType::EType asset_type);
-
+const LLUUID MAGIC_ID("3c115e51-04f4-523c-9fa6-98aff1034730");
-///----------------------------------------------------------------------------
-/// Class LLInventoryType
-///----------------------------------------------------------------------------
-
-// Unlike asset type names, not limited to 8 characters.
-// Need not match asset type names.
-static const char* INVENTORY_TYPE_NAMES[LLInventoryType::IT_COUNT] =
-{
- "texture", // 0
- "sound",
- "callcard",
- "landmark",
- NULL,
- NULL, // 5
- "object",
- "notecard",
- "category",
- "root",
- "script", // 10
- NULL,
- NULL,
- NULL,
- NULL,
- "snapshot", // 15
- NULL,
- "attach",
- "wearable",
- "animation",
- "gesture", // 20
-};
-
-// This table is meant for decoding to human readable form. Put any
-// and as many printable characters you want in each one.
-// See also LLAssetType::mAssetTypeHumanNames
-static const char* INVENTORY_TYPE_HUMAN_NAMES[LLInventoryType::IT_COUNT] =
-{
- "texture", // 0
- "sound",
- "calling card",
- "landmark",
- NULL,
- NULL, // 5
- "object",
- "note card",
- "folder",
- "root",
- "script", // 10
- NULL,
- NULL,
- NULL,
- NULL,
- "snapshot", // 15
- NULL,
- "attachment",
- "wearable",
- "animation",
- "gesture", // 20
-};
-
-// Maps asset types to the default inventory type for that kind of asset.
-// Thus, "Lost and Found" is a "Category"
-static const LLInventoryType::EType
-DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] =
-{
- LLInventoryType::IT_TEXTURE, // AT_TEXTURE
- LLInventoryType::IT_SOUND, // AT_SOUND
- LLInventoryType::IT_CALLINGCARD, // AT_CALLINGCARD
- LLInventoryType::IT_LANDMARK, // AT_LANDMARK
- LLInventoryType::IT_LSL, // AT_SCRIPT
- LLInventoryType::IT_WEARABLE, // AT_CLOTHING
- LLInventoryType::IT_OBJECT, // AT_OBJECT
- LLInventoryType::IT_NOTECARD, // AT_NOTECARD
- LLInventoryType::IT_CATEGORY, // AT_CATEGORY
- LLInventoryType::IT_ROOT_CATEGORY, // AT_ROOT_CATEGORY
- LLInventoryType::IT_LSL, // AT_LSL_TEXT
- LLInventoryType::IT_LSL, // AT_LSL_BYTECODE
- LLInventoryType::IT_TEXTURE, // AT_TEXTURE_TGA
- LLInventoryType::IT_WEARABLE, // AT_BODYPART
- LLInventoryType::IT_CATEGORY, // AT_TRASH
- LLInventoryType::IT_CATEGORY, // AT_SNAPSHOT_CATEGORY
- LLInventoryType::IT_CATEGORY, // AT_LOST_AND_FOUND
- LLInventoryType::IT_SOUND, // AT_SOUND_WAV
- LLInventoryType::IT_NONE, // AT_IMAGE_TGA
- LLInventoryType::IT_NONE, // AT_IMAGE_JPEG
- LLInventoryType::IT_ANIMATION, // AT_ANIMATION
- LLInventoryType::IT_GESTURE, // AT_GESTURE
-};
-
-static const int MAX_POSSIBLE_ASSET_TYPES = 2;
-static const LLAssetType::EType
-INVENTORY_TO_ASSET_TYPE[LLInventoryType::IT_COUNT][MAX_POSSIBLE_ASSET_TYPES] =
-{
- { LLAssetType::AT_TEXTURE, LLAssetType::AT_NONE }, // IT_TEXTURE
- { LLAssetType::AT_SOUND, LLAssetType::AT_NONE }, // IT_SOUND
- { LLAssetType::AT_CALLINGCARD, LLAssetType::AT_NONE }, // IT_CALLINGCARD
- { LLAssetType::AT_LANDMARK, LLAssetType::AT_NONE }, // IT_LANDMARK
- { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
- { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
- { LLAssetType::AT_OBJECT, LLAssetType::AT_NONE }, // IT_OBJECT
- { LLAssetType::AT_NOTECARD, LLAssetType::AT_NONE }, // IT_NOTECARD
- { LLAssetType::AT_NONE, LLAssetType::AT_NONE }, // IT_CATEGORY
- { LLAssetType::AT_NONE, LLAssetType::AT_NONE }, // IT_ROOT_CATEGORY
- { LLAssetType::AT_LSL_TEXT, LLAssetType::AT_LSL_BYTECODE }, // IT_LSL
- { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
- { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
- { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
- { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
- { LLAssetType::AT_TEXTURE, LLAssetType::AT_NONE }, // IT_SNAPSHOT
- { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
- { LLAssetType::AT_OBJECT, LLAssetType::AT_NONE }, // IT_ATTACHMENT
- { LLAssetType::AT_CLOTHING, LLAssetType::AT_BODYPART }, // IT_WEARABLE
- { LLAssetType::AT_ANIMATION, LLAssetType::AT_NONE }, // IT_ANIMATION
- { LLAssetType::AT_GESTURE, LLAssetType::AT_NONE }, // IT_GESTURE
-};
-
-// static
-const char* LLInventoryType::lookup(EType type)
-{
- if((type >= 0) && (type < IT_COUNT))
- {
- return INVENTORY_TYPE_NAMES[S32(type)];
- }
- else
- {
- return NULL;
- }
-}
-
-// static
-LLInventoryType::EType LLInventoryType::lookup(const char* name)
-{
- for(S32 i = 0; i < IT_COUNT; ++i)
- {
- if((INVENTORY_TYPE_NAMES[i])
- && (0 == strcmp(name, INVENTORY_TYPE_NAMES[i])))
- {
- // match
- return (EType)i;
- }
- }
- return IT_NONE;
-}
-
-// XUI:translate
-// translation from a type to a human readable form.
-// static
-const char* LLInventoryType::lookupHumanReadable(EType type)
-{
- if((type >= 0) && (type < IT_COUNT))
- {
- return INVENTORY_TYPE_HUMAN_NAMES[S32(type)];
- }
- else
- {
- return NULL;
- }
-}
-
-// return the default inventory for the given asset type.
-// static
-LLInventoryType::EType LLInventoryType::defaultForAssetType(LLAssetType::EType asset_type)
-{
- if((asset_type >= 0) && (asset_type < LLAssetType::AT_COUNT))
- {
- return DEFAULT_ASSET_FOR_INV_TYPE[S32(asset_type)];
- }
- else
- {
- return IT_NONE;
- }
-}
///----------------------------------------------------------------------------
/// Class LLInventoryObject
@@ -331,10 +150,6 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream)
{
input_stream.getline(buffer, MAX_STRING);
sscanf(buffer, " %254s %254s", keyword, valuestr); /* Flawfinder: ignore */
- if(!keyword)
- {
- continue;
- }
if(0 == strcmp("{",keyword))
{
continue;
@@ -702,10 +517,6 @@ BOOL LLInventoryItem::importFile(FILE* fp)
{
fgets(buffer, MAX_STRING, fp);
sscanf(buffer, " %254s %254s", keyword, valuestr); /* Flawfinder: ignore */
- if(!keyword)
- {
- continue;
- }
if(0 == strcmp("{",keyword))
{
continue;
@@ -907,10 +718,6 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
buffer,
" %254s %254s",
keyword, valuestr);
- if(!keyword)
- {
- continue;
- }
if(0 == strcmp("{",keyword))
{
continue;
@@ -1399,7 +1206,8 @@ void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size)
}
else
{
- llerrs << "unpackBinaryBucket failed. item_buffer or bin_bucket is Null." << llendl;
+ llerrs << "unpackBinaryBucket failed. item_buffer or bin_bucket is Null." << llendl;
+ delete[] item_buffer;
return;
}
item_buffer[bin_bucket_size] = '\0';
@@ -1568,10 +1376,6 @@ BOOL LLInventoryCategory::importFile(FILE* fp)
buffer,
" %254s %254s",
keyword, valuestr);
- if(!keyword)
- {
- continue;
- }
if(0 == strcmp("{",keyword))
{
continue;
@@ -1651,10 +1455,6 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream)
buffer,
" %254s %254s",
keyword, valuestr);
- if(!keyword)
- {
- continue;
- }
if(0 == strcmp("{",keyword))
{
continue;
@@ -1719,25 +1519,6 @@ BOOL LLInventoryCategory::exportLegacyStream(std::ostream& output_stream, BOOL)
/// Local function definitions
///----------------------------------------------------------------------------
-bool inventory_and_asset_types_match(
- LLInventoryType::EType inventory_type,
- LLAssetType::EType asset_type)
-{
- bool rv = false;
- if((inventory_type >= 0) && (inventory_type < LLInventoryType::IT_COUNT))
- {
- for(S32 i = 0; i < MAX_POSSIBLE_ASSET_TYPES; ++i)
- {
- if(INVENTORY_TO_ASSET_TYPE[inventory_type][i] == asset_type)
- {
- rv = true;
- break;
- }
- }
- }
- return rv;
-}
-
LLSD ll_create_sd_from_inventory_item(LLPointer<LLInventoryItem> item)
{
LLSD rv;
diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h
index 95d9ae1288..5ee93137f8 100644
--- a/indra/llinventory/llinventory.h
+++ b/indra/llinventory/llinventory.h
@@ -13,6 +13,7 @@
#include "llassetstorage.h"
#include "lldarray.h"
+#include "llinventorytype.h"
#include "llmemtype.h"
#include "llpermissions.h"
#include "llsaleinfo.h"
@@ -31,63 +32,6 @@ enum
MAX_INVENTORY_BUFFER_SIZE = 1024
};
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLInventoryType
-//
-// Class used to encapsulate operations around inventory type.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-class LLInventoryType
-{
-public:
- enum EType
- {
- IT_TEXTURE = 0,
- IT_SOUND = 1,
- IT_CALLINGCARD = 2,
- IT_LANDMARK = 3,
- //IT_SCRIPT = 4,
- //IT_CLOTHING = 5,
- IT_OBJECT = 6,
- IT_NOTECARD = 7,
- IT_CATEGORY = 8,
- IT_ROOT_CATEGORY = 9,
- IT_LSL = 10,
- //IT_LSL_BYTECODE = 11,
- //IT_TEXTURE_TGA = 12,
- //IT_BODYPART = 13,
- //IT_TRASH = 14,
- IT_SNAPSHOT = 15,
- //IT_LOST_AND_FOUND = 16,
- IT_ATTACHMENT = 17,
- IT_WEARABLE = 18,
- IT_ANIMATION = 19,
- IT_GESTURE = 20,
- IT_COUNT = 21,
-
- IT_NONE = -1
- };
-
- // machine transation between type and strings
- static EType lookup(const char* name);
- static const char* lookup(EType type);
-
- // translation from a type to a human readable form.
- static const char* lookupHumanReadable(EType type);
-
- // return the default inventory for the given asset type.
- static EType defaultForAssetType(LLAssetType::EType asset_type);
-
-private:
- // don't instantiate or derive one of these objects
- LLInventoryType( void ) {}
- ~LLInventoryType( void ) {}
-
-//private:
-// static const char* mInventoryTypeNames[];
-// static const char* mInventoryTypeHumanNames[];
-// static LLInventoryType::EType mInventoryAssetType[];
-};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/indra/llinventory/llinventorytype.cpp b/indra/llinventory/llinventorytype.cpp
new file mode 100644
index 0000000000..84a93d807a
--- /dev/null
+++ b/indra/llinventory/llinventorytype.cpp
@@ -0,0 +1,202 @@
+/**
+ * @file llinventorytype.cpp
+ * @brief Inventory item type, more specific than an asset type.
+ *
+ * Copyright (c) 2001-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+#include "linden_common.h"
+
+#include "llinventorytype.h"
+
+///----------------------------------------------------------------------------
+/// Class LLInventoryType
+///----------------------------------------------------------------------------
+
+// Unlike asset type names, not limited to 8 characters.
+// Need not match asset type names.
+static const char* INVENTORY_TYPE_NAMES[LLInventoryType::IT_COUNT] =
+{
+ "texture", // 0
+ "sound",
+ "callcard",
+ "landmark",
+ NULL,
+ NULL, // 5
+ "object",
+ "notecard",
+ "category",
+ "root",
+ "script", // 10
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ "snapshot", // 15
+ NULL,
+ "attach",
+ "wearable",
+ "animation",
+ "gesture", // 20
+};
+
+// This table is meant for decoding to human readable form. Put any
+// and as many printable characters you want in each one.
+// See also LLAssetType::mAssetTypeHumanNames
+static const char* INVENTORY_TYPE_HUMAN_NAMES[LLInventoryType::IT_COUNT] =
+{
+ "texture", // 0
+ "sound",
+ "calling card",
+ "landmark",
+ NULL,
+ NULL, // 5
+ "object",
+ "note card",
+ "folder",
+ "root",
+ "script", // 10
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ "snapshot", // 15
+ NULL,
+ "attachment",
+ "wearable",
+ "animation",
+ "gesture", // 20
+};
+
+// Maps asset types to the default inventory type for that kind of asset.
+// Thus, "Lost and Found" is a "Category"
+static const LLInventoryType::EType
+DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] =
+{
+ LLInventoryType::IT_TEXTURE, // AT_TEXTURE
+ LLInventoryType::IT_SOUND, // AT_SOUND
+ LLInventoryType::IT_CALLINGCARD, // AT_CALLINGCARD
+ LLInventoryType::IT_LANDMARK, // AT_LANDMARK
+ LLInventoryType::IT_LSL, // AT_SCRIPT
+ LLInventoryType::IT_WEARABLE, // AT_CLOTHING
+ LLInventoryType::IT_OBJECT, // AT_OBJECT
+ LLInventoryType::IT_NOTECARD, // AT_NOTECARD
+ LLInventoryType::IT_CATEGORY, // AT_CATEGORY
+ LLInventoryType::IT_ROOT_CATEGORY, // AT_ROOT_CATEGORY
+ LLInventoryType::IT_LSL, // AT_LSL_TEXT
+ LLInventoryType::IT_LSL, // AT_LSL_BYTECODE
+ LLInventoryType::IT_TEXTURE, // AT_TEXTURE_TGA
+ LLInventoryType::IT_WEARABLE, // AT_BODYPART
+ LLInventoryType::IT_CATEGORY, // AT_TRASH
+ LLInventoryType::IT_CATEGORY, // AT_SNAPSHOT_CATEGORY
+ LLInventoryType::IT_CATEGORY, // AT_LOST_AND_FOUND
+ LLInventoryType::IT_SOUND, // AT_SOUND_WAV
+ LLInventoryType::IT_NONE, // AT_IMAGE_TGA
+ LLInventoryType::IT_NONE, // AT_IMAGE_JPEG
+ LLInventoryType::IT_ANIMATION, // AT_ANIMATION
+ LLInventoryType::IT_GESTURE, // AT_GESTURE
+};
+
+static const int MAX_POSSIBLE_ASSET_TYPES = 2;
+static const LLAssetType::EType
+INVENTORY_TO_ASSET_TYPE[LLInventoryType::IT_COUNT][MAX_POSSIBLE_ASSET_TYPES] =
+{
+ { LLAssetType::AT_TEXTURE, LLAssetType::AT_NONE }, // IT_TEXTURE
+ { LLAssetType::AT_SOUND, LLAssetType::AT_NONE }, // IT_SOUND
+ { LLAssetType::AT_CALLINGCARD, LLAssetType::AT_NONE }, // IT_CALLINGCARD
+ { LLAssetType::AT_LANDMARK, LLAssetType::AT_NONE }, // IT_LANDMARK
+ { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
+ { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
+ { LLAssetType::AT_OBJECT, LLAssetType::AT_NONE }, // IT_OBJECT
+ { LLAssetType::AT_NOTECARD, LLAssetType::AT_NONE }, // IT_NOTECARD
+ { LLAssetType::AT_NONE, LLAssetType::AT_NONE }, // IT_CATEGORY
+ { LLAssetType::AT_NONE, LLAssetType::AT_NONE }, // IT_ROOT_CATEGORY
+ { LLAssetType::AT_LSL_TEXT, LLAssetType::AT_LSL_BYTECODE }, // IT_LSL
+ { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
+ { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
+ { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
+ { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
+ { LLAssetType::AT_TEXTURE, LLAssetType::AT_NONE }, // IT_SNAPSHOT
+ { LLAssetType::AT_NONE, LLAssetType::AT_NONE },
+ { LLAssetType::AT_OBJECT, LLAssetType::AT_NONE }, // IT_ATTACHMENT
+ { LLAssetType::AT_CLOTHING, LLAssetType::AT_BODYPART }, // IT_WEARABLE
+ { LLAssetType::AT_ANIMATION, LLAssetType::AT_NONE }, // IT_ANIMATION
+ { LLAssetType::AT_GESTURE, LLAssetType::AT_NONE }, // IT_GESTURE
+};
+
+// static
+const char* LLInventoryType::lookup(EType type)
+{
+ if((type >= 0) && (type < IT_COUNT))
+ {
+ return INVENTORY_TYPE_NAMES[S32(type)];
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+// static
+LLInventoryType::EType LLInventoryType::lookup(const char* name)
+{
+ for(S32 i = 0; i < IT_COUNT; ++i)
+ {
+ if((INVENTORY_TYPE_NAMES[i])
+ && (0 == strcmp(name, INVENTORY_TYPE_NAMES[i])))
+ {
+ // match
+ return (EType)i;
+ }
+ }
+ return IT_NONE;
+}
+
+// XUI:translate
+// translation from a type to a human readable form.
+// static
+const char* LLInventoryType::lookupHumanReadable(EType type)
+{
+ if((type >= 0) && (type < IT_COUNT))
+ {
+ return INVENTORY_TYPE_HUMAN_NAMES[S32(type)];
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+// return the default inventory for the given asset type.
+// static
+LLInventoryType::EType LLInventoryType::defaultForAssetType(LLAssetType::EType asset_type)
+{
+ if((asset_type >= 0) && (asset_type < LLAssetType::AT_COUNT))
+ {
+ return DEFAULT_ASSET_FOR_INV_TYPE[S32(asset_type)];
+ }
+ else
+ {
+ return IT_NONE;
+ }
+}
+
+bool inventory_and_asset_types_match(
+ LLInventoryType::EType inventory_type,
+ LLAssetType::EType asset_type)
+{
+ bool rv = false;
+ if((inventory_type >= 0) && (inventory_type < LLInventoryType::IT_COUNT))
+ {
+ for(S32 i = 0; i < MAX_POSSIBLE_ASSET_TYPES; ++i)
+ {
+ if(INVENTORY_TO_ASSET_TYPE[inventory_type][i] == asset_type)
+ {
+ rv = true;
+ break;
+ }
+ }
+ }
+ return rv;
+}
diff --git a/indra/llinventory/llinventorytype.h b/indra/llinventory/llinventorytype.h
new file mode 100644
index 0000000000..fc132d455a
--- /dev/null
+++ b/indra/llinventory/llinventorytype.h
@@ -0,0 +1,74 @@
+/**
+ * @file llinventorytype.h
+ * @brief Inventory item type, more specific than an asset type.
+ *
+ * Copyright (c) 2001-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+#ifndef LLINVENTORYTYPE_H
+#define LLINVENTORYTYPE_H
+
+#include "llassettype.h"
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLInventoryType
+//
+// Class used to encapsulate operations around inventory type.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+class LLInventoryType
+{
+public:
+ enum EType
+ {
+ IT_TEXTURE = 0,
+ IT_SOUND = 1,
+ IT_CALLINGCARD = 2,
+ IT_LANDMARK = 3,
+ //IT_SCRIPT = 4,
+ //IT_CLOTHING = 5,
+ IT_OBJECT = 6,
+ IT_NOTECARD = 7,
+ IT_CATEGORY = 8,
+ IT_ROOT_CATEGORY = 9,
+ IT_LSL = 10,
+ //IT_LSL_BYTECODE = 11,
+ //IT_TEXTURE_TGA = 12,
+ //IT_BODYPART = 13,
+ //IT_TRASH = 14,
+ IT_SNAPSHOT = 15,
+ //IT_LOST_AND_FOUND = 16,
+ IT_ATTACHMENT = 17,
+ IT_WEARABLE = 18,
+ IT_ANIMATION = 19,
+ IT_GESTURE = 20,
+ IT_COUNT = 21,
+
+ IT_NONE = -1
+ };
+
+ // machine transation between type and strings
+ static EType lookup(const char* name);
+ static const char* lookup(EType type);
+
+ // translation from a type to a human readable form.
+ static const char* lookupHumanReadable(EType type);
+
+ // return the default inventory for the given asset type.
+ static EType defaultForAssetType(LLAssetType::EType asset_type);
+
+private:
+ // don't instantiate or derive one of these objects
+ LLInventoryType( void );
+ ~LLInventoryType( void );
+};
+
+// helper function which returns true if inventory type and asset type
+// are potentially compatible. For example, an attachment must be an
+// object, but a wearable can be a bodypart or clothing asset.
+bool inventory_and_asset_types_match(
+ LLInventoryType::EType inventory_type,
+ LLAssetType::EType asset_type);
+
+#endif
diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp
index 7ea83f6e5e..c2b2eb27de 100644
--- a/indra/llinventory/llparcel.cpp
+++ b/indra/llinventory/llparcel.cpp
@@ -1194,6 +1194,24 @@ BOOL LLParcel::exportStream(std::ostream& output_stream)
return TRUE;
}
+// virtual
+LLSD LLParcel::asLLSD() const
+{
+ LLSD p;
+ p["parcel-id"] = getID();
+ p["name"] = getName();
+ p["desc"] = getDesc();
+ p["owner-id"] = getOwnerID();
+ p["group-id"] = getGroupID();
+ p["group-owned"] = (bool)getIsGroupOwned();
+ p["auction-id"] = (S32)getAuctionID();
+ p["snapshot-id"] = getSnapshotID();
+ p["authorized-buyer-id"] = getAuthorizedBuyerID();
+ p["sale-price"] = getSalePrice();
+ p["parcel-flags"] = (S32)getParcelFlags();
+ // NOTE: This list is incomplete, as this is used only for search. JC
+ return p;
+}
// Assumes we are in a block "ParcelData"
void LLParcel::packMessage(LLMessageSystem* msg)
@@ -1766,7 +1784,7 @@ const char* category_to_ui_string(LLParcel::ECategory category)
else
{
// C_ANY = -1 , but the "Any" string is at the end of the list
- index = ((S32) LLParcel::C_COUNT) + 1;
+ index = ((S32) LLParcel::C_COUNT);
}
return PARCEL_CATEGORY_UI_STRING[index];
}
diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h
index 131bcdd55d..46c7a99400 100644
--- a/indra/llinventory/llparcel.h
+++ b/indra/llinventory/llparcel.h
@@ -226,6 +226,7 @@ public:
BOOL importStream(std::istream& input_stream);
BOOL importAccessEntry(std::istream& input_stream, LLAccessEntry* entry);
BOOL exportStream(std::ostream& output_stream);
+ virtual LLSD asLLSD() const;
void packMessage(LLMessageSystem* msg);
void unpackMessage(LLMessageSystem* msg);
@@ -254,7 +255,7 @@ public:
BOOL removeFromBanList(const LLUUID& agent_id);
// ACCESSORS
- const LLUUID& getID() { return mID; }
+ const LLUUID& getID() const { return mID; }
const char* getName() const { return mName.c_str(); }
const char* getDesc() const { return mDesc.c_str(); }
const char* getMusicURL() const { return mMusicURL.c_str(); }
@@ -263,14 +264,13 @@ public:
const U8 getMediaAutoScale() const { return mMediaAutoScale; }
S32 getLocalID() const { return mLocalID; }
const LLUUID& getOwnerID() const { return mOwnerID; }
- const LLUUID& getGroupID() const { return mGroupID; }
- //const char* getGroupName() const { return mGroupName.c_str(); }
+ const LLUUID& getGroupID() const { return mGroupID; }
S32 getPassPrice() const { return mPassPrice; }
F32 getPassHours() const { return mPassHours; }
BOOL getIsGroupOwned() const { return mGroupOwned; }
- U32 getAuctionID() { return mAuctionID; }
- bool isInEscrow() const { return mInEscrow; }
+ U32 getAuctionID() const { return mAuctionID; }
+ bool isInEscrow() const { return mInEscrow; }
BOOL isPublic() const;
diff --git a/indra/llinventory/llpermissions.cpp b/indra/llinventory/llpermissions.cpp
index 7daab177a4..e0e8036d42 100644
--- a/indra/llinventory/llpermissions.cpp
+++ b/indra/llinventory/llpermissions.cpp
@@ -511,10 +511,6 @@ BOOL LLPermissions::importFile(FILE* fp)
buffer,
" %255s %255s",
keyword, valuestr);
- if (!keyword)
- {
- continue;
- }
if (!strcmp("{", keyword))
{
continue;
@@ -649,10 +645,6 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream)
buffer,
" %255s %255s",
keyword, valuestr);
- if (!keyword)
- {
- continue;
- }
if (!strcmp("{", keyword))
{
continue;