Exemplo n.º 1
0
void cLog::generateTimeHead(tstring & header)
{
    GetLocalTime(&m_systm);
    
    header.resize(128);
    msprintf_s(&header[0], 128, _T("[%2.2d:%2.2d:%2.2d]: "), 
        m_systm.wHour, m_systm.wMinute, m_systm.wSecond);

    trimPartString(header);
}
Exemplo n.º 2
0
void bin2string(const byte * data, size_t length, tstring & out)
{
	out.resize(length * 2);
	tchar * p = (tchar *)out.c_str();
	for (; 0 != length; ++data, --length, p += 2)
	{
		if (*data < 0x10)
		{
			*p = '0';
			itox((int)(*data), p + 1, 16);
		}
		else
		{
			itox((int)(*data), p, 16);
		}
	}
}
Exemplo n.º 3
0
vector<tstring> Mind::Parse(tstring s)
{
	int len = (int)s.length() - 1;
	vector <tstring> res;
	while (len != -1 && _istspace(s[len]))
		len--;
	if (len < 0)
		return res;
	s.resize(len);
	int it = 0;
	while (it != len)
	{
		while (it != len && _istspace(s[it]))
			it++;
		if (it == len)
			break;
		int start = it;
		while (it != len && !_istspace(s[it]))
			it++;
		res.push_back(s.substr(start, it - start));
	}
	return res;
}
Exemplo n.º 4
0
inline void format(tstring& s)
{
	int pos = (int)s.length() - 1;
	if (s[pos] == _T('\r'))
		s.resize(pos);
}