/indra/newview/llstylemap.cpp
C++ | 83 lines | 47 code | 8 blank | 28 comment | 10 complexity | 793eaed71a200a6573d9a920fe1fc23b MD5 | raw file
Possible License(s): LGPL-2.1
1/** 2 * @file llstylemap.cpp 3 * @brief LLStyleMap class implementation 4 * 5 * $LicenseInfo:firstyear=2002&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#include "llviewerprecompiledheaders.h" 28 29#include "llstylemap.h" 30 31#include "llstring.h" 32#include "llui.h" 33#include "llslurl.h" 34#include "llviewercontrol.h" 35#include "llagent.h" 36 37const LLStyle::Params &LLStyleMap::lookupAgent(const LLUUID &source) 38{ 39 // Find this style in the map or add it if not. This map holds links to residents' profiles. 40 if (mMap.find(source) == mMap.end()) 41 { 42 LLStyle::Params style_params; 43 if (source != LLUUID::null) 44 { 45 style_params.color.control = "HTMLLinkColor"; 46 style_params.readonly_color.control = "HTMLLinkColor"; 47 style_params.link_href = LLSLURL("agent", source, "inspect").getSLURLString(); 48 } 49 mMap[source] = style_params; 50 } 51 return mMap[source]; 52} 53 54// This is similar to lookupAgent for any generic URL encoded style. 55const LLStyle::Params &LLStyleMap::lookup(const LLUUID& id, const std::string& link) 56{ 57 // Find this style in the map or add it if not. 58 style_map_t::iterator iter = mMap.find(id); 59 if (iter == mMap.end()) 60 { 61 LLStyle::Params style_params; 62 63 if (id != LLUUID::null && !link.empty()) 64 { 65 style_params.color.control = "HTMLLinkColor"; 66 style_params.readonly_color.control = "HTMLLinkColor"; 67 style_params.link_href = link; 68 } 69 else 70 { 71 style_params.color = LLColor4::white; 72 style_params.readonly_color = LLColor4::white; 73 } 74 mMap[id] = style_params; 75 } 76 else 77 { 78 iter->second.link_href = link; 79 } 80 81 return mMap[id]; 82} 83