SUMMARY:  INNER | FIELD | CONSTR | METHOD | FRIEND DETAIL:  FIELD | CONSTR | METHOD | FRIEND


Namespace Platform::Lang

namespace Platform::Lang

Provides language extending constructs for manipulating generic types. This is the basis of the platform's type system.

The platform extends the type system of the C++ language with the following constructs:

Common operations are static methods which work for any type. They are accessible through the Traits template object in the global namespace. The following methods are defined to be the common operations:

Method Description
deepSizeOf(object) computes the deep size of an object
exchange(objectA, objectB) exchanges two objects of the same type
hashCodeOf(object) computes the hash code of an object
hashCodeIgnoreCaseOf(object) computes the hash code of an object disregarding case (Textual types only)
equal(objectA, objectB) tests whether two objects are equal
equalIgnoreCase(objectA, objectB) tests whether two objects are equal ignoring case differences (Textual types only)
compare(objectA, objectB) compares two objects for order
compareIgnoreCase(objectA, objectB) compares two objects for order ignoring case differences (Textual types only)
toString(object) returns a string representation of an object


Type traits provide a generic way to query properties of a given type and to perform common operations on that type. Type traits are defined by the Traits template object in the global namespace and derive from the type properties implementation.

Type properties provide the implementation of type traits and common operations. Type properties are defined in the Lang::TypeProperties namespace.

Type evaluators provide a way to examine, combine and transform types. They are defined in the Lang::TypeEvaluators namespace.

Type concepts implement the fundamental concepts used by the platform. They are defined in the Lang::TypeConcepts namespace.

Type actors provide the default action functors used by the platform. They are defined in the Lang::TypeActors namespace.

Finally, the Lang namespace provides methods to access the common functions without explicitly specifying a type (it is deduced by the language for function calls).

See Also:
Traits, Lang::TypeProperties, Lang::TypeEvaluators, Lang::TypeConcepts, Lang::TypeActors

Inner Compounds, Typedefs, and Enumscollapse
struct FalseType
          A type representing boolean False.
struct TrueType
          A type representing boolean True.

Method Summarycollapse
template <typename Type,
typename TypeX>
Int
compare(const Type& objectA, const TypeX& objectB)
          Compares two objects for order (total order relation).
template <typename Type,
typename TypeX>
Int
compareIgnoreCase(const Type& objectA, const TypeX& objectB)
          Compares two objects for order ignoring case differences (case insensitive total ordering relation).
template <typename Type>
Void
construct(Type* target)
          Constructs an object.
template <typename Type>
Void
construct(Type* target, Int count)
          Constructs an array of objects.
template <typename Type>
Void
copy(Type* target, const Type& object)
          Constructs a copy of an object.
template <typename Type>
Void
copy(Type* target, const Type* source, Int count)
          Copies an array of objects.
template <typename Type>
UInt
deepSizeOf(const Type& object)
          Computes the deep size of the specified object.
template <typename Type>
Void
destroy(Type* target)
          Destroys an object.
template <typename Type>
Void
destroy(Type* target, Int count)
          Destroys objects in the specified array.
template <typename Type,
typename TypeX>
Bool
equal(const Type& objectA, const TypeX& objectB)
          Tests whether two objects are equal (equivalence relation).
template <typename Type,
typename TypeX>
Bool
equalIgnoreCase(const Type& objectA, const TypeX& objectB)
          Tests whether two objects are equal ignoring case differences (case insensitive equivalence relation).
template <typename Type>
Void
exchange(Type& objectA, Type& objectB)
          Exchanges the values of two objects.
template <typename Type>
Void
fill(Type* target, const Type& object, Int count)
          Constructs an array of objects.
template <typename Type>
UInt
hashCodeIgnoreCaseOf(const Type& object)
          Computes the hash code for the specified object ignoring case differences.
template <typename Type>
UInt
hashCodeOf(const Type& object)
          Computes the hash code for the specified object.
template <typename Type>
String
toString(const Type& object)
          Returns a string representation of the specified object.
template <typename Type>
String
toXml(const Type& object)
          

 

Method Detail

compare[inline]

template <typename Type, typename TypeX>
Int compare(const Type& objectA, const TypeX& objectB)

Compares two objects for order (total order relation).

Parameters:
objectA - first object
objectB - second object
Returns:
a signed integer number, result, indicating the order relationship between the objects as follows:
  • result < 0 if objectA < objectB
  • result == 0 if objectA == objectB
  • result > 0 if objectA > objectB

compareIgnoreCase[inline]

template <typename Type, typename TypeX>
Int compareIgnoreCase(const Type& objectA, const TypeX& objectB)

Compares two objects for order ignoring case differences (case insensitive total ordering relation).

Parameters:
objectA - first object
objectB - second object
Returns:
a signed integer number, result, indicating the order relationship between the objects as follows:
  • result < 0 if objectA < objectB
  • result == 0 if objectA == objectB
  • result > 0 if objectA > objectB

