summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2009-07-24 00:46:26 +0000
committerLoren Shih <seraph@lindenlab.com>2009-07-24 00:46:26 +0000
commit17b9cda4325a035f00e077a6a8e33a8c4f2d5a89 (patch)
tree61cf3566c5162237104dfeec8c9332aa34883aa3 /indra/llcommon
parent858f7846715f5182ed9b5e8da7f98ae972297b10 (diff)
For QAR-1710 : Server merge for QAR-1594 QAR-1643 QAR-1644 - "AVP Changes [SIM]"
svn merge -r 128022:128028 svn+ssh://svn.lindenlab.com/svn/linden/branches/avatar-pipeline/server__merge__trunk-r127980 to svn+ssh://svn.lindenlab.com/svn/linden/trunk This is the server-side merge for inventory links, folder links&types, and landmark&callingcard permissions.
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/CMakeLists.txt1
-rw-r--r--indra/llcommon/llassettype.cpp340
-rw-r--r--indra/llcommon/llassettype.h170
-rw-r--r--indra/llcommon/lldictionary.h106
-rw-r--r--indra/llcommon/stdenums.h3
5 files changed, 392 insertions, 228 deletions
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index beac8df636..7bfcd43684 100644
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -99,6 +99,7 @@ set(llcommon_HEADER_FILES
lldefs.h
lldependencies.h
lldepthstack.h
+ lldictionary.h
lldlinked.h
lldqueueptr.h
llendianswizzle.h
diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp
index cf3bf89b4f..b852e4c00f 100644
--- a/indra/llcommon/llassettype.cpp
+++ b/indra/llcommon/llassettype.cpp
@@ -33,145 +33,125 @@
#include "linden_common.h"
#include "llassettype.h"
+#include "lldictionary.h"
+#include "llmemory.h"
-#include "llstring.h"
-#include "lltimer.h"
+///----------------------------------------------------------------------------
+/// Class LLAssetType
+///----------------------------------------------------------------------------
+struct AssetEntry : public LLDictionaryEntry
+{
+ AssetEntry(const char *desc_name,
+ const char *type_name, // 8 character limit!
+ const char *human_name, // for decoding to human readable form; put any and as many printable characters you want in each one
+ const char *category_name, // used by llinventorymodel when creating new categories
+ EDragAndDropType dad_type,
+ bool can_link, // can you create a link to this type?
+ bool is_protected) // can the viewer change categories of this type?
+ :
+ LLDictionaryEntry(desc_name),
+ mTypeName(type_name),
+ mHumanName(human_name),
+ mCategoryName(category_name),
+ mDadType(dad_type),
+ mCanLink(can_link),
+ mIsProtected(is_protected)
+ {
+ llassert(strlen(mTypeName) <= 8);
+ }
-// I added lookups for exact text of asset type enums in addition to the ones below, so shoot me. -Steve
+ const char *mTypeName;
+ const char *mHumanName;
+ const char *mCategoryName;
+ EDragAndDropType mDadType;
+ bool mCanLink;
+ bool mIsProtected;
+};
-struct asset_info_t
+class LLAssetDictionary : public LLSingleton<LLAssetDictionary>,
+ public LLDictionary<LLAssetType::EType, AssetEntry>
{
- LLAssetType::EType type;
- const char* desc;
+public:
+ LLAssetDictionary();
};
-asset_info_t asset_types[] =
+LLAssetDictionary::LLAssetDictionary()
{
- { LLAssetType::AT_TEXTURE, "TEXTURE" },
- { LLAssetType::AT_SOUND, "SOUND" },
- { LLAssetType::AT_CALLINGCARD, "CALLINGCARD" },
- { LLAssetType::AT_LANDMARK, "LANDMARK" },
- { LLAssetType::AT_SCRIPT, "SCRIPT" },
- { LLAssetType::AT_CLOTHING, "CLOTHING" },
- { LLAssetType::AT_OBJECT, "OBJECT" },
- { LLAssetType::AT_NOTECARD, "NOTECARD" },
- { LLAssetType::AT_CATEGORY, "CATEGORY" },
- { LLAssetType::AT_ROOT_CATEGORY, "ROOT_CATEGORY" },
- { LLAssetType::AT_LSL_TEXT, "LSL_TEXT" },
- { LLAssetType::AT_LSL_BYTECODE, "LSL_BYTECODE" },
- { LLAssetType::AT_TEXTURE_TGA, "TEXTURE_TGA" },
- { LLAssetType::AT_BODYPART, "BODYPART" },
- { LLAssetType::AT_TRASH, "TRASH" },
- { LLAssetType::AT_SNAPSHOT_CATEGORY, "SNAPSHOT_CATEGORY" },
- { LLAssetType::AT_LOST_AND_FOUND, "LOST_AND_FOUND" },
- { LLAssetType::AT_SOUND_WAV, "SOUND_WAV" },
- { LLAssetType::AT_IMAGE_TGA, "IMAGE_TGA" },
- { LLAssetType::AT_IMAGE_JPEG, "IMAGE_JPEG" },
- { LLAssetType::AT_ANIMATION, "ANIMATION" },
- { LLAssetType::AT_GESTURE, "GESTURE" },
- { LLAssetType::AT_SIMSTATE, "SIMSTATE" },
- { LLAssetType::AT_NONE, "NONE" },
+ // DESCRIPTION TYPE NAME HUMAN NAME CATEGORY NAME DRAG&DROP CAN LINK? PROTECTED?
+ // |--------------------|-----------|-------------------|-------------------|---------------|-----------|-----------|
+ addEntry(LLAssetType::AT_TEXTURE, new AssetEntry("TEXTURE", "texture", "texture", "Textures", DAD_TEXTURE, FALSE, TRUE));
+ addEntry(LLAssetType::AT_SOUND, new AssetEntry("SOUND", "sound", "sound", "Sounds", DAD_SOUND, FALSE, TRUE));
+ addEntry(LLAssetType::AT_CALLINGCARD, new AssetEntry("CALLINGCARD", "callcard", "calling card", "Calling Cards", DAD_CALLINGCARD, FALSE, TRUE));
+ addEntry(LLAssetType::AT_LANDMARK, new AssetEntry("LANDMARK", "landmark", "landmark", "Landmarks", DAD_LANDMARK, FALSE, TRUE));
+ addEntry(LLAssetType::AT_SCRIPT, new AssetEntry("SCRIPT", "script", "legacy script", "Scripts", DAD_NONE, FALSE, TRUE));
+ addEntry(LLAssetType::AT_CLOTHING, new AssetEntry("CLOTHING", "clothing", "clothing", "Clothing", DAD_CLOTHING, TRUE, TRUE));
+ addEntry(LLAssetType::AT_OBJECT, new AssetEntry("OBJECT", "object", "object", "Objects", DAD_OBJECT, TRUE, TRUE));
+ addEntry(LLAssetType::AT_NOTECARD, new AssetEntry("NOTECARD", "notecard", "note card", "Notecards", DAD_NOTECARD, FALSE, TRUE));
+ addEntry(LLAssetType::AT_CATEGORY, new AssetEntry("CATEGORY", "category", "folder", "New Folder", DAD_CATEGORY, TRUE, TRUE));
+ addEntry(LLAssetType::AT_ROOT_CATEGORY, new AssetEntry("ROOT_CATEGORY", "root", "root", "Inventory", DAD_ROOT_CATEGORY, TRUE, TRUE));
+ addEntry(LLAssetType::AT_LSL_TEXT, new AssetEntry("LSL_TEXT", "lsltext", "lsl2 script", "Scripts", DAD_SCRIPT, FALSE, TRUE));
+ addEntry(LLAssetType::AT_LSL_BYTECODE, new AssetEntry("LSL_BYTECODE", "lslbyte", "lsl bytecode", "Scripts", DAD_NONE, FALSE, TRUE));
+ addEntry(LLAssetType::AT_TEXTURE_TGA, new AssetEntry("TEXTURE_TGA", "txtr_tga", "tga texture", "Uncompressed Images", DAD_NONE, FALSE, TRUE));
+ addEntry(LLAssetType::AT_BODYPART, new AssetEntry("BODYPART", "bodypart", "body part", "Body Parts", DAD_BODYPART, TRUE, TRUE));
+ addEntry(LLAssetType::AT_TRASH, new AssetEntry("TRASH", "trash", "trash", "Trash", DAD_NONE, FALSE, TRUE));
+ addEntry(LLAssetType::AT_SNAPSHOT_CATEGORY, new AssetEntry("SNAPSHOT_CATEGORY", "snapshot", "snapshot", "Photo Album", DAD_NONE, FALSE, TRUE));
+ addEntry(LLAssetType::AT_LOST_AND_FOUND, new AssetEntry("LOST_AND_FOUND", "lstndfnd", "lost and found", "Lost And Found", DAD_NONE, FALSE, TRUE));
+ addEntry(LLAssetType::AT_SOUND_WAV, new AssetEntry("SOUND_WAV", "snd_wav", "sound", "Uncompressed SoundS", DAD_NONE, FALSE, TRUE));
+ addEntry(LLAssetType::AT_IMAGE_TGA, new AssetEntry("IMAGE_TGA", "img_tga", "targa image", "Uncompressed Images", DAD_NONE, FALSE, TRUE));
+ addEntry(LLAssetType::AT_IMAGE_JPEG, new AssetEntry("IMAGE_JPEG", "jpeg", "jpeg image", "Uncompressed Images", DAD_NONE, FALSE, TRUE));
+ addEntry(LLAssetType::AT_ANIMATION, new AssetEntry("ANIMATION", "animatn", "animation", "Animations", DAD_ANIMATION, FALSE, TRUE));
+ addEntry(LLAssetType::AT_GESTURE, new AssetEntry("GESTURE", "gesture", "gesture", "Gestures", DAD_GESTURE, FALSE, TRUE));
+ addEntry(LLAssetType::AT_SIMSTATE, new AssetEntry("SIMSTATE", "simstate", "simstate", "New Folder", DAD_NONE, FALSE, TRUE));
+ addEntry(LLAssetType::AT_FAVORITE, new AssetEntry("FAVORITE", "favorite", "favorite", "favorite", DAD_NONE, FALSE, TRUE));
+
+ addEntry(LLAssetType::AT_LINK, new AssetEntry("LINK", "link", "symbolic link", "Link", DAD_LINK, FALSE, TRUE));
+ addEntry(LLAssetType::AT_LINK_FOLDER, new AssetEntry("FOLDER_LINK", "link_f", "symbolic folder link", "New Folder", DAD_LINK, FALSE, TRUE));
+
+ for (S32 ensemble_num = S32(LLAssetType::AT_FOLDER_ENSEMBLE_START);
+ ensemble_num <= S32(LLAssetType::AT_FOLDER_ENSEMBLE_END);
+ ensemble_num++)
+ {
+ addEntry(LLAssetType::EType(ensemble_num), new AssetEntry("ENSEMBLE", "ensemble", "ensemble", "New Folder", DAD_CATEGORY, TRUE, FALSE));
+ }
+
+ addEntry(LLAssetType::AT_CURRENT_OUTFIT, new AssetEntry("CURRENT", "current", "current outfit", "Current Outfit", DAD_CATEGORY, FALSE, TRUE));
+ addEntry(LLAssetType::AT_OUTFIT, new AssetEntry("OUTFIT", "outfit", "outfit", "Outfit", DAD_CATEGORY, TRUE, FALSE));
+ addEntry(LLAssetType::AT_MY_OUTFITS, new AssetEntry("MY_OUTFITS", "my_otfts", "my outfits", "My Outfits", DAD_CATEGORY, FALSE, TRUE));
+
+ addEntry(LLAssetType::AT_NONE, new AssetEntry("NONE", "-1", NULL, "New Folder", DAD_NONE, FALSE, FALSE));
};
-LLAssetType::EType LLAssetType::getType(const std::string& sin)
+// static
+LLAssetType::EType LLAssetType::getType(const std::string& desc_name)
{
- std::string s = sin;
+ std::string s = desc_name;
LLStringUtil::toUpper(s);
- for (S32 idx = 0; ;idx++)
- {
- asset_info_t* info = asset_types + idx;
- if (info->type == LLAssetType::AT_NONE)
- break;
- if (s == info->desc)
- return info->type;
- }
- return LLAssetType::AT_NONE;
+ return LLAssetDictionary::getInstance()->lookup(s);
}
-std::string LLAssetType::getDesc(LLAssetType::EType type)
+// static
+const std::string &LLAssetType::getDesc(LLAssetType::EType asset_type)
{
- for (S32 idx = 0; ;idx++)
+ const AssetEntry *entry = LLAssetDictionary::getInstance()->lookup(asset_type);
+ if (entry)
+ {
+ return entry->mName;
+ }
+ else
{
- asset_info_t* info = asset_types + idx;
- if (type == info->type)
- return info->desc;
- if (info->type == LLAssetType::AT_NONE)
- break;
+ static const std::string error_string = "BAD TYPE";
+ return error_string;
}
- return "BAD TYPE";
}
-//============================================================================
-
-// The asset type names are limited to 8 characters.
-// static
-const char* LLAssetType::mAssetTypeNames[LLAssetType::AT_COUNT] =
-{
- "texture",
- "sound",
- "callcard",
- "landmark",
- "script",
- "clothing",
- "object",
- "notecard",
- "category",
- "root",
- "lsltext",
- "lslbyte",
- "txtr_tga",// Intentionally spelled this way. Limited to eight characters.
- "bodypart",
- "trash",
- "snapshot",
- "lstndfnd",
- "snd_wav",
- "img_tga",
- "jpeg",
- "animatn",
- "gesture",
- "simstate"
-};
-
-// This table is meant for decoding to human readable form. Put any
-// and as many printable characters you want in each one.
-// See also llinventory.cpp INVENTORY_TYPE_HUMAN_NAMES
-const char* LLAssetType::mAssetTypeHumanNames[LLAssetType::AT_COUNT] =
-{
- "texture",
- "sound",
- "calling card",
- "landmark",
- "legacy script",
- "clothing",
- "object",
- "note card",
- "folder",
- "root",
- "lsl2 script",
- "lsl bytecode",
- "tga texture",
- "body part",
- "trash",
- "snapshot",
- "lost and found",
- "sound",
- "targa image",
- "jpeg image",
- "animation",
- "gesture",
- "simstate"
-};
-
-///----------------------------------------------------------------------------
-/// class LLAssetType
-///----------------------------------------------------------------------------
-
// static
-const char* LLAssetType::lookup( LLAssetType::EType type )
+const char *LLAssetType::lookup(LLAssetType::EType asset_type)
{
- if( (type >= 0) && (type < AT_COUNT ))
+ const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
+ const AssetEntry *entry = dict->lookup(asset_type);
+ if (entry)
{
- return mAssetTypeNames[ S32( type ) ];
+ return entry->mTypeName;
}
else
{
@@ -180,30 +160,35 @@ const char* LLAssetType::lookup( LLAssetType::EType type )
}
// static
-LLAssetType::EType LLAssetType::lookup( const char* name )
+LLAssetType::EType LLAssetType::lookup(const char* name)
{
return lookup(ll_safe_string(name));
}
-LLAssetType::EType LLAssetType::lookup( const std::string& name )
+LLAssetType::EType LLAssetType::lookup(const std::string& type_name)
{
- for( S32 i = 0; i < AT_COUNT; i++ )
+ const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
+ for (LLAssetDictionary::const_iterator iter = dict->begin();
+ iter != dict->end();
+ iter++)
{
- if( name == mAssetTypeNames[i] )
+ const AssetEntry *entry = iter->second;
+ if (type_name == entry->mTypeName)
{
- // match
- return (EType)i;
+ return iter->first;
}
}
return AT_NONE;
}
// static
-const char* LLAssetType::lookupHumanReadable(LLAssetType::EType type)
+const char *LLAssetType::lookupHumanReadable(LLAssetType::EType asset_type)
{
- if( (type >= 0) && (type < AT_COUNT ))
+ const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
+ const AssetEntry *entry = dict->lookup(asset_type);
+ if (entry)
{
- return mAssetTypeHumanNames[S32(type)];
+ return entry->mHumanName;
}
else
{
@@ -212,49 +197,94 @@ const char* LLAssetType::lookupHumanReadable(LLAssetType::EType type)
}
// static
-LLAssetType::EType LLAssetType::lookupHumanReadable( const char* name )
+LLAssetType::EType LLAssetType::lookupHumanReadable(const char* name)
{
return lookupHumanReadable(ll_safe_string(name));
}
-LLAssetType::EType LLAssetType::lookupHumanReadable( const std::string& name )
+LLAssetType::EType LLAssetType::lookupHumanReadable(const std::string& readable_name)
{
- for( S32 i = 0; i < AT_COUNT; i++ )
+ const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
+ for (LLAssetDictionary::const_iterator iter = dict->begin();
+ iter != dict->end();
+ iter++)
{
- if( name == mAssetTypeHumanNames[i] )
+ const AssetEntry *entry = iter->second;
+ if (readable_name == entry->mHumanName)
{
- // match
- return (EType)i;
+ return iter->first;
}
}
return AT_NONE;
}
-EDragAndDropType LLAssetType::lookupDragAndDropType( EType asset )
+// static
+const char *LLAssetType::lookupCategoryName(LLAssetType::EType asset_type)
+{
+ const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
+ const AssetEntry *entry = dict->lookup(asset_type);
+ if (entry)
+ {
+ return entry->mCategoryName;
+ }
+ else
+ {
+ return "New Folder";
+ }
+}
+
+// static
+EDragAndDropType LLAssetType::lookupDragAndDropType(EType asset_type)
+{
+ const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
+ const AssetEntry *entry = dict->lookup(asset_type);
+ if (entry)
+ return entry->mDadType;
+ else
+ return DAD_NONE;
+}
+
+// static
+bool LLAssetType::lookupCanLink(EType asset_type)
+{
+ const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
+ const AssetEntry *entry = dict->lookup(asset_type);
+ if (entry)
+ {
+ return entry->mCanLink;
+ }
+ return false;
+}
+
+// static
+// Not adding this to dictionary since we probably will only have these two types
+bool LLAssetType::lookupIsLinkType(EType asset_type)
+{
+ if (asset_type == AT_LINK || asset_type == AT_LINK_FOLDER)
+ {
+ return true;
+ }
+ return false;
+}
+
+// static
+// Only ensembles and plain folders aren't protected. "Protected" means
+// you can't change certain properties such as their type.
+bool LLAssetType::lookupIsProtectedCategoryType(EType asset_type)
{
- switch( asset )
+ const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
+ const AssetEntry *entry = dict->lookup(asset_type);
+ if (entry)
{
- case AT_TEXTURE: return DAD_TEXTURE;
- case AT_SOUND: return DAD_SOUND;
- case AT_CALLINGCARD: return DAD_CALLINGCARD;
- case AT_LANDMARK: return DAD_LANDMARK;
- case AT_SCRIPT: return DAD_NONE;
- case AT_CLOTHING: return DAD_CLOTHING;
- case AT_OBJECT: return DAD_OBJECT;
- case AT_NOTECARD: return DAD_NOTECARD;
- case AT_CATEGORY: return DAD_CATEGORY;
- case AT_ROOT_CATEGORY: return DAD_ROOT_CATEGORY;
- case AT_LSL_TEXT: return DAD_SCRIPT;
- case AT_BODYPART: return DAD_BODYPART;
- case AT_ANIMATION: return DAD_ANIMATION;
- case AT_GESTURE: return DAD_GESTURE;
- default: return DAD_NONE;
- };
+ return entry->mIsProtected;
+ }
+ return true;
}
+
// static. Generate a good default description
-void LLAssetType::generateDescriptionFor(LLAssetType::EType type,
- std::string& desc)
+void LLAssetType::generateDescriptionFor(LLAssetType::EType asset_type,
+ std::string& description)
{
const S32 BUF_SIZE = 30;
char time_str[BUF_SIZE]; /* Flawfinder: ignore */
@@ -262,6 +292,6 @@ void LLAssetType::generateDescriptionFor(LLAssetType::EType type,
time(&now);
memset(time_str, '\0', BUF_SIZE);
strftime(time_str, BUF_SIZE - 1, "%Y-%m-%d %H:%M:%S ", localtime(&now));
- desc.assign(time_str);
- desc.append(LLAssetType::lookupHumanReadable(type));
+ description.assign(time_str);
+ description.append(LLAssetType::lookupHumanReadable(asset_type));
}
diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h
index 4077b8d2c1..5c30c8354f 100644
--- a/indra/llcommon/llassettype.h
+++ b/indra/llcommon/llassettype.h
@@ -30,8 +30,8 @@
* $/LicenseInfo$
*/
-#ifndef LL_LLASSETTYPE
-#define LL_LLASSETTYPE
+#ifndef LL_LLASSETTYPE_H
+#define LL_LLASSETTYPE_H
#include <string>
@@ -42,137 +42,163 @@ class LLAssetType
public:
enum EType
{
- // Used for painting the faces of geometry.
- // Stored in typical j2c stream format
AT_TEXTURE = 0,
+ // Used for painting the faces of geometry.
+ // Stored in typical j2c stream format.
- // Used to fill the aural spectrum.
AT_SOUND = 1,
+ // Used to fill the aural spectrum.
- // Links instant message access to the user on the card. eg, a
- // card for yourself, a card for linden support, a card for
- // the guy you were talking to in the coliseum.
AT_CALLINGCARD = 2,
+ // Links instant message access to the user on the card.
+ // : E.G. A card for yourself, for linden support, for
+ // : the guy you were talking to in the coliseum.
- // Links to places in the world with location and a screen
- // shot or image saved. eg, home, linden headquarters, the
- // coliseum, or destinations where we want to increase
- // traffic.
AT_LANDMARK = 3,
+ // Links to places in the world with location and a screen shot or image saved.
+ // : E.G. Home, linden headquarters, the coliseum, destinations where
+ // : we want to increase traffic.
- // Valid scripts that can be attached to an object. eg. open a
- // door, jump into the air.
AT_SCRIPT = 4,
+ // Valid scripts that can be attached to an object.
+ // : E.G. Open a door, jump into the air.
- // A collection of textures and parameters that can be worn
- // by an avatar.
AT_CLOTHING = 5,
+ // A collection of textures and parameters that can be worn by an avatar.
- // Any combination of textures, sounds, and scripts that are
- // associated with a fixed piece of geometry. eg, a hot tub, a
- // house with working door.
AT_OBJECT = 6,
+ // Any combination of textures, sounds, and scripts that are
+ // associated with a fixed piece of geometry.
+ // : E.G. A hot tub, a house with working door.
- // Just text
AT_NOTECARD = 7,
+ // Just text.
- // A category holds a collection of inventory items. It's
- // treated as an item in the inventory, and therefore needs a
- // type.
AT_CATEGORY = 8,
+ // Holds a collection of inventory items.
+ // It's treated as an item in the inventory and therefore needs a type.
- // A root category is a user's root inventory category. We
- // decided to expose it visually, so it seems logical to fold
- // it into the asset types.
AT_ROOT_CATEGORY = 9,
+ // A user's root inventory category.
+ // We decided to expose it visually, so it seems logical to fold
+ // it into the asset types.
- // The LSL is the brand spanking new scripting language. We've
- // split it into a text and bytecode representation.
AT_LSL_TEXT = 10,
AT_LSL_BYTECODE = 11,
+ // The LSL is the scripting language.
+ // We've split it into a text and bytecode representation.
- // uncompressed TGA texture
AT_TEXTURE_TGA = 12,
+ // Uncompressed TGA texture.
- // A collection of textures and parameters that can be worn
- // by an avatar.
AT_BODYPART = 13,
+ // A collection of textures and parameters that can be worn by an avatar.
- // This asset type is meant to only be used as a marker for a
- // category preferred type. Using this, we can throw things in
- // the trash before completely deleting.
AT_TRASH = 14,
+ // Only to be used as a marker for a category preferred type.
+ // Using this, we can throw things in the trash before completely deleting.
- // This is a marker for a folder meant for snapshots. No
- // actual assets will be snapshots, though if there were, you
- // could interpret them as textures.
AT_SNAPSHOT_CATEGORY = 15,
+ // A marker for a folder meant for snapshots.
+ // No actual assets will be snapshots, though if there were, you
+ // could interpret them as textures.
- // This is used to stuff lost&found items into
AT_LOST_AND_FOUND = 16,
+ // Used to stuff lost&found items into.
- // uncompressed sound
AT_SOUND_WAV = 17,
+ // Uncompressed sound.
- // uncompressed image, non-square, and not appropriate for use
- // as a texture.
AT_IMAGE_TGA = 18,
+ // Uncompressed image, non-square.
+ // Not appropriate for use as a texture.
- // compressed image, non-square, and not appropriate for use
- // as a texture.
AT_IMAGE_JPEG = 19,
+ // Compressed image, non-square.
+ // Not appropriate for use as a texture.
- // animation
AT_ANIMATION = 20,
+ // Animation.
- // gesture, sequence of animations, sounds, chat, wait steps
AT_GESTURE = 21,
+ // Gesture, sequence of animations, sounds, chat, wait steps.
- // simstate file
AT_SIMSTATE = 22,
+ // Simstate file.
- // +*********************************************+
- // | TO ADD AN ELEMENT TO THIS ENUM: |
- // +*********************************************+
- // | 1. INSERT BEFORE AT_COUNT |
- // | 2. INCREMENT AT_COUNT BY 1 |
- // | 3. ADD TO LLAssetType::mAssetTypeNames |
- // | 4. ADD TO LLAssetType::mAssetTypeHumanNames |
- // +*********************************************+
+ AT_FAVORITE = 23,
+ // favorite items
- AT_COUNT = 23,
+ AT_LINK = 24,
+ // Inventory symbolic link
+
+ AT_LINK_FOLDER = 25,
+ // Inventory folder link
+
+ AT_FOLDER_ENSEMBLE_START = 26,
+ AT_FOLDER_ENSEMBLE_END = 45,
+ // This range is reserved for special clothing folder types.
+
+ AT_CURRENT_OUTFIT = 46,
+ // Current outfit
+
+ AT_OUTFIT = 47,
+ // Predefined outfit ("look")
+
+ AT_MY_OUTFITS = 48,
+ // Folder that holds your outfits.
+
+
+ AT_COUNT = 49,
+
+ // +*********************************************************+
+ // | TO ADD AN ELEMENT TO THIS ENUM: |
+ // +*********************************************************+
+ // | 1. INSERT BEFORE AT_COUNT |
+ // | 2. INCREMENT AT_COUNT BY 1 |
+ // | 3. ADD TO LLAssetDictionary in LLAssetType.cpp |
+ // | 3. ADD TO DEFAULT_ASSET_FOR_INV in LLInventoryType.cpp |
+ // +*********************************************************+
AT_NONE = -1
};
// machine transation between type and strings
- static EType lookup(const char* name); // safe conversion to std::string, *TODO: deprecate
- static EType lookup(const std::string& name);
- static const char* lookup(EType type);
+ static EType lookup(const char* name); // safe conversion to std::string, *TODO: deprecate
+ static EType lookup(const std::string& type_name);
+ static const char* lookup(EType asset_type);
// translation from a type to a human readable form.
- static EType lookupHumanReadable( const char* name ); // safe conversion to std::string, *TODO: deprecate
- static EType lookupHumanReadable( const std::string& name );
- static const char* lookupHumanReadable(EType type);
-
- static EDragAndDropType lookupDragAndDropType( EType );
+ static EType lookupHumanReadable(const char* desc_name); // safe conversion to std::string, *TODO: deprecate
+ static EType lookupHumanReadable(const std::string& readable_name);
+ static const char* lookupHumanReadable(EType asset_type);
// Generate a good default description. You may want to add a verb
// or agent name after this depending on your application.
- static void generateDescriptionFor(LLAssetType::EType type,
- std::string& desc);
+ static void generateDescriptionFor(LLAssetType::EType asset_type,
+ std::string& description);
+
+ static EType getType(const std::string& desc_name);
+ static const std::string& getDesc(EType asset_type);
+ static EDragAndDropType lookupDragAndDropType(EType asset_type);
+
+ static bool lookupCanLink(EType asset_type);
+ static bool lookupIsLinkType(EType asset_type);
- static EType getType(const std::string& sin);
- static std::string getDesc(EType type);
+ static const char* lookupCategoryName(EType asset_type);
+ static bool lookupIsProtectedCategoryType(EType asset_type);
+
+ /* TODO: Change return types from "const char *" to "const std::string &".
+ This is fairly straightforward, but requires changing some calls to use .c_str().
+ e.g.:
+ - fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType));
+ + fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType).c_str());
+ */
private:
// don't instantiate or derive one of these objects
LLAssetType( void ) {}
~LLAssetType( void ) {}
-
-private:
- static const char* mAssetTypeNames[];
- static const char* mAssetTypeHumanNames[];
};
-#endif // LL_LLASSETTYPE
+#endif // LL_LLASSETTYPE_H
diff --git a/indra/llcommon/lldictionary.h b/indra/llcommon/lldictionary.h
new file mode 100644
index 0000000000..436b689ca6
--- /dev/null
+++ b/indra/llcommon/lldictionary.h
@@ -0,0 +1,106 @@
+/**
+ * @file lldictionary.h
+ * @brief Lldictionary class header file
+ *
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ *
+ * Copyright (c) 2002-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.
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLDICTIONARY_H
+#define LL_LLDICTIONARY_H
+
+#include <map>
+
+struct LLDictionaryEntry
+{
+ LLDictionaryEntry(const std::string &name) :
+ mName(name)
+ {
+ mNameCapitalized = mName;
+ LLStringUtil::replaceChar(mNameCapitalized, '-', ' ');
+ LLStringUtil::replaceChar(mNameCapitalized, '_', ' ');
+ for (U32 i=0; i < mNameCapitalized.size(); i++)
+ {
+ if (i == 0 || mNameCapitalized[i-1] == ' ') // don't change ordering of this statement or crash
+ {
+ mNameCapitalized[i] = toupper(mNameCapitalized[i]);
+ }
+ }
+ }
+ virtual ~LLDictionaryEntry() {}
+ const std::string mName;
+ std::string mNameCapitalized;
+};
+
+template <class Index, class Entry>
+class LLDictionary : public std::map<Index, Entry *>
+{
+public:
+ typedef std::map<Index, Entry *> map_t;
+ typedef typename map_t::iterator iterator_t;
+ typedef typename map_t::const_iterator const_iterator_t;
+
+ LLDictionary() {}
+ virtual ~LLDictionary()
+ {
+ for (iterator_t iter = map_t::begin(); iter != map_t::end(); ++iter)
+ delete (iter->second);
+ }
+
+ const Entry *lookup(Index index) const
+ {
+ const_iterator_t dictionary_iter = map_t::find(index);
+ if (dictionary_iter == map_t::end()) return NULL;
+ return dictionary_iter->second;
+ }
+ const Index lookup(const std::string &name) const
+ {
+ for (const_iterator_t dictionary_iter = map_t::begin();
+ dictionary_iter != map_t::end();
+ dictionary_iter++)
+ {
+ const Entry *entry = dictionary_iter->second;
+ if (entry->mName == name)
+ {
+ return dictionary_iter->first;
+ }
+ }
+ llassert(false);
+ return Index(-1);
+ }
+
+protected:
+ void addEntry(Index index, Entry *entry)
+ {
+ if (lookup(index))
+ {
+ llerrs << "Dictionary entry already added (attempted to add duplicate entry)" << llendl;
+ }
+ (*this)[index] = entry;
+ }
+};
+
+#endif // LL_LLDICTIONARY_H
diff --git a/indra/llcommon/stdenums.h b/indra/llcommon/stdenums.h
index 41da51fce3..1a5678dde1 100644
--- a/indra/llcommon/stdenums.h
+++ b/indra/llcommon/stdenums.h
@@ -54,7 +54,8 @@ enum EDragAndDropType
DAD_BODYPART = 11,
DAD_ANIMATION = 12,
DAD_GESTURE = 13,
- DAD_COUNT = 14, // number of types in this enum
+ DAD_LINK = 14,
+ DAD_COUNT = 15, // number of types in this enum
};
// Reasons for drags to be denied.