Type Class Reference

YCP type. More...

#include <Type.h>

Inheritance diagram for Type:

BlockType FlexType FunctionType ListType MapType NFlexType TupleType VariableType List of all members.

Public Types

enum  type_kind {
  UnspecT = 0, ErrorT, AnyT, BooleanT,
  ByteblockT, FloatT, IntegerT, LocaleT,
  PathT, StringT, SymbolT, TermT,
  VoidT, WildcardT, FlexT, VariableT,
  ListT, MapT, BlockT, TupleT,
  FunctionT, NilT, NFlexT
}
typedef enum Type::type_kind tkind

Public Member Functions

 Type ()
 Type (tkind kind, bytecodeistream &str)
virtual ~Type ()
virtual string toString () const
virtual std::ostream & toStream (std::ostream &str) const
virtual bool isBasetype () const
virtual constTypePtr matchFlex (constTypePtr, unsigned int=0) const
virtual int match (constTypePtr expected) const
virtual int matchvalue (YCPValue value) const
virtual bool canCast (constTypePtr to) const
virtual TypePtr clone () const
virtual constTypePtr unflex (constTypePtr type, unsigned int number=0) const
string preToString () const
string postToString () const
bool isConst () const
void asConst ()
bool isReference () const
void asReference ()
int basematch (constTypePtr expected) const
virtual bool equals (constTypePtr expected) const
bool isUnspec () const
bool isError () const
bool isAny () const
bool isBoolean () const
bool isByteblock () const
bool isFloat () const
bool isInteger () const
bool isLocale () const
bool isPath () const
bool isString () const
bool isSymbol () const
bool isTerm () const
bool isVoid () const
bool isWildcard () const
bool isFlex () const
bool isNFlex () const
bool isVariable () const
bool isList () const
bool isMap () const
bool isBlock () const
bool isTuple () const
bool isFunction () const
bool isNil () const
YCPValueType valueType () const
virtual constTypePtr commontype (constTypePtr type) const
virtual constTypePtr detailedtype (constTypePtr type) const

Static Public Member Functions

static void setNocheck (bool nocheck)
static constTypePtr vt2type (enum YCPValueType vt)
static int nextToken (const char **signature)
static constTypePtr fromSignature (const char **signature)
static constTypePtr fromSignature (const string &signature)
static constTypePtr determineFlexType (constFunctionTypePtr actual, constFunctionTypePtr declared)
static FunctionTypePtr Function (constTypePtr return_type)

Static Public Attributes

static const constTypePtr Unspec
static const constTypePtr Error
static const constTypePtr Any
static const constTypePtr Void
static const constTypePtr Boolean
static const constTypePtr Byteblock
static const constTypePtr Float
static const constTypePtr Integer
static const constTypePtr Locale
static const constTypePtr Path
static const constTypePtr String
static const constTypePtr Symbol
static const constTypePtr Term
static const constTypePtr Wildcard
static const constTypePtr ConstAny
static const constTypePtr ConstVoid
static const constTypePtr ConstBoolean
static const constTypePtr ConstByteblock
static const constTypePtr ConstFloat
static const constTypePtr ConstInteger
static const constTypePtr ConstLocale
static const constTypePtr ConstPath
static const constTypePtr ConstString
static const constTypePtr ConstSymbol
static const constTypePtr ConstTerm
static const constTypePtr ConstList
static const constTypePtr ConstMap
static const constTypePtr Flex
static const constTypePtr ConstFlex
static const constTypePtr NFlex1
static const constTypePtr ConstNFlex1
static const constTypePtr NFlex2
static const constTypePtr ConstNFlex2
static const constTypePtr NFlex3
static const constTypePtr ConstNFlex3
static const constTypePtr NFlex4
static const constTypePtr ConstNFlex4
static const constTypePtr ListUnspec
static const constTypePtr List
static const constTypePtr MapUnspec
static const constTypePtr Map
static const constTypePtr Variable
static const constTypePtr Block
static const constTypePtr Nil

Protected Member Functions

 Type (tkind kind, bool as_const =false, bool as_reference=false)

Protected Attributes

tkind m_kind
bool m_const
bool m_reference

Private Member Functions

 REP_BODY (Type)
