YFunction Class Reference

#include <YCode.h>

Inheritance diagram for YFunction:

YCode Rep

List of all members.

Public Member Functions

 YFunction (YBlockPtr parameterblock, const SymbolEntryPtr entry=0)
 YFunction (bytecodeistream &str)
 ~YFunction ()
virtual ykind kind () const
unsigned int parameterCount () const
YBlockPtr declaration () const
SymbolEntryPtr parameter (unsigned int position) const
YBlockPtr definition () const
void setDefinition (YBlockPtr body)
void setDefinition (bytecodeistream &str)
string toStringDeclaration () const
string toString () const
std::ostream & toStreamDefinition (std::ostream &str) const
std::ostream & toXmlDefinition (std::ostream &str, int indent) const
std::ostream & toStream (std::ostream &str) const
std::ostream & toXml (std::ostream &str, int indent) const
virtual YCPValue evaluate (bool cse=false)
constTypePtr type () const

Private Member Functions

 REP_BODY (YFunction)

Private Attributes

YBlockPtr m_declaration
YBlockPtr m_definition
bool m_is_global


Detailed Description

function declaration (m_body == 0) or definition (m_body != 0) it's anonymouse here ! The code() member of the corresponding SymbolEntry points to YFunction.

Constructor & Destructor Documentation

YFunction::YFunction ( YBlockPtr  parameterblock,
const SymbolEntryPtr  entry = 0 
)

YFunction::YFunction ( bytecodeistream str  ) 

YFunction::~YFunction (  ) 


Member Function Documentation

YFunction::REP_BODY ( YFunction   )  [private]

virtual ykind YFunction::kind (  )  const [inline, virtual]

Kind of this YCode. This method must be reimplemented in the inherited classes.

Returns:
the YCode kind

Implements YCode.

References YCode::ycFunction.

unsigned int YFunction::parameterCount ( void   )  const

References m_declaration.

Referenced by toStringDeclaration(), and type().

YBlockPtr YFunction::declaration (  )  const

References m_declaration.

SymbolEntryPtr YFunction::parameter ( unsigned int  position  )  const

References m_declaration.

Referenced by toStringDeclaration(), and type().

YBlockPtr YFunction::definition (  )  const

References m_definition.

void YFunction::setDefinition ( YBlockPtr  body  ) 

void YFunction::setDefinition ( bytecodeistream str  ) 

string YFunction::toStringDeclaration (  )  const

References parameter(), and parameterCount().

Referenced by toString().

string YFunction::toString ( void   )  const [virtual]

Return ASCII represtation of this YCP code.

Returns:
ASCII string representation

Reimplemented from YCode.

References m_definition, and toStringDeclaration().

Referenced by evaluate().

std::ostream & YFunction::toStreamDefinition ( std::ostream &  str  )  const

std::ostream & YFunction::toXmlDefinition ( std::ostream &  str,
int  indent 
) const

std::ostream & YFunction::toStream ( std::ostream &  str  )  const [virtual]

Write YCP code to a byte stream (bytecode implementation). Every class inheriting from YCode must reimplement this method.

Parameters:
str byte stream to store into
Returns:
byte stream for chaining writing bytecode (str)

Implements YCode.

References m_declaration, YCode::toStream(), Bytecode::writeBool(), and y2debug.

std::ostream & YFunction::toXml ( std::ostream &  str,
int  indent 
) const [virtual]

Write YCP code as XML representation. Every class inheriting from YCode must reimplement this method.

Parameters:
str string stream to store into
indend indentation level for pretty print
Returns:
string stream for chaining writing XML (str)

Implements YCode.

References m_declaration, m_definition, Xmlcode::popNamespace(), Xmlcode::pushNamespace(), and Xmlcode::spaces().

YCPValue YFunction::evaluate ( bool  cse = false  )  [virtual]

Execute YCP code to get the resulting YCPValue. Every inherited class of YCode should reimplement this method.

Returns:
YCPValue after executing the code
Parameters:
cse should the evaluation be done for parse time evaluation (i.e. constant subexpression elimination)

Reimplemented from YCode.

References toString(), and y2debug.

constTypePtr YFunction::type (  )  const [virtual]

Return type of this YCP code (interesting mostly for function calls).

Returns:
type of the value to be returned after calling evaluate

Reimplemented from YCode.

References parameter(), parameterCount(), and Type::Unspec.


Member Data Documentation

YBlockPtr YFunction::m_declaration [private]

YBlockPtr YFunction::m_definition [private]

bool YFunction::m_is_global [private]


The documentation for this class was generated from the following files:

Generated on Wed Dec 3 07:24:56 2008 for yast2-core by  doxygen 1.5.6