• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdesdk API Reference
  • KDE Home
  • Contact Us
 

umbrello/umbrello

  • sources
  • kde-4.12
  • kdesdk
  • umbrello
  • umbrello
  • codegenerators
  • ruby
rubycodecomment.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * This program is free software; you can redistribute it and/or modify *
3  * it under the terms of the GNU General Public License as published by *
4  * the Free Software Foundation; either version 2 of the License, or *
5  * (at your option) any later version. *
6  * *
7  * copyright (C) 2005 *
8  * Richard Dale <Richard_Dale@tipitina.demon.co.uk> *
9  * copyright (C) 2006-2013 *
10  * Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
11  ***************************************************************************/
12 
13 #include "rubycodecomment.h"
14 
15 #include <QRegExp>
16 
17 RubyCodeComment::RubyCodeComment(CodeDocument * doc, const QString & text)
18  : CodeComment(doc, text)
19 {
20 }
21 
22 RubyCodeComment::~RubyCodeComment()
23 {
24 }
25 
26 QString RubyCodeComment::getNewEditorLine(int amount)
27 {
28  QString line = getIndentationString(amount) + "# ";
29  return line;
30 }
31 
32 QString RubyCodeComment::unformatText(const QString & text, const QString & indent)
33 {
34  // remove leading or trailing comment stuff
35  QString mytext = TextBlock::unformatText(text, indent);
36 
37  // now leading hash
38  mytext.remove(QRegExp("^#\\s*"));
39  return mytext;
40 }
41 
42 QString RubyCodeComment::toString() const
43 {
44  QString output = "";
45 
46  // simple output method
47  if (getWriteOutText()) {
48  QString indent = getIndentationString();
49  QString endLine = getNewLineEndingChars();
50  output.append(formatMultiLineText(getText(), indent + "# ", endLine + endLine));
51  }
52 
53  return output;
54 }
TextBlock::unformatText
virtual QString unformatText(const QString &text, const QString &indent="")
UnFormat a long text string.
Definition: textblock.cpp:253
RubyCodeComment::toString
QString toString() const
Definition: rubycodecomment.cpp:42
rubycodecomment.h
RubyCodeComment::RubyCodeComment
RubyCodeComment(CodeDocument *doc, const QString &text="")
Constructors.
Definition: rubycodecomment.cpp:17
TextBlock::getNewLineEndingChars
static QString getNewLineEndingChars()
Get the new line chars which ends the line.
Definition: textblock.cpp:172
CodeDocument
A document containing the code for one file.
Definition: codedocument.h:32
RubyCodeComment::getNewEditorLine
virtual QString getNewEditorLine(int amount)
A special version here because we want to not only indent the new line, but to add the "#" as well...
Definition: rubycodecomment.cpp:26
RubyCodeComment::unformatText
virtual QString unformatText(const QString &text, const QString &indent="")
UnFormat a long text string.
Definition: rubycodecomment.cpp:32
TextBlock::formatMultiLineText
static QString formatMultiLineText(const QString &work, const QString &linePrefix, const QString &breakStr, bool addBreak=true, bool lastLineHasBreak=true)
Format a long text string to be more readable.
Definition: textblock.cpp:288
RubyCodeComment::~RubyCodeComment
virtual ~RubyCodeComment()
Empty Destructor.
Definition: rubycodecomment.cpp:22
TextBlock::getIndentationString
QString getIndentationString(int level=0) const
Get the actual amount of indentation for a given level of indentation.
Definition: textblock.cpp:193
TextBlock::getWriteOutText
bool getWriteOutText() const
Get the value of m_writeOutText Whether or not to include the text of this TextBlock into a file...
Definition: textblock.cpp:141
CodeComment
Text which will be comments.
Definition: codecomment.h:23
TextBlock::getText
QString getText() const
Get the value of m_text The actual text of this code block.
Definition: textblock.cpp:99
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:06:00 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

umbrello/umbrello

Skip menu "umbrello/umbrello"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • umbrello
  •   umbrello

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal