umbrello 2.34.70-5524f40e1
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:
Collaboration 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 () 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=0)
 
- 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 current ()
 
QString lookAhead ()
 
virtual QString advance ()
 
void pushScope (UMLPackage *p)
 
UMLPackagepopScope ()
 
UMLPackagecurrentScope ()
 
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...
 
UMLClassifierm_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
CodeImpThreadm_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 ClassImportcreateImporterByFileExt (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
wordwhitespace 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
keywordcurrent string from parser
Returns
success status of parsing
Here is the call graph for this function:

◆ parseInitializer()

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

Parses a python initializer

Parameters
_keywordcurrent string from parser
typereturns type of assignment
valuereturns assignment value
Returns
success status of parsing
Here is the call graph for this function:

◆ parseMethodParameters()

bool PythonImport::parseMethodParameters ( UMLOperation op)
protected

Parses method parameter list

Parameters
opUMLOperation instance to add parameter
Returns
success status of parsing
Here is the call graph for this function:

◆ parseStmt()

bool PythonImport::parseStmt ( )
protectedvirtual

Implement abstract operation from NativeImportBase.

Returns
success status of operation

Implements NativeImportBase.

Here is the call graph for this function:

◆ 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
linethe line to preprocess
Returns
success status of operation

Reimplemented from NativeImportBase.

Here is the call graph for this function:

◆ skipBody()

QString PythonImport::skipBody ( Uml::PrimitiveTypes::Enum foundReturn = 0)
protected

Skip ahead to outermost closing brace.

Parameters
foundReturnOptional 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
Here is the call graph for this function:

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: