本文整理汇总了C++中ConVar::getDefaultValue方法的典型用法代码示例。如果您正苦于以下问题:C++ ConVar::getDefaultValue方法的具体用法?C++ ConVar::getDefaultValue怎么用?C++ ConVar::getDefaultValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConVar
的用法示例。
在下文中一共展示了ConVar::getDefaultValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleCmd
void IConsole::handleCmd(const char *cmd)
{
// clear out the old command
m_cmd.clear();
// parse cmd into tokens
stringstream ss(cmd);
string buf;
// this actually needs to be more complex to handle
// processing double quoted strings as one argument
while (ss >> buf)
m_cmd.push_back(buf);
// if command is empty, do nothing
if (!m_cmd.size())
return;
// process the command
string theCmd(m_cmd[0]);
ConVarIter i = m_convars.find(theCmd);
if (i != m_convars.end())
{
ConVar *cv = i->second;
if (cv)
{
// is there a handler to invoke?
ConVar::ConVarPfn pfn = cv->getPfn();
if (pfn)
{
pfn();
}
else
{
// if no handler, then it's a regular variant convar
// are there arguments to process?
if (m_cmd.size() > 1)
{
string val;
CmdArgIter caIt(m_cmd.begin());
caIt++; // get past the cmd itself
// FIXME: doing this makes the cmd tokenizing seem ridiculous
// could just remove the actual command from the string
for (; caIt != m_cmd.end(); caIt++)
val += *caIt;
// forces change handler to be called as well
cv->setString(val);
}
else
{
// show value in console...don't like referring to the
ostringstream os;
os << "\"" << cv->getName() << "\" = \"" << cv->getString()
<< "\" (default: \"" << cv->getDefaultValue() << "\")";
info(os.str());
}
}
}
}
// update the previous commands list
m_prevCmds.push_back(cmd);
if (m_prevCmds.size() > m_cachedCmdsMax)
m_prevCmds.pop_front();
}