PageRenderTime 926ms CodeModel.GetById 909ms RepoModel.GetById 0ms app.codeStats 0ms

/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
Possible License(s): LGPL-2.1
  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. #ifndef LL_LLESTATEINFOMODEL_H
  27. #define LL_LLESTATEINFOMODEL_H
  28. class LLMessageSystem;
  29. #include "llsingleton.h"
  30. /**
  31. * Contains estate info, notifies interested parties of its changes.
  32. */
  33. class LLEstateInfoModel : public LLSingleton<LLEstateInfoModel>
  34. {
  35. LOG_CLASS(LLEstateInfoModel);
  36. public:
  37. typedef boost::signals2::signal<void()> update_signal_t;
  38. boost::signals2::connection setUpdateCallback(const update_signal_t::slot_type& cb); /// the model has been externally updated
  39. boost::signals2::connection setCommitCallback(const update_signal_t::slot_type& cb); /// our changes have been applied
  40. void sendEstateInfo(); /// send estate info to the simulator
  41. // getters
  42. bool getUseFixedSun() const;
  43. bool getIsExternallyVisible() const;
  44. bool getAllowDirectTeleport() const;
  45. bool getDenyAnonymous() const;
  46. bool getDenyAgeUnverified() const;
  47. bool getAllowVoiceChat() const;
  48. const std::string& getName() const { return mName; }
  49. const LLUUID& getOwnerID() const { return mOwnerID; }
  50. U32 getID() const { return mID; }
  51. F32 getSunHour() const { return getUseFixedSun() ? mSunHour : 0.f; }
  52. // setters
  53. void setUseFixedSun(bool val);
  54. void setIsExternallyVisible(bool val);
  55. void setAllowDirectTeleport(bool val);
  56. void setDenyAnonymous(bool val);
  57. void setDenyAgeUnverified(bool val);
  58. void setAllowVoiceChat(bool val);
  59. void setSunHour(F32 sun_hour) { mSunHour = sun_hour; }
  60. protected:
  61. typedef std::vector<std::string> strings_t;
  62. friend class LLSingleton<LLEstateInfoModel>;
  63. friend class LLDispatchEstateUpdateInfo;
  64. friend class LLEstateChangeInfoResponder;
  65. LLEstateInfoModel();
  66. /// refresh model with data from the incoming server message
  67. void update(const strings_t& strings);
  68. void notifyCommit();
  69. private:
  70. bool commitEstateInfoCaps();
  71. void commitEstateInfoDataserver();
  72. U32 getFlags() const { return mFlags; }
  73. void setFlag(U32 flag, bool val);
  74. std::string getInfoDump();
  75. // estate info
  76. std::string mName; /// estate name
  77. LLUUID mOwnerID; /// estate owner id
  78. U32 mID; /// estate id
  79. U32 mFlags; /// estate flags
  80. F32 mSunHour; /// estate sun hour
  81. update_signal_t mUpdateSignal; /// emitted when we receive update from sim
  82. update_signal_t mCommitSignal; /// emitted when our update gets applied to sim
  83. };
  84. #endif // LL_LLESTATEINFOMODEL_H