umbrello 26.07.70-c53146a 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 | Protected Member Functions | Protected Attributes | List of all members
PythonImport Class Reference

`#include <pythonimport.h>`

Inheritance diagram for PythonImport:

## Public Member Functions

| PythonImport (CodeImpThread *thread=nullptr)
virtual | ~PythonImport ()
Public Member Functions inherited from NativeImportBase
| NativeImportBase (const QString &singleLineCommentIntro, CodeImpThread *thread=nullptr)
virtual | ~NativeImportBase ()
Public Member Functions inherited from ClassImport
| ClassImport (CodeImpThread *thread=nullptr)
virtual | ~ClassImport ()
bool | importFiles (const QStringList &fileNames)
bool | importFile (const QString &fileName)
void | setRootPath (const QString &path)
bool | enabled () const

## Protected Member Functions

void | initVars ()
bool | parseInitializer (const QString &keyword, QString &type, QString &value)
bool | parseAssignmentStmt (const QString &keyword)
bool | parseMethodParameters (UMLOperation *op)
bool | parseStmt ()
void | fillSource (const QString &line)
bool | preprocess (QString &line)
QString | indentation (int level)
QString | skipBody (Uml::PrimitiveTypes::Enum *foundReturn=nullptr)
Protected Member Functions inherited from NativeImportBase
void | initialize ()
void | setMultiLineComment (const QString &intro, const QString &end)
void | setMultiLineAltComment (const QString &intro, const QString &end)
virtual bool | parseFile (const QString &filename)
virtual void | initVars ()
void | scan (const QString &line)
virtual bool | preprocess (QString &line)
virtual QStringList | split (const QString &line)
virtual void | fillSource (const QString &word)=0
virtual bool | parseStmt ()=0
void | skipStmt (const QString &until=QStringLiteral(";"))
bool | skipToClosing (QChar opener)
QString | current ()
QString | lookAhead ()
virtual QString | advance ()
void | pushScope (UMLPackage *p)
UMLPackage * | popScope ()
UMLPackage * | currentScope ()
int | scopeIndex ()
Protected Member Functions inherited from ClassImport
virtual void | initialize ()=0
virtual void | initPerFile ()
virtual bool | parseFile (const QString &fileName)=0
void | log (const QString &file, const QString &text)
void | log (const QString &text)

## Protected Attributes

int | m_srcIndent [100]
int | m_srcIndentIndex
bool | m_braceWasOpened
| Flag denoting the opening of a block. More...
bool | m_isStatic
| Flag denoting staticness of defined method. More...
Protected Attributes inherited from NativeImportBase
QString | m_singleLineCommentIntro
| start token of a single line comment More...
QStringList | m_source
| the scanned lexemes More...
int | m_srcIndex
| used for indexing m_source More...
QList< UMLPackage * > | m_scope
| stack of scopes for use by the specific importer More...
UMLClassifier * | m_klass
| class currently being processed More...
Uml::Visibility::Enum | m_currentAccess
| current access (public/protected/private) More...
QString | m_comment
| intermediate accumulator for comment text More...
bool | m_inComment
bool | m_isAbstract
| accumulator for abstractness More...
QString | m_multiLineCommentIntro
| multi line comment delimiter intro More...
QString | m_multiLineCommentEnd
| multi line comment delimiter end More...
QString | m_multiLineAltCommentIntro
QString | m_multiLineAltCommentEnd
Protected Attributes inherited from ClassImport
CodeImpThread * | m_thread
| thread in which the work of importing is done More...
bool | m_enabled
| state of importer More...
QString | m_rootPath
| root path of import More...

## Additional Inherited Members

Static Public Member Functions inherited from ClassImport
static ClassImport * | createImporterByFileExt (const QString &fileName, CodeImpThread *thread=nullptr)
Static Protected Attributes inherited from NativeImportBase
static QStringList | m_parsedFiles

## Detailed Description

Python code import

Author
  Oliver Kellogg Bugs and comments to umbre.nosp@m.llo-.nosp@m.devel.nosp@m.@kde.nosp@m..org or https://bugs.kde.org