tkind kind () const

Detailed Description

YCP type.


Member Typedef Documentation

typedef enum Type::type_kind Type::tkind


Member Enumeration Documentation

enum Type::type_kind

Enumerator:
UnspecT 
ErrorT 
AnyT 
BooleanT 
ByteblockT 
FloatT 
IntegerT 
LocaleT 
PathT 
StringT 
SymbolT 
TermT 
VoidT 
WildcardT 
FlexT 
VariableT 
ListT 
MapT 
BlockT 
TupleT 
FunctionT 
NilT 
NFlexT 


Constructor & Destructor Documentation

Type::Type ( tkind  kind,
bool  as_const = false,
bool  as_reference = false 
) [inline, protected]

Type::Type (  ) 

Type::Type ( tkind  kind,
bytecodeistream str 
)

Type::~Type (  )  [virtual]


Member Function Documentation

Type::REP_BODY ( Type   )  [private]

static void Type::setNocheck ( bool  nocheck  )  [static]

enable/disable type checking

constTypePtr Type::vt2type ( enum YCPValueType  vt  )  [static]

convert YCPValueType to Type

int Type::nextToken ( const char **  signature  )  [static]

signature parser, get next token

constTypePtr Type::fromSignature ( const char **  signature  )  [static]

Construct from a string literal type code

static constTypePtr Type::fromSignature ( const string &  signature  )  [inline, static]

Construct from a string literal type code

Parameters:
s eg. string("list <string>")

constTypePtr Type::determineFlexType ( constFunctionTypePtr  actual,
constFunctionTypePtr  declared 
) [static]

determine actual type if declared type contains 'flex' or 'flexN' Returns actual - unchanged or fixed

FunctionTypePtr Type::Function ( constTypePtr  return_type  )  [static]

tkind Type::kind (  )  const [inline, private]

string Type::toString (  )  const [virtual]

Converts a type code to its YCP notation.

Reimplemented in FlexType, NFlexType, VariableType, ListType, MapType, BlockType, TupleType, and FunctionType.

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

write out to stream

Reimplemented in FlexType, NFlexType, VariableType, ListType, MapType, BlockType, TupleType, and FunctionType.

virtual bool Type::isBasetype (  )  const [inline, virtual]

Reimplemented in FlexType, NFlexType, VariableType, ListType, MapType, BlockType, TupleType, and FunctionType.

virtual constTypePtr Type::matchFlex ( constTypePtr  ,
unsigned int  = 0 
) const [inline, virtual]

Reimplemented in FlexType, NFlexType, VariableType, ListType, MapType, BlockType, TupleType, and FunctionType.

int Type::match ( constTypePtr  expected  )  const [virtual]

check match with expected type <0: no match, ==0: full match, >0: propagated match

Reimplemented in FlexType, NFlexType, VariableType, ListType, MapType, BlockType, TupleType, and FunctionType.

int Type::matchvalue ( YCPValue  value  )  const [virtual]

check match with value <0: no match, ==0: full match, >0: propagated match

bool Type::canCast ( constTypePtr  to  )  const [virtual]

check, if the type can be casted (at runtime considered to be - similar to dynamic_cast) to another type

Reimplemented in ListType, MapType, BlockType, TupleType, and FunctionType.

TypePtr Type::clone (  )  const [virtual]

clone this type

Reimplemented in FlexType, NFlexType, VariableType, ListType, MapType, BlockType, TupleType, and FunctionType.

constTypePtr Type::unflex ( constTypePtr  type,
unsigned int  number = 0 
) const [virtual]

replace any 'FlexT' (number == 0) or 'NFlexT' (number != 0) with 'type'

Reimplemented in FlexType, NFlexType, VariableType, ListType, MapType, BlockType, TupleType, and FunctionType.

string Type::preToString (  )  const [inline]

prefix qualifier

string Type::postToString (  )  const [inline]

postfix qualifier

bool Type::isConst (  )  const [inline]

return const qualifier

void Type::asConst (  )  [inline]

set const qualifier

bool Type::isReference (  )  const [inline]

return reference qualifier

void Type::asReference (  )  [inline]

set reference qualifier

int Type::basematch ( constTypePtr  expected  )  const

