diff options
Diffstat (limited to 'Swiften/FileTransfer/FileTransfer.h')
| -rw-r--r-- | Swiften/FileTransfer/FileTransfer.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/Swiften/FileTransfer/FileTransfer.h b/Swiften/FileTransfer/FileTransfer.h index 01c8295..afb3f7b 100644 --- a/Swiften/FileTransfer/FileTransfer.h +++ b/Swiften/FileTransfer/FileTransfer.h | |||
| @@ -19,10 +19,16 @@ | |||
| 19 | #include <Swiften/Base/API.h> | 19 | #include <Swiften/Base/API.h> |
| 20 | #include <Swiften/Base/boost_bsignals.h> | 20 | #include <Swiften/Base/boost_bsignals.h> |
| 21 | #include <Swiften/FileTransfer/FileTransferError.h> | 21 | #include <Swiften/FileTransfer/FileTransferError.h> |
| 22 | 22 | ||
| 23 | namespace Swift { | 23 | namespace Swift { |
| 24 | /** | ||
| 25 | * The FileTransfer class provides a general interface for file-transfer | ||
| 26 | * implmenetations. Currently, only Jingle File Transfer based on XEP-0234 is | ||
| 27 | * implementated in the \ref OutgoingJingleFileTransfer and | ||
| 28 | * \ref IncomingJingleFileTransfer classes. | ||
| 29 | */ | ||
| 24 | class SWIFTEN_API FileTransfer { | 30 | class SWIFTEN_API FileTransfer { |
| 25 | public: | 31 | public: |
| 26 | struct State { | 32 | struct State { |
| 27 | enum Type { | 33 | enum Type { |
| 28 | Initial, | 34 | Initial, |
| @@ -47,25 +53,31 @@ namespace Swift { | |||
| 47 | virtual ~FileTransfer(); | 53 | virtual ~FileTransfer(); |
| 48 | 54 | ||
| 49 | virtual void cancel() = 0; | 55 | virtual void cancel() = 0; |
| 50 | 56 | ||
| 51 | const std::string& getFileName() const { | 57 | const std::string& getFileName() const { |
| 52 | return filename; | 58 | return filename_; |
| 53 | } | 59 | } |
| 54 | 60 | ||
| 55 | boost::uintmax_t getFileSizeInBytes() const { | 61 | boost::uintmax_t getFileSizeInBytes() const { |
| 56 | return fileSizeInBytes; | 62 | return fileSizeInBytes_; |
| 63 | } | ||
| 64 | |||
| 65 | const State& getState() const { | ||
| 66 | return state_; | ||
| 57 | } | 67 | } |
| 58 | 68 | ||
| 59 | public: | 69 | public: |
| 60 | boost::signal<void (size_t /* proccessedBytes */)> onProcessedBytes; | 70 | boost::signal<void (size_t /* proccessedBytes */)> onProcessedBytes; |
| 61 | boost::signal<void (const State&)> onStateChanged; | 71 | boost::signal<void (const State&)> onStateChanged; |
| 62 | boost::signal<void (boost::optional<FileTransferError>)> onFinished; | 72 | boost::signal<void (boost::optional<FileTransferError>)> onFinished; |
| 63 | 73 | ||
| 64 | protected: | 74 | protected: |
| 75 | void setState(const State& state); | ||
| 65 | void setFileInfo(const std::string& name, boost::uintmax_t size); | 76 | void setFileInfo(const std::string& name, boost::uintmax_t size); |
| 66 | 77 | ||
| 67 | private: | 78 | private: |
| 68 | boost::uintmax_t fileSizeInBytes; | 79 | boost::uintmax_t fileSizeInBytes_; |
| 69 | std::string filename; | 80 | std::string filename_; |
| 81 | State state_; | ||
| 70 | }; | 82 | }; |
| 71 | } | 83 | } |
Swift