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 () |
virtual void | fillSource (const QString &word)=0 |
void | initialize () |
virtual void | initVars () |
virtual bool | parseFile (const QString &filename) |
virtual bool | parseStmt ()=0 |
virtual bool | preprocess (QString &line) |
void | scan (const QString &line) |
void | setMultiLineAltComment (const QString &intro, const QString &end) |
void | setMultiLineComment (const QString &intro, const QString &end) |
void | skipStmt (const QString &until=";") |
bool | skipToClosing (QChar opener) |
virtual QStringList | split (const QString &line) |
Protected Member Functions inherited from ClassImport | |
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 |
QStringList | m_parsedFiles |
QList< UMLPackage * > | m_scope |
uint | m_scopeIndex |
QString | m_singleLineCommentIntro |
QStringList | m_source |
int | m_srcIndex |
Protected Attributes inherited from ClassImport | |
bool | m_enabled |
CodeImpThread * | m_thread |
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 32 of file nativeimportbase.cpp.
|
virtual |
Destructor.
Definition at line 47 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 143 of file nativeimportbase.cpp.
|
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 436 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 342 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 353 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.
|
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 171 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 310 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 70 of file nativeimportbase.cpp.
|
protected |
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 58 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 81 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 96 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 260 of file nativeimportbase.cpp.
Member Data Documentation
|
protected |
intermediate accumulator for comment text
Definition at line 95 of file nativeimportbase.h.
|
protected |
current access (public/protected/private)
Definition at line 94 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 101 of file nativeimportbase.h.
|
protected |
accumulator for abstractness
Definition at line 102 of file nativeimportbase.h.
|
protected |
class currently being processed
Definition at line 93 of file nativeimportbase.h.
|
protected |
Definition at line 119 of file nativeimportbase.h.
|
protected |
Some languages support an alternative set of multi line comment delimiters.
Definition at line 118 of file nativeimportbase.h.
|
protected |
multi line comment delimiter end
Definition at line 113 of file nativeimportbase.h.
|
protected |
multi line comment delimiter intro
Definition at line 112 of file nativeimportbase.h.
|
protected |
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 110 of file nativeimportbase.h.
|
protected |
stack of scopes for use by the specific importer
Definition at line 91 of file nativeimportbase.h.
|
protected |
indexes m_scope, index 0 is reserved for global scope
Definition at line 92 of file nativeimportbase.h.
|
protected |
start token of a single line comment
Definition at line 88 of file nativeimportbase.h.
|
protected |
the scanned lexemes
Definition at line 89 of file nativeimportbase.h.
|
protected |
used for indexing m_source
Definition at line 90 of file nativeimportbase.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:06:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.