lib Library API Documentation

KSValue Class Reference

This class acts like a union. More...

#include <koscript_value.h>

List of all members.

Public Types

typedef KSSharedPtr< KSValuePtr
enum  Type {
  Empty, StringType, IntType, BoolType,
  DoubleType, ListType, MapType, CharType,
  CharRefType, FunctionType, MethodType, PropertyType,
  ModuleType, StructType, StructClassType, StructBuiltinMethodType,
  DateType, TimeType, NTypes
}
enum  Mode { LeftExpr, Constant, Temp }

Public Member Functions

 KSValue (Type)
 KSValue (const KSValue &)
 KSValue (const QString &_v)
 KSValue (const QValueList< Ptr > &_v)
 KSValue (const QMap< QString, Ptr > &_v)
 KSValue (KScript::Long _v)
 KSValue (int _v)
 KSValue (KScript::Boolean _v)
 KSValue (KScript::Double _v)
 KSValue (const KScript::Char &_v)
 KSValue (const KScript::CharRef &_v)
 KSValue (KSFunction *_v)
 KSValue (KSMethod *_v)
 KSValue (KSProperty *_v)
 KSValue (KSModule *_v)
 KSValue (KSStruct *_v)
 KSValue (KSStructClass *_v)
 KSValue (KSStructBuiltinMethod _v)
 KSValue (const QTime &t)
 KSValue (const QDate &d)
KSValueoperator= (const KSValue &)
void setValue (const QString &)
void setValue (const QValueList< Ptr > &)
void setValue (const QMap< QString, Ptr > &)
void setValue (int _v)
void setValue (KScript::Long)
void setValue (KScript::Boolean)
void setValue (KScript::Double)
void setValue (const KScript::Char &)
void setValue (const KScript::CharRef &)
void setValue (KSFunction *)
void setValue (KSMethod *)
void setValue (KSProperty *)
void setValue (KSModule *)
void setValue (KSStruct *)
void setValue (KSStructClass *)
void setValue (KSStructBuiltinMethod)
void setValue (const QDate &)
void setValue (const QTime &)
void suck (KSValue *)
Mode mode () const
void setMode (Mode m)
Type type () const
virtual QString typeName () const
bool isEmpty () const
const QDate & dateValue () const
QDate & dateValue ()
const QTime & timeValue () const
QTime & timeValue ()
const QString & stringValue () const
QString & stringValue ()
const QValueList< Ptr > & listValue () const
QValueList< Ptr > & listValue ()
const QMap< QString, Ptr > & mapValue () const
QMap< QString, Ptr > & mapValue ()
KScript::Long intValue () const
KScript::Boolean boolValue () const
KScript::Double doubleValue () const
KScript::Char charValue () const
KScript::CharRef & charRefValue ()
const KScript::CharRef & charRefValue () const
KSFunction * functionValue ()
const KSFunction * functionValue () const
KSMethodmethodValue ()
const KSMethodmethodValue () const
KSProperty * propertyValue ()
const KSProperty * propertyValue () const
KSModulemoduleValue ()
const KSModulemoduleValue () const
KSStructClass * structClassValue ()
const KSStructClass * structClassValue () const
KSStruct * structValue ()
const KSStruct * structValue () const
KSStructBuiltinMethod structBuiltinMethodValue ()
bool cast (Type)
bool implicitCast (Type typ) const
QString toString (KSContext &context)
bool operator== (const KSValue &v) const
bool cmp (const KSValue &v) const
void clear ()

Static Public Member Functions

QString typeToName (Type _typ)
Type nameToType (const QString &_name)
KSValuenull ()

Protected Attributes

Mode m_mode
Type typ
union {
   KScript::Long   i
   KScript::Boolean   b
   KScript::Double   d
   ushort   c
   void *   ptr
   KSStructBuiltinMethod   sm
   QDate *   date
   QTime *   time
val


Detailed Description

This class acts like a union.

It can hold one value at the time and it can hold the most common types. For CORBA people: It is a poor mans CORBA::Any.

Definition at line 47 of file koscript_value.h.


Member Function Documentation

bool KSValue::cast Type   ) 
 

DO NOT USE ANY MORE.

Definition at line 404 of file koscript_value.cc.

bool KSValue::implicitCast Type  typ  )  const
 

Returns:
TRUE if the stored value is of type typ or can be implicit casted to that type.

Definition at line 700 of file koscript_value.cc.

Referenced by KSUtil::checkType().

void KSValue::clear  ) 
 

Frees all data allocated by this KSValue.

Definition at line 293 of file koscript_value.cc.

KSValue::Type KSValue::nameToType const QString &  _name  )  [static]
 

Returns:
KSValue::Empty if the given name is empty or unknown.

Definition at line 394 of file koscript_value.cc.

KSValue* KSValue::null  )  [inline, static]
 

Returns:
an empty value. Its reference count is increased so that you can assign it directly to some KSContext.

Definition at line 203 of file koscript_value.h.


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Nov 17 13:19:32 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2003