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


C++ GmatCommand::GetSummaryName方法代码示例

本文整理汇总了C++中GmatCommand::GetSummaryName方法的典型用法代码示例。如果您正苦于以下问题:C++ GmatCommand::GetSummaryName方法的具体用法?C++ GmatCommand::GetSummaryName怎么用?C++ GmatCommand::GetSummaryName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GmatCommand的用法示例。


在下文中一共展示了GmatCommand::GetSummaryName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

//------------------------------------------------------------------------------
// void GetSubCommandString(GmatCommand* brCmd, Integer level, std::string &cmdseq,
//                          bool showAddr = true, bool showGenStr = false,
//                          bool showSummaryName = false,
//                          const std::string &indentStr = "---")
//------------------------------------------------------------------------------
void GmatCommandUtil::
GetSubCommandString(GmatCommand* brCmd, Integer level, std::string &cmdseq,
                    bool showAddr, bool showGenStr, bool showSummaryName,
                    const std::string &indentStr)
{
   char buf[13];
   GmatCommand* current = brCmd;
   Integer childNo = 0;
   GmatCommand* nextInBranch;
   GmatCommand* child;
   std::string cmdstr, genStr;
   buf[0] = '\0';
   
   while((child = current->GetChildCommand(childNo)) != NULL)
   {
      nextInBranch = child;
      
      while ((nextInBranch != NULL) && (nextInBranch != current))
      {
         for (int i=0; i<=level; i++)
         {
            cmdseq.append(indentStr);
            
            #ifdef DEBUG_COMMAND_SEQ_STRING
            MessageInterface::ShowMessage(indentStr);
            #endif
         }
         
         if (showAddr)
            sprintf(buf, "(%p)", nextInBranch);
         
         genStr = "";
			if (showGenStr)
			{
				if (nextInBranch->GetTypeName() == "BeginScript")
					genStr = "<BeginScript>";
				else if (nextInBranch->GetTypeName() == "EndScript")
					genStr = "<EndScript>";
				else
					genStr = " <" + nextInBranch->GetGeneratingString(Gmat::NO_COMMENTS) + ">";
         }
			else if (showSummaryName)
         {
            // Show summary name
            genStr = "(" + nextInBranch->GetSummaryName() + ")";
			}
			
         // if indentation string is not blank, use it from the first sub level
         if (indentStr.find(" ") == indentStr.npos)
            cmdstr = indentStr + " " + std::string(buf) + nextInBranch->GetTypeName() + genStr + "\n";
         else
            cmdstr = std::string(buf) + nextInBranch->GetTypeName() + genStr + "\n";
         
         cmdseq.append(cmdstr);
         
         #ifdef DEBUG_COMMAND_SEQ_STRING
         MessageInterface::ShowMessage("%s", cmdstr.c_str());
         #endif
         
         if (nextInBranch->GetChildCommand() != NULL)
            GetSubCommandString(nextInBranch, level+1, cmdseq, showAddr, showGenStr,
                                showSummaryName, indentStr);
         
         nextInBranch = nextInBranch->GetNext();
      }
      
      ++childNo;
   }
}
开发者ID:,项目名称:,代码行数:75,代码来源:


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