diff options
Diffstat (limited to 'indra/llinventory')
-rw-r--r-- | indra/llinventory/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/llinventory/llinventory.cpp | 108 | ||||
-rw-r--r-- | indra/llinventory/llinventory.h | 301 | ||||
-rw-r--r-- | indra/llinventory/llinventorydefines.cpp | 37 | ||||
-rw-r--r-- | indra/llinventory/llinventorydefines.h | 106 | ||||
-rw-r--r-- | indra/llinventory/llinventorytype.cpp | 6 | ||||
-rw-r--r-- | indra/llinventory/llinventorytype.h | 2 | ||||
-rw-r--r-- | indra/llinventory/llparcel.cpp | 1 |
8 files changed, 317 insertions, 246 deletions
diff --git a/indra/llinventory/CMakeLists.txt b/indra/llinventory/CMakeLists.txt index b358f0a013..a563db901a 100644 --- a/indra/llinventory/CMakeLists.txt +++ b/indra/llinventory/CMakeLists.txt @@ -20,6 +20,7 @@ set(llinventory_SOURCE_FILES llcategory.cpp lleconomy.cpp llinventory.cpp + llinventorydefines.cpp llinventorytype.cpp lllandmark.cpp llnotecard.cpp @@ -36,6 +37,7 @@ set(llinventory_HEADER_FILES llcategory.h lleconomy.h llinventory.h + llinventorydefines.h llinventorytype.h lllandmark.h llnotecard.h diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index d665deb605..53830b1a14 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -31,10 +31,10 @@ */ #include "linden_common.h" - #include "llinventory.h" #include "lldbstrings.h" +#include "llinventorydefines.h" #include "llxorcipher.h" #include "llsd.h" #include "message.h" @@ -43,9 +43,8 @@ #include "llsdutil.h" ///---------------------------------------------------------------------------- -/// exported functions +/// Exported functions ///---------------------------------------------------------------------------- - static const std::string INV_ITEM_ID_LABEL("item_id"); static const std::string INV_FOLDER_ID_LABEL("folder_id"); static const std::string INV_PARENT_ID_LABEL("parent_id"); @@ -64,34 +63,29 @@ static const std::string INV_CREATION_DATE_LABEL("created_at"); // key used by agent-inventory-service static const std::string INV_ASSET_TYPE_LABEL_WS("type_default"); static const std::string INV_FOLDER_ID_LABEL_WS("category_id"); + ///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs ///---------------------------------------------------------------------------- - const U8 TASK_INVENTORY_ITEM_KEY = 0; const U8 TASK_INVENTORY_ASSET_KEY = 1; const LLUUID MAGIC_ID("3c115e51-04f4-523c-9fa6-98aff1034730"); - ///---------------------------------------------------------------------------- /// Class LLInventoryObject ///---------------------------------------------------------------------------- -LLInventoryObject::LLInventoryObject( - const LLUUID& uuid, - const LLUUID& parent_uuid, - LLAssetType::EType type, - const std::string& name) : +LLInventoryObject::LLInventoryObject(const LLUUID& uuid, + const LLUUID& parent_uuid, + LLAssetType::EType type, + const std::string& name) : mUUID(uuid), mParentUUID(parent_uuid), mType(type), mName(name) { - LLStringUtil::replaceNonstandardASCII(mName, ' '); - LLStringUtil::replaceChar(mName, '|', ' '); - LLStringUtil::trim(mName); - LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN); + correctInventoryName(mName); } LLInventoryObject::LLInventoryObject() : @@ -99,7 +93,7 @@ LLInventoryObject::LLInventoryObject() : { } -LLInventoryObject::~LLInventoryObject( void ) +LLInventoryObject::~LLInventoryObject() { } @@ -158,12 +152,8 @@ void LLInventoryObject::setUUID(const LLUUID& new_uuid) void LLInventoryObject::rename(const std::string& n) { std::string new_name(n); - LLStringUtil::replaceNonstandardASCII(new_name, ' '); - LLStringUtil::replaceChar(new_name, '|', ' '); - LLStringUtil::trim(new_name); - LLStringUtil::truncate(new_name, DB_INV_ITEM_NAME_STR_LEN); - - if( new_name != mName ) + correctInventoryName(new_name); + if( !new_name.empty() && new_name != mName ) { mName = new_name; } @@ -224,10 +214,7 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream) " %254s %254[^|]", keyword, valuestr); mName.assign(valuestr); - LLStringUtil::replaceNonstandardASCII(mName, ' '); - LLStringUtil::replaceChar(mName, '|', ' '); - LLStringUtil::trim(mName); - LLStringUtil::truncate(mName, DB_INV_ITEM_NAME_STR_LEN); + correctInventoryName(mName); } else { @@ -287,23 +274,31 @@ void LLInventoryObject::updateServer(BOOL) const llwarns << "LLInventoryObject::updateServer() called. Doesn't do anything." << llendl; } +inline +void LLInventoryObject::correctInventoryName(std::string& name) +{ + LLStringUtil::replaceNonstandardASCII(name, ' '); + LLStringUtil::replaceChar(name, '|', ' '); + LLStringUtil::trim(name); + LLStringUtil::truncate(name, DB_INV_ITEM_NAME_STR_LEN); +} + ///---------------------------------------------------------------------------- /// Class LLInventoryItem ///---------------------------------------------------------------------------- -LLInventoryItem::LLInventoryItem( - const LLUUID& uuid, - const LLUUID& parent_uuid, - const LLPermissions& permissions, - const LLUUID& asset_uuid, - LLAssetType::EType type, - LLInventoryType::EType inv_type, - const std::string& name, - const std::string& desc, - const LLSaleInfo& sale_info, - U32 flags, - S32 creation_date_utc) : +LLInventoryItem::LLInventoryItem(const LLUUID& uuid, + const LLUUID& parent_uuid, + const LLPermissions& permissions, + const LLUUID& asset_uuid, + LLAssetType::EType type, + LLInventoryType::EType inv_type, + const std::string& name, + const std::string& desc, + const LLSaleInfo& sale_info, + U32 flags, + S32 creation_date_utc) : LLInventoryObject(uuid, parent_uuid, type, name), mPermissions(permissions), mAssetUUID(asset_uuid), @@ -458,11 +453,18 @@ void LLInventoryItem::setCreationDate(time_t creation_date_utc) mCreationDate = creation_date_utc; } +// Currently only used in the Viewer to handle calling cards +// where the creator is actually used to store the target. +void LLInventoryItem::setCreator(const LLUUID& creator) +{ + mPermissions.setCreator(creator); +} + void LLInventoryItem::accumulatePermissionSlamBits(const LLInventoryItem& old_item) { // Remove any pre-existing II_FLAGS_PERM_OVERWRITE_MASK flags // because we now detect when they should be set. - setFlags( old_item.getFlags() | (getFlags() & ~(LLInventoryItem::II_FLAGS_PERM_OVERWRITE_MASK)) ); + setFlags( old_item.getFlags() | (getFlags() & ~(LLInventoryItemFlags::II_FLAGS_PERM_OVERWRITE_MASK)) ); // Enforce the PERM_OVERWRITE flags for any masks that are different // but only for AT_OBJECT's since that is the only asset type that can @@ -473,20 +475,20 @@ void LLInventoryItem::accumulatePermissionSlamBits(const LLInventoryItem& old_it U32 flags_to_be_set = 0; if(old_permissions.getMaskNextOwner() != getPermissions().getMaskNextOwner()) { - flags_to_be_set |= LLInventoryItem::II_FLAGS_OBJECT_SLAM_PERM; + flags_to_be_set |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_PERM; } if(old_permissions.getMaskEveryone() != getPermissions().getMaskEveryone()) { - flags_to_be_set |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE; + flags_to_be_set |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE; } if(old_permissions.getMaskGroup() != getPermissions().getMaskGroup()) { - flags_to_be_set |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP; + flags_to_be_set |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP; } LLSaleInfo old_sale_info = old_item.getSaleInfo(); if(old_sale_info != getSaleInfo()) { - flags_to_be_set |= LLInventoryItem::II_FLAGS_OBJECT_SLAM_SALE; + flags_to_be_set |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_SALE; } setFlags(getFlags() | flags_to_be_set); } @@ -1304,28 +1306,14 @@ void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size) setCreationDate(now); } -// returns TRUE if a should appear before b -BOOL item_dictionary_sort( LLInventoryItem* a, LLInventoryItem* b ) -{ - return (LLStringUtil::compareDict( a->getName().c_str(), b->getName().c_str() ) < 0); -} - -// returns TRUE if a should appear before b -BOOL item_date_sort( LLInventoryItem* a, LLInventoryItem* b ) -{ - return a->getCreationDate() < b->getCreationDate(); -} - - ///---------------------------------------------------------------------------- /// Class LLInventoryCategory ///---------------------------------------------------------------------------- -LLInventoryCategory::LLInventoryCategory( - const LLUUID& uuid, - const LLUUID& parent_uuid, - LLFolderType::EType preferred_type, - const std::string& name) : +LLInventoryCategory::LLInventoryCategory(const LLUUID& uuid, + const LLUUID& parent_uuid, + LLFolderType::EType preferred_type, + const std::string& name) : LLInventoryObject(uuid, parent_uuid, LLAssetType::AT_CATEGORY, name), mPreferredType(preferred_type) { diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h index 9faecbea85..4c6ac83ab8 100644 --- a/indra/llinventory/llinventory.h +++ b/indra/llinventory/llinventory.h @@ -33,8 +33,6 @@ #ifndef LL_LLINVENTORY_H #define LL_LLINVENTORY_H -#include <functional> - #include "lldarray.h" #include "llfoldertype.h" #include "llinventorytype.h" @@ -45,180 +43,98 @@ #include "llsd.h" #include "lluuid.h" -// consts for Key field in the task inventory update message -extern const U8 TASK_INVENTORY_ITEM_KEY; -extern const U8 TASK_INVENTORY_ASSET_KEY; - -// anonymous enumeration to specify a max inventory buffer size for -// use in packBinaryBucket() -enum -{ - MAX_INVENTORY_BUFFER_SIZE = 1024 -}; - - +class LLMessageSystem; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLInventoryObject // -// This is the base class for inventory objects that handles the -// common code between items and categories. The 'mParentUUID' member -// means the parent category since all inventory objects except each -// user's root category are in some category. Each user's root -// category will have mParentUUID==LLUUID::null. +// Base class for anything in the user's inventory. Handles the common code +// between items and categories. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class LLMessageSystem; - class LLInventoryObject : public LLRefCount { -protected: - LLUUID mUUID; - LLUUID mParentUUID; - LLAssetType::EType mType; - std::string mName; +public: + typedef std::list<LLPointer<LLInventoryObject> > object_list_t; -protected: - virtual ~LLInventoryObject( void ); - + //-------------------------------------------------------------------- + // Initialization + //-------------------------------------------------------------------- public: MEM_TYPE_NEW(LLMemType::MTYPE_INVENTORY); - LLInventoryObject(const LLUUID& uuid, const LLUUID& parent_uuid, - LLAssetType::EType type, const std::string& name); LLInventoryObject(); + LLInventoryObject(const LLUUID& uuid, + const LLUUID& parent_uuid, + LLAssetType::EType type, + const std::string& name); void copyObject(const LLInventoryObject* other); // LLRefCount requires custom copy +protected: + virtual ~LLInventoryObject(); - // accessors - virtual const LLUUID& getUUID() const; + //-------------------------------------------------------------------- + // Accessors + //-------------------------------------------------------------------- +public: + virtual const LLUUID& getUUID() const; // inventoryID that this item points to + virtual const LLUUID& getLinkedUUID() const; // inventoryID that this item points to, else this item's inventoryID const LLUUID& getParentUUID() const; - virtual const LLUUID& getLinkedUUID() const; // get the inventoryID that this item points to, else this item's inventoryID virtual const std::string& getName() const; virtual LLAssetType::EType getType() const; LLAssetType::EType getActualType() const; // bypasses indirection for linked items BOOL getIsLinkType() const; - // mutators - will not call updateServer(); + + //-------------------------------------------------------------------- + // Mutators + // Will not call updateServer + //-------------------------------------------------------------------- +public: void setUUID(const LLUUID& new_uuid); virtual void rename(const std::string& new_name); void setParent(const LLUUID& new_parent); void setType(LLAssetType::EType type); - // file support - implemented here so that a minimal information - // set can be transmitted between simulator and viewer. -// virtual BOOL importFile(LLFILE* fp); - virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const; +private: + // in place correction for inventory name string + void correctInventoryName(std::string& name); + //-------------------------------------------------------------------- + // File Support + // Implemented here so that a minimal information set can be transmitted + // between simulator and viewer. + //-------------------------------------------------------------------- +public: + // virtual BOOL importFile(LLFILE* fp); + virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const; virtual BOOL importLegacyStream(std::istream& input_stream); virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const; - // virtual methods virtual void removeFromServer(); virtual void updateParentOnServer(BOOL) const; virtual void updateServer(BOOL) const; + + //-------------------------------------------------------------------- + // Member Variables + //-------------------------------------------------------------------- +protected: + LLUUID mUUID; + LLUUID mParentUUID; // Parent category. Root categories have LLUUID::NULL. + LLAssetType::EType mType; + std::string mName; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLInventoryItem // -// An inventory item represents something that the current user has in -// their inventory. +// An item in the current user's inventory. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - class LLInventoryItem : public LLInventoryObject { public: typedef LLDynamicArray<LLPointer<LLInventoryItem> > item_array_t; - -protected: - LLPermissions mPermissions; - LLUUID mAssetUUID; - std::string mDescription; - LLSaleInfo mSaleInfo; - LLInventoryType::EType mInventoryType; - U32 mFlags; - time_t mCreationDate; // seconds from 1/1/1970, UTC - -public: - - /** - * Anonymous enumeration for specifying the inventory item flags. - */ - enum - { - // The shared flags at the top are shared among all inventory - // types. After that section, all values of flags are type - // dependent. The shared flags will start at 2^30 and work - // down while item type specific flags will start at 2^0 and - // work up. - II_FLAGS_NONE = 0, - - - // - // Shared flags - // - // - - // This value means that the asset has only one reference in - // the system. If the inventory item is deleted, or the asset - // id updated, then we can remove the old reference. - II_FLAGS_SHARED_SINGLE_REFERENCE = 0x40000000, - - - // - // Landmark flags - // - II_FLAGS_LANDMARK_VISITED = 1, - - // - // Object flags - // - - // flag to indicate that object permissions should have next - // owner perm be more restrictive on rez. We bump this into - // the second byte of the flags since the low byte is used to - // track attachment points. - II_FLAGS_OBJECT_SLAM_PERM = 0x100, - - // flag to indicate that the object sale information has been changed. - II_FLAGS_OBJECT_SLAM_SALE = 0x1000, - - // These flags specify which permissions masks to overwrite - // upon rez. Normally, if no permissions slam (above) or - // overwrite flags are set, the asset's permissions are - // used and the inventory's permissions are ignored. If - // any of these flags are set, the inventory's permissions - // take precedence. - II_FLAGS_OBJECT_PERM_OVERWRITE_BASE = 0x010000, - II_FLAGS_OBJECT_PERM_OVERWRITE_OWNER = 0x020000, - II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP = 0x040000, - II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE = 0x080000, - II_FLAGS_OBJECT_PERM_OVERWRITE_NEXT_OWNER = 0x100000, - - // flag to indicate whether an object that is returned is composed - // of muiltiple items or not. - II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS = 0x200000, - - // - // wearables use the low order byte of flags to store the - // EWearableType enumeration found in newview/llwearable.h - // - II_FLAGS_WEARABLES_MASK = 0xff, - - // these bits need to be cleared whenever the asset_id is updated - // on a pre-existing inventory item (DEV-28098 and DEV-30997) - II_FLAGS_PERM_OVERWRITE_MASK = II_FLAGS_OBJECT_SLAM_PERM - | II_FLAGS_OBJECT_SLAM_SALE - | II_FLAGS_OBJECT_PERM_OVERWRITE_BASE - | II_FLAGS_OBJECT_PERM_OVERWRITE_OWNER - | II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP - | II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE - | II_FLAGS_OBJECT_PERM_OVERWRITE_NEXT_OWNER, - }; - -protected: - ~LLInventoryItem(); // ref counted + //-------------------------------------------------------------------- + // Initialization + //-------------------------------------------------------------------- public: - MEM_TYPE_NEW(LLMemType::MTYPE_INVENTORY); LLInventoryItem(const LLUUID& uuid, const LLUUID& parent_uuid, @@ -237,10 +153,14 @@ public: // is prohibited LLInventoryItem(const LLInventoryItem* other); virtual void copyItem(const LLInventoryItem* other); // LLRefCount requires custom copy - void generateUUID() { mUUID.generate(); } +protected: + ~LLInventoryItem(); // ref counted - // accessors + //-------------------------------------------------------------------- + // Accessors + //-------------------------------------------------------------------- +public: virtual const LLUUID& getLinkedUUID() const; virtual const LLPermissions& getPermissions() const; virtual const LLUUID& getCreatorUUID() const; @@ -252,8 +172,12 @@ public: virtual time_t getCreationDate() const; virtual U32 getCRC32() const; // really more of a checksum. - // mutators - will not call updateServer(), and will never fail - // (though it may correct to sane values) + //-------------------------------------------------------------------- + // Mutators + // Will not call updateServer and will never fail + // (though it may correct to sane values) + //-------------------------------------------------------------------- +public: void setAssetUUID(const LLUUID& asset_id); void setDescription(const std::string& new_desc); void setSaleInfo(const LLSaleInfo& sale_info); @@ -261,62 +185,68 @@ public: void setInventoryType(LLInventoryType::EType inv_type); void setFlags(U32 flags); void setCreationDate(time_t creation_date_utc); + void setCreator(const LLUUID& creator); // only used for calling cards // Check for changes in permissions masks and sale info - // and set the corresponding bits in mFlags + // and set the corresponding bits in mFlags. void accumulatePermissionSlamBits(const LLInventoryItem& old_item); - - // This is currently only used in the Viewer to handle calling cards - // where the creator is actually used to store the target. - void setCreator(const LLUUID& creator) { mPermissions.setCreator(creator); } - // Put this inventory item onto the current outgoing mesage. It - // assumes you have already called nextBlock(). + // Put this inventory item onto the current outgoing mesage. + // Assumes you have already called nextBlock(). virtual void packMessage(LLMessageSystem* msg) const; - // unpack returns TRUE if the inventory item came through the - // network ok. It uses a simple crc check which is defeatable, but - // we want to detect network mangling somehow. + // Returns TRUE if the inventory item came through the network correctly. + // Uses a simple crc check which is defeatable, but we want to detect + // network mangling somehow. virtual BOOL unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0); - // file support + + //-------------------------------------------------------------------- + // File Support + //-------------------------------------------------------------------- +public: virtual BOOL importFile(LLFILE* fp); virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const; - virtual BOOL importLegacyStream(std::istream& input_stream); virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const; - // helper functions - - // pack all information needed to reconstruct this item into the given binary bucket. - // perm_override is optional + //-------------------------------------------------------------------- + // Helper Functions + //-------------------------------------------------------------------- +public: + // Pack all information needed to reconstruct this item into the given binary bucket. S32 packBinaryBucket(U8* bin_bucket, LLPermissions* perm_override = NULL) const; void unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size); LLSD asLLSD() const; void asLLSD( LLSD& sd ) const; bool fromLLSD(const LLSD& sd); + //-------------------------------------------------------------------- + // Member Variables + //-------------------------------------------------------------------- +protected: + LLPermissions mPermissions; + LLUUID mAssetUUID; + std::string mDescription; + LLSaleInfo mSaleInfo; + LLInventoryType::EType mInventoryType; + U32 mFlags; + time_t mCreationDate; // seconds from 1/1/1970, UTC }; -BOOL item_dictionary_sort(LLInventoryItem* a,LLInventoryItem* b); -BOOL item_date_sort(LLInventoryItem* a, LLInventoryItem* b); - - //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLInventoryCategory // -// An instance of this class represents a category of inventory -// items. Users come with a set of default categories, and can create -// new ones as needed. +// A category/folder of inventory items. Users come with a set of default +// categories, and can create new ones as needed. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - class LLInventoryCategory : public LLInventoryObject { public: typedef LLDynamicArray<LLPointer<LLInventoryCategory> > cat_array_t; -protected: - ~LLInventoryCategory(); - + //-------------------------------------------------------------------- + // Initialization + //-------------------------------------------------------------------- public: MEM_TYPE_NEW(LLMemType::MTYPE_INVENTORY); LLInventoryCategory(const LLUUID& uuid, const LLUUID& parent_uuid, @@ -325,40 +255,49 @@ public: LLInventoryCategory(); LLInventoryCategory(const LLInventoryCategory* other); void copyCategory(const LLInventoryCategory* other); // LLRefCount requires custom copy +protected: + ~LLInventoryCategory(); - // accessors and mutators + //-------------------------------------------------------------------- + // Accessors And Mutators + //-------------------------------------------------------------------- +public: LLFolderType::EType getPreferredType() const; void setPreferredType(LLFolderType::EType type); - // For messaging system support - virtual void packMessage(LLMessageSystem* msg) const; - virtual void unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0); - LLSD asLLSD() const; bool fromLLSD(const LLSD& sd); - // file support + //-------------------------------------------------------------------- + // Messaging + //-------------------------------------------------------------------- +public: + virtual void packMessage(LLMessageSystem* msg) const; + virtual void unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0); + + //-------------------------------------------------------------------- + // File Support + //-------------------------------------------------------------------- +public: virtual BOOL importFile(LLFILE* fp); virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const; - virtual BOOL importLegacyStream(std::istream& input_stream); virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const; + //-------------------------------------------------------------------- + // Member Variables + //-------------------------------------------------------------------- protected: - // May be the type that this category was "meant" to hold (although it may hold any type). - LLFolderType::EType mPreferredType; + LLFolderType::EType mPreferredType; // Type that this category was "meant" to hold (although it may hold any type). }; //----------------------------------------------------------------------------- -// Useful bits +// Convertors +// +// These functions convert between structured data and an inventory +// item, appropriate for serialization. //----------------------------------------------------------------------------- - -typedef std::list<LLPointer<LLInventoryObject> > InventoryObjectList; - -// These functions convert between structured data and an inventory -// item, appropriate for serialization. LLSD ll_create_sd_from_inventory_item(LLPointer<LLInventoryItem> item); -//LLPointer<LLInventoryItem> ll_create_item_from_sd(const LLSD& sd_item); LLSD ll_create_sd_from_inventory_category(LLPointer<LLInventoryCategory> cat); LLPointer<LLInventoryCategory> ll_create_category_from_sd(const LLSD& sd_cat); diff --git a/indra/llinventory/llinventorydefines.cpp b/indra/llinventory/llinventorydefines.cpp new file mode 100644 index 0000000000..a9610d4d4b --- /dev/null +++ b/indra/llinventory/llinventorydefines.cpp @@ -0,0 +1,37 @@ +/** + * @file llinventorydefines.cpp + * @brief Implementation of the inventory defines. + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2009, 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +#include "linden_common.h" +#include "llinventorydefines.h" + +const U8 TASK_INVENTORY_ITEM_KEY = 0; +const U8 TASK_INVENTORY_ASSET_KEY = 1; diff --git a/indra/llinventory/llinventorydefines.h b/indra/llinventory/llinventorydefines.h new file mode 100644 index 0000000000..67e629c546 --- /dev/null +++ b/indra/llinventory/llinventorydefines.h @@ -0,0 +1,106 @@ +/** + * @file llinventorydefines.h + * @brief LLInventoryDefines + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2009, 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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. + * $/LicenseInfo$ + */ + +#ifndef LL_LLINVENTORYDEFINES_H +#define LL_LLINVENTORYDEFINES_H + +// Consts for "key" field in the task inventory update message +extern const U8 TASK_INVENTORY_ITEM_KEY; +extern const U8 TASK_INVENTORY_ASSET_KEY; + +// Max inventory buffer size (for use in packBinaryBucket) +enum +{ + MAX_INVENTORY_BUFFER_SIZE = 1024 +}; + +//-------------------------------------------------------------------- +// Inventory item flags enums +// The shared flags at the top are shared among all inventory +// types. After that section, all values of flags are type +// dependent. The shared flags will start at 2^30 and work +// down while item type specific flags will start at 2^0 and work up. +//-------------------------------------------------------------------- +class LLInventoryItemFlags +{ +public: + enum EType + { + II_FLAGS_NONE = 0, + + II_FLAGS_SHARED_SINGLE_REFERENCE = 0x40000000, + // The asset has only one reference in the system. If the + // inventory item is deleted, or the assetid updated, then we + // can remove the old reference. + + II_FLAGS_LANDMARK_VISITED = 1, + + II_FLAGS_OBJECT_SLAM_PERM = 0x100, + // Object permissions should have next owner perm be more + // restrictive on rez. We bump this into the second byte of the + // flags since the low byte is used to track attachment points. + + II_FLAGS_OBJECT_SLAM_SALE = 0x1000, + // The object sale information has been changed. + + II_FLAGS_OBJECT_PERM_OVERWRITE_BASE = 0x010000, + II_FLAGS_OBJECT_PERM_OVERWRITE_OWNER = 0x020000, + II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP = 0x040000, + II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE = 0x080000, + II_FLAGS_OBJECT_PERM_OVERWRITE_NEXT_OWNER = 0x100000, + // Specify which permissions masks to overwrite + // upon rez. Normally, if no permissions slam (above) or + // overwrite flags are set, the asset's permissions are + // used and the inventory's permissions are ignored. If + // any of these flags are set, the inventory's permissions + // take precedence. + + II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS = 0x200000, + // Whether a returned object is composed of multiple items. + + II_FLAGS_WEARABLES_MASK = 0xff, + // Wearables use the low order byte of flags to store the + // LLWearableType::EType enumeration found in newview/llwearable.h + + II_FLAGS_PERM_OVERWRITE_MASK = (II_FLAGS_OBJECT_SLAM_PERM | + II_FLAGS_OBJECT_SLAM_SALE | + II_FLAGS_OBJECT_PERM_OVERWRITE_BASE | + II_FLAGS_OBJECT_PERM_OVERWRITE_OWNER | + II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP | + II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE | + II_FLAGS_OBJECT_PERM_OVERWRITE_NEXT_OWNER), + // These bits need to be cleared whenever the asset_id is updated + // on a pre-existing inventory item (DEV-28098 and DEV-30997) + }; +}; + +#endif // LL_LLINVENTORYDEFINES_H diff --git a/indra/llinventory/llinventorytype.cpp b/indra/llinventory/llinventorytype.cpp index c268625064..5c5500b6f4 100644 --- a/indra/llinventory/llinventorytype.cpp +++ b/indra/llinventory/llinventorytype.cpp @@ -90,7 +90,6 @@ LLInventoryDictionary::LLInventoryDictionary() addEntry(LLInventoryType::IT_ANIMATION, new InventoryEntry("animation", "animation", 1, LLAssetType::AT_ANIMATION)); addEntry(LLInventoryType::IT_GESTURE, new InventoryEntry("gesture", "gesture", 1, LLAssetType::AT_GESTURE)); addEntry(LLInventoryType::IT_MESH, new InventoryEntry("mesh", "mesh", 1, LLAssetType::AT_MESH)); - } @@ -150,7 +149,6 @@ DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] = LLInventoryType::IT_NONE, // AT_NONE LLInventoryType::IT_NONE, // AT_NONE LLInventoryType::IT_NONE, // AT_NONE - LLInventoryType::IT_MESH // AT_MESH }; @@ -210,6 +208,10 @@ bool LLInventoryType::cannotRestrictPermissions(LLInventoryType::EType type) bool inventory_and_asset_types_match(LLInventoryType::EType inventory_type, LLAssetType::EType asset_type) { + // Links can be of any inventory type. + if (LLAssetType::lookupIsLinkType(asset_type)) + return true; + const InventoryEntry *entry = LLInventoryDictionary::getInstance()->lookup(inventory_type); if (!entry) return false; diff --git a/indra/llinventory/llinventorytype.h b/indra/llinventory/llinventorytype.h index af426b9007..17ed3df951 100644 --- a/indra/llinventory/llinventorytype.h +++ b/indra/llinventory/llinventorytype.h @@ -67,7 +67,6 @@ public: IT_WEARABLE = 18, IT_ANIMATION = 19, IT_GESTURE = 20, - IT_MESH = 22, IT_COUNT = 23, @@ -77,7 +76,6 @@ public: // machine transation between type and strings static EType lookup(const std::string& name); static const std::string &lookup(EType type); - // translation from a type to a human readable form. static const std::string &lookupHumanReadable(EType type); diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp index b08cb28218..d741cc855b 100644 --- a/indra/llinventory/llparcel.cpp +++ b/indra/llinventory/llparcel.cpp @@ -58,7 +58,6 @@ static const std::string PARCEL_OWNERSHIP_STATUS_STRING[LLParcel::OS_COUNT+1] = }; // NOTE: Adding parcel categories also requires updating: -// * floater_directory.xml category combobox // * floater_about_land.xml category combobox // * Web site "create event" tools // DO NOT DELETE ITEMS FROM THIS LIST WITHOUT DEEPLY UNDERSTANDING WHAT YOU'RE DOING. |