javacodecomment.cpp
00001 00002 /*************************************************************************** 00003 * * 00004 * This program is free software; you can redistribute it and/or modify * 00005 * it under the terms of the GNU General Public License as published by * 00006 * the Free Software Foundation; either version 2 of the License, or * 00007 * (at your option) any later version. * 00008 * * 00009 ***************************************************************************/ 00010 00011 /* This code generated by: 00012 * Author : thomas 00013 * Date : Mon Jun 23 2003 00014 */ 00015 00016 #include "javacodecomment.h" 00017 #include <qregexp.h> 00018 00019 // Constructors/Destructors 00020 // 00021 00022 JavaCodeComment::JavaCodeComment ( CodeDocument * doc, const QString & text ) 00023 : CodeComment (doc, text) 00024 { 00025 00026 } 00027 00028 JavaCodeComment::~JavaCodeComment ( ) { } 00029 00030 // 00031 // Methods 00032 // 00033 00034 00035 // Accessor methods 00036 // 00037 00038 00039 // Public attribute accessor methods 00040 // 00041 00042 // Other methods 00043 // 00044 00045 QString JavaCodeComment::getNewEditorLine ( int amount ) { 00046 QString line = getIndentationString(amount) + "// "; 00047 return line; 00048 } 00049 00053 QString JavaCodeComment::unformatText ( const QString & text , const QString & indent) 00054 { 00055 00056 // remove leading or trailing comment stuff 00057 QString mytext = TextBlock::unformatText(text, indent); 00058 00059 // now leading slashes 00060 mytext.remove(QRegExp("^\\/\\/\\s*")); 00061 return mytext; 00062 } 00063 00067 QString JavaCodeComment::toString ( ) 00068 { 00069 00070 QString output = ""; 00071 00072 // simple output method 00073 if(getWriteOutText()) 00074 { 00075 QString indent = getIndentationString(); 00076 QString endLine = getNewLineEndingChars(); 00077 output.append(formatMultiLineText (getText(), indent +"// ", endLine)); 00078 } 00079 00080 return output; 00081 } 00082 00083 00084 #include "javacodecomment.moc"
