#pragma once #include #include "data/Data.h" /* * 无数据数据类型 * * */ class StringData : public Data { public: StringData(); StringData(std::string &data); virtual ~StringData() {}; Data* clone() override; void copy(Data* data) override; void copy(Data& data) override; int length() override { return m_data.length(); }; // 转换为字符串格式 virtual std::string toStr() override; // 转换为Byte字符串 virtual std::string toByteStr() override; // 转换为十六进制字符串 virtual std::string toHexStr() override; // 根据Byte字符串解析数据 virtual bool fromByteStr(std::string str = "") override; std::string& getData() { return m_data; } void setData(std::string& data) { m_data = data; } private: std::string m_data; };