umbrello: PythonImport Class Reference

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

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=0)
virtual | ~PythonImport ()
Public Member Functions inherited from NativeImportBase
| NativeImportBase (const QString &singleLineCommentIntro, CodeImpThread *thread=0)
virtual | ~NativeImportBase ()
Public Member Functions inherited from ClassImport
| ClassImport (CodeImpThread *thread=0)
virtual | ~ClassImport ()
bool | importFiles (const QStringList &fileNames)
bool | importFile (const QString &fileName)
void | setRootPath (const QString &path)
bool | enabled ()

## 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 ()
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)
void | scan (const QString &line)
virtual QStringList | split (const QString &line)
void | skipStmt (const QString &until=QLatin1String(";"))
bool | skipToClosing (QChar opener)
QString | lookAhead ()
virtual QString | advance ()
void | pushScope (UMLPackage *p)
UMLPackage * | popScope ()
UMLPackage * | currentScope ()
int | scopeIndex ()
Protected Member Functions inherited from ClassImport
virtual void | initPerFile ()
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=0)
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 = `0` | ) |
| explicit

Constructor.

## ◆ ~PythonImport()

PythonImport::~PythonImport | ( |  | ) |
| virtual

Destructor.

## Member Function Documentation

## ◆ fillSource()

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

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 | ( |  | ) |
| protectedvirtual

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 | ( |  | ) |
| protectedvirtual

Implement abstract operation from NativeImportBase.

Returns
  success status of operation

Implements NativeImportBase.

## ◆ preprocess()

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

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 | ( |  | ) |
| protected

Skip ahead to outermost closing brace.

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