construct[inline]

template <typename Type>
Void construct(Type* target)

Constructs an object. The object is constructed at the given memory location by invoking Type's default constructor.

Parameters:
target - the location where to construct the object
Remarks:
the effect of this method is equivalent to the following C++ expression: new(static_cast<void*>(target)) Type()

construct[inline]

template <typename Type>
Void construct(Type* target, Int count)

Constructs an array of objects. The objects are constructed at the given memory location by invoking Type's default constructor.

Parameters:
target - the location where to construct the objects
count - the number of objects to construct
Remarks:
an exception thrown during construction rolls back the entire operation: the elements already constructed are destroyed in the reverse order and the exception is rethrown
See Also:
construct(Type* target)

copy[inline]

template <typename Type>
Void copy(Type* target, const Type& object)

Constructs a copy of an object. Copies the specified object by invoking its copy constructor.

Parameters:
target - the location where to construct the copy
object - the original object whose value is to be copied
Remarks:
the effect of this method is equivalent to the following C++ expression: new(static_cast<void*>(target)) Type(object)

copy[inline]

template <typename Type>
Void copy(Type* target, const Type* source, Int count)

Copies an array of objects. The objects are copied by invoking the copy constructor for every element in the source array.

Parameters:
target - the destination location where to copy the objects
source - the source location of the array from which the objects are copied
count - the number of elements to copy
Remarks:
an exception thrown during copying rolls back the entire operation: the elements already constructed are destroyed in the reverse order and the exception is rethrown
See Also:
copy(Type* target, const Type& object)

deepSizeOf[inline]

template <typename Type>
UInt deepSizeOf(const Type& object)

Computes the deep size of the specified object. The deep size is defined as sizeof(Type) for fundamental types and the sum of the result of recursive deepSizeOf on members for compound types (e.g. containers).

Parameters:
object - an object
Returns:
the deep size of an object in bytes

destroy[inline]

template <typename Type>
Void destroy(Type* target)

Destroys an object. The specified object of type Type is destroyed by invoking its destructor. After this method returns the memory occupied by the object (if any) can be safely deallocated.

Parameters:
target - the location of the object that is to be destroyed
Remarks:
the effect of this method is equivalent to the following C++ expression: target->~Type()

destroy[inline]

template <typename Type>
Void destroy(Type* target, Int count)

Destroys objects in the specified array. The objects are destroyed in the reverse order (e.g. last object in the array is destroyed first) by invoking Type's destructor on every element in the array.

Parameters:
target - the location where to destroy the objects
count - the number of objects to destroy

equal[inline]

template <typename Type, typename TypeX>
Bool equal(const Type& objectA, const TypeX& objectB)

Tests whether two objects are equal (equivalence relation).

Parameters:
objectA - first object
objectB - second object
Returns:
True if the objects are equal, False otherwise

equalIgnoreCase[inline]

template <typename Type, typename TypeX>
Bool equalIgnoreCase(const Type& objectA, const TypeX& objectB)

Tests whether two objects are equal ignoring case differences (case insensitive equivalence relation).

Parameters:
objectA - first object
objectB - second object
Returns:
True if the objects are equal, False otherwise

exchange[inline]

template <typename Type>
Void exchange(Type& objectA, Type& objectB)

Exchanges the values of two objects.

Parameters:
objectA - first object
objectB - second object

fill[inline]

template <typename Type>
Void fill(Type* target, const Type& object, Int count)

Constructs an array of objects. The objects are constructed at the given memory location by invoking Type's copy constructor for every element.

Parameters:
target - the location where to construct the objects
object - the original object whose value is to be copied
count - the number of objects to construct
Remarks:
an exception thrown during construction rolls back the entire operation: the elements already constructed are destroyed in the reverse order and the exception is rethrown

hashCodeIgnoreCaseOf[inline]

template <typename Type>
UInt hashCodeIgnoreCaseOf(const Type& object)

Computes the hash code for the specified object ignoring case differences. The hash code for compound types is computed by recursively calling hashCodeOf on the members.

Parameters:
object - an object
Returns:
the computed hash code of the specified object

hashCodeOf[inline]

template <typename Type>
UInt hashCodeOf(const Type& object)

Computes the hash code for the specified object. The hash code for compound types is computed by recursively calling hashCodeOf on the members.

Parameters:
object - an object
Returns:
the computed hash code of the specified object

toString[inline]

template <typename Type>
String toString(const Type& object)

Returns a string representation of the specified object.

Parameters:
object - an object
Returns:
a string representation of the object

toXml[inline]

template <typename Type>
String toXml(const Type& object)



SUMMARY:  INNER | FIELD | CONSTR | METHOD | FRIEND DETAIL:  FIELD | CONSTR | METHOD | FRIEND