## Constructor & Destructor Documentation

## ◆ PythonImport()

PythonImport::PythonImport | ( | CodeImpThread * | thread = `nullptr` | ) |

explicit

Constructor.

## ◆ ~PythonImport()

PythonImport::~PythonImport | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## ◆ fillSource()

void PythonImport::fillSource | ( | const QString & | word | ) |

protected virtual

Implement abstract operation from NativeImportBase.

Parameters

  word | whitespace delimited item

Implements NativeImportBase.

## ◆ indentation()

QString PythonImport::indentation | ( | int | level | ) |

protected

Return an amount of spaces that corresponds to

Parameters

  level |

Returns
  spaces of indentation

## ◆ initVars()

void PythonImport::initVars | ( |  | ) |

protected virtual

Reimplement operation from NativeImportBase.

Reimplemented from NativeImportBase.

## ◆ parseAssignmentStmt()

bool PythonImport::parseAssignmentStmt | ( | const QString & | keyword | ) |

protected

Parse assignments in the form <identifier> '=' <value> Instance variables are identified by a prefixed 'self.'.

Parameters

  keyword | current string from parser

Returns
  success status of parsing

## ◆ parseInitializer()

bool PythonImport::parseInitializer | ( | const QString & | _keyword,
|  | QString & | type,
|  | QString & | value
| ) |  |

protected

Parses a python initializer

Parameters

  _keyword | current string from parser
  type | returns type of assignment
  value | returns assignment value

Returns
  success status of parsing

## ◆ parseMethodParameters()

bool PythonImport::parseMethodParameters | ( | UMLOperation * | op | ) |

protected

Parses method parameter list

Parameters

  op | UMLOperation instance to add parameter

Returns
  success status of parsing

## ◆ parseStmt()

bool PythonImport::parseStmt | ( |  | ) |

protected virtual

Implement abstract operation from NativeImportBase.

Returns
  success status of operation

Implements NativeImportBase.

## ◆ preprocess()

bool PythonImport::preprocess | ( | QString & | line | ) |

protected virtual

Reimplement operation from NativeImportBase. In addition to handling multiline comments, this method transforms changes in leading indentation into braces (opening brace for increase in indentation, closing brace for decrease in indentation) in m_source. Removal of Python's indentation sensitivity simplifies subsequent processing using Umbrello's native import framework.

Parameters

  line | the line to preprocess

Returns
  success status of operation

Reimplemented from NativeImportBase.

## ◆ skipBody()

QString PythonImport::skipBody | ( | Uml::PrimitiveTypes::Enum * | foundReturn = `nullptr` | ) |

protected

Skip ahead to outermost closing brace.

Parameters

  foundReturn | Optional pointer to Uml::PrimitiveTypes::Enum. If given then the variable pointed to will be set if a 'return' statement is encountered while skipping:
  - If after 'return' there is a value True or False then *foundReturn is set to Boolean;
  - elsif after 'return' there is a number without decimal point then *foundReturn is set to Integer;
  - elsif after 'return' there is a number with decimal point then *foundReturn is set to Real;
  - else *foundReturn is set to String. If no 'return' statement was encountered then *foundReturn is set to Reserved.

Returns
  body contents skipped

## Member Data Documentation

## ◆ m_braceWasOpened

bool PythonImport::m_braceWasOpened

protected

Flag denoting the opening of a block.

## ◆ m_isStatic

bool PythonImport::m_isStatic

protected

Flag denoting staticness of defined method.

## ◆ m_srcIndent

int PythonImport::m_srcIndent[100]

protected

Buffer for number of indentation characters (whitespace, i.e. tabs or spaces) at beginning of input line.

## ◆ m_srcIndentIndex

int PythonImport::m_srcIndentIndex

protected

Index for m_srcIndent[]. Index 0 is reserved and contains 0.

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

- umbrello/codeimport/pythonimport.h
- umbrello/codeimport/pythonimport.cpp