Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Examples

Type Class Reference

#include <Type.h>

Inheritance diagram for Type:

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

Public Types

typedef enum Type::type_kind tkind
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
}

Public Member Functions

 Type ()
 Type (tkind kind, std::istream &str)
virtual ~Type ()
virtual string toString () const
virtual std::ostream & toStream (std::ostream &str) const
virtual bool isBasetype () const
virtual constTypePtr matchFlex (constTypePtr type, unsigned int number=0) const
virtual int match (constTypePtr expected) 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

Static Public Member Functions

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

Static Public Attributes

const constTypePtr Unspec = TypePtr ( new Type (UnspecT))
const constTypePtr Error = TypePtr ( new Type (ErrorT))
const constTypePtr Any = TypePtr ( new Type (AnyT))
const constTypePtr Void = TypePtr ( new Type (VoidT))
const constTypePtr Boolean = TypePtr ( new Type (BooleanT))
const constTypePtr Byteblock = TypePtr ( new Type (ByteblockT))
const constTypePtr Float = TypePtr ( new Type (FloatT))
const constTypePtr Integer = TypePtr ( new Type (IntegerT))
const constTypePtr Locale = TypePtr ( new Type (LocaleT))
const constTypePtr Path = TypePtr ( new Type (PathT))
const constTypePtr String = TypePtr ( new Type (StringT))
const constTypePtr Symbol = TypePtr ( new Type (SymbolT))
const constTypePtr Term = TypePtr ( new Type (TermT))
const constTypePtr Wildcard = TypePtr ( new Type (WildcardT))
const constTypePtr ConstAny = TypePtr ( new Type (AnyT, true))
const constTypePtr ConstVoid = TypePtr ( new Type (VoidT, true))
const constTypePtr ConstBoolean = TypePtr ( new Type (BooleanT, true))
const constTypePtr ConstByteblock = TypePtr ( new Type (ByteblockT, true))
const constTypePtr ConstFloat = TypePtr ( new Type (FloatT, true))
const constTypePtr ConstInteger = TypePtr ( new Type (IntegerT, true))
const constTypePtr ConstLocale = TypePtr ( new Type (LocaleT, true))
const constTypePtr ConstPath = TypePtr ( new Type (PathT, true))
const constTypePtr ConstString = TypePtr ( new Type (StringT, true))
const constTypePtr ConstSymbol = TypePtr ( new Type (SymbolT, true))
const constTypePtr ConstTerm = TypePtr ( new Type (TermT, true))
const constTypePtr ConstList = TypePtr ( new Type (ListT, true))
const constTypePtr ConstMap = TypePtr ( new Type (MapT, true))
const constTypePtr Flex = TypePtr ( new FlexType())
const constTypePtr ConstFlex = TypePtr ( new FlexType (true))
const constTypePtr NFlex1 = TypePtr ( new NFlexType(1))
const constTypePtr ConstNFlex1 = TypePtr ( new NFlexType (1, true))
const constTypePtr NFlex2 = TypePtr ( new NFlexType(2))
const constTypePtr ConstNFlex2 = TypePtr ( new NFlexType (2, true))
const constTypePtr NFlex3 = TypePtr ( new NFlexType(3))
const constTypePtr ConstNFlex3 = TypePtr ( new NFlexType (3, true))
const constTypePtr NFlex4 = TypePtr ( new NFlexType(4))
const constTypePtr ConstNFlex4 = TypePtr ( new NFlexType (4, true))
const constTypePtr ListUnspec = new ListType (Type::Unspec)
const constTypePtr List = new ListType (Type::Any)
const constTypePtr MapUnspec = new MapType (Type::Unspec, Type::Unspec)
const constTypePtr Map = new MapType (Type::Any, Type::Any)
const constTypePtr Variable = new VariableType (Type::Any)
const constTypePtr Block = new BlockType (Type::Any)
const constTypePtr Nil = TypePtr ( new Type (NilT))

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

Member Typedef Documentation

typedef enum Type::type_kind Type::tkind
 


Member Enumeration Documentation

enum Type::type_kind
 

Enumeration values:
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,
std::istream &  str
 

Type::~Type  )  [virtual]
 


Member Function Documentation

void Type::asConst  )  [inline]
 

set const 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::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::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::determineFlexType constFunctionTypePtr  actual,
constFunctionTypePtr  declared
[static]
 

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

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.

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

Construct from a string literal type code

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

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

Construct from a string literal type code

FunctionTypePtr Type::Function constTypePtr  return_type  )  [static]
 

bool Type::isAny  )  const [inline]
 

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

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

bool Type::isBlock  )  const [inline]
 

bool Type::isBoolean  )  const [inline]
 

bool Type::isByteblock  )  const [inline]
 

bool Type::isConst  )  const [inline]
 

return const qualifier

bool Type::isError  )  const [inline]
 

bool Type::isFlex  )  const [inline]
 

bool Type::isFloat  )  const [inline]
 

bool Type::isFunction  )  const [inline]
 

bool Type::isInteger  )  const [inline]
 

bool Type::isList  )  const [inline]
 

bool Type::isLocale  )  const [inline]
 

bool Type::isMap  )  const [inline]
 

bool Type::isNFlex  )  const [inline]
 

bool Type::isNil  )  const [inline]
 

bool Type::isPath  )  const [inline]
 

bool Type::isReference  )  const [inline]
 

return reference qualifier

bool Type::isString  )  const [inline]
 

bool Type::isSymbol  )  const [inline]
 

bool Type::isTerm  )  const [inline]
 

