You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
813 B
C++
55 lines
813 B
C++
#include "StringData.h"
|
|
#include <sstream>
|
|
#include <iomanip>
|
|
#include <ctime>
|
|
|
|
#include "Utils.h"
|
|
|
|
StringData::StringData()
|
|
{
|
|
}
|
|
|
|
StringData::StringData(std::string &data)
|
|
{
|
|
m_data = data;
|
|
}
|
|
|
|
Data* StringData::clone()
|
|
{
|
|
Data* data = new StringData(m_data);
|
|
return data;
|
|
}
|
|
|
|
void StringData::copy(Data* data)
|
|
{
|
|
StringData *dt = dynamic_cast<StringData *>(data);
|
|
m_data = dt->getData();
|
|
}
|
|
|
|
void StringData::copy(Data& data)
|
|
{
|
|
StringData *dt = dynamic_cast<StringData *>(&data);
|
|
m_data = dt->getData();
|
|
}
|
|
|
|
std::string StringData::toStr()
|
|
{
|
|
return m_data;
|
|
}
|
|
|
|
std::string StringData::toByteStr()
|
|
{
|
|
return m_data;
|
|
}
|
|
|
|
std::string StringData::toHexStr()
|
|
{
|
|
return Utils::strToHexStr(m_data);
|
|
}
|
|
|
|
bool StringData::fromByteStr(std::string str)
|
|
{
|
|
m_data = str;
|
|
return true;
|
|
}
|