PageRenderTime 45ms CodeModel.GetById 33ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 1ms

/indra/llmessage/lltransfersourcefile.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 75 lines | 39 code | 10 blank | 26 comment | 0 complexity | 79e003cd7f9192efa78048e2f8235504 MD5 | raw file
 1/** 
 2 * @file lltransfersourcefile.h
 3 * @brief Transfer system for sending a file.
 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#ifndef LL_LLTRANSFERSOURCEFILE_H
28#define LL_LLTRANSFERSOURCEFILE_H
29
30#include "lltransfermanager.h"
31
32class LLTransferSourceParamsFile : public LLTransferSourceParams
33{
34public:
35	LLTransferSourceParamsFile();
36	virtual ~LLTransferSourceParamsFile() {}
37	/*virtual*/ void packParams(LLDataPacker &dp) const;
38	/*virtual*/ BOOL unpackParams(LLDataPacker &dp);
39
40	void setFilename(const std::string &filename)		{ mFilename = filename; }
41	std::string getFilename() const					{ return mFilename; }
42
43	void setDeleteOnCompletion(BOOL enabled)		{ mDeleteOnCompletion = enabled; }
44	BOOL getDeleteOnCompletion()					{ return mDeleteOnCompletion; }
45protected:
46	std::string mFilename;
47	// ONLY DELETE THINGS OFF THE SIM IF THE FILENAME BEGINS IN 'TEMP'
48	BOOL mDeleteOnCompletion;
49};
50
51class LLTransferSourceFile : public LLTransferSource
52{
53public:
54	LLTransferSourceFile(const LLUUID &transfer_id, const F32 priority);
55	virtual ~LLTransferSourceFile();
56
57protected:
58	/*virtual*/ void initTransfer();
59	/*virtual*/ F32 updatePriority();
60	/*virtual*/ LLTSCode dataCallback(const S32 packet_id,
61									  const S32 max_bytes,
62									  U8 **datap,
63									  S32 &returned_bytes,
64									  BOOL &delete_returned);
65	/*virtual*/ void completionCallback(const LLTSCode status);
66
67	virtual void packParams(LLDataPacker& dp) const;
68	/*virtual*/ BOOL unpackParams(LLDataPacker &dp);
69
70protected:
71	LLTransferSourceParamsFile mParams;
72	LLFILE *mFP;
73};
74
75#endif // LL_LLTRANSFERSOURCEFILE_H