PageRenderTime 16ms CodeModel.GetById 2ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llagentpicksinfo.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 100 lines | 26 code | 20 blank | 54 comment | 0 complexity | d4faed13e92125b6bdbc57a3f2c3548c MD5 | raw file
  1/** 
  2 * @file llagentpicksinfo.h
  3 * @brief LLAgentPicksInfo class header file
  4 *
  5 * $LicenseInfo:firstyear=2000&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_LLAGENTPICKS_H
 28#define LL_LLAGENTPICKS_H
 29
 30#include "llsingleton.h"
 31
 32struct LLAvatarPicks;
 33
 34/**
 35 * Class that provides information about Agent Picks
 36 */
 37class LLAgentPicksInfo : public LLSingleton<LLAgentPicksInfo>
 38{
 39	class LLAgentPicksObserver;
 40
 41public:
 42
 43	LLAgentPicksInfo();
 44	
 45	virtual ~LLAgentPicksInfo();
 46
 47	/**
 48	 * Requests number of picks from server. 
 49	 * 
 50	 * Number of Picks is requested from server, thus it is not available immediately.
 51	 */
 52	void requestNumberOfPicks();
 53
 54	/**
 55	 * Returns number of Picks.
 56	 */
 57	S32 getNumberOfPicks() { return mNumberOfPicks; }
 58
 59	/**
 60	 * Returns maximum number of Picks.
 61	 */
 62	S32 getMaxNumberOfPicks() { return mMaxNumberOfPicks; }
 63
 64	/**
 65	 * Returns TRUE if Agent has maximum allowed number of Picks.
 66	 */
 67	bool isPickLimitReached();
 68
 69	/**
 70	 * After creating or deleting a Pick we can assume operation on server will be 
 71	 * completed successfully. Incrementing/decrementing number of picks makes new number
 72	 * of picks available immediately. Actual number of picks will be updated when we receive 
 73	 * response from server.
 74	 */
 75	void incrementNumberOfPicks() { ++mNumberOfPicks; }
 76
 77	void decrementNumberOfPicks() { --mNumberOfPicks; }
 78
 79private:
 80
 81	void onServerRespond(LLAvatarPicks* picks);
 82
 83	/**
 84	* Sets number of Picks.
 85	*/
 86	void setNumberOfPicks(S32 number) { mNumberOfPicks = number; }
 87
 88	/**
 89	* Sets maximum number of Picks.
 90	*/
 91	void setMaxNumberOfPicks(S32 max_picks) { mMaxNumberOfPicks = max_picks; }
 92
 93private:
 94
 95	LLAgentPicksObserver* mAgentPicksObserver;
 96	S32 mMaxNumberOfPicks;
 97	S32 mNumberOfPicks;
 98};
 99
100#endif //LL_LLAGENTPICKS_H