HyperspaceExplorer 0.7.1
|
A Dialog to enter a function from . More...
#include <FunctionDialogImpl.h>
Public Member Functions | |
FunctionDialogImpl (QWidget *parent=0, Qt::WFlags f=0) | |
FunctionDialogImpl c'tor - displays the dialog. | |
Private Slots | |
virtual bool | checkValidity () |
Called when the user clicks the OK button in the Function Dialog. | |
virtual bool | loadFunction () |
Display and load the selected DLL into current address space. | |
Private Member Functions | |
virtual bool | functionPresent (const QString &) |
Loads the dynamic library given by libName, if it exists and can be loaded. | |
virtual void | writeSource () |
Write a C++ source file containing the given function. |
A Dialog to enter a function from .
The function which has been entered will then be compiled into a dynamic library and loaded to be displayed on screen as a Function.
UI::Dialogs::FunctionDialogImpl::FunctionDialogImpl | ( | QWidget * | parent = 0 , |
Qt::WFlags | f = 0 |
||
) |
FunctionDialogImpl c'tor - displays the dialog.
parent | parent widget (NULL) |
f | window flags |
References checkValidity(), and loadFunction().
bool UI::Dialogs::FunctionDialogImpl::checkValidity | ( | ) | [private, virtual, slot] |
Called when the user clicks the OK button in the Function Dialog.
Checks whether all fields are filled in, whether the given function is valid C++ syntax, ie. whether it compiles, and whether the compiled code links into a dynamic library.
As a side effect, it generates this library.
Finally, it checks whether the library can be loaded. if so, it accepts the input.
Also, this function creates a directory structure "plugins/real" under the resource directory and changes the CWD to that folder for the duration of checkValidity ().
The name for this function is chosen rather unfortunately, i admit.
Referenced by FunctionDialogImpl().
bool UI::Dialogs::FunctionDialogImpl::functionPresent | ( | const QString & | libName | ) | [private, virtual] |
Loads the dynamic library given by libName, if it exists and can be loaded.
Then checks whether a function named f() is present. if so, returns true. else borks with an error message.
libName | filename for the selected DLL |
Implements UI::Dialogs::PluginCreator.
bool UI::Dialogs::FunctionDialogImpl::loadFunction | ( | ) | [private, virtual, slot] |
Display and load the selected DLL into current address space.
Loads a dynamic library, which can be selected by the user on a QFileDialog. calls loadFunction () below. see there.
Implements UI::Dialogs::PluginCreator.
Referenced by FunctionDialogImpl().
void UI::Dialogs::FunctionDialogImpl::writeSource | ( | ) | [private, virtual] |
Write a C++ source file containing the given function.
Also written is a little framework to make the source file compilable by g++ (there is currently no support for other compilers).
The resulting file "<function-name>.C" defines the function f() and the function symbolic(), which returns the function in symbolic terms, not in C++ syntax.
Implements UI::Dialogs::PluginCreator.