summaryrefslogtreecommitdiff
path: root/indra/llinventory
diff options
context:
space:
mode:
authorAndrew Meadows <andrew@lindenlab.com>2009-04-01 17:11:37 +0000
committerAndrew Meadows <andrew@lindenlab.com>2009-04-01 17:11:37 +0000
commit3d4e04b5569952629f68c52c9309b5364e16136c (patch)
tree16bf58109074959695886f7125170c37b095cd90 /indra/llinventory
parenta8525c90b9ab0544583585cf887388b64ee1323f (diff)
QAR-1284 ip-takedown tools simulator work is ready for merge
svn merge -r115879:116020 svn+ssh://svn.lindenlab.com/svn/linden/branches/dmcat/dmcat-5 no conflicts
Diffstat (limited to 'indra/llinventory')
-rw-r--r--indra/llinventory/llinventory.cpp23
-rw-r--r--indra/llinventory/llinventory.h87
-rw-r--r--indra/llinventory/llsaleinfo.cpp2
-rw-r--r--indra/llinventory/llsaleinfo.h2
4 files changed, 18 insertions, 96 deletions
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp
index b1cfd68668..4dddd9de3e 100644
--- a/indra/llinventory/llinventory.cpp
+++ b/indra/llinventory/llinventory.cpp
@@ -333,15 +333,6 @@ void LLInventoryItem::copyItem(const LLInventoryItem* other)
mCreationDate = other->mCreationDate;
}
-// As a constructor alternative, the clone() method works like a
-// copy constructor, but gens a new UUID.
-void LLInventoryItem::cloneItem(LLPointer<LLInventoryItem>& newitem) const
-{
- newitem = new LLInventoryItem;
- newitem->copyItem(this);
- newitem->mUUID.generate();
-}
-
const LLPermissions& LLInventoryItem::getPermissions() const
{
return mPermissions;
@@ -934,6 +925,12 @@ BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL inclu
LLSD LLInventoryItem::asLLSD() const
{
LLSD sd = LLSD();
+ asLLSD(sd);
+ return sd;
+}
+
+void LLInventoryItem::asLLSD( LLSD& sd ) const
+{
sd[INV_ITEM_ID_LABEL] = mUUID;
sd[INV_PARENT_ID_LABEL] = mParentUUID;
sd[INV_PERMISSIONS_LABEL] = ll_create_sd_from_permissions(mPermissions);
@@ -965,11 +962,9 @@ LLSD LLInventoryItem::asLLSD() const
sd[INV_NAME_LABEL] = mName;
sd[INV_DESC_LABEL] = mDescription;
sd[INV_CREATION_DATE_LABEL] = (S32) mCreationDate;
-
- return sd;
}
-bool LLInventoryItem::fromLLSD(LLSD& sd)
+bool LLInventoryItem::fromLLSD(const LLSD& sd)
{
mInventoryType = LLInventoryType::IT_NONE;
mAssetUUID.setNull();
@@ -1419,7 +1414,7 @@ void LLInventoryCategory::packMessage(LLMessageSystem* msg) const
msg->addStringFast(_PREHASH_Name, mName);
}
-bool LLInventoryCategory::fromLLSD(LLSD& sd)
+bool LLInventoryCategory::fromLLSD(const LLSD& sd)
{
std::string w;
@@ -1661,6 +1656,7 @@ LLSD ll_create_sd_from_inventory_item(LLPointer<LLInventoryItem> item)
return rv;
}
+/* deprecated, use LLInventoryItem::fromLLSD() instead
LLPointer<LLInventoryItem> ll_create_item_from_sd(const LLSD& sd_item)
{
LLPointer<LLInventoryItem> rv = new LLInventoryItem;
@@ -1690,6 +1686,7 @@ LLPointer<LLInventoryItem> ll_create_item_from_sd(const LLSD& sd_item)
rv->setCreationDate(sd_item[INV_CREATION_DATE_LABEL].asInteger());
return rv;
}
+*/
LLSD ll_create_sd_from_inventory_category(LLPointer<LLInventoryCategory> cat)
{
diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h
index 937e12dbcf..53a52cd324 100644
--- a/indra/llinventory/llinventory.h
+++ b/indra/llinventory/llinventory.h
@@ -89,7 +89,7 @@ public:
void copyObject(const LLInventoryObject* other); // LLRefCount requires custom copy
// accessors
- const LLUUID& getUUID() const;
+ virtual const LLUUID& getUUID() const;
const LLUUID& getParentUUID() const;
const std::string& getName() const;
LLAssetType::EType getType() const;
@@ -225,10 +225,7 @@ public:
LLInventoryItem(const LLInventoryItem* other);
virtual void copyItem(const LLInventoryItem* other); // LLRefCount requires custom copy
- // As a constructor alternative, the clone() method works like a
- // copy constructor, but gens a new UUID.
- // It is up to the caller to delete (unref) the item.
- virtual void cloneItem(LLPointer<LLInventoryItem>& newitem) const;
+ void generateUUID() { mUUID.generate(); }
// accessors
const LLPermissions& getPermissions() const;
@@ -276,7 +273,8 @@ public:
S32 packBinaryBucket(U8* bin_bucket, LLPermissions* perm_override = NULL) const;
void unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size);
LLSD asLLSD() const;
- bool fromLLSD(LLSD& sd);
+ void asLLSD( LLSD& sd ) const;
+ bool fromLLSD(const LLSD& sd);
};
@@ -317,7 +315,7 @@ public:
virtual void unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0);
LLSD asLLSD() const;
- bool fromLLSD(LLSD& sd);
+ bool fromLLSD(const LLSD& sd);
// file support
virtual BOOL importFile(LLFILE* fp);
@@ -338,85 +336,12 @@ protected:
// Useful bits
//-----------------------------------------------------------------------------
-// This functor tests if an item is transferrable and returns true if
-// it is. Derived from unary_function<> so that the object can be used
-// in stl-compliant adaptable predicates (eg, not1<>). You might want
-// to use this in std::partition() or similar logic.
-struct IsItemTransferable : public std::unary_function<LLInventoryItem*, bool>
-{
- LLUUID mDestID;
- IsItemTransferable(const LLUUID& dest_id) : mDestID(dest_id) {}
- bool operator()(const LLInventoryItem* item) const
- {
- return (item->getPermissions().allowTransferTo(mDestID)) ? true:false;
- }
-};
-
-// This functor is used to set the owner and group of inventory items,
-// for example, in a simple std::for_each() loop. Note that the call
-// to setOwnerAndGroup can fail if authority_id != LLUUID::null.
-struct SetItemOwnerAndGroup
-{
- LLUUID mAuthorityID;
- LLUUID mOwnerID;
- LLUUID mGroupID;
- SetItemOwnerAndGroup(const LLUUID& authority_id,
- const LLUUID& owner_id,
- const LLUUID& group_id) :
- mAuthorityID(authority_id), mOwnerID(owner_id), mGroupID(group_id) {}
- void operator()(LLInventoryItem* item) const
- {
- LLPermissions perm = item->getPermissions();
- bool is_atomic = (LLAssetType::AT_OBJECT == item->getType()) ? false : true;
- perm.setOwnerAndGroup(mAuthorityID, mOwnerID, mGroupID, is_atomic);
- // If no owner id is set, this is equivalent to a deed action.
- // Clear 'share with group'.
- if (mOwnerID.isNull())
- {
- perm.setMaskGroup(PERM_NONE);
- }
- item->setPermissions(perm);
- }
-};
-
-// This functor is used to unset the share with group, everyone perms, and
-// for sale info for objects being sold through contents.
-struct SetNotForSale
-{
- LLUUID mAgentID;
- LLUUID mGroupID;
- SetNotForSale(const LLUUID& agent_id,
- const LLUUID& group_id) :
- mAgentID(agent_id), mGroupID(group_id) {}
- void operator()(LLInventoryItem* item) const
- {
- // Clear group & everyone permissions.
- LLPermissions perm = item->getPermissions();
- perm.setGroupBits(mAgentID, mGroupID, FALSE, PERM_MODIFY | PERM_MOVE | PERM_COPY);
- perm.setEveryoneBits(mAgentID, mGroupID, FALSE, PERM_MOVE | PERM_COPY);
- item->setPermissions(perm);
-
- // Mark group & everyone permissions for overwrite on the next
- // rez if it is an object.
- if(LLAssetType::AT_OBJECT == item->getType())
- {
- U32 flags = item->getFlags();
- flags |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
- flags |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
- item->setFlags(flags);
- }
-
- // Clear for sale info.
- item->setSaleInfo(LLSaleInfo::DEFAULT);
- }
-};
-
typedef std::list<LLPointer<LLInventoryObject> > InventoryObjectList;
// These functions convert between structured data and an inventroy
// 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);
+//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/llsaleinfo.cpp b/indra/llinventory/llsaleinfo.cpp
index 11709bc593..b7afb28adf 100644
--- a/indra/llinventory/llsaleinfo.cpp
+++ b/indra/llinventory/llsaleinfo.cpp
@@ -111,7 +111,7 @@ LLSD LLSaleInfo::asLLSD() const
return sd;
}
-bool LLSaleInfo::fromLLSD(LLSD& sd, BOOL& has_perm_mask, U32& perm_mask)
+bool LLSaleInfo::fromLLSD(const LLSD& sd, BOOL& has_perm_mask, U32& perm_mask)
{
const char *w;
diff --git a/indra/llinventory/llsaleinfo.h b/indra/llinventory/llsaleinfo.h
index 07f440527b..d546c49fd7 100644
--- a/indra/llinventory/llsaleinfo.h
+++ b/indra/llinventory/llsaleinfo.h
@@ -98,7 +98,7 @@ public:
BOOL exportLegacyStream(std::ostream& output_stream) const;
LLSD asLLSD() const;
operator LLSD() const { return asLLSD(); }
- bool fromLLSD(LLSD& sd, BOOL& has_perm_mask, U32& perm_mask);
+ bool fromLLSD(const LLSD& sd, BOOL& has_perm_mask, U32& perm_mask);
BOOL importLegacyStream(std::istream& input_stream, BOOL& has_perm_mask, U32& perm_mask);
LLXMLNode *exportFileXML() const;