当前位置: 首页>>代码示例>>C++>>正文


C++ ConVar::getDefaultValue方法代码示例

本文整理汇总了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();
}
开发者ID:BGCX261,项目名称:zot2-svn-to-git,代码行数:67,代码来源:iconsole.cpp


注:本文中的ConVar::getDefaultValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。