check if base matches with expected type <0: no match, ==0: full match, >0: propagated match

bool Type::equals ( constTypePtr  expected  )  const [virtual]

check equality of the types, without any assumptions like any == unspec

Reimplemented in VariableType, ListType, MapType, BlockType, TupleType, and FunctionType.

bool Type::isUnspec (  )  const [inline]

bool Type::isError (  )  const [inline]

bool Type::isAny (  )  const [inline]

bool Type::isBoolean (  )  const [inline]

bool Type::isByteblock (  )  const [inline]

bool Type::isFloat (  )  const [inline]

bool Type::isInteger (  )  const [inline]

bool Type::isLocale (  )  const [inline]

bool Type::isPath (  )  const [inline]

bool Type::isString (  )  const [inline]

bool Type::isSymbol (  )  const [inline]

bool Type::isTerm (  )  const [inline]

bool Type::isVoid (  )  const [inline]

bool Type::isWildcard (  )  const [inline]

bool Type::isFlex (  )  const [inline]

bool Type::isNFlex (  )  const [inline]

bool Type::isVariable (  )  const [inline]

bool Type::isList (  )  const [inline]

bool Type::isMap (  )  const [inline]

bool Type::isBlock (  )  const [inline]

bool Type::isTuple (  )  const [inline]

bool Type::isFunction (  )  const [inline]

bool Type::isNil (  )  const [inline]

YCPValueType Type::valueType (  )  const

constTypePtr Type::commontype ( constTypePtr  type  )  const [virtual]

Finds a type that can hold both given types This should be the narrowest such type - TODO

Reimplemented in ListType, and MapType.

constTypePtr Type::detailedtype ( constTypePtr  type  )  const [virtual]

Finds a type which contains most information This should be the narrowest such type - TODO

Reimplemented in ListType, and MapType.


Member Data Documentation

tkind Type::m_kind [protected]

bool Type::m_const [protected]

bool Type::m_reference [protected]

const constTypePtr Type::Unspec [static]

const constTypePtr Type::Error [static]

const constTypePtr Type::Any [static]

const constTypePtr Type::Void [static]

const constTypePtr Type::Boolean [static]

const constTypePtr Type::Byteblock [static]

const constTypePtr Type::Float [static]

const constTypePtr Type::Integer [static]

const constTypePtr Type::Locale [static]

const constTypePtr Type::Path [static]

const constTypePtr Type::String [static]

const constTypePtr Type::Symbol [static]

const constTypePtr Type::Term [static]

const constTypePtr Type::Wildcard [static]

const constTypePtr Type::ConstAny [static]

const constTypePtr Type::ConstVoid [static]

const constTypePtr Type::ConstBoolean [static]

const constTypePtr Type::ConstByteblock [static]

const constTypePtr Type::ConstFloat [static]

const constTypePtr Type::ConstInteger [static]

const constTypePtr Type::ConstLocale [static]

const constTypePtr Type::ConstPath [static]

const constTypePtr Type::ConstString [static]

const constTypePtr Type::ConstSymbol [static]

const constTypePtr Type::ConstTerm [static]

const constTypePtr Type::ConstList [static]

const constTypePtr Type::ConstMap [static]

const constTypePtr Type::Flex [static]

const constTypePtr Type::ConstFlex [static]

const constTypePtr Type::NFlex1 [static]

const constTypePtr Type::ConstNFlex1 [static]

const constTypePtr Type::NFlex2 [static]

const constTypePtr Type::ConstNFlex2 [static]

const constTypePtr Type::NFlex3 [static]

const constTypePtr Type::ConstNFlex3 [static]

const constTypePtr Type::NFlex4 [static]

const constTypePtr Type::ConstNFlex4 [static]

const constTypePtr Type::ListUnspec [static]

const constTypePtr Type::List [static]

const constTypePtr Type::MapUnspec [static]

const constTypePtr Type::Map [static]

const constTypePtr Type::Variable [static]

const constTypePtr Type::Block [static]

const constTypePtr Type::Nil [static]


The documentation for this class was generated from the following files:
Generated on Tue Nov 6 01:20:22 2007 for yast2-core by  doxygen 1.5.0