/* */ #ifndef _D_DATA_H_ #define _D_DATA_H_ #include "MetaEntry.h" #include namespace aria2 { class Data : public MetaEntry { private: int32_t len; unsigned char* data; bool number; void init(const unsigned char* data, int32_t len); public: /** * This class stores the copy of data. So caller must take care of freeing * memory of data. */ Data(const char* data, int32_t len, bool number = false); Data(const unsigned char* data, int32_t len, bool number = false); Data(const std::string& data, bool number = false); ~Data(); std::string toString() const; int32_t toInt() const; int64_t toLLInt() const; const unsigned char* getData() const; int32_t getLen() const; bool isNumber() const; void accept(MetaEntryVisitor* v) const; }; } // namespace aria2 #endif // _D_DATA_H_