PageRenderTime 25ms CodeModel.GetById 14ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 1ms

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