PageRenderTime 124ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/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
Possible License(s): LGPL-2.1
  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. #ifndef LL_LLTRANSFERSOURCEFILE_H
  27. #define LL_LLTRANSFERSOURCEFILE_H
  28. #include "lltransfermanager.h"
  29. class LLTransferSourceParamsFile : public LLTransferSourceParams
  30. {
  31. public:
  32. LLTransferSourceParamsFile();
  33. virtual ~LLTransferSourceParamsFile() {}
  34. /*virtual*/ void packParams(LLDataPacker &dp) const;
  35. /*virtual*/ BOOL unpackParams(LLDataPacker &dp);
  36. void setFilename(const std::string &filename) { mFilename = filename; }
  37. std::string getFilename() const { return mFilename; }
  38. void setDeleteOnCompletion(BOOL enabled) { mDeleteOnCompletion = enabled; }
  39. BOOL getDeleteOnCompletion() { return mDeleteOnCompletion; }
  40. protected:
  41. std::string mFilename;
  42. // ONLY DELETE THINGS OFF THE SIM IF THE FILENAME BEGINS IN 'TEMP'
  43. BOOL mDeleteOnCompletion;
  44. };
  45. class LLTransferSourceFile : public LLTransferSource
  46. {
  47. public:
  48. LLTransferSourceFile(const LLUUID &transfer_id, const F32 priority);
  49. virtual ~LLTransferSourceFile();
  50. protected:
  51. /*virtual*/ void initTransfer();
  52. /*virtual*/ F32 updatePriority();
  53. /*virtual*/ LLTSCode dataCallback(const S32 packet_id,
  54. const S32 max_bytes,
  55. U8 **datap,
  56. S32 &returned_bytes,
  57. BOOL &delete_returned);
  58. /*virtual*/ void completionCallback(const LLTSCode status);
  59. virtual void packParams(LLDataPacker& dp) const;
  60. /*virtual*/ BOOL unpackParams(LLDataPacker &dp);
  61. protected:
  62. LLTransferSourceParamsFile mParams;
  63. LLFILE *mFP;
  64. };
  65. #endif // LL_LLTRANSFERSOURCEFILE_H