Removed exportFileXML, and importXML, updated indra/test's
and generally updated cpp's to V-D look(include order, spelling fixes, and whatnot) Also, commented out pointless using namespace std.
This commit is contained in:
@@ -45,9 +45,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");
|
||||
@@ -1199,109 +1198,8 @@ fail:
|
||||
|
||||
}
|
||||
|
||||
LLXMLNode *LLInventoryItem::exportFileXML(BOOL include_asset_key) const
|
||||
{
|
||||
LLMemType m1(LLMemType::MTYPE_INVENTORY);
|
||||
LLXMLNode *ret = new LLXMLNode("item", FALSE);
|
||||
|
||||
ret->createChild("uuid", TRUE)->setUUIDValue(1, &mUUID);
|
||||
ret->createChild("parent_uuid", TRUE)->setUUIDValue(1, &mParentUUID);
|
||||
|
||||
mPermissions.exportFileXML()->setParent(ret);
|
||||
|
||||
// Check for permissions to see the asset id, and if so write it
|
||||
// out as an asset id. Otherwise, apply our cheesy encryption.
|
||||
if(include_asset_key)
|
||||
{
|
||||
U32 mask = mPermissions.getMaskBase();
|
||||
if(((mask & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED)
|
||||
|| (mAssetUUID.isNull()))
|
||||
{
|
||||
ret->createChild("asset_id", FALSE)->setUUIDValue(1, &mAssetUUID);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLUUID shadow_id(mAssetUUID);
|
||||
LLXORCipher cipher(MAGIC_ID.mData, UUID_BYTES);
|
||||
cipher.encrypt(shadow_id.mData, UUID_BYTES);
|
||||
|
||||
ret->createChild("shadow_id", FALSE)->setUUIDValue(1, &shadow_id);
|
||||
}
|
||||
}
|
||||
|
||||
std::string type_str = LLAssetType::lookup(mType);
|
||||
std::string inv_type_str = LLInventoryType::lookup(mInventoryType);
|
||||
|
||||
ret->createChild("asset_type", FALSE)->setStringValue(type_str);
|
||||
ret->createChild("inventory_type", FALSE)->setStringValue(inv_type_str);
|
||||
S32 tmp_flags = (S32) mFlags;
|
||||
ret->createChild("flags", FALSE)->setByteValue(4, (U8*)(&tmp_flags), LLXMLNode::ENCODING_HEX);
|
||||
|
||||
mSaleInfo.exportFileXML()->setParent(ret);
|
||||
|
||||
std::string temp;
|
||||
temp.assign(mName);
|
||||
ret->createChild("name", FALSE)->setStringValue(temp);
|
||||
temp.assign(mDescription);
|
||||
ret->createChild("description", FALSE)->setStringValue(temp);
|
||||
S32 date = mCreationDate;
|
||||
ret->createChild("creation_date", FALSE)->setIntValue(1, &date);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL LLInventoryItem::importXML(LLXMLNode* node)
|
||||
{
|
||||
BOOL success = FALSE;
|
||||
if (node)
|
||||
{
|
||||
success = TRUE;
|
||||
LLXMLNodePtr sub_node;
|
||||
if (node->getChild("uuid", sub_node))
|
||||
success = (1 == sub_node->getUUIDValue(1, &mUUID));
|
||||
if (node->getChild("parent_uuid", sub_node))
|
||||
success = success && (1 == sub_node->getUUIDValue(1, &mParentUUID));
|
||||
if (node->getChild("permissions", sub_node))
|
||||
success = success && mPermissions.importXML(sub_node);
|
||||
if (node->getChild("asset_id", sub_node))
|
||||
success = success && (1 == sub_node->getUUIDValue(1, &mAssetUUID));
|
||||
if (node->getChild("shadow_id", sub_node))
|
||||
{
|
||||
success = success && (1 == sub_node->getUUIDValue(1, &mAssetUUID));
|
||||
LLXORCipher cipher(MAGIC_ID.mData, UUID_BYTES);
|
||||
cipher.decrypt(mAssetUUID.mData, UUID_BYTES);
|
||||
}
|
||||
if (node->getChild("asset_type", sub_node))
|
||||
mType = LLAssetType::lookup(sub_node->getValue());
|
||||
if (node->getChild("inventory_type", sub_node))
|
||||
mInventoryType = LLInventoryType::lookup(sub_node->getValue());
|
||||
if (node->getChild("flags", sub_node))
|
||||
{
|
||||
S32 tmp_flags = 0;
|
||||
success = success && (1 == sub_node->getIntValue(1, &tmp_flags));
|
||||
mFlags = (U32) tmp_flags;
|
||||
}
|
||||
if (node->getChild("sale_info", sub_node))
|
||||
success = success && mSaleInfo.importXML(sub_node);
|
||||
if (node->getChild("name", sub_node))
|
||||
mName = sub_node->getValue();
|
||||
if (node->getChild("description", sub_node))
|
||||
mDescription = sub_node->getValue();
|
||||
if (node->getChild("creation_date", sub_node))
|
||||
{
|
||||
S32 date = 0;
|
||||
success = success && (1 == sub_node->getIntValue(1, &date));
|
||||
mCreationDate = date;
|
||||
}
|
||||
|
||||
if (!success)
|
||||
{
|
||||
lldebugs << "LLInventory::importXML() failed for node named '"
|
||||
<< node->getName() << "'" << llendl;
|
||||
}
|
||||
}
|
||||
return success;
|
||||
}
|
||||
// Deleted LLInventoryItem::exportFileXML() and LLInventoryItem::importXML()
|
||||
// because I can't find any non-test code references to it. 2009-05-04 JC
|
||||
|
||||
S32 LLInventoryItem::packBinaryBucket(U8* bin_bucket, LLPermissions* perm_override) const
|
||||
{
|
||||
|
||||
@@ -214,15 +214,11 @@ public:
|
||||
virtual BOOL importLegacyStream(std::istream& input_stream);
|
||||
virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const;
|
||||
|
||||
virtual LLXMLNode *exportFileXML(BOOL include_asset_key = TRUE) const;
|
||||
BOOL importXML(LLXMLNode* node);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// 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;
|
||||
@@ -249,7 +245,6 @@ protected:
|
||||
// items. Users come with a set of default categories, and can create
|
||||
// new ones as needed.
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
class LLInventoryCategory : public LLInventoryObject
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -853,67 +853,8 @@ BOOL LLPermissions::exportLegacyStream(std::ostream& output_stream) const
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
LLXMLNode *LLPermissions::exportFileXML() const
|
||||
{
|
||||
LLXMLNode *ret = new LLXMLNode("permissions", FALSE);
|
||||
|
||||
ret->createChild("group_owned", TRUE)->setBoolValue(mIsGroupOwned);
|
||||
|
||||
ret->createChild("base_mask", FALSE)->setByteValue(4, (U8*)&mMaskBase, LLXMLNode::ENCODING_HEX);
|
||||
ret->createChild("owner_mask", FALSE)->setByteValue(4, (U8*)&mMaskOwner, LLXMLNode::ENCODING_HEX);
|
||||
ret->createChild("group_mask", FALSE)->setByteValue(4, (U8*)&mMaskGroup, LLXMLNode::ENCODING_HEX);
|
||||
ret->createChild("everyone_mask", FALSE)->setByteValue(4, (U8*)&mMaskEveryone, LLXMLNode::ENCODING_HEX);
|
||||
ret->createChild("next_owner_mask", FALSE)->setByteValue(4, (U8*)&mMaskNextOwner, LLXMLNode::ENCODING_HEX);
|
||||
|
||||
ret->createChild("creator_id", FALSE)->setUUIDValue(1, &mCreator);
|
||||
ret->createChild("owner_id", FALSE)->setUUIDValue(1, &mOwner);
|
||||
ret->createChild("last_owner_id", FALSE)->setUUIDValue(1, &mLastOwner);
|
||||
ret->createChild("group_id", FALSE)->setUUIDValue(1, &mGroup);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool LLPermissions::importXML(LLXMLNode* node)
|
||||
{
|
||||
bool success = false;
|
||||
if (node)
|
||||
{
|
||||
success = true;
|
||||
LLXMLNodePtr sub_node;
|
||||
if (node->getChild("base_mask", sub_node))
|
||||
success = success && (4 == sub_node->getByteValue(4, (U8*)&mMaskBase));
|
||||
if (node->getChild("owner_mask", sub_node))
|
||||
success = success && (4 == sub_node->getByteValue(4, (U8*)&mMaskOwner));
|
||||
if (node->getChild("group_mask", sub_node))
|
||||
success = success && (4 == sub_node->getByteValue(4, (U8*)&mMaskGroup));
|
||||
if (node->getChild("everyone_mask", sub_node))
|
||||
success = success && (4 == sub_node->getByteValue(4, (U8*)&mMaskEveryone));
|
||||
if (node->getChild("next_owner_mask", sub_node))
|
||||
success = success && (4 == sub_node->getByteValue(4, (U8*)&mMaskNextOwner));
|
||||
|
||||
if (node->getChild("creator_id", sub_node))
|
||||
success = success && (1 == sub_node->getUUIDValue(1, &mCreator));
|
||||
if (node->getChild("owner_id", sub_node))
|
||||
success = success && (1 == sub_node->getUUIDValue(1, &mOwner));
|
||||
if (node->getChild("last_owner_id", sub_node))
|
||||
success = success && (1 == sub_node->getUUIDValue(1, &mLastOwner));
|
||||
if (node->getChild("group_id", sub_node))
|
||||
success = success && (1 == sub_node->getUUIDValue(1, &mGroup));
|
||||
if (node->getChild("group_owned", sub_node))
|
||||
{
|
||||
BOOL tmpbool = FALSE;
|
||||
success = success && (1 == sub_node->getBoolValue(1, &tmpbool));
|
||||
mIsGroupOwned = (bool)tmpbool;
|
||||
}
|
||||
if (!success)
|
||||
{
|
||||
lldebugs << "LLPermissions::importXML() failed for node named '"
|
||||
<< node->getName() << "'" << llendl;
|
||||
}
|
||||
}
|
||||
return success;
|
||||
}
|
||||
// Deleted LLPermissions::exportFileXML() and LLPermissions::importXML()
|
||||
// because I can't find any non-test code references to it. 2009-05-04 JC
|
||||
|
||||
bool LLPermissions::operator==(const LLPermissions &rhs) const
|
||||
{
|
||||
|
||||
@@ -149,7 +149,7 @@ public:
|
||||
const LLUUID& getGroup() const { return mGroup; }
|
||||
|
||||
// return the agent_id of the last agent owner. Only returns
|
||||
// LLUUID::null if there has never been a previous owner.
|
||||
// LLUUID::null if there has never been a previous owner (*note: this is apparently not true, say for textures in inventory, it may return LLUUID::null even if there was a previous owner).
|
||||
const LLUUID& getLastOwner() const { return mLastOwner; }
|
||||
|
||||
U32 getMaskBase() const { return mMaskBase; }
|
||||
@@ -235,6 +235,7 @@ public:
|
||||
// Last owner doesn't have much in the way of permissions so it's
|
||||
//not too dangerous to do this.
|
||||
void setLastOwner(const LLUUID& last_owner);
|
||||
|
||||
// saves last owner, sets owner to uuid null, sets group
|
||||
// owned. group_id must be the group of the object (that's who it
|
||||
// is being deeded to) and the object must be group
|
||||
@@ -324,9 +325,6 @@ public:
|
||||
BOOL importLegacyStream(std::istream& input_stream);
|
||||
BOOL exportLegacyStream(std::ostream& output_stream) const;
|
||||
|
||||
LLXMLNode *exportFileXML() const;
|
||||
bool importXML(LLXMLNode* node);
|
||||
|
||||
bool operator==(const LLPermissions &rhs) const;
|
||||
bool operator!=(const LLPermissions &rhs) const;
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
#include <iostream>
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "llsaleinfo.h"
|
||||
|
||||
@@ -135,38 +135,8 @@ bool LLSaleInfo::fromLLSD(const LLSD& sd, BOOL& has_perm_mask, U32& perm_mask)
|
||||
return true;
|
||||
}
|
||||
|
||||
LLXMLNode *LLSaleInfo::exportFileXML() const
|
||||
{
|
||||
LLXMLNode *ret = new LLXMLNode("sale_info", FALSE);
|
||||
std::string type_str = ll_safe_string( lookup(mSaleType));
|
||||
ret->createChild("type", TRUE)->setStringValue(1, &type_str);
|
||||
ret->createChild("price", TRUE)->setIntValue(1, &mSalePrice);
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL LLSaleInfo::importXML(LLXMLNode* node)
|
||||
{
|
||||
BOOL success = FALSE;
|
||||
if (node)
|
||||
{
|
||||
success = TRUE;
|
||||
LLXMLNodePtr sub_node;
|
||||
if (node->getChild("type", sub_node))
|
||||
{
|
||||
mSaleType = lookup(sub_node->getValue().c_str());
|
||||
}
|
||||
if (node->getChild("price", sub_node))
|
||||
{
|
||||
success &= (1 == sub_node->getIntValue(1, &mSalePrice));
|
||||
}
|
||||
if (!success)
|
||||
{
|
||||
lldebugs << "LLSaleInfo::importXML() failed for node named '"
|
||||
<< node->getName() << "'" << llendl;
|
||||
}
|
||||
}
|
||||
return success;
|
||||
}
|
||||
// Deleted LLSaleInfo::exportFileXML() and LLSaleInfo::importXML()
|
||||
// because I can't find any non-test code references to it. 2009-05-04 JC
|
||||
|
||||
BOOL LLSaleInfo::importFile(LLFILE* fp, BOOL& has_perm_mask, U32& perm_mask)
|
||||
{
|
||||
|
||||
@@ -101,9 +101,6 @@ public:
|
||||
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;
|
||||
BOOL importXML(LLXMLNode* node);
|
||||
|
||||
LLSD packMessage() const;
|
||||
void unpackMessage(LLSD sales);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user