umbrello/umbrello
NativeImportBase Class Reference
#include <nativeimportbase.h>

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
| NativeImportBase::NativeImportBase | ( | const QString & | singleLineCommentIntro | ) |
Constructor.
- Parameters:
-
singleLineCommentIntro "//" for IDL and Java, "--" for Ada
Definition at line 24 of file nativeimportbase.cpp.
| NativeImportBase::~NativeImportBase | ( | ) | [virtual] |
Definition at line 34 of file nativeimportbase.cpp.
Member Function Documentation
| void NativeImportBase::initialize | ( | ) | [protected, virtual] |
Implement abstract operation from ClassImport.
Implements ClassImport.
Definition at line 336 of file nativeimportbase.cpp.
| void NativeImportBase::setMultiLineComment | ( | const QString & | intro, | |
| const QString & | end | |||
| ) | [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 37 of file nativeimportbase.cpp.
| void NativeImportBase::setMultiLineAltComment | ( | const QString & | intro, | |
| const QString & | end | |||
| ) | [protected] |
Set the delimiter strings for an alternative form of multi line comment.
Definition at line 42 of file nativeimportbase.cpp.
| void NativeImportBase::parseFile | ( | const QString & | filename | ) | [protected, virtual] |
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.
Implements ClassImport.
Reimplemented in IDLImport, and JavaImport.
Definition at line 262 of file nativeimportbase.cpp.
| void NativeImportBase::initVars | ( | ) | [protected, virtual] |
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 259 of file nativeimportbase.cpp.
| void NativeImportBase::scan | ( | QString | line | ) | [protected] |
Scan a single line.
The lexer.
parseFile() calls this for each line read from the input file. This in turn calls other methods such as preprocess() and fillSource().
- Parameters:
-
line The line to scan.
Definition at line 235 of file nativeimportbase.cpp.
| bool NativeImportBase::preprocess | ( | QString & | line | ) | [protected, virtual] |
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 IDLImport, and PythonImport.
Definition at line 109 of file nativeimportbase.cpp.
| QStringList NativeImportBase::split | ( | const QString & | lin | ) | [protected, virtual] |
Split the line so that a string is returned as a single element of the list.
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.
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 192 of file nativeimportbase.cpp.
| virtual void NativeImportBase::fillSource | ( | const QString & | word | ) | [protected, pure 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, IDLImport, JavaImport, PascalImport, and PythonImport.
| virtual bool NativeImportBase::parseStmt | ( | ) | [protected, pure 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, IDLImport, JavaImport, PascalImport, and PythonImport.
| void NativeImportBase::skipStmt | ( | QString | until = ";" |
) | [protected] |
Advance m_srcIndex until m_source[m_srcIndex] contains the lexeme given by `until'.
Definition at line 47 of file nativeimportbase.cpp.
| bool NativeImportBase::skipToClosing | ( | QChar | opener | ) | [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: '{' '[' '(' '<'
- Returns:
- True for success, false for misuse (invalid opener) or if no matching closing character is found in m_source.
Definition at line 53 of file nativeimportbase.cpp.
| QString NativeImportBase::advance | ( | ) | [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.
Definition at line 93 of file nativeimportbase.cpp.
Member Data Documentation
QString NativeImportBase::m_singleLineCommentIntro [protected] |
How to start a single line comment in this programming language.
Definition at line 163 of file nativeimportbase.h.
QStringList NativeImportBase::m_source [protected] |
int NativeImportBase::m_srcIndex [protected] |
UMLPackage* NativeImportBase::m_scope[32] [protected] |
Stack of scopes for use by the specific importer.
Definition at line 177 of file nativeimportbase.h.
uint NativeImportBase::m_scopeIndex [protected] |
Indexes m_scope.
Index 0 is reserved for global scope.
Definition at line 181 of file nativeimportbase.h.
UMLClassifier* NativeImportBase::m_klass [protected] |
Uml::Visibility NativeImportBase::m_currentAccess [protected] |
QString NativeImportBase::m_comment [protected] |
bool NativeImportBase::m_inComment [protected] |
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.
bool NativeImportBase::m_isAbstract [protected] |
QStringList NativeImportBase::m_parsedFiles [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 211 of file nativeimportbase.h.
QString NativeImportBase::m_multiLineCommentIntro [protected] |
QString NativeImportBase::m_multiLineCommentEnd [protected] |
Definition at line 217 of file nativeimportbase.h.
QString NativeImportBase::m_multiLineAltCommentIntro [protected] |
Some languages support an alternative set of multi line comment delimiters.
Definition at line 222 of file nativeimportbase.h.
QString NativeImportBase::m_multiLineAltCommentEnd [protected] |
Definition at line 223 of file nativeimportbase.h.
The documentation for this class was generated from the following files:
KDE 4.0 API Reference