代码拉取完成,页面将自动刷新
#ifndef __R_STRING_H__
#define __R_STRING_H__
#include <string.h>
class r_string
{
public:
r_string()
:m_size(0)
{
m_buf[0] = '\0';
}
r_string(const char* str, const int in_size)
: m_size(in_size)
{
memcpy(m_buf, str, in_size);
m_buf[in_size] = '\0';
}
r_string(const char* str)
{
m_size = strlen(str);
memcpy(m_buf, str, m_size);
m_buf[m_size] = '\0';
}
r_string& operator=(const r_string& r)
{
m_size = r.m_size;
memcpy(m_buf, r.m_buf, m_size);
m_buf[m_size] = '\0';
return *this;
}
void assign(const char* str, const int in_size)
{
memcpy(m_buf, str, in_size);
m_size = in_size;
m_buf[m_size] = '\0';
}
void append(const char* str, const int in_size)
{
memcpy(m_buf + m_size, str, in_size);
m_size += in_size;
m_buf[m_size] = '\0';
}
const char* c_str()
{
return m_buf;
}
char* Data()
{
return m_buf;
}
int Size()
{
return m_size;
}
private:
char m_buf[256];
int m_size;
};
#endif
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。