D programming Language



Download 1.66 Mb.
Page37/47
Date08.01.2017
Size1.66 Mb.
#7507
1   ...   33   34   35   36   37   38   39   40   ...   47

object


This module is implicitly imported.

class Object

All class objects in D inherit from Object.

static int printf(char* format, ...);

C printf function.

char[] toString()

Convert Object to a human readable string.

uint toHash()

Compute hash function for Object.

int cmp(Object obj)

Compare with another Object obj. Returns:

<0 for (this < obj)

=0 for (this == obj)

>0 for (this > obj)

class ClassInfo

Runtime type information about a class.

class Exception

All exceptions should be derived from class Exception.


outbuffer


class OutBuffer

OutBuffer provides a way to build up an array of bytes out of raw data. It is useful for things like preparing an array of bytes to write out to a file. OutBuffer's byte order is the format native to the computer. To control the byte order (endianness), use a class derived from OutBuffer. To convert an array of bytes back into raw data, use InBuffer.

void reserve(uint nbytes)

Preallocate nbytes more to the size of the internal buffer. This is a speed optimization, a good guess at the maximum size of the resulting buffer will improve performance by eliminating reallocations and copying.

void write(ubyte[] bytes)

void write(ubyte b)

void write(byte b)

void write(char c)

void write(ushort w)

void write(short s)

void write(wchar c)

void write(uint w)

void write(int i)

void write(ulong l)

void write(long l)

void write(float f)

void write(double f)

void write(real f)

void write(char[] s)

void write(OutBuffer buf)

Append data to the internal buffer.

void fill0(uint nbytes)

Append nbytes of 0 to the internal buffer.

void alignSize(uint alignsize)

0-fill to align on an alignsize boundary. alignsize must be a power of 2.

void align2()

Optimize common special case alignSize(2)

void align4()

Optimize common special case alignSize(4)

ubyte[] toBytes()

Convert internal buffer to array of bytes.

char[] toString()

Convert internal buffer to array of chars.

void vprintf(char[] format, va_list args)

Append output of vprintf() to internal buffer.

void printf(char[] format, ...)

Append output of printf() to internal buffer.

void spread(uint index, uint nbytes)

At offset index into buffer, create nbytes of space by shifting upwards all data past index.




path


const char[] sep;

Character used to separate directory names in a path.

const char[] altsep;

Alternate version of sep[], used in Windows.

const char[] pathsep;

Path separator string.

const char[] linesep;

String used to separate lines.

const char[] curdir;

String representing the current directory.

const char[] pardir;

String representing the parent directory.

char[] getExt(char[] fullname)

Get extension. For example, "d:\path\foo.bat" returns "bat".

char[] getBaseName(char[] fullname)

Get base name. For example, "d:\path\foo.bat" returns "foo.bat".

char[] getDirName(char[] fullname)

Get directory name. For example, "d:\path\foo.bat" returns "d:\path".

char[] getDrive(char[] fullname)

Get drive. For example, "d:\path\foo.bat" returns "d:". Returns null string on systems without the concept of a drive.

char[] defaultExt(char[] fullname, char[] ext)

Put a default extension on fullname if it doesn't already have an extension.

char[] addExt(char[] fullname, char[] ext)

Add file extension or replace existing extension.

int isabs(char[] path)

Determine if absolute path name.

char[] join(char[] p1, char[] p2)

Join two path components.

int fncharmatch(char c1, char c2)

Match file name characters. Case sensitivity depends on the operating system.

int fnmatch(char[] name, char[] pattern)

Match filename strings with pattern[], using the following wildcards:



* match 0 or more characters

? match any character

[chars] match any character that appears between the []

[!chars] match any character that does not appear between the [! ]

Matching is case sensitive on a file system that is case sensitive.


Returns:

!=0 match

0 no match


process



random


void rand_seed(uint seed, uint index)

The random number generator is seeded at program startup with a random value. This ensures that each program generates a different sequence of random numbers. To generate a repeatable sequence, use rand_seed() to start the sequence. seed and index start it, and each successive value increments index. This means that the nth random number of the sequence can be directly generated by passing index + n to rand_seed().

uint rand()

Get next random number in sequence.






Download 1.66 Mb.

Share with your friends:
1   ...   33   34   35   36   37   38   39   40   ...   47




The database is protected by copyright ©ininet.org 2024
send message

    Main page