PageRenderTime 23ms CodeModel.GetById 10ms app.highlight 9ms RepoModel.GetById 2ms app.codeStats 0ms

/indra/llinventory/lluserrelations.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 112 lines | 55 code | 15 blank | 42 comment | 2 complexity | a4fb8b26af8804d71466dbaa8840df4d MD5 | raw file
  1/** 
  2 * @file lluserrelations.cpp
  3 * @author Phoenix
  4 * @date 2006-10-12
  5 * @brief Implementation of a simple cache of user relations.
  6 *
  7 * $LicenseInfo:firstyear=2006&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
 29#include "linden_common.h"
 30#include "lluserrelations.h"
 31
 32// static
 33const U8 LLRelationship::GRANTED_VISIBLE_MASK = LLRelationship::GRANT_MODIFY_OBJECTS | LLRelationship::GRANT_MAP_LOCATION;
 34const LLRelationship LLRelationship::DEFAULT_RELATIONSHIP = LLRelationship(GRANT_ONLINE_STATUS, GRANT_ONLINE_STATUS, false);
 35
 36LLRelationship::LLRelationship() :
 37	mGrantToAgent(0),
 38	mGrantFromAgent(0),
 39	mChangeSerialNum(0),
 40	mIsOnline(false)
 41{
 42}
 43
 44LLRelationship::LLRelationship(S32 grant_to, S32 grant_from, bool is_online) :
 45	mGrantToAgent(grant_to),
 46	mGrantFromAgent(grant_from),
 47	mChangeSerialNum(0),
 48	mIsOnline(is_online)
 49{
 50}
 51
 52bool LLRelationship::isOnline() const
 53{
 54	return mIsOnline;
 55}
 56
 57void LLRelationship::online(bool is_online)
 58{
 59	mIsOnline = is_online;
 60	mChangeSerialNum++;
 61}
 62
 63bool LLRelationship::isRightGrantedTo(S32 rights) const
 64{
 65	return ((mGrantToAgent & rights) == rights);
 66}
 67
 68bool LLRelationship::isRightGrantedFrom(S32 rights) const
 69{
 70	return ((mGrantFromAgent & rights) == rights);
 71}
 72
 73S32 LLRelationship::getRightsGrantedTo() const
 74{
 75	return mGrantToAgent;
 76}
 77
 78S32 LLRelationship::getRightsGrantedFrom() const
 79{
 80	return mGrantFromAgent;
 81}
 82
 83void LLRelationship::grantRights(S32 to_agent, S32 from_agent)
 84{
 85	mGrantToAgent |= to_agent;
 86	mGrantFromAgent |= from_agent;
 87	mChangeSerialNum++;
 88}
 89
 90void LLRelationship::revokeRights(S32 to_agent, S32 from_agent)
 91{
 92	mGrantToAgent &= ~to_agent;
 93	mGrantFromAgent &= ~from_agent;
 94	mChangeSerialNum++;
 95}
 96
 97
 98
 99/*
100bool LLGrantedRights::getNextRights(
101	LLUUID& agent_id,
102	S32& to_agent,
103	S32& from_agent) const
104{
105	rights_map_t::const_iterator iter = mRights.upper_bound(agent_id);
106	if(iter == mRights.end()) return false;
107	agent_id = (*iter).first;
108	to_agent = (*iter).second.mToAgent;
109	from_agent = (*iter).second.mFromAgent;
110	return true;
111}
112*/