diff options
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/llcommon/llassettype.cpp | 154 | ||||
-rw-r--r-- | indra/llcommon/llassettype.h | 62 | ||||
-rw-r--r-- | indra/llcommon/llfoldertype.cpp | 165 | ||||
-rw-r--r-- | indra/llcommon/llfoldertype.h | 123 |
5 files changed, 169 insertions, 337 deletions
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index f785698612..e7aaf3c984 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -50,7 +50,6 @@ set(llcommon_SOURCE_FILES llfile.cpp llfindlocale.cpp llfixedbuffer.cpp - llfoldertype.cpp llformat.cpp llframetimer.cpp llheartbeat.cpp @@ -151,7 +150,6 @@ set(llcommon_HEADER_FILES llfile.h llfindlocale.h llfixedbuffer.h - llfoldertype.h llformat.h llframetimer.h llhash.h diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp index 6d5b12d840..b2a92861cc 100644 --- a/indra/llcommon/llassettype.cpp +++ b/indra/llcommon/llassettype.cpp @@ -43,21 +43,30 @@ 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 - bool can_link) // can you create a link to this type? + 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), - mCanLink(can_link) + mCategoryName(category_name), + mDadType(dad_type), + mCanLink(can_link), + mIsProtected(is_protected) { llassert(strlen(mTypeName) <= 8); } const char *mTypeName; const char *mHumanName; + const char *mCategoryName; + EDragAndDropType mDadType; bool mCanLink; + bool mIsProtected; }; class LLAssetDictionary : public LLSingleton<LLAssetDictionary>, @@ -69,32 +78,48 @@ public: LLAssetDictionary::LLAssetDictionary() { - // DESCRIPTION TYPE NAME HUMAN NAME CAN LINK? - // |--------------------|-----------|-------------------|-----------| - addEntry(LLAssetType::AT_TEXTURE, new AssetEntry("TEXTURE", "texture", "texture", FALSE)); - addEntry(LLAssetType::AT_SOUND, new AssetEntry("SOUND", "sound", "sound", FALSE)); - addEntry(LLAssetType::AT_CALLINGCARD, new AssetEntry("CALLINGCARD", "callcard", "calling card", FALSE)); - addEntry(LLAssetType::AT_LANDMARK, new AssetEntry("LANDMARK", "landmark", "landmark", FALSE)); - addEntry(LLAssetType::AT_SCRIPT, new AssetEntry("SCRIPT", "script", "legacy script", FALSE)); - addEntry(LLAssetType::AT_CLOTHING, new AssetEntry("CLOTHING", "clothing", "clothing", TRUE)); - addEntry(LLAssetType::AT_OBJECT, new AssetEntry("OBJECT", "object", "object", TRUE)); - addEntry(LLAssetType::AT_NOTECARD, new AssetEntry("NOTECARD", "notecard", "note card", FALSE)); - addEntry(LLAssetType::AT_CATEGORY, new AssetEntry("CATEGORY", "category", "folder", TRUE)); - addEntry(LLAssetType::AT_LSL_TEXT, new AssetEntry("LSL_TEXT", "lsltext", "lsl2 script", FALSE)); - addEntry(LLAssetType::AT_LSL_BYTECODE, new AssetEntry("LSL_BYTECODE", "lslbyte", "lsl bytecode", FALSE)); - addEntry(LLAssetType::AT_TEXTURE_TGA, new AssetEntry("TEXTURE_TGA", "txtr_tga", "tga texture", FALSE)); - addEntry(LLAssetType::AT_BODYPART, new AssetEntry("BODYPART", "bodypart", "body part", TRUE)); - addEntry(LLAssetType::AT_SOUND_WAV, new AssetEntry("SOUND_WAV", "snd_wav", "sound", FALSE)); - addEntry(LLAssetType::AT_IMAGE_TGA, new AssetEntry("IMAGE_TGA", "img_tga", "targa image", FALSE)); - addEntry(LLAssetType::AT_IMAGE_JPEG, new AssetEntry("IMAGE_JPEG", "jpeg", "jpeg image", FALSE)); - addEntry(LLAssetType::AT_ANIMATION, new AssetEntry("ANIMATION", "animatn", "animation", FALSE)); - addEntry(LLAssetType::AT_GESTURE, new AssetEntry("GESTURE", "gesture", "gesture", TRUE)); - addEntry(LLAssetType::AT_SIMSTATE, new AssetEntry("SIMSTATE", "simstate", "simstate", FALSE)); - - addEntry(LLAssetType::AT_LINK, new AssetEntry("LINK", "link", "symbolic link", FALSE)); - addEntry(LLAssetType::AT_LINK_FOLDER, new AssetEntry("FOLDER_LINK", "link_f", "symbolic folder link", FALSE)); - - addEntry(LLAssetType::AT_NONE, new AssetEntry("NONE", "-1", NULL, FALSE)); + // DESCRIPTION TYPE NAME HUMAN NAME CATEGORY NAME DRAG&DROP CAN LINK? PROTECTED? + // |--------------------|-----------|-------------------|-------------------|---------------|-----------|-----------| + addEntry(LLAssetType::AT_TEXTURE, new AssetEntry("TEXTURE", "texture", "texture", "Textures", DAD_TEXTURE, TRUE, TRUE)); + addEntry(LLAssetType::AT_SOUND, new AssetEntry("SOUND", "sound", "sound", "Sounds", DAD_SOUND, TRUE, TRUE)); + addEntry(LLAssetType::AT_CALLINGCARD, new AssetEntry("CALLINGCARD", "callcard", "calling card", "Calling Cards", DAD_CALLINGCARD, TRUE, TRUE)); + addEntry(LLAssetType::AT_LANDMARK, new AssetEntry("LANDMARK", "landmark", "landmark", "Landmarks", DAD_LANDMARK, TRUE, TRUE)); + addEntry(LLAssetType::AT_SCRIPT, new AssetEntry("SCRIPT", "script", "legacy script", "Scripts", DAD_NONE, TRUE, 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, TRUE, 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, TRUE, TRUE)); + addEntry(LLAssetType::AT_LSL_BYTECODE, new AssetEntry("LSL_BYTECODE", "lslbyte", "lsl bytecode", "Scripts", DAD_NONE, TRUE, TRUE)); + addEntry(LLAssetType::AT_TEXTURE_TGA, new AssetEntry("TEXTURE_TGA", "txtr_tga", "tga texture", "Uncompressed Images", DAD_NONE, TRUE, 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, TRUE, TRUE)); + addEntry(LLAssetType::AT_IMAGE_TGA, new AssetEntry("IMAGE_TGA", "img_tga", "targa image", "Uncompressed Images", DAD_NONE, TRUE, TRUE)); + addEntry(LLAssetType::AT_IMAGE_JPEG, new AssetEntry("IMAGE_JPEG", "jpeg", "jpeg image", "Uncompressed Images", DAD_NONE, TRUE, TRUE)); + addEntry(LLAssetType::AT_ANIMATION, new AssetEntry("ANIMATION", "animatn", "animation", "Animations", DAD_ANIMATION, TRUE, TRUE)); + addEntry(LLAssetType::AT_GESTURE, new AssetEntry("GESTURE", "gesture", "gesture", "Gestures", DAD_GESTURE, TRUE, 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, FALSE, FALSE)); + } + + addEntry(LLAssetType::AT_CURRENT_OUTFIT, new AssetEntry("CURRENT", "current", "current outfit", "Current Look", DAD_CATEGORY, FALSE, TRUE)); + addEntry(LLAssetType::AT_OUTFIT, new AssetEntry("OUTFIT", "outfit", "outfit", "New Look", DAD_CATEGORY, FALSE, FALSE)); + addEntry(LLAssetType::AT_MY_OUTFITS, new AssetEntry("MY_OUTFITS", "my_otfts", "my outfits", "My Looks", DAD_CATEGORY, FALSE, TRUE)); + + addEntry(LLAssetType::AT_NONE, new AssetEntry("NONE", "-1", NULL, "New Folder", DAD_NONE, FALSE, FALSE)); }; // static @@ -115,7 +140,8 @@ const std::string &LLAssetType::getDesc(LLAssetType::EType asset_type) } else { - return badLookup(); + static const std::string error_string = "BAD TYPE"; + return error_string; } } @@ -130,7 +156,7 @@ const char *LLAssetType::lookup(LLAssetType::EType asset_type) } else { - return badLookup().c_str(); + return "-1"; } } @@ -140,7 +166,6 @@ LLAssetType::EType LLAssetType::lookup(const char* name) return lookup(ll_safe_string(name)); } -// static LLAssetType::EType LLAssetType::lookup(const std::string& type_name) { const LLAssetDictionary *dict = LLAssetDictionary::getInstance(); @@ -168,7 +193,7 @@ const char *LLAssetType::lookupHumanReadable(LLAssetType::EType asset_type) } else { - return badLookup().c_str(); + return NULL; } } @@ -178,7 +203,6 @@ LLAssetType::EType LLAssetType::lookupHumanReadable(const char* name) return lookupHumanReadable(ll_safe_string(name)); } -// static LLAssetType::EType LLAssetType::lookupHumanReadable(const std::string& readable_name) { const LLAssetDictionary *dict = LLAssetDictionary::getInstance(); @@ -196,6 +220,32 @@ LLAssetType::EType LLAssetType::lookupHumanReadable(const std::string& readable_ } // 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(); @@ -219,9 +269,37 @@ bool LLAssetType::lookupIsLinkType(EType asset_type) } // static -const std::string &LLAssetType::badLookup() +// 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) { - static const std::string sBadLookup = "llassettype_bad_lookup"; - return sBadLookup; + const LLAssetDictionary *dict = LLAssetDictionary::getInstance(); + const AssetEntry *entry = dict->lookup(asset_type); + if (entry) + { + return entry->mIsProtected; + } + return true; +} +// static +bool LLAssetType::lookupIsEnsembleCategoryType(EType asset_type) +{ + return (asset_type >= AT_FOLDER_ENSEMBLE_START && + asset_type <= AT_FOLDER_ENSEMBLE_END); +} + + +// static. Generate a good default description +void LLAssetType::generateDescriptionFor(LLAssetType::EType asset_type, + std::string& description) +{ + const S32 BUF_SIZE = 30; + char time_str[BUF_SIZE]; /* Flawfinder: ignore */ + time_t now; + time(&now); + memset(time_str, '\0', BUF_SIZE); + strftime(time_str, BUF_SIZE - 1, "%Y-%m-%d %H:%M:%S ", localtime(&now)); + description.assign(time_str); + description.append(LLAssetType::lookupHumanReadable(asset_type)); } diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h index ec2290d30e..3c760e4d91 100644 --- a/indra/llcommon/llassettype.h +++ b/indra/llcommon/llassettype.h @@ -94,6 +94,18 @@ public: AT_BODYPART = 13, // A collection of textures and parameters that can be worn by an avatar. + 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. + + 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. + + AT_LOST_AND_FOUND = 16, + // Used to stuff lost&found items into. + AT_SOUND_WAV = 17, // Uncompressed sound. @@ -114,22 +126,38 @@ public: AT_SIMSTATE = 22, // Simstate file. + AT_FAVORITE = 23, + // favorite items + 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 = 26, + AT_COUNT = 49, // +*********************************************************+ // | TO ADD AN ELEMENT TO THIS ENUM: | // +*********************************************************+ // | 1. INSERT BEFORE AT_COUNT | // | 2. INCREMENT AT_COUNT BY 1 | - // | 3. ADD TO LLAssetType.cpp | - // | 4. ADD TO LLViewerAssetType.cpp | - // | 5. ADD TO DEFAULT_ASSET_FOR_INV in LLInventoryType.cpp | + // | 3. ADD TO LLAssetDictionary in LLAssetType.cpp | + // | 3. ADD TO DEFAULT_ASSET_FOR_INV in LLInventoryType.cpp | // +*********************************************************+ AT_NONE = -1 @@ -145,17 +173,33 @@ public: 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 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 const std::string& badLookup(); // error string when a lookup fails - -protected: - LLAssetType() {} - ~LLAssetType() {} + static const char* lookupCategoryName(EType asset_type); + static bool lookupIsProtectedCategoryType(EType asset_type); + static bool lookupIsEnsembleCategoryType(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 ) {} }; #endif // LL_LLASSETTYPE_H diff --git a/indra/llcommon/llfoldertype.cpp b/indra/llcommon/llfoldertype.cpp deleted file mode 100644 index 9107b11597..0000000000 --- a/indra/llcommon/llfoldertype.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/** - * @file llfoldertype.cpp - * @brief Implementatino of LLFolderType functionality. - * - * $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 "llfoldertype.h" -#include "lldictionary.h" -#include "llmemory.h" -#include "llsingleton.h" - -///---------------------------------------------------------------------------- -/// Class LLFolderType -///---------------------------------------------------------------------------- -struct FolderEntry : public LLDictionaryEntry -{ - FolderEntry(const std::string &type_name, // 8 character limit! - bool is_protected) // can the viewer change categories of this type? - : - LLDictionaryEntry(type_name), - mIsProtected(is_protected) - { - llassert(type_name.length() <= 8); - } - - const bool mIsProtected; -}; - -class LLFolderDictionary : public LLSingleton<LLFolderDictionary>, - public LLDictionary<LLFolderType::EType, FolderEntry> -{ -public: - LLFolderDictionary(); -}; - -LLFolderDictionary::LLFolderDictionary() -{ - // TYPE NAME PROTECTED - // |-----------|---------| - addEntry(LLFolderType::FT_TEXTURE, new FolderEntry("texture", TRUE)); - addEntry(LLFolderType::FT_SOUND, new FolderEntry("sound", TRUE)); - addEntry(LLFolderType::FT_CALLINGCARD, new FolderEntry("callcard", TRUE)); - addEntry(LLFolderType::FT_LANDMARK, new FolderEntry("landmark", TRUE)); - addEntry(LLFolderType::FT_CLOTHING, new FolderEntry("clothing", TRUE)); - addEntry(LLFolderType::FT_OBJECT, new FolderEntry("object", TRUE)); - addEntry(LLFolderType::FT_NOTECARD, new FolderEntry("notecard", TRUE)); - addEntry(LLFolderType::FT_CATEGORY, new FolderEntry("category", TRUE)); - addEntry(LLFolderType::FT_ROOT_CATEGORY, new FolderEntry("root", TRUE)); - addEntry(LLFolderType::FT_LSL_TEXT, new FolderEntry("lsltext", TRUE)); - addEntry(LLFolderType::FT_BODYPART, new FolderEntry("bodypart", TRUE)); - addEntry(LLFolderType::FT_TRASH, new FolderEntry("trash", TRUE)); - addEntry(LLFolderType::FT_SNAPSHOT_CATEGORY, new FolderEntry("snapshot", TRUE)); - addEntry(LLFolderType::FT_LOST_AND_FOUND, new FolderEntry("lstndfnd", TRUE)); - addEntry(LLFolderType::FT_ANIMATION, new FolderEntry("animatn", TRUE)); - addEntry(LLFolderType::FT_GESTURE, new FolderEntry("gesture", TRUE)); - addEntry(LLFolderType::FT_FAVORITE, new FolderEntry("favorite", TRUE)); - - for (S32 ensemble_num = S32(LLFolderType::FT_ENSEMBLE_START); ensemble_num <= S32(LLFolderType::FT_ENSEMBLE_END); ensemble_num++) - { - addEntry(LLFolderType::EType(ensemble_num), new FolderEntry("ensemble", FALSE)); - } - - addEntry(LLFolderType::FT_CURRENT_OUTFIT, new FolderEntry("current", TRUE)); - addEntry(LLFolderType::FT_OUTFIT, new FolderEntry("outfit", FALSE)); - addEntry(LLFolderType::FT_MY_OUTFITS, new FolderEntry("my_otfts", TRUE)); - addEntry(LLFolderType::FT_INBOX, new FolderEntry("inbox", TRUE)); - - addEntry(LLFolderType::FT_NONE, new FolderEntry("-1", FALSE)); -}; - -// static -LLFolderType::EType LLFolderType::lookup(const std::string& name) -{ - return LLFolderDictionary::getInstance()->lookup(name); -} - -// static -const std::string &LLFolderType::lookup(LLFolderType::EType folder_type) -{ - const FolderEntry *entry = LLFolderDictionary::getInstance()->lookup(folder_type); - if (entry) - { - return entry->mName; - } - else - { - return badLookup(); - } -} - -// static -// Only ensembles and plain folders aren't protected. "Protected" means -// you can't change certain properties such as their type. -bool LLFolderType::lookupIsProtectedType(EType folder_type) -{ - const LLFolderDictionary *dict = LLFolderDictionary::getInstance(); - const FolderEntry *entry = dict->lookup(folder_type); - if (entry) - { - return entry->mIsProtected; - } - return true; -} - -// static -bool LLFolderType::lookupIsEnsembleType(EType folder_type) -{ - return (folder_type >= FT_ENSEMBLE_START && - folder_type <= FT_ENSEMBLE_END); -} - -// static -LLAssetType::EType LLFolderType::folderTypeToAssetType(LLFolderType::EType folder_type) -{ - if (LLAssetType::lookup(LLAssetType::EType(folder_type)) == LLAssetType::badLookup()) - { - llwarns << "Converting to unknown asset type " << folder_type << llendl; - } - return (LLAssetType::EType)folder_type; -} - -// static -LLFolderType::EType LLFolderType::assetTypeToFolderType(LLAssetType::EType asset_type) -{ - if (LLFolderType::lookup(LLFolderType::EType(asset_type)) == LLFolderType::badLookup()) - { - llwarns << "Converting to unknown folder type " << asset_type << llendl; - } - return (LLFolderType::EType)asset_type; -} - -// static -const std::string &LLFolderType::badLookup() -{ - static const std::string sBadLookup = "llfoldertype_bad_lookup"; - return sBadLookup; -} diff --git a/indra/llcommon/llfoldertype.h b/indra/llcommon/llfoldertype.h deleted file mode 100644 index 5374ffd829..0000000000 --- a/indra/llcommon/llfoldertype.h +++ /dev/null @@ -1,123 +0,0 @@ -/** - * @file llfoldertype.h - * @brief Declaration of LLFolderType. - * - * $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_LLFOLDERTYPE_H -#define LL_LLFOLDERTYPE_H - -#include <string> -#include "llassettype.h" - -// This class handles folder types (similar to assettype, except for folders) -// and operations on those. -class LL_COMMON_API LLFolderType -{ -public: - // ! BACKWARDS COMPATIBILITY ! Folder type enums must match asset type enums. - enum EType - { - FT_TEXTURE = 0, - - FT_SOUND = 1, - - FT_CALLINGCARD = 2, - - FT_LANDMARK = 3, - - // FT_SCRIPT = 4, - - FT_CLOTHING = 5, - - FT_OBJECT = 6, - - FT_NOTECARD = 7, - - FT_CATEGORY = 8, - - FT_ROOT_CATEGORY = 9, - - FT_LSL_TEXT = 10, - - // FT_LSL_BYTECODE = 11, - // FT_TEXTURE_TGA = 12, - - FT_BODYPART = 13, - - FT_TRASH = 14, - - FT_SNAPSHOT_CATEGORY = 15, - - FT_LOST_AND_FOUND = 16, - - // FT_SOUND_WAV = 17, - // FT_IMAGE_TGA = 18, - // FT_IMAGE_JPEG = 19, - - FT_ANIMATION = 20, - - FT_GESTURE = 21, - - // FT_SIMSTATE = 22, - - FT_FAVORITE = 23, - - FT_ENSEMBLE_START = 26, - FT_ENSEMBLE_END = 45, - // This range is reserved for special clothing folder types. - - FT_CURRENT_OUTFIT = 46, - FT_OUTFIT = 47, - FT_MY_OUTFITS = 48, - - FT_INBOX = 49, - - FT_COUNT = 50, - - FT_NONE = -1 - }; - - static EType lookup(const std::string& type_name); - static const std::string& lookup(EType folder_type); - - static bool lookupIsProtectedType(EType folder_type); - static bool lookupIsEnsembleType(EType folder_type); - - static LLAssetType::EType folderTypeToAssetType(LLFolderType::EType folder_type); - static LLFolderType::EType assetTypeToFolderType(LLAssetType::EType asset_type); - - static const std::string& badLookup(); // error string when a lookup fails - -protected: - LLFolderType() {} - ~LLFolderType() {} -}; - -#endif // LL_LLFOLDERTYPE_H |