Y2Function Class Reference

#include <Y2Function.h>

Inheritance diagram for Y2Function:

Y2StdioFunction Y2SystemFunction Y2YCPFunction List of all members.

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

Detailed Description

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;
	}
    }
} 


Constructor & Destructor Documentation

virtual Y2Function::~Y2Function  )  [inline, virtual]
 

Whithout this, can't delete YEFunction which is derived from YCode, Y2Function


Member Function Documentation

virtual bool Y2Function::appendParameter const YCPValue arg  )  [pure virtual]
 

Appends a parameter to the call.

Returns:
false if there was a type mismatch

Implemented in Y2YCPFunction, Y2StdioFunction, and Y2SystemFunction.

virtual bool Y2Function::attachParameter const YCPValue arg,
const int  position
[pure virtual]
 

Attaches a parameter to a given position to the call.

Returns:
false if there was a type mismatch

Implemented in Y2YCPFunction, Y2StdioFunction, and Y2SystemFunction.

virtual YCPValue Y2Function::evaluateCall  )  [pure virtual]
 

Executes the call

Implemented in Y2YCPFunction, Y2StdioFunction, and Y2SystemFunction.

virtual bool Y2Function::finishParameters  )  [pure virtual]
 

Signal that we're done adding parameters.

Returns:
false if there was a parameter missing

Implemented in Y2YCPFunction, Y2StdioFunction, and Y2SystemFunction.

virtual string Y2Function::name  )  const [pure virtual]
 

Implemented in Y2YCPFunction, Y2StdioFunction, and Y2SystemFunction.

virtual bool Y2Function::reset  )  [pure virtual]
 

Reset the currecn parameters, so the instance can be reused for the next call (appendParameter etc)

Implemented in Y2YCPFunction, Y2StdioFunction, and Y2SystemFunction.

virtual constTypePtr Y2Function::wantedParameterType  )  const [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)

Returns:
Type::Any if number of parameters exceeded

Implemented in Y2YCPFunction, Y2StdioFunction, and Y2SystemFunction.


The documentation for this class was generated from the following file:
Generated on Fri Jun 16 18:07:46 2006 for yast2-core by  doxygen 1.4.6