umbrello/umbrello
rubycodeaccessormethod.cpp
Go to the documentation of this file.
37 RubyCodeAccessorMethod::RubyCodeAccessorMethod(CodeClassField * field, CodeAccessorMethod::AccessorType type)
43 RubyClassifierCodeDocument *rccd = dynamic_cast<RubyClassifierCodeDocument*>(field->getParentDocument());
93 text += QLatin1String("if ") + fieldName + QLatin1String(".size() < ")+ QString::number(maxOccurs) + QLatin1Char(' ') + endLine + indent;
98 text += indent + QLatin1String("puts(\"ERROR: Cannot add") + fieldType + QLatin1String(" to ") + fieldName
99 + QLatin1String(", minimum number of items reached.\")") + endLine + QLatin1String("end") + endLine;
116 text += QLatin1String("if ") + fieldName + QLatin1String(".size() >= ") + QString::number(minOccurs) + endLine + indent;
121 text += indent + QLatin1String("puts(\"ERROR: Cant remove") + fieldType + QLatin1String(" from ") + fieldName + QLatin1String(", minimum number of items reached.\")") + endLine + QLatin1String("end") + endLine;
182 headerText = QLatin1String("Add an object of type ") + objectType + QLatin1String(" to the Array ") + fieldName + endLine + description + endLine + QLatin1String("@return nil");
183 setStartMethodText(QLatin1String("def ")+ methodName + QLatin1Char('(') + methodParams + QLatin1Char(')'));
192 methodName = QLatin1String("get") + Codegen_Utils::capitalizeFirstLetter(fieldType) + QLatin1String("List");
194 headerText = QLatin1String("Get the list of ") + fieldName + endLine + description + endLine + QLatin1String("_returns_ List of ") + fieldName;
195 setStartMethodText(QLatin1String("def ")+ methodName + QLatin1Char('(') + methodParams + QLatin1Char(')'));
202 headerText = QLatin1String("Remove an object of type ") + objectType + QLatin1String(" from the List ") + fieldName + endLine + description;
203 setStartMethodText(QLatin1String("def ") + methodName + QLatin1Char('(') + methodParams + QLatin1Char(')'));
void setType(AccessorType type)
Set the type of accessor method this is.
Definition: codeaccessormethod.cpp:72
void setEndMethodText(const QString &value)
Set the ending text that finishes this method after the body is printed.
Definition: codemethodblock.cpp:66
void setStartMethodText(const QString &value)
Set the starting text that begins this method before the body is printed.
Definition: codemethodblock.cpp:58
static QString cppToRubyName(const QString &cppName)
Convert C++ names such as 'm_foobar' or pFoobar to just 'foobar' for ruby.
Definition: rubycodegenerator.cpp:134
void setText(const QString &text)
Set the value of m_text The actual text of this code block.
Definition: textblock.cpp:80
QString getNewLineEndingChars() const
Utility function to get the actual characters.
Definition: codegenerationpolicy.cpp:248
class RubyCodeDocumentation A Ruby code comment.
Definition: rubycodedocumentation.h:29
AccessorType getType()
Utility method to get the value of the parent object of the parent classifield.
Definition: codeaccessormethod.cpp:64
virtual void setAttributesOnNode(QDomDocument &doc, QDomElement &blockElement)
Set attributes of the node that represents this class in the XMI document.
Definition: rubycodeaccessormethod.cpp:58
CodeClassField * getParentClassField()
Get the value of m_parentclassfield.
Definition: codeaccessormethod.cpp:40
class CodeGenerationPolicy This class describes the code generation policy for this project...
Definition: codegenerationpolicy.h:29
QString & remove(int position, int n)
ClassifierCodeDocument * getParentDocument()
Get the parent Code Document.
Definition: codeparameter.cpp:133
int minimumListOccurances()
Find the minimum number of things that can occur in an association If mistakenly called on attribute ...
Definition: codeclassfield.cpp:328
Definition: basictypes.h:58
QString number(int n, int base)
QString capitalizeFirstLetter(const QString &string)
Return the input string with the first letter capitalized.
Definition: codegen_utils.cpp:421
Definition: codeaccessormethod.h:32
class RubyClassifierCodeDocument A Ruby UMLClassifier Code Document.
Definition: rubyclassifiercodedocument.h:36
Definition: codeaccessormethod.h:32
virtual void setAttributesOnNode(QDomDocument &doc, QDomElement &blockElement)
Set attributes of the node that represents this class in the XMI document.
Definition: codeaccessormethod.cpp:123
int maximumListOccurances()
Find the maximum number of things that can occur in an association If mistakenly called on attribute ...
Definition: codeclassfield.cpp:352
QString toString(Enum item, bool mnemonic)
Convert Visibility item into QString representation.
Definition: basictypes.cpp:99
Definition: codeaccessormethod.h:20
Definition: codeaccessormethod.h:32
CodeGenerationPolicy * commonPolicy() const
Returns the default code generation policy.
Definition: uml.cpp:2219
Definition: basictypes.h:57
virtual void updateContent()
This is the method called from within syncToparent() to update the body of the method.
Definition: rubycodeaccessormethod.cpp:78
QString & replace(int position, int n, QChar after)
virtual void setAttributesFromNode(QDomElement &element)
Set the class attributes of this object from the passed element node.
Definition: codeaccessormethod.cpp:137
Uml::Visibility::Enum getAttributeAccessorScope()
Get the value of m_attributeAccessorScope.
Definition: codegenerationpolicy.cpp:384
Uml::Visibility::Enum getVisibility() const
Utility method to get the value of parent object scope.
Definition: codeparameter.cpp:89
RubyCodeAccessorMethod(CodeClassField *field, CodeAccessorMethod::AccessorType type)
Constructor.
Definition: rubycodeaccessormethod.cpp:37
Definition: codeaccessormethod.h:32
virtual void setAttributesFromNode(QDomElement &element)
Set the class attributes of this object from the passed element node.
Definition: rubycodeaccessormethod.cpp:70
void update()
Must be called before this object is usable.
Definition: rubycodeaccessormethod.cpp:225
Definition: basictypes.h:61
void setComment(CodeComment *object)
Set the Comment object.
Definition: codeblockwithcomments.cpp:38
QString getText() const
Get the value of m_text The actual text of this code block.
Definition: textblock.cpp:99
Definition: basictypes.h:59
virtual void updateMethodDeclaration()
This is the method called from within syncToparent().
Definition: rubycodeaccessormethod.cpp:136
static QString getIndentation()
Get how much a single "level" of indentation will actually indent.
Definition: textblock.cpp:182
static QString cppToRubyType(const QString &cppType)
Convert a C++ type such as 'int' or 'QWidget' to ruby types Integer and Qt::Widget.
Definition: rubycodegenerator.cpp:110
Definition: rubycodeclassfield.h:22
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:40:26 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:40:26 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.