diff options
Diffstat (limited to 'linden/indra/newview/lltexturetable.cpp')
-rw-r--r-- | linden/indra/newview/lltexturetable.cpp | 157 |
1 files changed, 0 insertions, 157 deletions
diff --git a/linden/indra/newview/lltexturetable.cpp b/linden/indra/newview/lltexturetable.cpp deleted file mode 100644 index 52e4a46..0000000 --- a/linden/indra/newview/lltexturetable.cpp +++ /dev/null | |||
@@ -1,157 +0,0 @@ | |||
1 | /** | ||
2 | * @file lltexturetable.cpp | ||
3 | * @brief Table of texture names and IDs for viewer | ||
4 | * | ||
5 | * Copyright (c) 2001-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * Second Life Viewer Source Code | ||
8 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
9 | * to you under the terms of the GNU General Public License, version 2.0 | ||
10 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
11 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
12 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
13 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
14 | * | ||
15 | * There are special exceptions to the terms and conditions of the GPL as | ||
16 | * it is applied to this Source Code. View the full text of the exception | ||
17 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
18 | * online at http://secondlife.com/developers/opensource/flossexception | ||
19 | * | ||
20 | * By copying, modifying or distributing this software, you acknowledge | ||
21 | * that you have read and understood your obligations described above, | ||
22 | * and agree to abide by those obligations. | ||
23 | * | ||
24 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
26 | * COMPLETENESS OR PERFORMANCE. | ||
27 | */ | ||
28 | |||
29 | #include "llviewerprecompiledheaders.h" | ||
30 | |||
31 | #include <string.h> | ||
32 | |||
33 | #include "lltexturetable.h" | ||
34 | #include "llstring.h" | ||
35 | |||
36 | LLTextureTable gTextureTable; | ||
37 | |||
38 | |||
39 | LLTextureInfo::LLTextureInfo(const std::string& name, const LLUUID &uuid, const std::string& description) | ||
40 | { | ||
41 | S32 length = name.size(); | ||
42 | if (length > 0) | ||
43 | { | ||
44 | mName = name; | ||
45 | } | ||
46 | else | ||
47 | { | ||
48 | char *temp = new char[UUID_STR_LENGTH]; | ||
49 | uuid.toString(temp); | ||
50 | mName = temp; | ||
51 | } | ||
52 | LLString::toLower(mName); | ||
53 | |||
54 | mUUID = uuid; | ||
55 | mDescription = description; | ||
56 | } | ||
57 | |||
58 | LLTextureInfo::~LLTextureInfo() | ||
59 | { | ||
60 | } | ||
61 | |||
62 | LLTextureTable::LLTextureTable() | ||
63 | { | ||
64 | mTextureInfoList.setInsertBefore(&LLTextureTable::insertBefore); | ||
65 | } | ||
66 | |||
67 | LLTextureTable::~LLTextureTable() | ||
68 | { | ||
69 | mTextureInfoList.deleteAllData(); | ||
70 | } | ||
71 | |||
72 | // Comparison function for sorting the list. | ||
73 | // static | ||
74 | BOOL LLTextureTable::insertBefore(LLTextureInfo* a, LLTextureInfo* b) | ||
75 | { | ||
76 | return (a->mName.compare(b->mName) < 0); | ||
77 | } | ||
78 | |||
79 | |||
80 | //void LLTextureTable::bubbleSort() | ||
81 | //{ | ||
82 | // mTextureInfoList.bubbleSortList(); | ||
83 | //} | ||
84 | |||
85 | BOOL LLTextureTable::add(const std::string& name, const LLUUID &uuid, const std::string& description) | ||
86 | { | ||
87 | LLTextureInfo *infop; | ||
88 | |||
89 | infop = new LLTextureInfo(name, uuid, description); | ||
90 | if (!infop) return FALSE; | ||
91 | |||
92 | mTextureInfoList.addDataSorted(infop); | ||
93 | |||
94 | return TRUE; | ||
95 | } | ||
96 | |||
97 | |||
98 | // *FIX: Since the table is sorted based on name, this could be vastly | ||
99 | // sped up by doing a binary search. | ||
100 | LLUUID LLTextureTable::getUUID(const std::string& name) | ||
101 | { | ||
102 | LLTextureInfo *infop; | ||
103 | |||
104 | for (infop = mTextureInfoList.getFirstData(); infop != NULL; infop = mTextureInfoList.getNextData() ) | ||
105 | { | ||
106 | LLString name_lc = name; | ||
107 | LLString::toLower(name_lc); | ||
108 | if (name_lc == infop->mName) | ||
109 | { | ||
110 | return infop->mUUID; | ||
111 | } | ||
112 | } | ||
113 | |||
114 | return LLUUID::null; | ||
115 | } | ||
116 | |||
117 | |||
118 | std::string LLTextureTable::getDesc(const std::string& name) | ||
119 | { | ||
120 | LLTextureInfo *infop; | ||
121 | |||
122 | for (infop = mTextureInfoList.getFirstData(); infop != NULL; infop = mTextureInfoList.getNextData() ) | ||
123 | { | ||
124 | LLString name_lc = name; | ||
125 | LLString::toLower(name_lc); | ||
126 | if (name_lc == infop->mName) | ||
127 | { | ||
128 | return infop->mDescription; | ||
129 | } | ||
130 | } | ||
131 | |||
132 | return LLString::null; | ||
133 | } | ||
134 | |||
135 | |||
136 | std::string LLTextureTable::getName(const LLUUID &id) | ||
137 | { | ||
138 | LLTextureInfo *infop; | ||
139 | |||
140 | for (infop = mTextureInfoList.getFirstData(); infop != NULL; infop = mTextureInfoList.getNextData() ) | ||
141 | { | ||
142 | if (id == infop->mUUID) | ||
143 | { | ||
144 | return infop->mName; | ||
145 | } | ||
146 | } | ||
147 | |||
148 | return LLString::null; | ||
149 | } | ||
150 | |||
151 | |||
152 | void LLTextureTable::deleteAll() | ||
153 | { | ||
154 | // Clear out the list | ||
155 | |||
156 | mTextureInfoList.deleteAllData(); | ||
157 | } | ||