PageRenderTime 10ms CodeModel.GetById 1ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/indra/llcommon/llavatarname.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 95 lines | 23 code | 17 blank | 55 comment | 0 complexity | 097a2e18f9da8d210d8afe4308ec2de6 MD5 | raw file
 1/** 
 2 * @file llavatarname.h
 3 * @brief Represents name-related data for an avatar, such as the
 4 * username/SLID ("bobsmith123" or "james.linden") and the display
 5 * name ("James Cook")
 6 *
 7 * $LicenseInfo:firstyear=2010&license=viewerlgpl$
 8 * Second Life Viewer Source Code
 9 * Copyright (C) 2010, Linden Research, Inc.
10 * 
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation;
14 * version 2.1 of the License only.
15 * 
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 * Lesser General Public License for more details.
20 * 
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
24 * 
25 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
26 * $/LicenseInfo$
27 */
28#ifndef LLAVATARNAME_H
29#define LLAVATARNAME_H
30
31#include <string>
32
33class LLSD;
34
35class LL_COMMON_API LLAvatarName
36{
37public:
38	LLAvatarName();
39	
40	bool operator<(const LLAvatarName& rhs) const;
41
42	LLSD asLLSD() const;
43
44	void fromLLSD(const LLSD& sd);
45
46	// For normal names, returns "James Linden (james.linden)"
47	// When display names are disabled returns just "James Linden"
48	std::string getCompleteName() const;
49
50	// Returns "James Linden" or "bobsmith123 Resident" for backwards
51	// compatibility with systems like voice and muting
52	// *TODO: Eliminate this in favor of username only
53	std::string getLegacyName() const;
54
55	// "bobsmith123" or "james.linden", US-ASCII only
56	std::string mUsername;
57
58	// "Jose' Sanchez" or "James Linden", UTF-8 encoded Unicode
59	// Contains data whether or not user has explicitly set
60	// a display name; may duplicate their username.
61	std::string mDisplayName;
62
63	// For "James Linden", "James"
64	// For "bobsmith123", "bobsmith123"
65	// Used to communicate with legacy systems like voice and muting which
66	// rely on old-style names.
67	// *TODO: Eliminate this in favor of username only
68	std::string mLegacyFirstName;
69
70	// For "James Linden", "Linden"
71	// For "bobsmith123", "Resident"
72	// see above for rationale
73	std::string mLegacyLastName;
74
75	// If true, both display name and SLID were generated from
76	// a legacy first and last name, like "James Linden (james.linden)"
77	bool mIsDisplayNameDefault;
78
79	// Under error conditions, we may insert "dummy" records with
80	// names like "???" into caches as placeholders.  These can be
81	// shown in UI, but are not serialized.
82	bool mIsTemporaryName;
83
84	// Names can change, so need to keep track of when name was
85	// last checked.
86	// Unix time-from-epoch seconds for efficiency
87	F64 mExpires;
88	
89	// You can only change your name every N hours, so record
90	// when the next update is allowed
91	// Unix time-from-epoch seconds
92	F64 mNextUpdate;
93};
94
95#endif