aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llinventory/llsaleinfo.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/llinventory/llsaleinfo.h
parentREADME.txt (diff)
downloadmeta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/llinventory/llsaleinfo.h')
-rw-r--r--linden/indra/llinventory/llsaleinfo.h129
1 files changed, 129 insertions, 0 deletions
diff --git a/linden/indra/llinventory/llsaleinfo.h b/linden/indra/llinventory/llsaleinfo.h
new file mode 100644
index 0000000..5e80108
--- /dev/null
+++ b/linden/indra/llinventory/llsaleinfo.h
@@ -0,0 +1,129 @@
1/**
2 * @file llsaleinfo.h
3 * @brief LLSaleInfo class header file.
4 *
5 * Copyright (c) 2002-2007, Linden Research, Inc.
6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement
10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12 * online at http://secondlife.com/developers/opensource/gplv2
13 *
14 * There are special exceptions to the terms and conditions of the GPL as
15 * it is applied to this Source Code. View the full text of the exception
16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 * online at http://secondlife.com/developers/opensource/flossexception
18 *
19 * By copying, modifying or distributing this software, you acknowledge
20 * that you have read and understood your obligations described above,
21 * and agree to abide by those obligations.
22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE.
26 */
27
28#ifndef LL_LLSALEINFO_H
29#define LL_LLSALEINFO_H
30
31#include <stdio.h>
32#include <iostream>
33
34#include "llpermissionsflags.h"
35#include "llsd.h"
36#include "llxmlnode.h"
37
38//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
39// Class LLSaleInfo
40//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41
42// L$ default price for objects
43const S32 DEFAULT_PRICE = 10;
44
45class LLMessageSystem;
46
47class LLSaleInfo
48{
49public:
50 // use this to avoid temporary object creation
51 static const LLSaleInfo DEFAULT;
52
53 enum EForSale
54 {
55 // item is not to be considered for transactions
56 FS_NOT = 0,
57
58 // the origional is on sale
59 FS_ORIGINAL = 1,
60
61 // A copy is for sale
62 FS_COPY = 2,
63
64 // Valid only for tasks, the inventory is for sale
65 // at the price in this structure.
66 FS_CONTENTS = 3,
67
68 FS_COUNT
69 };
70
71protected:
72 EForSale mSaleType;
73 S32 mSalePrice;
74
75public:
76 // default constructor is fine usually
77 LLSaleInfo();
78 LLSaleInfo(EForSale sale_type, S32 sale_price);
79
80 // accessors
81 BOOL isForSale() const;
82 EForSale getSaleType() const { return mSaleType; }
83 S32 getSalePrice() const { return mSalePrice; }
84 U32 getCRC32() const;
85
86 // mutators
87 void setSaleType(EForSale type) { mSaleType = type; }
88 void setSalePrice(S32 price);
89 //void setNextOwnerPermMask(U32 mask) { mNextOwnerPermMask = mask; }
90
91
92 // file serialization
93 BOOL exportFile(FILE* fp) const;
94 BOOL importFile(FILE* fp, BOOL& has_perm_mask, U32& perm_mask);
95
96 BOOL exportLegacyStream(std::ostream& output_stream) const;
97 LLSD asLLSD() const;
98 operator LLSD() const { return asLLSD(); }
99 bool fromLLSD(LLSD& sd, BOOL& has_perm_mask, U32& perm_mask);
100 BOOL importLegacyStream(std::istream& input_stream, BOOL& has_perm_mask, U32& perm_mask);
101
102 LLXMLNode *exportFileXML() const;
103 BOOL importXML(LLXMLNode* node);
104
105 // message serialization
106 void packMessage(LLMessageSystem* msg) const;
107 void unpackMessage(LLMessageSystem* msg, const char* block);
108 void unpackMultiMessage(LLMessageSystem* msg, const char* block,
109 S32 block_num);
110
111 // static functionality for determine for sale status.
112 static EForSale lookup(const char* name);
113 static const char* lookup(EForSale type);
114
115 // Allow accumulation of sale info. The price of each is added,
116 // conflict in sale type results in FS_NOT, and the permissions
117 // are tightened.
118 void accumulate(const LLSaleInfo& sale_info);
119
120 bool operator==(const LLSaleInfo &rhs) const;
121 bool operator!=(const LLSaleInfo &rhs) const;
122};
123
124// These functions convert between structured data and sale info as
125// appropriate for serialization.
126LLSD ll_create_sd_from_sale_info(const LLSaleInfo& sale);
127LLSaleInfo ll_sale_info_from_sd(const LLSD& sd);
128
129#endif // LL_LLSALEINFO_H