diff options
Diffstat (limited to 'linden/indra/llcommon/llavatarname.h')
-rw-r--r-- | linden/indra/llcommon/llavatarname.h | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/linden/indra/llcommon/llavatarname.h b/linden/indra/llcommon/llavatarname.h new file mode 100644 index 0000000..3b6c6ea --- /dev/null +++ b/linden/indra/llcommon/llavatarname.h | |||
@@ -0,0 +1,105 @@ | |||
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 | |||
33 | class LLSD; | ||
34 | |||
35 | class LL_COMMON_API LLAvatarName | ||
36 | { | ||
37 | public: | ||
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 | // For normal names, returns "Whatever Display Name (John Doe)" when | ||
51 | // display name and legacy name are different, or just "John Doe" | ||
52 | // when they are equal or when display names are disabled. | ||
53 | // When linefeed == true, the space between the display name and | ||
54 | // the opening parenthesis for the legacy name is replaced with a | ||
55 | // line feed. | ||
56 | std::string getNames(bool linefeed = false) const; | ||
57 | |||
58 | // Returns "James Linden" or "bobsmith123 Resident" for backwards | ||
59 | // compatibility with systems like voice and muting | ||
60 | std::string getLegacyName() const; | ||
61 | |||
62 | // "bobsmith123" or "james.linden", US-ASCII only | ||
63 | std::string mUsername; | ||
64 | |||
65 | // "Jose' Sanchez" or "James Linden", UTF-8 encoded Unicode | ||
66 | // Contains data whether or not user has explicitly set | ||
67 | // a display name; may duplicate their username. | ||
68 | std::string mDisplayName; | ||
69 | |||
70 | // For "James Linden", "James" | ||
71 | // For "bobsmith123", "bobsmith123" | ||
72 | // Used to communicate with legacy systems like voice and muting which | ||
73 | // rely on old-style names. | ||
74 | std::string mLegacyFirstName; | ||
75 | |||
76 | // For "James Linden", "Linden" | ||
77 | // For "bobsmith123", "Resident" | ||
78 | // see above for rationale | ||
79 | std::string mLegacyLastName; | ||
80 | |||
81 | // If true, both display name and SLID were generated from | ||
82 | // a legacy first and last name, like "James Linden (james.linden)" | ||
83 | bool mIsDisplayNameDefault; | ||
84 | |||
85 | // Under error conditions, we may insert "dummy" records with | ||
86 | // names equal to legacy name into caches as placeholders. | ||
87 | // These can be shown in UI, but are not serialized. | ||
88 | bool mIsDummy; | ||
89 | |||
90 | // Names can change, so need to keep track of when name was | ||
91 | // last checked. | ||
92 | // Unix time-from-epoch seconds for efficiency | ||
93 | F64 mExpires; | ||
94 | |||
95 | // You can only change your name every N hours, so record | ||
96 | // when the next update is allowed | ||
97 | // Unix time-from-epoch seconds | ||
98 | F64 mNextUpdate; | ||
99 | |||
100 | // true to prevent the displaying of "Resident" as a last name | ||
101 | // in legacy names | ||
102 | static bool sOmitResidentAsLastName; | ||
103 | }; | ||
104 | |||
105 | #endif | ||