PageRenderTime 25ms CodeModel.GetById 18ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 1ms

/indra/newview/llestateinfomodel.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 103 lines | 52 code | 19 blank | 32 comment | 0 complexity | 0c2bb852e96f8612d8c1fe4e3098d2d4 MD5 | raw file
  1/** 
  2 * @file llestateinfomodel.h
  3 * @brief Estate info model
  4 *
  5 * $LicenseInfo:firstyear=2011&license=viewerlgpl$
  6 * Second Life Viewer Source Code
  7 * Copyright (C) 2011, 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_LLESTATEINFOMODEL_H
 28#define LL_LLESTATEINFOMODEL_H
 29
 30class LLMessageSystem;
 31
 32#include "llsingleton.h"
 33
 34/**
 35 * Contains estate info, notifies interested parties of its changes.
 36 */
 37class LLEstateInfoModel : public LLSingleton<LLEstateInfoModel>
 38{
 39	LOG_CLASS(LLEstateInfoModel);
 40
 41public:
 42	typedef boost::signals2::signal<void()> update_signal_t;
 43	boost::signals2::connection setUpdateCallback(const update_signal_t::slot_type& cb); /// the model has been externally updated
 44	boost::signals2::connection setCommitCallback(const update_signal_t::slot_type& cb); /// our changes have been applied
 45
 46	void sendEstateInfo(); /// send estate info to the simulator
 47
 48	// getters
 49	bool				getUseFixedSun()			const;
 50	bool				getIsExternallyVisible()	const;
 51	bool				getAllowDirectTeleport()	const;
 52	bool				getDenyAnonymous()			const;
 53	bool				getDenyAgeUnverified()		const;
 54	bool				getAllowVoiceChat()			const;
 55
 56	const std::string&	getName()					const { return mName; }
 57	const LLUUID&		getOwnerID()				const { return mOwnerID; }
 58	U32					getID()						const { return mID; }
 59	F32					getSunHour()				const { return getUseFixedSun() ? mSunHour : 0.f; }
 60
 61	// setters
 62	void setUseFixedSun(bool val);
 63	void setIsExternallyVisible(bool val);
 64	void setAllowDirectTeleport(bool val);
 65	void setDenyAnonymous(bool val);
 66	void setDenyAgeUnverified(bool val);
 67	void setAllowVoiceChat(bool val);
 68
 69	void setSunHour(F32 sun_hour) { mSunHour = sun_hour; }
 70
 71protected:
 72	typedef std::vector<std::string> strings_t;
 73
 74	friend class LLSingleton<LLEstateInfoModel>;
 75	friend class LLDispatchEstateUpdateInfo;
 76	friend class LLEstateChangeInfoResponder;
 77
 78	LLEstateInfoModel();
 79
 80	/// refresh model with data from the incoming server message
 81	void update(const strings_t& strings);
 82
 83	void notifyCommit();
 84
 85private:
 86	bool commitEstateInfoCaps();
 87	void commitEstateInfoDataserver();
 88	U32  getFlags() const { return mFlags; }
 89	void setFlag(U32 flag, bool val);
 90	std::string getInfoDump();
 91
 92	// estate info
 93	std::string	mName;			/// estate name
 94	LLUUID		mOwnerID;		/// estate owner id
 95	U32			mID;			/// estate id
 96	U32			mFlags;			/// estate flags
 97	F32			mSunHour;		/// estate sun hour
 98
 99	update_signal_t mUpdateSignal; /// emitted when we receive update from sim
100	update_signal_t mCommitSignal; /// emitted when our update gets applied to sim
101};
102
103#endif // LL_LLESTATEINFOMODEL_H