yast2-core
|
#include <Y2Function.h>
Public Member Functions | |
virtual | ~Y2Function () |
virtual bool | attachParameter (const YCPValue &arg, const int position)=0 |
virtual constTypePtr | wantedParameterType () const =0 |
virtual bool | appendParameter (const YCPValue &arg)=0 |
virtual bool | finishParameters ()=0 |
virtual YCPValue | evaluateCall ()=0 |
virtual bool | reset ()=0 |
virtual string | name () const =0 |
A function call interface. It is an abstract base for providing an interface for calling a function inside YaST. Any Y2 namespace can provide its own implementation for calling functions provided by the namespace. Typically returned value by Y2Namespace::createFunctionCall ("funcname", function_type).
// an example to call Popup::Message()
// first, find out the component for the namespace Y2Component* impl = Y2ComponentBroker::provideNamespace ("Popup"); if (impl != 0) { // let the component import the namespace Y2Namespace* ns = impl->import ("Popup");
if (ns != 0) { // create a function call object for the function Y2Function* fnc = ns->createFunctionCall ("Message" , Type::fromSignature ("void (string)"));
if (fnc != 0) { // pass the parameter for the function fnc->appendParameter (YCPString ("This is my test")); fnc->finishParameters ();
// evaluate the call fnc->evaluateCall ();
// function is not longer needed, free it delete fnc; } } }
|
inlinevirtual |
Whithout this, can't delete YEFunction which is derived from YCode, Y2Function
|
pure virtual |
Appends a parameter to the call.
Implemented in Y2YCPFunction.
|
pure virtual |
Attaches a parameter to a given position to the call.
Implemented in Y2YCPFunction.
Referenced by YEFunction::evaluate(), and YEFunctionPointer::evaluate().
|
pure virtual |
Executes the call
Implemented in Y2YCPFunction.
Referenced by YEFunction::evaluate(), YEFunctionPointer::evaluate(), and Y2Namespace::initialize().
|
pure virtual |
Signal that we're done adding parameters.
Implemented in Y2YCPFunction.
|
pure virtual |
Implemented in Y2YCPFunction.
|
pure virtual |
Reset the current parameters, so the instance can be reused for the next call (appendParameter etc)
Implemented in Y2YCPFunction.
Referenced by YEFunction::evaluate(), and YEFunctionPointer::evaluate().
|
pure virtual |
What type is expected for the next appendParameter (val) ? (Used when calling from Perl, to be able to convert from the simple type system of Perl to the elaborate type system of YCP)
Implemented in Y2YCPFunction.