umbrello: RubyWriter Class Reference

umbrello 2.38.3 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Private Member Functions | List of all members
RubyWriter Class Reference

`#include <rubywriter.h>`

Inheritance diagram for RubyWriter:

## Public Member Functions
| RubyWriter ()
virtual | ~RubyWriter ()
virtual void | writeClass (UMLClassifier *c)
virtual Uml::ProgrammingLanguage::Enum | language () const
virtual QStringList | reservedKeywords () const
Public Member Functions inherited from SimpleCodeGenerator
| SimpleCodeGenerator (bool createDirHierarchyForPackages=true)
virtual | ~SimpleCodeGenerator ()
void | writeCodeToFile (UMLClassifierList &concepts)
void | writeCodeToFile ()
virtual void | writeClass (UMLClassifier *c)=0
Public Member Functions inherited from CodeGenerator
| CodeGenerator ()
virtual | ~CodeGenerator ()
bool | addCodeDocument (CodeDocument *add_object)
bool | removeCodeDocument (CodeDocument *remove_object)
CodeDocumentList * | getCodeDocumentList ()
QString | getUniqueID (CodeDocument *codeDoc)
virtual void | saveToXMI (QXmlStreamWriter &writer)
CodeDocument * | findCodeDocumentByID (const QString &id)
virtual void | writeCodeToFile ()
virtual void | writeCodeToFile (UMLClassifierList &list)
void | setIncludeHeadings (bool i)
bool | includeHeadings () const
void | setHeadingFileDir (const QString &)
QString | headingFileDir () const
void | setForceDoc (bool f)
bool | forceDoc () const
void | setSectionCommentPolicy (CodeGenerationPolicy::WriteSectionCommentsPolicy f)
bool | forceSections () const
virtual QString | getHeadingFile (const QString &file)
QString | findFileName (CodeDocument *codeDocument)
virtual void | loadFromXMI (QDomElement &element)
virtual Uml::ProgrammingLanguage::Enum | language () const =0
CodeDocument * | findCodeDocumentByClassifier (UMLClassifier *classifier)
virtual QStringList | defaultDatatypes () const
virtual bool | isReservedKeyword (const QString &keyword)
virtual QStringList | reservedKeywords () const
virtual void | createDefaultStereotypes ()
virtual void | initFromParentDocument ()=0

## Private Member Functions
QString | cppToRubyType (const QString &typeStr)
QString | cppToRubyName (const QString &nameStr)
void | writeAttributeMethods (UMLAttributeList attribs, Uml::Visibility::Enum visibility, QTextStream &stream)
void | writeSingleAttributeAccessorMethods (const QString &fieldName, const QString &descr, QTextStream &h)
void | writeOperations (UMLClassifier *c, QTextStream &h)
void | writeOperations (const QString &classname, const UMLOperationList &opList, Uml::Visibility::Enum permitScope, QTextStream &h)

## Additional Inherited Members
Public Types inherited from CodeGenerator
enum | GenerationState { Generated , Failed , Skipped }
Public Slots inherited from SimpleCodeGenerator
virtual void | syncCodeToDocument ()
Public Slots inherited from CodeGenerator
virtual void | syncCodeToDocument ()
Signals inherited from CodeGenerator
void | codeGenerated (UMLClassifier *concept, bool generated)
void | codeGenerated (UMLClassifier *concept, CodeGenerator::GenerationState result)
void | showGeneratedFile (const QString &filename)
Static Public Member Functions inherited from CodeGenerator
static QString | cleanName (const QString &name)
static QString | formatDoc (const QString &text, const QString &linePrefix=QStringLiteral(" *"), int lineWidth=80)
static QString | formatFullDocBlock (const QString &text, const QString &blockHeader=QStringLiteral("/* "), const QString &blockFooter=QStringLiteral(" */"), const QString &linePrefix=QStringLiteral(" *"), int lineWidth=80)
static QString | formatSourceCode (const QString &code, const QString &indentation)
static void | findObjectsRelated (UMLClassifier *c, UMLPackageList &cList)
Protected Member Functions inherited from SimpleCodeGenerator
QString | findFileName (UMLPackage *concept, const QString &ext)
QString | overwritableName (UMLPackage *concept, const QString &name, const QString &ext)
bool | hasDefaultValueAttr (UMLClassifier *c)
bool | hasAbstractOps (UMLClassifier *c)
QString | indent ()
virtual void | initFromParentDocument ()
Protected Member Functions inherited from CodeGenerator
QString | overwritableName (const QString &name, const QString &extension)
bool | openFile (QFile &file, const QString &name)
void | writeListedCodeDocsToFile (CodeDocumentList *docs)
virtual void | finalizeRun ()
Protected Attributes inherited from SimpleCodeGenerator
QString | className_
QString | fileName_
QMap< UMLPackage *, QString > | m_fileMap
bool | m_createDirHierarchyForPackages
QString | m_indentation
int | m_indentLevel
QString | m_endl
Protected Attributes inherited from CodeGenerator
QHash< QString, CodeDocument * > | m_codeDocumentDictionary
bool | m_applyToAllRemaining
UMLDoc * | m_document

