hasmer
Public Member Functions | Properties | List of all members
Hasmer.PrimitiveValue Class Reference

A wrapper type for any other given type, which keeps track of the original type that was passed. This is used to ensure that primitive types can maintain their original type when cast from object to their type. By just using object, all primitive values are coerced into a double, which is undesirable. More...

Public Member Functions

 PrimitiveValue ()
 Creates a new PrimitiveValue, defaulting to null as the value. More...
 
 PrimitiveValue (object rawValue)
 Creates a new PrimitiveValue given the raw value. More...
 
void SetValue (object rawValue)
 Overrides the current raw value with a new one. The type code is also changed to the type of the raw value. More...
 
ulong GetIntegerValue ()
 Returns the raw value coerced to a ulong. The the raw value is not an integer type, an exception is thrown. More...
 
GetValue< T > ()
 Returns the raw value coerced to type T. It is the duty of the caller to ensure that the type actually is of type T before calling. More...
 
override int GetHashCode ()
 
override bool Equals (object obj)
 
override string ToString ()
 

Properties

TypeCode TypeCode [get]
 The type code of the original value passed. More...
 
object RawValue [get]
 The raw value, stored as an object. You probably don't want to use this, use GetValue() instead. More...
 

Detailed Description

A wrapper type for any other given type, which keeps track of the original type that was passed. This is used to ensure that primitive types can maintain their original type when cast from object to their type. By just using object, all primitive values are coerced into a double, which is undesirable.

Constructor & Destructor Documentation

◆ PrimitiveValue() [1/2]

Hasmer.PrimitiveValue.PrimitiveValue ( )
inline

Creates a new PrimitiveValue, defaulting to null as the value.

◆ PrimitiveValue() [2/2]

Hasmer.PrimitiveValue.PrimitiveValue ( object  rawValue)
inline

Creates a new PrimitiveValue given the raw value.

Parameters
rawValue

Member Function Documentation

◆ GetIntegerValue()

ulong Hasmer.PrimitiveValue.GetIntegerValue ( )

Returns the raw value coerced to a ulong. The the raw value is not an integer type, an exception is thrown.

◆ GetValue< T >()

T Hasmer.PrimitiveValue.GetValue< T > ( )

Returns the raw value coerced to type T. It is the duty of the caller to ensure that the type actually is of type T before calling.

◆ SetValue()

void Hasmer.PrimitiveValue.SetValue ( object  rawValue)
inline

Overrides the current raw value with a new one. The type code is also changed to the type of the raw value.

Property Documentation

◆ RawValue

object Hasmer.PrimitiveValue.RawValue
get

The raw value, stored as an object. You probably don't want to use this, use GetValue() instead.

◆ TypeCode

TypeCode Hasmer.PrimitiveValue.TypeCode
get

The type code of the original value passed.


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