summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2015-10-29 10:12:03 (GMT)
committerKevin Smith <kevin.smith@isode.com>2015-10-30 12:49:14 (GMT)
commitcb62de17d1e17fd3049a6bc8155a100574a42a85 (patch)
treeddbabd81818f1dd16ba2ebc96b45267a1d2e4bf2 /Swiften/FileTransfer/FileTransfer.h
parent1d921f3d39ed134ca7f1d40011c1a07a5835b73c (diff)
downloadswift-cb62de17d1e17fd3049a6bc8155a100574a42a85.zip
swift-cb62de17d1e17fd3049a6bc8155a100574a42a85.tar.bz2
Add FileTransfer::getState() method
In addition, this adds the file-transfer classes to the Doxygen documentation. Test-Information: Unit and integration tests still pass. Change-Id: Ib6c16078c90ed56fae835cb2abfea8a564c3afa3
Diffstat (limited to 'Swiften/FileTransfer/FileTransfer.h')
-rw-r--r--Swiften/FileTransfer/FileTransfer.h20
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
23namespace Swift { 23namespace 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}