## Detailed Description

Class RubyWriter is a ruby code generator for UMLClassifier objects. Just call writeClass and feed it a UMLClassifier.

## Constructor & Destructor Documentation

## ◆ RubyWriter()

RubyWriter::RubyWriter | ( |  | ) |

## ◆ ~RubyWriter()

RubyWriter::~RubyWriter | ( |  | ) |
| virtual

## Member Function Documentation

## ◆ cppToRubyName()

QString RubyWriter::cppToRubyName | ( | const QString & | nameStr | ) |
| private

Convert C++ names such as 'm_foobar' or pFoobar to just 'foobar' for ruby.

Parameters

  nameStr | the C++ name to be converted

## ◆ cppToRubyType()

QString RubyWriter::cppToRubyType | ( | const QString & | typeStr | ) |
| private

Convert a C++ type such as 'int' or 'QWidget' to ruby types Integer and Qt::Widget.

Parameters

  typeStr | the C++ type to be converted

## ◆ language()

Uml::ProgrammingLanguage::Enum RubyWriter::language | ( |  | ) | const
| virtual

Returns "Ruby".

Returns
  the programming language identifier

Implements CodeGenerator.

## ◆ reservedKeywords()

QStringList RubyWriter::reservedKeywords | ( |  | ) | const
| virtual

Get list of reserved keywords.

Returns
  the list of reserved keywords

Reimplemented from CodeGenerator.

## ◆ writeAttributeMethods()

void RubyWriter::writeAttributeMethods | ( | UMLAttributeList | attribs,
|  | Uml::Visibility::Enum | visibility,
|  | QTextStream & | stream
| ) |  |
| private

Calls writeSingleAttributeAccessorMethods() on each of the attributes in attribs list.

Parameters

  attribs | the attribute
  visibility | the visibility of the attribute
  stream | output stream to the generated file

## ◆ writeClass()

void RubyWriter::writeClass | ( | UMLClassifier * | c | ) |
| virtual

Call this method to generate C++ code for a UMLClassifier.

Parameters

  c | the class you want to generate code for.

Implements SimpleCodeGenerator.

## ◆ writeOperations() [1/2]

void RubyWriter::writeOperations | ( | const QString & | classname,
|  | const UMLOperationList & | opList,
|  | Uml::Visibility::Enum | permitScope,
|  | QTextStream & | h
| ) |  |
| private

Write a list of class operations.

Parameters

  classname | the name of the class
  opList | the list of operations
  permitScope | the visibility enum
  h | output stream for the header file

## ◆ writeOperations() [2/2]

void RubyWriter::writeOperations | ( | UMLClassifier * | c,
|  | QTextStream & | h
| ) |  |
| private

Write all operations for a given class.

Parameters

  c | the concept we are generating code for
  h | output stream for the header file

## ◆ writeSingleAttributeAccessorMethods()

void RubyWriter::writeSingleAttributeAccessorMethods | ( | const QString & | fieldName,
|  | const QString & | descr,
|  | QTextStream & | h
| ) |  |
| private

Write all method declarations, for attributes and associations for the given permitted scope.

Parameters

  fieldName | the field name
  descr | the description
  h | output stream to the generated file

The documentation for this class was generated from the following files:

- umbrello/codegenerators/ruby/rubywriter.h
- umbrello/codegenerators/ruby/rubywriter.cpp