rubycodecomment.cpp
00001 /*************************************************************************** 00002 rubycodecomment.cpp 00003 Derived from the Java code generator by thomas 00004 00005 begin : Thur Jul 21 2005 00006 author : Richard Dale 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 * copyright (C) 2006-2007 * 00017 * Umbrello UML Modeller Authors <uml-devel@uml.sf.net> * 00018 ***************************************************************************/ 00019 00020 #include "rubycodecomment.h" 00021 #include <qregexp.h> 00022 00023 // Constructors/Destructors 00024 // 00025 00026 RubyCodeComment::RubyCodeComment(CodeDocument * doc, const QString & text) 00027 : CodeComment(doc, text) 00028 { 00029 00030 } 00031 00032 RubyCodeComment::~RubyCodeComment( ) { } 00033 00034 // 00035 // Methods 00036 // 00037 00038 00039 // Accessor methods 00040 // 00041 00042 00043 // Public attribute accessor methods 00044 // 00045 00046 // Other methods 00047 // 00048 00049 QString RubyCodeComment::getNewEditorLine( int amount ) { 00050 QString line = getIndentationString(amount) + "# "; 00051 return line; 00052 } 00053 00057 QString RubyCodeComment::unformatText(const QString & text, const QString & indent) 00058 { 00059 // remove leading or trailing comment stuff 00060 QString mytext = TextBlock::unformatText(text, indent); 00061 00062 // now leading hash 00063 mytext.remove(QRegExp("^#\\s*")); 00064 return mytext; 00065 } 00066 00070 QString RubyCodeComment::toString( ) 00071 { 00072 QString output = ""; 00073 00074 // simple output method 00075 if (getWriteOutText()) { 00076 QString indent = getIndentationString(); 00077 QString endLine = getNewLineEndingChars(); 00078 output.append(formatMultiLineText(getText(), indent + "# ", endLine + endLine)); 00079 } 00080 00081 return output; 00082 } 00083 00084 00085 #include "rubycodecomment.moc"
