From c07901e29ed545bbb02e3bddf148fe1104b94e9f Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:44:56 -0500 Subject: Second Life viewer sources 1.15.1.3 --- linden/indra/llinventory/files.lst | 1 + linden/indra/llinventory/lleconomy.cpp | 2 + linden/indra/llinventory/lleconomy.h | 2 + linden/indra/llinventory/llinventory.cpp | 225 +-------------------------- linden/indra/llinventory/llinventory.h | 58 +------ linden/indra/llinventory/llinventory.vcproj | 9 ++ linden/indra/llinventory/llinventorytype.cpp | 222 ++++++++++++++++++++++++++ linden/indra/llinventory/llinventorytype.h | 94 +++++++++++ linden/indra/llinventory/llparcel.cpp | 20 ++- linden/indra/llinventory/llparcel.h | 10 +- linden/indra/llinventory/llpermissions.cpp | 8 - 11 files changed, 358 insertions(+), 293 deletions(-) create mode 100644 linden/indra/llinventory/llinventorytype.cpp create mode 100644 linden/indra/llinventory/llinventorytype.h (limited to 'linden/indra/llinventory') 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 @@ llinventory/llcategory.cpp llinventory/lleconomy.cpp llinventory/llinventory.cpp +llinventory/llinventorytype.cpp llinventory/lllandmark.cpp llinventory/llnotecard.cpp llinventory/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 @@ #include "message.h" #include "v3math.h" +LLGlobalEconomy *gGlobalEconomy = NULL; + LLGlobalEconomy::LLGlobalEconomy() : mObjectCount( -1 ), 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: }; +extern LLGlobalEconomy* gGlobalEconomy; + #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 @@ #include "llsdutil.h" -#include "llsdutil.h" - ///---------------------------------------------------------------------------- /// exported functions ///---------------------------------------------------------------------------- @@ -67,187 +65,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 @@ -351,10 +170,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; @@ -722,10 +537,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; @@ -927,10 +738,6 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) buffer, " %254s %254s", keyword, valuestr); - if(!keyword) - { - continue; - } if(0 == strcmp("{",keyword)) { continue; @@ -1419,7 +1226,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'; @@ -1588,10 +1396,6 @@ BOOL LLInventoryCategory::importFile(FILE* fp) buffer, " %254s %254s", keyword, valuestr); - if(!keyword) - { - continue; - } if(0 == strcmp("{",keyword)) { continue; @@ -1671,10 +1475,6 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream) buffer, " %254s %254s", keyword, valuestr); - if(!keyword) - { - continue; - } if(0 == strcmp("{",keyword)) { continue; @@ -1739,25 +1539,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 item) { 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 @@ #include "llassetstorage.h" #include "lldarray.h" +#include "llinventorytype.h" #include "llmemtype.h" #include "llpermissions.h" #include "llsaleinfo.h" @@ -51,63 +52,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/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 @@ RelativePath=".\llinventory.cpp"> + + + + + + 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 @@ +/** + * @file llinventorytype.cpp + * @brief Inventory item type, more specific than an asset type. + * + * Copyright (c) 2001-2007, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + */ + +#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/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 @@ +/** + * @file llinventorytype.h + * @brief Inventory item type, more specific than an asset type. + * + * Copyright (c) 2001-2007, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + */ + +#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/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) 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) @@ -1786,7 +1804,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/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: 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); @@ -274,7 +275,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(); } @@ -283,14 +284,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/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) buffer, " %255s %255s", keyword, valuestr); - if (!keyword) - { - continue; - } if (!strcmp("{", keyword)) { continue; @@ -669,10 +665,6 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream) buffer, " %255s %255s", keyword, valuestr); - if (!keyword) - { - continue; - } if (!strcmp("{", keyword)) { continue; -- cgit v1.1