本文整理汇总了C++中KviCString::hexDecode方法的典型用法代码示例。如果您正苦于以下问题:C++ KviCString::hexDecode方法的具体用法?C++ KviCString::hexDecode怎么用?C++ KviCString::hexDecode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KviCString
的用法示例。
在下文中一共展示了KviCString::hexDecode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fi
LogFile::LogFile(const QString & szName)
{
m_szFilename = szName;
QFileInfo fi(m_szFilename);
QString szTmpName = fi.fileName();
m_bCompressed = (fi.suffix() == "gz");
if(m_bCompressed)
{
//removes trailing dot and extension
szTmpName.chop(3);
}
QString szTypeToken = szTmpName.section('_',0,0);
// Ignore non-logs files, this includes '.' and '..'
if(KviQString::equalCI(szTypeToken,"channel") || KviQString::equalCI(szTypeToken,"deadchannel"))
{
m_szType = "channel";
m_eType = Channel;
} else if(KviQString::equalCI(szTypeToken,"console"))
{
m_szType = "console";
m_eType = Console;
} else if(KviQString::equalCI(szTypeToken,"query"))
{
m_szType = "query";
m_eType = Query;
} else if(KviQString::equalCI(szTypeToken,"dccchat"))
{
m_szType = "dccchat";
m_eType = DccChat;
} else {
m_szType = "";
m_eType = Other;
}
KviCString szUndecoded = szTmpName.section('.',0,0);
szUndecoded.cutToFirst('_');
m_szName = szUndecoded.hexDecode(szUndecoded.ptr()).ptr();
szUndecoded = szTmpName.section('.',1).section('_',0,-2);
m_szNetwork = szUndecoded.hexDecode(szUndecoded.ptr()).ptr();
QString szDate = szTmpName.section('_',-1).section('.',0,-2);
switch(KVI_OPTION_UINT(KviOption_uintOutputDatetimeFormat))
{
case 1:
m_date = QDate::fromString(szDate, Qt::ISODate);
break;
case 2:
m_date = QDate::fromString(szDate, Qt::SystemLocaleShortDate);
if(!m_date.isValid())
{
// some locale date formats use '/' as a separator; we change them to '-'
// when creating log files. Try to reverse that change here
QString szUnescapedDate = szDate;
szUnescapedDate.replace('-', KVI_PATH_SEPARATOR_CHAR);
m_date = QDate::fromString(szUnescapedDate, Qt::SystemLocaleShortDate);
if(m_date.isValid())
{
//qt4 defaults to 1900 for years. So "11" means "1911" instead of "2011".. what a pity
if(m_date.year() < 1990)
m_date = m_date.addYears(100);
}
}
break;
case 0:
default:
m_date = QDate::fromString(szDate, "yyyy.MM.dd");
break;
}
if(!m_date.isValid())
{
// probably the log has been created when the OutputDatetimeFormat option
// was set to a different value. Try to guess its format
m_date = QDate::fromString(szDate, "yyyy.MM.dd");
if(!m_date.isValid())
{
m_date = QDate::fromString(szDate, Qt::ISODate);
if(!m_date.isValid())
{
m_date = QDate::fromString(szDate, Qt::SystemLocaleShortDate);
if(!m_date.isValid())
{
// some locale date formats use '/' as a separator; we change them to '-'
// when creating log files. Try to reverse that change here
QString szUnescapedDate = szDate;
szUnescapedDate.replace('-', KVI_PATH_SEPARATOR_CHAR);
m_date = QDate::fromString(szUnescapedDate, Qt::SystemLocaleShortDate);
if(m_date.isValid())
{
//qt4 defaults to 1900 for years. So "11" means "1911" instead of "2011".. what a pity
if(m_date.year() < 1990)
m_date = m_date.addYears(100);
}
}
// if the date is still not valid, we give up
}
}
//.........这里部分代码省略.........
示例2: load
//.........这里部分代码省略.........
if((*trail == '\r') || (*trail == '\t') || (*trail == ' '))*trail = 0;
else break;
trail--;
}
// yeah, have some data in this line :D
switch(*begin)
{
case 0:
// empty line
break;
case '#':
// comment: just skip it
break;
case '[':
// group ?
begin++;
if(*begin && (*begin != ']'))
{
char * z = begin;
#define COMPAT_WITH_OLD_CONFIGS
#ifdef COMPAT_WITH_OLD_CONFIGS
// run to the end of the string
while(*z)z++;
// run back to the trailing ']'
while((z > begin) && (*z != ']'))z--;
// if it is not ther just run back to the end of the string
if(*z != ']')while(*z)z++;
#else
// new configs have it always encoded properly
while(*z && (*z != ']'))z++;
#endif
*z = 0;
tmp.hexDecode(begin);
tmp.stripRightWhiteSpace(); // no external spaces in group names
if(!tmp.isEmpty())
{
QString szGroup = m_bLocal8Bit ?
QString::fromLocal8Bit(tmp.ptr(),tmp.len()) :
QString::fromUtf8(tmp.ptr(),tmp.len());
p_group = m_pDict->find(szGroup);
if(!p_group)
{
p_group = new KviConfigurationFileGroup(17,false);
p_group->setAutoDelete(true);
m_pDict->insert(szGroup,p_group);
}
}
}
break;
default:
{
// real data ?
char * z = begin;
while(*z && (*z != '='))z++;
if(*z && (z != begin))
{
*z = 0;
tmp.hexDecode(begin);
tmp.stripRightWhiteSpace(); // No external spaces at all in keys
if(!tmp.isEmpty())
{
QString szKey = m_bLocal8Bit ?
QString::fromLocal8Bit(tmp.ptr(),tmp.len()) :
QString::fromUtf8(tmp.ptr(),tmp.len());