/** * Set attributes of the node that represents this class * in the XMI document. * @param doc the xmi document * @param blockElement the xmi element holding the attributes */ void TextBlock::setAttributesOnNode(QDomDocument & doc, QDomElement & blockElement) { Q_UNUSED(doc); QString endLine = UMLApp::app()->commonPolicy()->getNewLineEndingChars(); blockElement.setAttribute("tag",getTag()); // only write these if different from defaults if (getIndentationLevel()) blockElement.setAttribute("indentLevel", QString::number(getIndentationLevel())); if (!m_text.isEmpty()) blockElement.setAttribute("text", encodeText(m_text, endLine)); if (!getWriteOutText()) blockElement.setAttribute("writeOutText", getWriteOutText()?"true":"false"); if (!canDelete()) blockElement.setAttribute("canDelete", canDelete()?"true":"false"); }
/** * @return QString */ QString CPPCodeComment::toString ( ) { QString output = ""; // simple output method if(getWriteOutText()) { QString indent = getIndentationString(); QString endLine = getNewLineEndingChars(); output.append(formatMultiLineText (getText()+endLine, indent +"// ", endLine)); } return output; }
QString DCodeComment::toString () const { QString output; // simple output method if(getWriteOutText()) { QString indent = getIndentationString(); QString endLine = getNewLineEndingChars(); QString body = getText(); // check the need for multiline comments if (body.indexOf(QRegExp(endLine)) >= 0) { output += indent + QLatin1String("/**") + endLine; output += formatMultiLineText (body, indent + QLatin1String(" * "), endLine); output += indent + QLatin1String(" */") + endLine; } else { output += formatMultiLineText (body, indent + QLatin1String("// "), endLine); } } return output; }