PageRenderTime 14ms CodeModel.GetById 1ms app.highlight 7ms RepoModel.GetById 2ms app.codeStats 0ms

/indra/llinventory/llinventorytype.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 95 lines | 39 code | 11 blank | 45 comment | 0 complexity | c5bb88471d69994f73a6716857f5d67c MD5 | raw file
 1/** 
 2 * @file llinventorytype.h
 3 * @brief Inventory item type, more specific than an asset type.
 4 *
 5 * $LicenseInfo:firstyear=2001&license=viewerlgpl$
 6 * Second Life Viewer Source Code
 7 * Copyright (C) 2010, Linden Research, Inc.
 8 * 
 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation;
12 * version 2.1 of the License only.
13 * 
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * Lesser General Public License for more details.
18 * 
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 * 
23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
24 * $/LicenseInfo$
25 */
26
27#ifndef LLINVENTORYTYPE_H
28#define LLINVENTORYTYPE_H
29
30#include "llassettype.h"
31
32//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33// Class LLInventoryType
34//
35// Class used to encapsulate operations around inventory type.
36//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37
38class LLInventoryType
39{
40public:
41	enum EType
42	{
43		IT_TEXTURE = 0,
44		IT_SOUND = 1, 
45		IT_CALLINGCARD = 2,
46		IT_LANDMARK = 3,
47		//IT_SCRIPT = 4,
48		//IT_CLOTHING = 5,
49		IT_OBJECT = 6,
50		IT_NOTECARD = 7,
51		IT_CATEGORY = 8,
52		IT_ROOT_CATEGORY = 9,
53		IT_LSL = 10,
54		//IT_LSL_BYTECODE = 11,
55		//IT_TEXTURE_TGA = 12,
56		//IT_BODYPART = 13,
57		//IT_TRASH = 14,
58		IT_SNAPSHOT = 15,
59		//IT_LOST_AND_FOUND = 16,
60		IT_ATTACHMENT = 17,
61		IT_WEARABLE = 18,
62		IT_ANIMATION = 19,
63		IT_GESTURE = 20,
64		IT_MESH = 22,
65		IT_WIDGET = 23,
66		IT_COUNT = 24,
67
68		IT_NONE = -1
69	};
70
71	// machine transation between type and strings
72	static EType lookup(const std::string& name);
73	static const std::string &lookup(EType type);
74	// translation from a type to a human readable form.
75	static const std::string &lookupHumanReadable(EType type);
76
77	// return the default inventory for the given asset type.
78	static EType defaultForAssetType(LLAssetType::EType asset_type);
79
80	// true if this type cannot have restricted permissions.
81	static bool cannotRestrictPermissions(EType type);
82
83private:
84	// don't instantiate or derive one of these objects
85	LLInventoryType( void );
86	~LLInventoryType( void );
87};
88
89// helper function that returns true if inventory type and asset type
90// are potentially compatible. For example, an attachment must be an
91// object, but a wearable can be a bodypart or clothing asset.
92bool inventory_and_asset_types_match(LLInventoryType::EType inventory_type,
93									 LLAssetType::EType asset_type);
94
95#endif