PageRenderTime 28ms CodeModel.GetById 19ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 1ms

/indra/newview/llagentaccess.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 86 lines | 37 code | 15 blank | 34 comment | 0 complexity | 3ab86bfa5e6e6aca546afbccc6241985 MD5 | raw file
 1/** 
 2 * @file llagentaccess.h
 3 * @brief LLAgentAccess class implementation - manages maturity and godmode info
 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 LL_LLAGENTACCESS_H
28#define LL_LLAGENTACCESS_H
29
30#include "stdtypes.h"
31
32// forward declaration so that we don't have to include the whole class
33class LLControlGroup;
34
35class LLAgentAccess
36{
37public:
38	LLAgentAccess(LLControlGroup& savedSettings);
39	
40	bool getAdminOverride() const;
41	void setAdminOverride(bool b);
42
43	void setGodLevel(U8 god_level);
44	bool isGodlike() const;
45	bool isGodlikeWithoutAdminMenuFakery() const;
46	U8 getGodLevel() const;
47	
48	
49	// rather than just expose the preference setting, we're going to actually
50	// expose what the client code cares about -- what the user should see
51	// based on a combination of the is* and prefers* flags, combined with God bit.
52	bool wantsPGOnly() const;
53	bool canAccessMature() const;
54	bool canAccessAdult() const;
55	bool prefersPG() const;
56	bool prefersMature() const;
57	bool prefersAdult() const;
58	bool isTeen() const;
59	bool isMature() const;
60	bool isAdult() const;
61	
62	void setTeen(bool teen);
63	void setMaturity(char text);
64	
65	static int convertTextToMaturity(char text);
66	
67	void setTransition();	// sets the transition bit, which defaults to false
68	bool isInTransition() const;
69	bool canSetMaturity(S32 maturity);
70	
71private:
72	U8 mAccess;	// SIM_ACCESS_MATURE etc
73	U8 mGodLevel;
74	bool mAdminOverride;
75	
76	// this should be deleted after the 60-day AO transition.
77	// It should be safe to remove it in Viewer 2009
78	// It's set by a special short-term flag in login.cgi 
79	// called ao_transition. When that's gone, this can go, along with
80	// all of the code that depends on it.
81	bool mAOTransition;
82	
83	LLControlGroup& mSavedSettings;
84};
85
86#endif // LL_LLAGENTACCESS_H