/indra/llmessage/llclassifiedflags.cpp

https://bitbucket.org/lindenlab/viewer-beta/ · C++ · 84 lines · 37 code · 9 blank · 38 comment · 15 complexity · 22cc21d10e97d2b9f8c3387a1cf5cea8 MD5 · raw file

  1. /**
  2. * @file llclassifiedflags.cpp
  3. * @brief
  4. *
  5. * $LicenseInfo:firstyear=2006&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. // llclassifiedflags.cpp
  28. //
  29. // Some exported symbols and functions for dealing with classified flags.
  30. //
  31. // Copyright 2005, Linden Research, Inc
  32. //*****************************************************************************
  33. #include "linden_common.h"
  34. #include "llclassifiedflags.h"
  35. ClassifiedFlags pack_classified_flags_request(BOOL auto_renew, BOOL inc_pg, BOOL inc_mature, BOOL inc_adult)
  36. {
  37. U8 rv = 0;
  38. if(inc_pg) rv |= CLASSIFIED_QUERY_INC_PG;
  39. if(inc_mature) rv |= CLASSIFIED_QUERY_INC_MATURE;
  40. if (inc_pg && !inc_mature) rv |= CLASSIFIED_FLAG_MATURE;
  41. if(inc_adult) rv |= CLASSIFIED_QUERY_INC_ADULT;
  42. if(auto_renew) rv |= CLASSIFIED_FLAG_AUTO_RENEW;
  43. return rv;
  44. }
  45. ClassifiedFlags pack_classified_flags(BOOL auto_renew, BOOL inc_pg, BOOL inc_mature, BOOL inc_adult)
  46. {
  47. U8 rv = 0;
  48. if(inc_pg) rv |= CLASSIFIED_QUERY_INC_PG;
  49. if(inc_mature)
  50. {
  51. rv |= CLASSIFIED_QUERY_INC_MATURE;
  52. rv |= CLASSIFIED_FLAG_MATURE;
  53. }
  54. if(inc_adult) rv |= CLASSIFIED_QUERY_INC_ADULT;
  55. if(auto_renew) rv |= CLASSIFIED_FLAG_AUTO_RENEW;
  56. return rv;
  57. }
  58. bool is_cf_mature(ClassifiedFlags flags)
  59. {
  60. return ((flags & CLASSIFIED_FLAG_MATURE) != 0) || ((flags & CLASSIFIED_QUERY_INC_MATURE) != 0);
  61. }
  62. // Deprecated, but leaving commented out because someday we might
  63. // want to let users enable/disable classifieds. JC
  64. //bool is_cf_enabled(ClassifiedFlags flags)
  65. //{
  66. // return ((flags & CLASSIFIED_FLAG_ENABLED) == CLASSIFIED_FLAG_ENABLED);
  67. //}
  68. bool is_cf_update_time(ClassifiedFlags flags)
  69. {
  70. return ((flags & CLASSIFIED_FLAG_UPDATE_TIME) != 0);
  71. }
  72. bool is_cf_auto_renew(ClassifiedFlags flags)
  73. {
  74. return ((flags & CLASSIFIED_FLAG_AUTO_RENEW) != 0);
  75. }