PageRenderTime 39ms CodeModel.GetById 10ms app.highlight 20ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llremoteparcelrequest.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 105 lines | 58 code | 16 blank | 31 comment | 0 complexity | cfa0169cc8ec564aee9b1bd2cf975194 MD5 | raw file
  1/** 
  2 * @file llremoteparcelrequest.h
  3 * @author Sam Kolb
  4 * @brief Get information about a parcel you aren't standing in to display
  5 * landmark/teleport information.
  6 *
  7 * $LicenseInfo:firstyear=2007&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#ifndef LL_LLREMOTEPARCELREQUEST_H
 30#define LL_LLREMOTEPARCELREQUEST_H
 31
 32#include "llhttpclient.h"
 33#include "llpanel.h"
 34
 35class LLMessageSystem;
 36class LLRemoteParcelInfoObserver;
 37
 38class LLRemoteParcelRequestResponder : public LLHTTPClient::Responder
 39{
 40public:
 41	LLRemoteParcelRequestResponder(LLHandle<LLRemoteParcelInfoObserver> observer_handle);
 42
 43	//If we get back a normal response, handle it here
 44	/*virtual*/ void result(const LLSD& content);
 45
 46	//If we get back an error (not found, etc...), handle it here
 47	/*virtual*/ void error(U32 status, const std::string& reason);
 48
 49protected:
 50	LLHandle<LLRemoteParcelInfoObserver> mObserverHandle;
 51};
 52
 53struct LLParcelData
 54{
 55	LLUUID		parcel_id;
 56	LLUUID		owner_id;
 57	std::string	name;
 58	std::string	desc;
 59	S32			actual_area;
 60	S32			billable_area;
 61	U8			flags;
 62	F32			global_x;
 63	F32			global_y;
 64	F32			global_z;
 65	std::string	sim_name;
 66	LLUUID		snapshot_id;
 67	F32			dwell;
 68	S32			sale_price;
 69	S32			auction_id;
 70};
 71
 72// An interface class for panels which display parcel information
 73// like name, description, area, snapshot etc.
 74class LLRemoteParcelInfoObserver
 75{
 76public:
 77	LLRemoteParcelInfoObserver() { mObserverHandle.bind(this); }
 78	virtual ~LLRemoteParcelInfoObserver() {}
 79	virtual void processParcelInfo(const LLParcelData& parcel_data) = 0;
 80	virtual void setParcelID(const LLUUID& parcel_id) = 0;
 81	virtual void setErrorStatus(U32 status, const std::string& reason) = 0;
 82	LLHandle<LLRemoteParcelInfoObserver>	getObserverHandle() const { return mObserverHandle; }
 83
 84protected:
 85	LLRootHandle<LLRemoteParcelInfoObserver> mObserverHandle;
 86};
 87
 88class LLRemoteParcelInfoProcessor : public LLSingleton<LLRemoteParcelInfoProcessor>
 89{
 90public:
 91	virtual ~LLRemoteParcelInfoProcessor() {}
 92
 93	void addObserver(const LLUUID& parcel_id, LLRemoteParcelInfoObserver* observer);
 94	void removeObserver(const LLUUID& parcel_id, LLRemoteParcelInfoObserver* observer);
 95
 96	void sendParcelInfoRequest(const LLUUID& parcel_id);
 97
 98	static void processParcelInfoReply(LLMessageSystem* msg, void**);
 99
100private:
101	typedef std::multimap<LLUUID, LLHandle<LLRemoteParcelInfoObserver> > observer_multimap_t;
102	observer_multimap_t mObservers;
103};
104
105#endif // LL_LLREMOTEPARCELREQUEST_H