llclassifiedflags.h 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /**
  2. * @file llclassifiedflags.h
  3. * @brief Flags used in the classifieds.
  4. *
  5. * $LicenseInfo:firstyear=2005&license=viewergpl$
  6. *
  7. * Copyright (c) 2005-2009, Linden Research, Inc.
  8. *
  9. * Second Life Viewer Source Code
  10. * The source code in this file ("Source Code") is provided by Linden Lab
  11. * to you under the terms of the GNU General Public License, version 2.0
  12. * ("GPL"), unless you have obtained a separate licensing agreement
  13. * ("Other License"), formally executed by you and Linden Lab. Terms of
  14. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16. *
  17. * There are special exceptions to the terms and conditions of the GPL as
  18. * it is applied to this Source Code. View the full text of the exception
  19. * in the file doc/FLOSS-exception.txt in this software distribution, or
  20. * online at
  21. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22. *
  23. * By copying, modifying or distributing this software, you acknowledge
  24. * that you have read and understood your obligations described above,
  25. * and agree to abide by those obligations.
  26. *
  27. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29. * COMPLETENESS OR PERFORMANCE.
  30. * $/LicenseInfo$
  31. */
  32. #ifndef LL_LLCLASSIFIEDFLAGS_H
  33. #define LL_LLCLASSIFIEDFLAGS_H
  34. #include "llpreprocessor.h"
  35. typedef U8 ClassifiedFlags;
  36. constexpr U8 CLASSIFIED_FLAG_NONE = 1 << 0;
  37. constexpr U8 CLASSIFIED_FLAG_MATURE = 1 << 1;
  38. //constexpr U8 CLASSIFIED_FLAG_ENABLED = 1 << 2; // see llclassifiedflags.cpp
  39. //constexpr U8 CLASSIFIED_FLAG_HAS_PRICE= 1 << 3; // deprecated
  40. constexpr U8 CLASSIFIED_FLAG_UPDATE_TIME= 1 << 4;
  41. constexpr U8 CLASSIFIED_FLAG_AUTO_RENEW = 1 << 5;
  42. constexpr U8 CLASSIFIED_QUERY_FILTER_MATURE = 1 << 1;
  43. //constexpr U8 CLASSIFIED_QUERY_FILTER_ENABLED = 1 << 2;
  44. //constexpr U8 CLASSIFIED_QUERY_FILTER_PRICE = 1 << 3;
  45. // These are new with Adult-enabled viewers (1.23 and later)
  46. constexpr U8 CLASSIFIED_QUERY_INC_PG = 1 << 2;
  47. constexpr U8 CLASSIFIED_QUERY_INC_MATURE = 1 << 3;
  48. constexpr U8 CLASSIFIED_QUERY_INC_ADULT = 1 << 6;
  49. constexpr U8 CLASSIFIED_QUERY_INC_NEW_VIEWER = (CLASSIFIED_QUERY_INC_PG |
  50. CLASSIFIED_QUERY_INC_MATURE |
  51. CLASSIFIED_QUERY_INC_ADULT);
  52. constexpr S32 MAX_CLASSIFIEDS = 100;
  53. // This function is used in Adult-flag-aware viewers to pack old query flags
  54. // into the request so that they can talk to old dataservers properly. When all
  55. // OpenSim servers will be able to deal with adult flags, we can revert back to
  56. // ClassifiedFlags pack_classified_flags and get rider of this one.
  57. ClassifiedFlags pack_classified_flags_request(bool auto_renew, bool is_pg,
  58. bool is_mature, bool is_adult);
  59. ClassifiedFlags pack_classified_flags(bool auto_renew, bool is_pg,
  60. bool is_mature, bool is_adult);
  61. LL_INLINE bool is_cf_mature(ClassifiedFlags flags)
  62. {
  63. return (flags & CLASSIFIED_FLAG_MATURE) != 0 ||
  64. (flags & CLASSIFIED_QUERY_INC_MATURE) != 0;
  65. }
  66. LL_INLINE bool is_cf_update_time(ClassifiedFlags flags)
  67. {
  68. return (flags & CLASSIFIED_FLAG_UPDATE_TIME) != 0;
  69. }
  70. LL_INLINE bool is_cf_auto_renew(ClassifiedFlags flags)
  71. {
  72. return (flags & CLASSIFIED_FLAG_AUTO_RENEW) != 0;
  73. }
  74. # if 0 // Deprecated, but leaving commented out because someday we might
  75. // want to let users enable/disable classifieds. JC
  76. LL_INLINE bool is_cf_enabled(ClassifiedFlags flags)
  77. {
  78. return (flags & CLASSIFIED_FLAG_ENABLED) == CLASSIFIED_FLAG_ENABLED;
  79. }
  80. # endif
  81. #endif // LL_LLCLASSIFIEDFLAGS_H