floo2
bmx_file_attachment.h
1 //-------------------------------------------------------------------------------------------------
2 // File : bmx_file_attachment.h
3 // Author : Eric Liang <eric@bmxlabs.com>
4 // Purpose : bmx message file attachment define file.
5 // Created : 12 Nov 2018 by Eric Liang <eric@bmxlabs.com>
6 //-------------------------------------------------------------------------------------------------
7 //
8 // Copyright (C) 2018-2019 MaxIM.Top
9 //
10 // You may obtain a copy of the licence at http://www.maxim.top/LICENCE-MAXIM.md
11 //
12 //-------------------------------------------------------------------------------------------------
13 
14 #ifndef bmx_file_attachment_h
15 #define bmx_file_attachment_h
16 
17 #include "bmx_message_attachment.h"
18 
19 namespace floo {
20 
21 template <typename T> class Encoder;
22 template <typename T> class Decoder;
23 
27 class EXPORT_API BMXFileAttachment : public BMXMessageAttachment
28 {
29 public:
30 
36  BMXFileAttachment(const std::string& path, const std::string& displayName = "");
37 
44  BMXFileAttachment(const std::string &ratelUrl, const std::string& displayName, int64_t fileLength);
45 
49  virtual ~BMXFileAttachment() {}
50 
55  virtual Type type() const { return Type::File; }
56 
61  virtual BMXMessageAttachmentPtr clone() const;
62 
67  const std::string& path() const;
68 
73  const std::string& displayName() const;
74 
79  const std::string& ratelUrl() const;
80 
85  const std::string& url() const;
86 
91  int64_t fileLength() const;
92 
97  DownloadStatus downloadStatus() const;
98 
99 protected:
100  std::string mPath;
101  std::string mDisplayName;
102  std::string mRatelUrl;
103  std::string mUrl;
104  int64_t mFileLength;
105  DownloadStatus mDownloadStatus;
106 
107 private:
108  friend class Encoder<BMXFileAttachment>;
109  friend class Decoder<BMXFileAttachment>;
110 };
111 
112 typedef std::shared_ptr<BMXFileAttachment> BMXFileAttachmentPtr;
113 }
114 
115 #endif /* bmx_file_attachment_h */
消息附件
Definition: bmx_message_attachment.h:26
消息文件附件
Definition: bmx_file_attachment.h:27
Definition: bmx_file_attachment.h:22
virtual ~BMXFileAttachment()
析构函数
Definition: bmx_file_attachment.h:49
virtual Type type() const
返回文件类型
Definition: bmx_file_attachment.h:55
Type
附件类型
Definition: bmx_message_attachment.h:33
Definition: bmx_file_attachment.h:21