NativeImportBase Class Reference
Intermediate base class for native Umbrello implementations of programming language import Base class for native implementations of language import. More...
#include <nativeimportbase.h>
Inheritance diagram for NativeImportBase:

Public Member Functions | |
| NativeImportBase (const QString &singleLineCommentIntro) | |
| Constructor. | |
Protected Member Functions | |
| void | initialize () |
| Implement abstract operation from ClassImport. | |
| void | setMultiLineComment (const QString &intro, const QString &end) |
| Set the delimiter strings for a multi line comment. | |
| void | setMultiLineAltComment (const QString &intro, const QString &end) |
| Set the delimiter strings for an alternative form of multi line comment. | |
| virtual void | parseFile (const QString &filename) |
| Import a single file. | |
| virtual void | initVars () |
| Initialize auxiliary variables. | |
| void | scan (QString line) |
| Scan a single line. | |
| virtual bool | preprocess (QString &line) |
| Preprocess a line. | |
| virtual QStringList | split (const QString &line) |
| Split the line so that a string is returned as a single element of the list. | |
| virtual void | fillSource (const QString &word)=0 |
| Analyze the given word and fill `m_source'. | |
| virtual bool | parseStmt ()=0 |
| Parse the statement which starts at m_source[m_srcIndex] leaving m_srcIndex pointing to the end of the recognized statement. | |
| void | skipStmt (QString until=";") |
| Advance m_srcIndex until m_source[m_srcIndex] contains the lexeme given by `until'. | |
| bool | skipToClosing (QChar opener) |
| Advance m_srcIndex to the index of the corresponding closing character of the given opening. | |
| QString | advance () |
| Advance m_srcIndex until m_source[m_srcIndex] contains a non-comment. | |
Protected Attributes | |
| QString | m_singleLineCommentIntro |
| How to start a single line comment in this programming language. | |
| QStringList | m_source |
| The scanned lexemes. | |
| uint | m_srcIndex |
| Used for indexing m_source. | |
| UMLPackage * | m_scope [32] |
| Stack of scopes for use by the specific importer. | |
| uint | m_scopeIndex |
| Indexes m_scope. | |
| UMLClassifier * | m_klass |
| The class currently being processed. | |
| Uml::Visibility | m_currentAccess |
| The current access (public/protected/private). | |
| QString | m_comment |
| Intermediate accumulator for comment text. | |
| bool | m_inComment |
| True if we are currently in a multi-line comment. | |
| bool | m_isAbstract |
| Accumulator for abstractness. | |
| QStringList | m_parsedFiles |
| List of parsed files. | |
| QString | m_multiLineCommentIntro |
| Multi line comment delimiters. | |
| QString | m_multiLineCommentEnd |
| QString | m_multiLineAltCommentIntro |
| Some languages support an alternative set of multi line comment delimiters. | |
| QString | m_multiLineAltCommentEnd |
Detailed Description
Intermediate base class for native Umbrello implementations of programming language import Base class for native implementations of 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.
- Author:
- Oliver Kellogg <okellogg@users.sourceforge.net> Bugs and comments to uml-devel@lists.sf.net or http://bugs.kde.org
Definition at line 44 of file nativeimportbase.h.
Constructor & Destructor Documentation
|
|
Constructor.
Definition at line 24 of file nativeimportbase.cpp. References m_currentAccess, m_inComment, m_isAbstract, m_klass, m_scopeIndex, m_singleLineCommentIntro, and m_srcIndex. |
Member Function Documentation
|
|
Implement abstract operation from ClassImport.
Implements ClassImport. Definition at line 337 of file nativeimportbase.cpp. References m_parsedFiles. |
|
||||||||||||
|
Set the delimiter strings for a multi line comment.
Definition at line 37 of file nativeimportbase.cpp. References m_multiLineCommentIntro. |
|
||||||||||||
|
Set the delimiter strings for an alternative form of multi line comment. Definition at line 42 of file nativeimportbase.cpp. References m_multiLineAltCommentIntro. |
|
|
Import a single file. The default implementation should be feasible for languages that don't depend on an external preprocessor.
Implements ClassImport. Reimplemented in IDLImport, and JavaImport. Definition at line 263 of file nativeimportbase.cpp. References Import_Utils::addIncludePath(), Import_Utils::includePathList(), initVars(), m_comment, m_currentAccess, m_klass, m_parsedFiles, m_scope, m_scopeIndex, m_singleLineCommentIntro, m_source, m_srcIndex, parseStmt(), scan(), and skipStmt(). Referenced by JavaImport::parseFile(), AdaImport::parseStems(), and PascalImport::parseStmt(). |
|
|
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, JavaImport, PascalImport, and PythonImport. Definition at line 260 of file nativeimportbase.cpp. Referenced by parseFile(). |
|
|
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().
Definition at line 236 of file nativeimportbase.cpp. References fillSource(), m_singleLineCommentIntro, m_source, preprocess(), and split(). Referenced by parseFile(), and IDLImport::parseFile(). |
|
|
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.
Reimplemented in IDLImport, and PythonImport. Definition at line 110 of file nativeimportbase.cpp. References m_comment, m_inComment, m_multiLineAltCommentIntro, m_multiLineCommentIntro, m_singleLineCommentIntro, m_source, and m_srcIndex. Referenced by IDLImport::preprocess(), and scan(). |
|
|
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. Reimplemented in AdaImport. Definition at line 193 of file nativeimportbase.cpp. Referenced by scan(). |
|
|
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, IDLImport, JavaImport, PascalImport, and PythonImport. Referenced by scan(). |
|
|
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.
Implemented in AdaImport, IDLImport, JavaImport, PascalImport, and PythonImport. Referenced by parseFile(). |
|
|
Advance m_srcIndex until m_source[m_srcIndex] contains the lexeme given by `until'.
Definition at line 47 of file nativeimportbase.cpp. References m_source, and m_srcIndex. Referenced by PascalImport::checkModifiers(), parseFile(), IDLImport::parseFile(), PythonImport::parseStmt(), PascalImport::parseStmt(), JavaImport::parseStmt(), IDLImport::parseStmt(), AdaImport::parseStmt(), PythonImport::skipBody(), and skipToClosing(). |
|
|
Advance m_srcIndex to the index of the corresponding closing character of the given opening. Nested opening/closing pairs are respected. Valid openers are: '{' '[' '(' '<'
Definition at line 53 of file nativeimportbase.cpp. References advance(), m_source, m_srcIndex, and skipStmt(). Referenced by JavaImport::joinTypename(), PascalImport::parseStmt(), and JavaImport::parseStmt(). |
|
|
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::null is returned. Definition at line 94 of file nativeimportbase.cpp. References m_comment, m_singleLineCommentIntro, m_source, and m_srcIndex. Referenced by PascalImport::checkModifiers(), IDLImport::joinTypename(), PythonImport::parseStmt(), PascalImport::parseStmt(), JavaImport::parseStmt(), IDLImport::parseStmt(), AdaImport::parseStmt(), PythonImport::skipBody(), and skipToClosing(). |
Member Data Documentation
|
|
How to start a single line comment in this programming language.
Definition at line 163 of file nativeimportbase.h. Referenced by advance(), NativeImportBase(), parseFile(), preprocess(), and scan(). |
|
|
The scanned lexemes.
Definition at line 168 of file nativeimportbase.h. Referenced by advance(), parseFile(), preprocess(), scan(), skipStmt(), and skipToClosing(). |
|
|
Used for indexing m_source.
Definition at line 172 of file nativeimportbase.h. Referenced by advance(), NativeImportBase(), parseFile(), preprocess(), skipStmt(), and skipToClosing(). |
|
|
Stack of scopes for use by the specific importer.
Definition at line 177 of file nativeimportbase.h. Referenced by parseFile(). |
|
|
Indexes m_scope. Index 0 is reserved for global scope. Definition at line 181 of file nativeimportbase.h. Referenced by NativeImportBase(), and parseFile(). |
|
|
The class currently being processed.
Definition at line 186 of file nativeimportbase.h. Referenced by NativeImportBase(), and parseFile(). |
|
|
The current access (public/protected/private).
Definition at line 190 of file nativeimportbase.h. Referenced by NativeImportBase(), and parseFile(). |
|
|
Intermediate accumulator for comment text.
Definition at line 194 of file nativeimportbase.h. Referenced by advance(), parseFile(), and preprocess(). |
|
|
True if we are currently in a multi-line comment. Only applies to languages with multi-line comments. Definition at line 199 of file nativeimportbase.h. Referenced by NativeImportBase(), and preprocess(). |
|
|
Accumulator for abstractness.
Definition at line 203 of file nativeimportbase.h. Referenced by NativeImportBase(). |
|
|
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 211 of file nativeimportbase.h. Referenced by initialize(), and parseFile(). |
|
|
Multi line comment delimiters.
Definition at line 216 of file nativeimportbase.h. Referenced by preprocess(), and setMultiLineComment(). |
|
|
Some languages support an alternative set of multi line comment delimiters.
Definition at line 222 of file nativeimportbase.h. Referenced by preprocess(), and setMultiLineAltComment(). |
The documentation for this class was generated from the following files:
