YConst Class Reference

YCP Constant. More...

#include <YCode.h>

Inheritance diagram for YConst:

YCode Rep

List of all members.

Public Member Functions

 YConst (ykind kind, YCPValue value)
 YConst (ykind kind, bytecodeistream &str)
 ~YConst ()
YCPValue value () const
virtual ykind kind () const
string toString () const
std::ostream & toStream (std::ostream &str) const
std::ostream & toXml (std::ostream &str, int indent) const
virtual bool isConstant () const
YCPValue evaluate (bool cse=false)
constTypePtr type () const

Private Member Functions

 REP_BODY (YConst)

Private Attributes

ykind m_kind
YCPValue m_value


Detailed Description

YCP Constant.

The base class for YCP constants (YCPValue).


Constructor & Destructor Documentation

YConst::YConst ( ykind  kind,
YCPValue  value 
)

YConst::YConst ( ykind  kind,
bytecodeistream str 
)

YConst::~YConst (  )  [inline]


Member Function Documentation

YCPValue YConst::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 YCPElement::isNull(), m_value, toString(), and y2debug.

virtual bool YConst::isConstant (  )  const [inline, virtual]

yes

Reimplemented from YCode.

YCode::ykind YConst::kind (  )  const [virtual]

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

Returns:
the YCode kind

Implements YCode.

References m_kind.

YConst::REP_BODY ( YConst   )  [private]

std::ostream & YConst::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 YCPElement::isNull(), m_kind, m_value, Bytecode::writeBool(), y2error, and YCode::ycConstant.

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

Return ASCII represtation of this YCP code.

Returns:
ASCII string representation

Reimplemented from YCode.

References YCPElement::isNull(), m_kind, m_value, YCode::ycBoolean, YCode::ycByteblock, YCode::ycFloat, YCode::ycInteger, YCode::ycList, YCode::ycLocale, YCode::ycMap, YCode::ycPath, YCode::ycString, YCode::ycSymbol, YCode::ycTerm, YCode::ycVoid, YCode::yeBlock, and YCode::yeLocale.

Referenced by evaluate().

std::ostream & YConst::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 YCPElement::isNull(), m_kind, m_value, y2error, and YCode::ycConstant.

constTypePtr YConst::type (  )  const [virtual]

YCPValue YConst::value (  )  const

References m_value.


Member Data Documentation

ykind YConst::m_kind [private]

Referenced by kind(), toStream(), toString(), toXml(), and type().


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

Generated on a sunny day for yast2-core by doxygen 1.5.9