PageRenderTime 32ms CodeModel.GetById 16ms 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
Possible License(s): LGPL-2.1
  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. #ifndef LL_LLREMOTEPARCELREQUEST_H
  29. #define LL_LLREMOTEPARCELREQUEST_H
  30. #include "llhttpclient.h"
  31. #include "llpanel.h"
  32. class LLMessageSystem;
  33. class LLRemoteParcelInfoObserver;
  34. class LLRemoteParcelRequestResponder : public LLHTTPClient::Responder
  35. {
  36. public:
  37. LLRemoteParcelRequestResponder(LLHandle<LLRemoteParcelInfoObserver> observer_handle);
  38. //If we get back a normal response, handle it here
  39. /*virtual*/ void result(const LLSD& content);
  40. //If we get back an error (not found, etc...), handle it here
  41. /*virtual*/ void error(U32 status, const std::string& reason);
  42. protected:
  43. LLHandle<LLRemoteParcelInfoObserver> mObserverHandle;
  44. };
  45. struct LLParcelData
  46. {
  47. LLUUID parcel_id;
  48. LLUUID owner_id;
  49. std::string name;
  50. std::string desc;
  51. S32 actual_area;
  52. S32 billable_area;
  53. U8 flags;
  54. F32 global_x;
  55. F32 global_y;
  56. F32 global_z;
  57. std::string sim_name;
  58. LLUUID snapshot_id;
  59. F32 dwell;
  60. S32 sale_price;
  61. S32 auction_id;
  62. };
  63. // An interface class for panels which display parcel information
  64. // like name, description, area, snapshot etc.
  65. class LLRemoteParcelInfoObserver
  66. {
  67. public:
  68. LLRemoteParcelInfoObserver() { mObserverHandle.bind(this); }
  69. virtual ~LLRemoteParcelInfoObserver() {}
  70. virtual void processParcelInfo(const LLParcelData& parcel_data) = 0;
  71. virtual void setParcelID(const LLUUID& parcel_id) = 0;
  72. virtual void setErrorStatus(U32 status, const std::string& reason) = 0;
  73. LLHandle<LLRemoteParcelInfoObserver> getObserverHandle() const { return mObserverHandle; }
  74. protected:
  75. LLRootHandle<LLRemoteParcelInfoObserver> mObserverHandle;
  76. };
  77. class LLRemoteParcelInfoProcessor : public LLSingleton<LLRemoteParcelInfoProcessor>
  78. {
  79. public:
  80. virtual ~LLRemoteParcelInfoProcessor() {}
  81. void addObserver(const LLUUID& parcel_id, LLRemoteParcelInfoObserver* observer);
  82. void removeObserver(const LLUUID& parcel_id, LLRemoteParcelInfoObserver* observer);
  83. void sendParcelInfoRequest(const LLUUID& parcel_id);
  84. static void processParcelInfoReply(LLMessageSystem* msg, void**);
  85. private:
  86. typedef std::multimap<LLUUID, LLHandle<LLRemoteParcelInfoObserver> > observer_multimap_t;
  87. observer_multimap_t mObservers;
  88. };
  89. #endif // LL_LLREMOTEPARCELREQUEST_H