//------------------------------------------------------------------------------ //void IndentComment(wxStringstream &gen, wxString &comment, // const wxString &prefix) //------------------------------------------------------------------------------ void BeginScript::IndentComment(wxString &gen, wxString &comment, const wxString &prefix) { TextParser tp; #if DBGLVL_GEN_STRING MessageInterface::ShowMessage (wxT("BeginScript::IndentComment() comment='%s', prefix='%s'\n"), comment.c_str(), prefix.c_str()); #endif StringArray textArray = tp.DecomposeBlock(comment); UnsignedInt size = textArray.size(); if (size > 0 && textArray[0] != wxT("")) { for (UnsignedInt i=0; i<size; i++) { gen << prefix << textArray[i]; if (textArray[i].find(wxT("\n")) == comment.npos && textArray[i].find(wxT("\r")) == comment.npos) { gen << wxT("\n"); } } } }
//------------------------------------------------------------------------------ //void IndentChildString(wxStringstream &gen, GmatCommand* cmd, // wxString &indent, Gmat::WriteMode mode, // const wxString &prefix, const wxString &useName, // bool indentCommentOnly) //------------------------------------------------------------------------------ void BeginScript::IndentChildString(wxString &gen, GmatCommand* cmd, wxString &indent, Gmat::WriteMode mode, const wxString &prefix, const wxString &useName, bool indentCommentOnly) { TextParser tp; #if DBGLVL_GEN_STRING ShowCommand(wxT(""), wxT("BeginScript::IndentChildString() cmd = "), cmd); MessageInterface::ShowMessage (wxT("BeginScript::IndentChildString() indent='%s', mode=%d, prefix='%s', ") wxT("useName='%s', indentCommentOnly=%d\n"), indent.c_str(), mode, prefix.c_str(), useName.c_str(), indentCommentOnly); #endif wxString cmdstr; if (indentCommentOnly) cmdstr = cmd->GetCommentLine(); else cmdstr = cmd->GetGeneratingString(mode, prefix, useName); StringArray textArray = tp.DecomposeBlock(cmdstr); UnsignedInt size = textArray.size(); #if DBGLVL_GEN_STRING MessageInterface::ShowMessage(wxT(" There are %d text lines\n"), size); #endif if (size > 0 && textArray[0] != wxT("")) { for (UnsignedInt i=0; i<size; i++) { if (indentCommentOnly) gen << indent << prefix << textArray[i]; else gen << indent << textArray[i]; if (textArray[i].find(wxT("\n")) == cmdstr.npos && textArray[i].find(wxT("\r")) == cmdstr.npos) { gen << wxT("\n"); } } } if (indentCommentOnly) gen << prefix << cmd->GetTypeName() << wxT(";"); }