PageRenderTime 33ms CodeModel.GetById 22ms 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
Possible License(s): LGPL-2.1
  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. #ifndef LL_LLAGENTPICKS_H
  27. #define LL_LLAGENTPICKS_H
  28. #include "llsingleton.h"
  29. struct LLAvatarPicks;
  30. /**
  31. * Class that provides information about Agent Picks
  32. */
  33. class LLAgentPicksInfo : public LLSingleton<LLAgentPicksInfo>
  34. {
  35. class LLAgentPicksObserver;
  36. public:
  37. LLAgentPicksInfo();
  38. virtual ~LLAgentPicksInfo();
  39. /**
  40. * Requests number of picks from server.
  41. *
  42. * Number of Picks is requested from server, thus it is not available immediately.
  43. */
  44. void requestNumberOfPicks();
  45. /**
  46. * Returns number of Picks.
  47. */
  48. S32 getNumberOfPicks() { return mNumberOfPicks; }
  49. /**
  50. * Returns maximum number of Picks.
  51. */
  52. S32 getMaxNumberOfPicks() { return mMaxNumberOfPicks; }
  53. /**
  54. * Returns TRUE if Agent has maximum allowed number of Picks.
  55. */
  56. bool isPickLimitReached();
  57. /**
  58. * After creating or deleting a Pick we can assume operation on server will be
  59. * completed successfully. Incrementing/decrementing number of picks makes new number
  60. * of picks available immediately. Actual number of picks will be updated when we receive
  61. * response from server.
  62. */
  63. void incrementNumberOfPicks() { ++mNumberOfPicks; }
  64. void decrementNumberOfPicks() { --mNumberOfPicks; }
  65. private:
  66. void onServerRespond(LLAvatarPicks* picks);
  67. /**
  68. * Sets number of Picks.
  69. */
  70. void setNumberOfPicks(S32 number) { mNumberOfPicks = number; }
  71. /**
  72. * Sets maximum number of Picks.
  73. */
  74. void setMaxNumberOfPicks(S32 max_picks) { mMaxNumberOfPicks = max_picks; }
  75. private:
  76. LLAgentPicksObserver* mAgentPicksObserver;
  77. S32 mMaxNumberOfPicks;
  78. S32 mNumberOfPicks;
  79. };
  80. #endif //LL_LLAGENTPICKS_H