#include <YCode.h>
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 |
YFunction::YFunction | ( | YBlockPtr | parameterblock, | |
const SymbolEntryPtr | entry = 0 | |||
) |
YFunction::YFunction | ( | bytecodeistream & | str | ) |
References m_declaration, Bytecode::readBool(), Bytecode::readCode(), y2debug, and y2error.
YFunction::~YFunction | ( | ) |
YBlockPtr YFunction::declaration | ( | ) | const |
References m_declaration.
YBlockPtr YFunction::definition | ( | ) | const |
References m_definition.
YCPValue YFunction::evaluate | ( | bool | cse = false |
) | [virtual] |
Execute YCP code to get the resulting YCPValue. Every inherited class of YCode should reimplement this method.
cse | should the evaluation be done for parse time evaluation (i.e. constant subexpression elimination) |
Reimplemented from YCode.
References toString(), and y2debug.
virtual ykind YFunction::kind | ( | ) | const [inline, virtual] |
Kind of this YCode. This method must be reimplemented in the inherited classes.
Implements YCode.
References YCode::ycFunction.
SymbolEntryPtr YFunction::parameter | ( | unsigned int | position | ) | const |
unsigned int YFunction::parameterCount | ( | void | ) | const |
YFunction::REP_BODY | ( | YFunction | ) | [private] |
void YFunction::setDefinition | ( | bytecodeistream & | str | ) |
void YFunction::setDefinition | ( | YBlockPtr | body | ) |
References YBlock::b_definition, and m_definition.
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.
str | byte stream to store into |
Implements YCode.
References m_declaration, Bytecode::writeBool(), and y2debug.
std::ostream & YFunction::toStreamDefinition | ( | std::ostream & | str | ) | const |
References m_declaration, m_definition, Bytecode::popNamespace(), Bytecode::pushNamespace(), Bytecode::writeBool(), and y2debug.
string YFunction::toString | ( | void | ) | const [virtual] |
Return ASCII represtation of this YCP code.
Reimplemented from YCode.
References m_definition, and toStringDeclaration().
Referenced by evaluate().
string YFunction::toStringDeclaration | ( | ) | const |
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.
str | string stream to store into | |
indend | indentation level for pretty print |
Implements YCode.
References m_declaration, m_definition, Xmlcode::popNamespace(), Xmlcode::pushNamespace(), and Xmlcode::spaces().
std::ostream & YFunction::toXmlDefinition | ( | std::ostream & | str, | |
int | indent | |||
) | const |
constTypePtr YFunction::type | ( | ) | const [virtual] |
Return type of this YCP code (interesting mostly for function calls).
Reimplemented from YCode.
References parameter(), parameterCount(), and Type::Unspec.
YBlockPtr YFunction::m_declaration [private] |
Referenced by declaration(), parameter(), parameterCount(), setDefinition(), toStream(), toStreamDefinition(), toXml(), and YFunction().
YBlockPtr YFunction::m_definition [private] |
Referenced by definition(), setDefinition(), toStreamDefinition(), toString(), and toXml().
bool YFunction::m_is_global [private] |