umbrello/umbrello
#include <nativeimportbase.h>
Public Member Functions | |
NativeImportBase (const QString &singleLineCommentIntro, CodeImpThread *thread=0) | |
virtual | ~NativeImportBase () |
Public Member Functions inherited from ClassImport | |
ClassImport (CodeImpThread *thread=0) | |
virtual | ~ClassImport () |
bool | enabled () |
bool | importFile (const QString &fileName) |
bool | importFiles (const QStringList &fileNames) |
Protected Member Functions | |
QString | advance () |
UMLPackage * | currentScope () |
virtual void | fillSource (const QString &word)=0 |
void | initialize () |
virtual void | initVars () |
virtual bool | parseFile (const QString &filename) |
virtual bool | parseStmt ()=0 |
UMLPackage * | popScope () |
virtual bool | preprocess (QString &line) |
void | pushScope (UMLPackage *p) |
void | scan (const QString &line) |
int | scopeIndex () |
void | setMultiLineAltComment (const QString &intro, const QString &end) |
void | setMultiLineComment (const QString &intro, const QString &end) |
void | skipStmt (const QString &until=QLatin1String(";")) |
bool | skipToClosing (QChar opener) |
virtual QStringList | split (const QString &line) |
Protected Member Functions inherited from ClassImport | |
virtual void | initPerFile () |
void | log (const QString &file, const QString &text) |
void | log (const QString &text) |
Protected Attributes | |
QString | m_comment |
Uml::Visibility::Enum | m_currentAccess |
bool | m_inComment |
bool | m_isAbstract |
UMLClassifier * | m_klass |
QString | m_multiLineAltCommentEnd |
QString | m_multiLineAltCommentIntro |
QString | m_multiLineCommentEnd |
QString | m_multiLineCommentIntro |
QList< UMLPackage * > | m_scope |
QString | m_singleLineCommentIntro |
QStringList | m_source |
int | m_srcIndex |
Protected Attributes inherited from ClassImport | |
bool | m_enabled |
CodeImpThread * | m_thread |
Static Protected Attributes | |
static QStringList | m_parsedFiles |
Additional Inherited Members | |
Static Public Member Functions inherited from ClassImport | |
static ClassImport * | createImporterByFileExt (const QString &fileName, CodeImpThread *thread=0) |
Detailed Description
Intermediate base class for native Umbrello implementations of programming language import.
The default call sequence is as follows (RealizedLanguageImport is used as a placeholder name for the concrete language importer.) NativeImportBase RealizedLanguageImport –> importFiles() parseFile() --------------------------------—> initVars() scan() preprocess() (may be reimplemented) ------------------------------—> fillSource() --------------------------------—> parseStmt() This sequence may be changed by overriding default implementations of virtual methods in NativeImportBase.
Base class for native implementations of language import
Definition at line 44 of file nativeimportbase.h.
Constructor & Destructor Documentation
|
explicit |
Constructor.
- Parameters
-
singleLineCommentIntro "//" for IDL and Java, "--" for Ada thread thread in which the code import runs
Definition at line 34 of file nativeimportbase.cpp.
|
virtual |
Destructor.
Definition at line 48 of file nativeimportbase.cpp.
Member Function Documentation
|
protected |
Advance m_srcIndex until m_source[m_srcIndex] contains a non-comment.
Comments encountered during advancement are accumulated in `m_comment'. If m_srcIndex hits the end of m_source then QString() is returned.
- Returns
- the current lexeme or an empty string
Definition at line 187 of file nativeimportbase.cpp.
|
protected |
|
protectedpure virtual |
Analyze the given word and fill `m_source'.
A "word" is a whitespace delimited item from the input line. To be provided by the specific importer class.
Implemented in AdaImport, CSharpImport, JavaImport, IDLImport, PascalImport, and PythonImport.
|
protectedvirtual |
Implement abstract operation from ClassImport.
Implements ClassImport.
Definition at line 490 of file nativeimportbase.cpp.
|
protectedvirtual |
Initialize auxiliary variables.
This is called by the default implementation of parseFile() after scanning (before parsing the QStringList m_source.) The default implementation is empty.
Reimplemented in AdaImport, CSharpImport, JavaImport, PascalImport, and PythonImport.
Definition at line 395 of file nativeimportbase.cpp.
|
protectedvirtual |
Import a single file.
The default implementation should be feasible for languages that don't depend on an external preprocessor.
- Parameters
-
filename The file to import.
- Returns
- state of parsing - false means errors
Implements ClassImport.
Reimplemented in CSharpImport, JavaImport, and IDLImport.
Definition at line 406 of file nativeimportbase.cpp.
|
protectedpure virtual |
Parse the statement which starts at m_source[m_srcIndex] leaving m_srcIndex pointing to the end of the recognized statement.
To be provided by the concrete importer.
- Returns
- True if the statement was recognized.
Implemented in AdaImport, CSharpImport, JavaImport, PascalImport, PythonImport, and IDLImport.
|
protected |
Return previously defined scope.
- Returns
- previous scope
Definition at line 153 of file nativeimportbase.cpp.
|
protectedvirtual |
Preprocess a line.
May modify the given line to remove items consumed by the preprocessing such as comments or preprocessor directives. The default implementation handles multi-line comments.
- Parameters
-
line The line to preprocess.
- Returns
- True if the line was completely consumed, false if there are still items left in the line for further analysis.
Reimplemented in PythonImport, and IDLImport.
Definition at line 215 of file nativeimportbase.cpp.
|
protected |
Set package as current scope.
- Parameters
-
p UML package to set as current scope
Definition at line 143 of file nativeimportbase.cpp.
|
protected |
Scan a single line.
parseFile() calls this for each line read from the input file. This in turn calls other methods such as preprocess() and fillSource(). The lexer. Tokenizes the given string and fills `m_source'. Stores possible comments in `m_comment'.
- Parameters
-
line The line to scan.
Definition at line 363 of file nativeimportbase.cpp.
|
protected |
Return current scope index.
- Returns
- >= 0 index, -1 empty
Definition at line 176 of file nativeimportbase.cpp.
|
protected |
Set the delimiter strings for an alternative form of multi line comment.
- Parameters
-
intro the start comment string end the end comment string
Definition at line 71 of file nativeimportbase.cpp.
Set the delimiter strings for a multi line comment.
- Parameters
-
intro In languages with a C style multiline comment this is slash-star. end In languages with a C style multiline comment this is star-slash.
Definition at line 59 of file nativeimportbase.cpp.
|
protected |
Advance m_srcIndex until m_source[m_srcIndex] contains the lexeme given by `until'.
- Parameters
-
until the target string
Definition at line 82 of file nativeimportbase.cpp.
|
protected |
Advance m_srcIndex to the index of the corresponding closing character of the given opening.
Nested opening/closing pairs are respected. Valid openers are: '{' '[' '(' '<'
- Parameters
-
opener the opener string
- Returns
- True for success, false for misuse (invalid opener) or if no matching closing character is found in m_source.
Definition at line 97 of file nativeimportbase.cpp.
|
protectedvirtual |
Split the line so that a string is returned as a single element of the list.
When not in a string then split at white space. The default implementation is suitable for C style strings and char constants.
- Parameters
-
line the line to split
- Returns
- the parts of the line
Reimplemented in AdaImport.
Definition at line 313 of file nativeimportbase.cpp.
Member Data Documentation
|
protected |
intermediate accumulator for comment text
Definition at line 99 of file nativeimportbase.h.
|
protected |
current access (public/protected/private)
Definition at line 98 of file nativeimportbase.h.
|
protected |
True if we are currently in a multi-line comment.
Only applies to languages with multi-line comments.
Definition at line 105 of file nativeimportbase.h.
|
protected |
accumulator for abstractness
Definition at line 106 of file nativeimportbase.h.
|
protected |
class currently being processed
Definition at line 97 of file nativeimportbase.h.
|
protected |
Definition at line 123 of file nativeimportbase.h.
|
protected |
Some languages support an alternative set of multi line comment delimiters.
Definition at line 122 of file nativeimportbase.h.
|
protected |
multi line comment delimiter end
Definition at line 117 of file nativeimportbase.h.
|
protected |
multi line comment delimiter intro
Definition at line 116 of file nativeimportbase.h.
|
staticprotected |
List of parsed files.
Contains file names without paths. Before actually parsing a given file, NativeImportBase checks whether the name is already present in this list in order to avoid parsing the same file multiple times.
Definition at line 114 of file nativeimportbase.h.
|
protected |
stack of scopes for use by the specific importer
Definition at line 96 of file nativeimportbase.h.
|
protected |
start token of a single line comment
Definition at line 93 of file nativeimportbase.h.
|
protected |
the scanned lexemes
Definition at line 94 of file nativeimportbase.h.
|
protected |
used for indexing m_source
Definition at line 95 of file nativeimportbase.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:40:28 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.