本文整理汇总了C++中GmatCommand::GetCommentLine方法的典型用法代码示例。如果您正苦于以下问题:C++ GmatCommand::GetCommentLine方法的具体用法?C++ GmatCommand::GetCommentLine怎么用?C++ GmatCommand::GetCommentLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GmatCommand
的用法示例。
在下文中一共展示了GmatCommand::GetCommentLine方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetCommentLine
//------------------------------------------------------------------------------
const std::string& BeginScript::GetGeneratingString(Gmat::WriteMode mode,
const std::string &prefix,
const std::string &useName)
{
//Note: This method is called only once from the ScriptInterpreter::WriteScript(),
// so all nested ScriptEvent generating strings should be handled here.
std::stringstream gen;
std::string indent;
std::string commentLine = GetCommentLine();
std::string inlineComment = GetInlineComment();
std::string beginPrefix = prefix;
if (mode != Gmat::GUI_EDITOR)
{
if (mode == Gmat::NO_COMMENTS)
{
gen << prefix << "BeginScript" << "\n";
}
else
{
IndentComment(gen, commentLine, prefix);
// Insert command name (Fix for GMT-2612, LOJ: 2012.10.22)
//gen << prefix << "BeginScript";
std::string tempString = prefix + "BeginScript";
InsertCommandName(tempString);
gen << tempString;
if (inlineComment != "")
gen << inlineComment << "\n";
else
gen << "\n";
}
}
#if DBGLVL_GEN_STRING
MessageInterface::ShowMessage
("BeginScript::GetGeneratingString() this=(%p)%s, mode=%d, prefix='%s', "
"useName='%s'\n", this, this->GetTypeName().c_str(), mode, prefix.c_str(),
useName.c_str());
#endif
if (mode == Gmat::GUI_EDITOR)
indent = "";
else
indent = " ";
GmatCommand *current = next;
while (current != NULL)
{
#if DBGLVL_GEN_STRING > 1
MessageInterface::ShowMessage
("BeginScript::GetGeneratingString() current=(%p)%s\n", current,
current->GetTypeName().c_str());
#endif
if (current->GetTypeName() != "EndScript")
{
// Indent whole block within Begin/EndScript
IndentChildString(gen, current, indent, mode, prefix, useName, false);
// Get command after EndScript
current = GmatCommandUtil::GetNextCommand(current);
if (current == NULL)
IndentChildString(gen, current, indent, mode, beginPrefix, useName, true);
}
else
{
if (mode != Gmat::GUI_EDITOR)
{
// Indent whole block within Begin/EndScript
IndentChildString(gen, current, indent, mode, beginPrefix, useName, true);
}
else
{
std::string comment = current->GetCommentLine();
#if DBGLVL_GEN_STRING
MessageInterface::ShowMessage(" EndScript comment = '%s'\n", comment.c_str());
#endif
// Only indent inline comment of EndScript (LOJ: 2013.03.27)
gen << indent << comment;
}
current = NULL;
}
}
generatingString = gen.str();
#if DBGLVL_GEN_STRING
MessageInterface::ShowMessage
("BeginScript::GetGeneratingString() returnning generatingString\n");
MessageInterface::ShowMessage("<<<\n%s>>>\n\n", generatingString.c_str());
#endif
return generatingString;
}