www.digitalmars.com

D Programming Language 1.0

Last update Mon Dec 31 10:53:28 2012

object

Part of the D programming language runtime library. Forms the symbols available to all D programs. Includes Object, which is the root of the class object hierarchy.

This module is implicitly imported.

Source:
internal/object.d

alias size_t;
An unsigned integral type large enough to span the memory space. Use for array indices and pointer offsets for maximal portability to architectures that have different memory address ranges. This is analogous to C's size_t.

alias ptrdiff_t;
A signed integral type large enough to span the memory space. Use for pointer differences and for size_t differences for maximal portability to architectures that have different memory address ranges. This is analogous to C's ptrdiff_t.

alias c_long;
Handy alias's for C's long and unsigned long types, which vary in size.

alias c_ulong;
Handy alias's for C's long and unsigned long types, which vary in size.

alias bit;
Standard boolean type.

class Object;
All D class objects inherit from Object.

void print();
Converts Object to human readable text and writes it to stdout.

char[] toString();
Convert Object to a human readable string.

hash_t toHash();
Compute hash function for Object.

int opCmp(Object o);
Compare with another Object obj.

Returns:
this < obj < 0
this == obj 0
this > obj > 0


int opEquals(Object o);
Returns !=0 if this object does have the same contents as obj.

static Object factory(char[] classname);
Create instance of class specified by classname. The class must either have no constructors or have a default constructor.

Returns:
null if failed

struct Interface;
Information about an interface. When an object is accessed via an interface, an Interface* appears as the first entry in its vtbl.

ClassInfo classinfo;
.classinfo for this interface (not for containing class)

int offset;
offset to Interface 'this' from Object 'this'

class ClassInfo;
Runtime type information about a class. Can be retrieved for any class type or instance by using the .classinfo property. A pointer to this appears as the first entry in the class's vtbl[].

byte[] init;
class static initializer (init.length gives size in bytes of class)

char[] name;
class name

void*[] vtbl;
virtual function pointer table

Interface[] interfaces;
interfaces this class implements

ClassInfo base;
base class

static ClassInfo find(char[] classname);
Search all modules for ClassInfo corresponding to classname.

Returns:
null if not found

Object create();
Create instance of Object represented by 'this'.

Returns:
the object created, or null if the Object does does not have a default constructor

struct OffsetTypeInfo;
Array of pairs giving the offset and type information for each member in an aggregate.

size_t offset;
Offset of member from start of object

TypeInfo ti;
TypeInfo for this member

class TypeInfo;
Runtime type information about a type. Can be retrieved for any type using a TypeidExpression.

hash_t getHash(void* p);
Returns a hash of the instance of a type.

int equals(void* p1, void* p2);
Compares two instances for equality.

int compare(void* p1, void* p2);
Compares two instances for <, ==, or >.

size_t tsize();
Returns size of the type.

void swap(void* p1, void* p2);
Swaps two instances of the type.

TypeInfo next();
Get TypeInfo for 'next' type, as defined by what kind of type this is, null if none.

void[] init();
Return default initializer. If the type should be initialized to all zeros, an array with a null ptr and a length equal to the type size will be returned.

uint flags();
Get flags for type: 1 means GC should scan for pointers

OffsetTypeInfo[] offTi();
Get type information on the contents of the type; null if not available

size_t talign();
Return alignment of type

class Exception;
All recoverable exceptions should be derived from class Exception.

this(char[] msg);
Constructor; msg is a descriptive message for the exception.

class Error: object.Exception;
All irrecoverable exceptions should be derived from class Error.

this(char[] msg);
Constructor; msg is a descriptive message for the exception.