bool Type::isTuple  )  const [inline]
 

bool Type::isUnspec  )  const [inline]
 

bool Type::isVariable  )  const [inline]
 

bool Type::isVoid  )  const [inline]
 

bool Type::isWildcard  )  const [inline]
 

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

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.

virtual constTypePtr Type::matchFlex constTypePtr  type,
unsigned int  number = 0
const [inline, virtual]
 

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

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

signature parser, get next token

string Type::postToString  )  const [inline]
 

postfix qualifier

string Type::preToString  )  const [inline]
 

prefix qualifier

Type::REP_BODY Type   )  [private]
 

void Type::setNocheck bool  nocheck  )  [static]
 

enable/disable type checking

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

write out to stream

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

string Type::toString  )  const [virtual]
 

Converts a type code to its YCP notation.

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.

YCPValueType Type::valueType  )  const
 

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

convert YCPValueType to Type


Member Data Documentation

const constTypePtr Type::Any = TypePtr ( new Type (AnyT)) [static]
 

const constTypePtr Type::Block = new BlockType (Type::Any) [static]
 

const constTypePtr Type::Boolean = TypePtr ( new Type (BooleanT)) [static]
 

const constTypePtr Type::Byteblock = TypePtr ( new Type (ByteblockT)) [static]
 

const constTypePtr Type::ConstAny = TypePtr ( new Type (AnyT, true)) [static]
 

const constTypePtr Type::ConstBoolean = TypePtr ( new Type (BooleanT, true)) [static]
 

const constTypePtr Type::ConstByteblock = TypePtr ( new Type (ByteblockT, true)) [static]
 

const constTypePtr Type::ConstFlex = TypePtr ( new FlexType (true)) [static]
 

const constTypePtr Type::ConstFloat = TypePtr ( new Type (FloatT, true)) [static]
 

const constTypePtr Type::ConstInteger = TypePtr ( new Type (IntegerT, true)) [static]
 

const constTypePtr Type::ConstList = TypePtr ( new Type (ListT, true)) [static]
 

const constTypePtr Type::ConstLocale = TypePtr ( new Type (LocaleT, true)) [static]
 

const constTypePtr Type::ConstMap = TypePtr ( new Type (MapT, true)) [static]
 

const constTypePtr Type::ConstNFlex1 = TypePtr ( new NFlexType (1, true)) [static]
 

const constTypePtr Type::ConstNFlex2 = TypePtr ( new NFlexType (2, true)) [static]
 

const constTypePtr Type::ConstNFlex3 = TypePtr ( new NFlexType (3, true)) [static]
 

const constTypePtr Type::ConstNFlex4 = TypePtr ( new NFlexType (4, true)) [static]
 

const constTypePtr Type::ConstPath = TypePtr ( new Type (PathT, true)) [static]
 

const constTypePtr Type::ConstString = TypePtr ( new Type (StringT, true)) [static]
 

const constTypePtr Type::ConstSymbol = TypePtr ( new Type (SymbolT, true)) [static]
 

const constTypePtr Type::ConstTerm = TypePtr ( new Type (TermT, true)) [static]
 

const constTypePtr Type::ConstVoid = TypePtr ( new Type (VoidT, true)) [static]
 

const constTypePtr Type::Error = TypePtr ( new Type (ErrorT)) [static]
 

const constTypePtr Type::Flex = TypePtr ( new FlexType()) [static]
 

const constTypePtr Type::Float = TypePtr ( new Type (FloatT)) [static]
 

const constTypePtr Type::Integer = TypePtr ( new Type (IntegerT)) [static]
 

const constTypePtr Type::List = new ListType (Type::Any) [static]
 

const constTypePtr Type::ListUnspec = new ListType (Type::Unspec) [static]
 

const constTypePtr Type::Locale = TypePtr ( new Type (LocaleT)) [static]
 

bool Type::m_const [protected]
 

tkind Type::m_kind [protected]
 

bool Type::m_reference [protected]
 

const constTypePtr Type::Map = new MapType (Type::Any, Type::Any) [static]
 

const constTypePtr Type::MapUnspec = new MapType (Type::Unspec, Type::Unspec) [static]
 

const constTypePtr Type::NFlex1 = TypePtr ( new NFlexType(1)) [static]
 

const constTypePtr Type::NFlex2 = TypePtr ( new NFlexType(2)) [static]
 

const constTypePtr Type::NFlex3 = TypePtr ( new NFlexType(3)) [static]
 

const constTypePtr Type::NFlex4 = TypePtr ( new NFlexType(4)) [static]
 

const constTypePtr Type::Nil = TypePtr ( new Type (NilT)) [static]
 

const constTypePtr Type::Path = TypePtr ( new Type (PathT)) [static]
 

const constTypePtr Type::String = TypePtr ( new Type (StringT)) [static]
 

const constTypePtr Type::Symbol = TypePtr ( new Type (SymbolT)) [static]
 

const constTypePtr Type::Term = TypePtr ( new Type (TermT)) [static]
 

const constTypePtr Type::Unspec = TypePtr ( new Type (UnspecT)) [static]
 

const constTypePtr Type::Variable = new VariableType (Type::Any) [static]
 

const constTypePtr Type::Void = TypePtr ( new Type (VoidT)) [static]
 

const constTypePtr Type::Wildcard = TypePtr ( new Type (WildcardT)) [static]
 


The documentation for this class was generated from the following files:
Generated on Fri Nov 9 18:15:24 2007 for yast2-core by doxygen 1.3.6