|
MKoD - D Programming Language
Dynamically Interconnected Variable Arguments (Diva) class -
D Project
During the months of June, July, and August of 2005 I've saw many messages on the
D forum, of people like myself wanting and / or needing the ability modify the
variadic function parameters created with the ellipsis (...)
parameter, and to then pass those changes into other functions for use.
Here are some of the posted requests:
1st: a simple way to pass through a list of arguments
2nd: a way to add arguments to an existing list
3rd: a way to re-order, insert, and remove arguments from the list
4th: be able to access each argument individually through indexing
5th: a way of passing the arglist (using _arguments
and _argptr) of one variadic function directly to another.
Note: examples of all five below
Please note, that since my PC is a Intel x86 CPU based running on WinXP SP2, this code hasn't been tested in any
other environment. If of course someone, would test it on another CPU or OS, I would love to hear the results...
and maybe I can then make some changes in the code to expand Diva usefulness to others.
• Dyriia: "Thanks to Walter's skill and dedication in
Terraforming D aka Mars for years now, each new
enhancement, bug fix, and adjustment to the D compiler has made it evolve ever closer to
the prized D v1.0 release! This code for example, was only made
possible with the addition of the the variadic parameter for functions, and the
typeid() done in D v0.93, as well
as the on going improvements being done to the TypeInfo structures. Thanks again to Walter, and
to the D community as a whole!"
:))
/+
' diva_special.d
' --------------------------------------------------------------
' Illustrates how Diva can handle all five user requests below:
' 1st request: a simple way to pass through a list of arguments.
' 2nd request: a way to add arguments to an existing list.
' 3rd request: a way to re-order, insert, and remove arguments from the list.
' 4th request: be able to access each argument individually through indexing.
' 5th request: a way of passing the arglist (using _arguments and _argptr)
' of one variadic function directly to another.
' --------------------------------------------------------------
' To compile: dmd diva_special.d diva.d isnumeric.d innumrange.d
+/
private import std.stdio;
private import std.format;
private import std.boxer;
private import std.utf;
private import std.stdarg;
private import isnumeric;
private import innumrange;
private import diva;
// Burton Radons
// This entry allows -unittest for testing, and/or no need for the -release switch
extern (C) void assert_3std5boxer() { }
int main()
{
char c = 'A';
char[] s = "ABCDEF";
wchar wc = 'B';
wchar[] ws = "STUVW";
dchar dc = 'C';
dchar[] ds = "XYZ";
bit b = true;
byte byt = 0x1F;
ubyte ubyt = 0xFF;
short sht = -589;
ushort usht = 2999U;
int i = -23;
uint ui = 1024U;
long l = 123L;
ulong ul = 456UL;
float f = 4367.34f;
double d = 34.56778;
real r = 98706.99E+12L;
ifloat ift = 4367.34fi;
idouble id = 34.56778i;
ireal ir = 98706.99E+12Li;
cfloat cf = 4367.34f+123.67i;
cdouble cd = 34.56778+456.74i;
creal cr = 98706.99E+12L+45634.45i;
void[] vo = "VOID[]";
Object o = new Object;
void * vp = null;
int i2 = 0;
Diva oDiva = new Diva(1024);
oDiva.append(c, s, wc, ws, dc, ds, b, byt, ubyt, sht, usht, i, ui,
l, ul, f, d, r, ift, id, ir, cf, cd, cr, vo, o, vp, "{end}");
// 1st request: a simple way to pass through a list of arguments
writefln("1. a simple way to pass through a list of arguments");
for (i2 = 0; i2 < oDiva.getNumberArgs; i2++)
writefln("argument %02d is a %7s, who's value is equal to \"%s\"",
i2, oDiva.gettypeid(i2), oDiva.get!(char[])(i2));
writefln();
// 2nd request: a way to add arguments to an existing list
writefln("2. a way to add arguments to an existing list");
writefln("action: prepend 3456.99L and 231L");
oDiva.prepend(3456.99L, 231L);
writefln("action: append 67834U");
oDiva.append(67834U);
displayArguments(oDiva);
writefln();
// 3rd request: a way to re-order, insert, and remove arguments from the list
writefln("3. a way to re-order, insert, and remove arguments from the list");
writefln("action: spliceall cfloat, cdouble, and creal data types, then prepend them back in");
oDiva.prepend(oDiva.spliceall(typeid(cfloat), typeid(cdouble), typeid(creal)));
writefln("action: insert \"Inserted Text\"d into the index position 5");
oDiva.insert(5, "Inserted Text"d);
writefln("action: remove the Object entry");
oDiva.remove(typeid(Object));
displayArguments(oDiva);
writefln();
// 4th request: be able to access each argument individually through indexing
writefln("4. be able to access each argument individually through indexing");
writefln("action: get!(dchar[])(11) = \"%s\"", oDiva.get!(dchar[])(11));
writefln("action: get!(creal)(2) = %g", oDiva.get!(creal)(2));
writefln("action: get!(uint)(30) = %d", oDiva.get!(uint)(30));
writefln("action: get!(double)(22) = %f", oDiva.get!(double)(22));
writefln("action: get!(ushort)(16) = %d", oDiva.get!(ushort)(16));
writefln("action: get!(bit)(12) = %d", oDiva.get!(bit)(12));
writefln("action: get!(long)(4) = %d", oDiva.get!(long)(4));
writefln("action: get!(wchar)(8) = (int) %d, (wchar) '%s'", oDiva.get!(wchar)(8), oDiva.get!(wchar)(8));
writefln("action: get!(ifloat)(24) = %g", oDiva.get!(ifloat)(24));
writefln();
writefln("action: set!(char[])(2, \"234.56e-12+789.675i\")");
oDiva.set!(char[])(2, "234.56e-12+789.675i");
writefln("action: get!(creal)(2) = %g", oDiva.get!(creal)(2));
writefln();
writefln("Example of making two gets to pull the complex float (creal) into a float and a ifloat.");
writefln("action: get!(float)(2) = %g", oDiva.get!(float)(2));
writefln("action: get!(ifloat)(2) = %gi", oDiva.get!(ifloat)(2));
writefln();
// 5th request: a way of passing the arglist of one variadic function directly to another.
writefln("5. a way of passing the arglist of one variadic function directly to another");
writefln("action: Diva class freed all data.");
oDiva.free(); // Clears all the data stored in the diva object
displayArguments(oDiva);
writefln();
writefln("action: append \"Test\"c, 123U, long.max, 234.45e+2f");
oDiva.append("Test"c, 123U, long.max, 234.45e+2f);
writefln("action: prepend format string");
oDiva.prepend("format string: char[]=\"%s\" uint=%d, long.max=%d, float=$%5.2f");
displayArguments(oDiva);
writefln();
/+
' Passing _arguments and _argptr values in doFormat() and writefln()
+/
writefln("action: _arguments and _argptr passed into doFormat(), and then into writefln()");
writefln("\"%s\"", .doFormatW(oDiva));
writefln();
writefln("action: _arguments and _argptr passed directly into writex()");
std.stdio.writefx(stdout, oDiva.getArgType, oDiva.getArgValue, true);
writefln();
/+
' Passing a Diva class data into a Box Array and back again!.
+/
TypeInfo[] unboxArgTypes;
va_list unboxArgValues;
Box[] boxxArr;
// Removing the format string
writefln("action: Remove the format string from the Diva class");
oDiva.remove(0);
displayArguments(oDiva);
writefln();
writefln("action: Pass the Diva class TypeInfo[] and va_list into a Box Array.");
// Boxing up Diva's argument types and values
boxxArr = boxArray(oDiva.getArgType, oDiva.getArgValue);
writefln("action: Display Box Array char[]=\"%s\", uint=%d, long=%d, float=%g",
unbox!(char[])(boxxArr[0]),
unbox!(uint) (boxxArr[1]),
unbox!(long) (boxxArr[2]),
unbox!(float) (boxxArr[3]));
writefln();
// Convert the box array back into arguments, and into an empty Diva again.
boxArrayToArguments(boxxArr, unboxArgTypes, unboxArgValues);
writefln("action: Diva class freed all data.");
oDiva.free();
displayArguments(oDiva);
writefln();
oDiva.prepend(unboxArgTypes, unboxArgValues);
unboxArgTypes.length = 0;
unboxArgValues = null;
writefln("action: Display Diva with data prepend back in from the Box Array.");
displayArguments(oDiva);
return 0;
}
/+
' wchar[] doFormatW( ... )
'
' Formats data and returns it as a Wide-Character String
+/
wchar[] doFormatW(...)
{
return doFormatW(_arguments, _argptr);
}
wchar[] doFormatW(in Diva oDiva)
{
return doFormatW(oDiva.getArgType, oDiva.getArgValue);
}
wchar[] doFormatW(TypeInfo[] Args, void* Values)
{
wchar[] ws;
void add2Buffer(in dchar dc)
{
std.utf.encode(ws, dc);
}
std.format.doFormat(&add2Buffer, Args, Values);
return ws;
}
C:\dmd>dmd diva_special.d diva.d isnumeric.d
C:\dmd\bin\..\..\dm\bin\link.exe diva_special+diva+isnumeric,,,user32+kernel32/noi;
C:\dmd>diva_special
1. a simple way to pass through a list of arguments
argument 00 is a char, who's value is equal to "A"
argument 01 is a char[], who's value is equal to "ABCDEF"
argument 02 is a wchar, who's value is equal to "B"
argument 03 is a wchar[], who's value is equal to "STUVW"
argument 04 is a dchar, who's value is equal to "C"
argument 05 is a dchar[], who's value is equal to "XYZ"
argument 06 is a bit, who's value is equal to "true"
argument 07 is a byte, who's value is equal to "31"
argument 08 is a ubyte, who's value is equal to "255"
argument 09 is a short, who's value is equal to "-589"
argument 10 is a ushort, who's value is equal to "2999"
argument 11 is a int, who's value is equal to "-23"
argument 12 is a uint, who's value is equal to "1024"
argument 13 is a long, who's value is equal to "123"
argument 14 is a ulong, who's value is equal to "456"
argument 15 is a float, who's value is equal to "4367.34"
argument 16 is a double, who's value is equal to "34.5678"
argument 17 is a real, who's value is equal to "9.8707e+16"
argument 18 is a ifloat, who's value is equal to "4367.34i"
argument 19 is a idouble, who's value is equal to "34.5678i"
argument 20 is a ireal, who's value is equal to "9.8707e+16i"
argument 21 is a cfloat, who's value is equal to "4367.34+123.67i"
argument 22 is a cdouble, who's value is equal to "34.5678+456.74i"
argument 23 is a creal, who's value is equal to "9.8707e+16+45634.5i"
argument 24 is a void[], who's value is equal to "VOID[]"
argument 25 is a Object, who's value is equal to "Object"
argument 26 is a void*, who's value is equal to ""
argument 27 is a char[], who's value is equal to "{end}"
2. a way to add arguments to an existing list
action: prepend 3456.99L and 231L
action: append 67834U
typeid= real, addr=0x8C4800, tsize=0x0A, value size=10, elements=N/A, value=3456.990000
typeid= long, addr=0x8C480C, tsize=0x08, value size=08, elements=N/A, value=231
typeid= char, addr=0x8C4814, tsize=0x01, value size=01, elements=N/A, value='A'
typeid= char[], addr=0x8C4818, tsize=0x08, value size=06, elements=006, value="ABCDEF" (0x422080)
typeid= wchar, addr=0x8C4820, tsize=0x02, value size=02, elements=N/A, value='B'
typeid= wchar[], addr=0x8C4824, tsize=0x08, value size=10, elements=005, value="STUVW" (0x422090)
typeid= dchar, addr=0x8C482C, tsize=0x04, value size=04, elements=N/A, value='C'
typeid= dchar[], addr=0x8C4830, tsize=0x08, value size=12, elements=003, value="XYZ" (0x4220A8)
typeid= bit, addr=0x8C4838, tsize=0x01, value size=01, elements=N/A, value=1
typeid= byte, addr=0x8C483C, tsize=0x01, value size=01, elements=N/A, value=31
typeid= ubyte, addr=0x8C4840, tsize=0x01, value size=01, elements=N/A, value=255
typeid= short, addr=0x8C4844, tsize=0x02, value size=02, elements=N/A, value=-589
typeid= ushort, addr=0x8C4848, tsize=0x02, value size=02, elements=N/A, value=2999
typeid= int, addr=0x8C484C, tsize=0x04, value size=04, elements=N/A, value=-23
typeid= uint, addr=0x8C4850, tsize=0x04, value size=04, elements=N/A, value=1024
typeid= long, addr=0x8C4854, tsize=0x08, value size=08, elements=N/A, value=123
typeid= ulong, addr=0x8C485C, tsize=0x08, value size=08, elements=N/A, value=456
typeid= float, addr=0x8C4864, tsize=0x04, value size=04, elements=N/A, value=4367.339844
typeid= double, addr=0x8C4868, tsize=0x08, value size=08, elements=N/A, value=34.567780
typeid= real, addr=0x8C4870, tsize=0x0A, value size=10, elements=N/A, value=98706989999999999.998000
typeid= ifloat, addr=0x8C487C, tsize=0x04, value size=04, elements=N/A, value=4367.34
typeid= idouble, addr=0x8C4880, tsize=0x08, value size=08, elements=N/A, value=34.5678
typeid= ireal, addr=0x8C4888, tsize=0x0A, value size=10, elements=N/A, value=9.8707e+16
typeid= cfloat, addr=0x8C4894, tsize=0x08, value size=08, elements=N/A, value=4367.34+123.67i
typeid= cdouble, addr=0x8C489C, tsize=0x10, value size=16, elements=N/A, value=34.5678+456.74i
typeid= creal, addr=0x8C48AC, tsize=0x14, value size=20, elements=N/A, value=9.8707e+16+45634.5i
typeid= void[], addr=0x8C48C0, tsize=0x08, value size=06, elements=006, value="VOID[]" (0x4220C0)
typeid= Object, addr=0x8C48C8, tsize=0x04, value size=04, elements=N/A, value="Object"
typeid= void*, addr=0x8C48CC, tsize=0x04, value size=01, elements=N/A, value=0x0
typeid= char[], addr=0x8C48D0, tsize=0x08, value size=05, elements=005, value="{end}" (0x4220C7)
typeid= uint, addr=0x8C48D8, tsize=0x04, value size=04, elements=N/A, value=67834
ending addr=8C48DC
3. a way to re-order, insert, and remove arguments from the list
action: spliceall cfloat, cdouble, and creal data types, then prepend them back in
action: insert "Inserted Text"d into the index position 5
action: remove the Object entry
typeid= cfloat, addr=0x8C4800, tsize=0x08, value size=08, elements=N/A, value=4367.34+123.67i
typeid= cdouble, addr=0x8C4808, tsize=0x10, value size=16, elements=N/A, value=34.5678+456.74i
typeid= creal, addr=0x8C4818, tsize=0x14, value size=20, elements=N/A, value=9.8707e+16+45634.5i
typeid= real, addr=0x8C482C, tsize=0x0A, value size=10, elements=N/A, value=3456.990000
typeid= long, addr=0x8C4838, tsize=0x08, value size=08, elements=N/A, value=231
typeid= dchar[], addr=0x8C4840, tsize=0x08, value size=52, elements=013, value="Inserted Text" (0x4222E8)
typeid= char, addr=0x8C4848, tsize=0x01, value size=01, elements=N/A, value='A'
typeid= char[], addr=0x8C484C, tsize=0x08, value size=06, elements=006, value="ABCDEF" (0x422080)
typeid= wchar, addr=0x8C4854, tsize=0x02, value size=02, elements=N/A, value='B'
typeid= wchar[], addr=0x8C4858, tsize=0x08, value size=10, elements=005, value="STUVW" (0x422090)
typeid= dchar, addr=0x8C4860, tsize=0x04, value size=04, elements=N/A, value='C'
typeid= dchar[], addr=0x8C4864, tsize=0x08, value size=12, elements=003, value="XYZ" (0x4220A8)
typeid= bit, addr=0x8C486C, tsize=0x01, value size=01, elements=N/A, value=1
typeid= byte, addr=0x8C4870, tsize=0x01, value size=01, elements=N/A, value=31
typeid= ubyte, addr=0x8C4874, tsize=0x01, value size=01, elements=N/A, value=255
typeid= short, addr=0x8C4878, tsize=0x02, value size=02, elements=N/A, value=-589
typeid= ushort, addr=0x8C487C, tsize=0x02, value size=02, elements=N/A, value=2999
typeid= int, addr=0x8C4880, tsize=0x04, value size=04, elements=N/A, value=-23
typeid= uint, addr=0x8C4884, tsize=0x04, value size=04, elements=N/A, value=1024
typeid= long, addr=0x8C4888, tsize=0x08, value size=08, elements=N/A, value=123
typeid= ulong, addr=0x8C4890, tsize=0x08, value size=08, elements=N/A, value=456
typeid= float, addr=0x8C4898, tsize=0x04, value size=04, elements=N/A, value=4367.339844
typeid= double, addr=0x8C489C, tsize=0x08, value size=08, elements=N/A, value=34.567780
typeid= real, addr=0x8C48A4, tsize=0x0A, value size=10, elements=N/A, value=98706989999999999.998000
typeid= ifloat, addr=0x8C48B0, tsize=0x04, value size=04, elements=N/A, value=4367.34
typeid= idouble, addr=0x8C48B4, tsize=0x08, value size=08, elements=N/A, value=34.5678
typeid= ireal, addr=0x8C48BC, tsize=0x0A, value size=10, elements=N/A, value=9.8707e+16
typeid= void[], addr=0x8C48C8, tsize=0x08, value size=06, elements=006, value="VOID[]" (0x4220C0)
typeid= void*, addr=0x8C48D0, tsize=0x04, value size=01, elements=N/A, value=0x0
typeid= char[], addr=0x8C48D4, tsize=0x08, value size=05, elements=005, value="{end}" (0x4220C7)
typeid= uint, addr=0x8C48DC, tsize=0x04, value size=04, elements=N/A, value=67834
ending addr=8C48E0
4. be able to access each argument individually through indexing
action: get!(dchar[])(11) = "XYZ"
action: get!(creal)(2) = 9.8707e+16+45634.5i
action: get!(uint)(30) = 67834
action: get!(double)(22) = 34.567780
action: get!(ushort)(16) = 2999
action: get!(bit)(12) = 1
action: get!(long)(4) = 231
action: get!(wchar)(8) = (int) 66, (wchar) 'B'
action: get!(ifloat)(24) = 4367.34
action: set!(char[])(2, "234.56e-12+789.675i")
action: get!(creal)(2) = 2.3456e-10+789.675i
Example of making two gets to pull the complex float (creal) into a float and a ifloat.
action: get!(float)(2) = 2.3456e-10
action: get!(ifloat)(2) = 789.675i
5. a way of passing the arglist of one variadic function directly to another
action: Diva class freed all data.
!!!!!! No arguments to display !!!!!!
action: append "Test"c, 123U, long.max, 234.45e+2f
action: prepend format string
typeid= char[], addr=0x8C3EC0, tsize=0x08, value size=61, elements=061, value="format string: char[]="%s" uint=%d, long.max=%d, float=$%5.2f" (0x422760)
typeid= char[], addr=0x8C3EC8, tsize=0x08, value size=04, elements=004, value="Test" (0x422728)
typeid= uint, addr=0x8C3ED0, tsize=0x04, value size=04, elements=N/A, value=123
typeid= long, addr=0x8C3ED4, tsize=0x08, value size=08, elements=N/A, value=9223372036854775807
typeid= float, addr=0x8C3EDC, tsize=0x04, value size=04, elements=N/A, value=23445.000000
ending addr=8C3EE0
action: _arguments and _argptr passed into doFormat(), and then into writefln()
"format string: char[]="Test" uint=123, long.max=9223372036854775807, float=$23445.00"
action: _arguments and _argptr passed directly into writex()
format string: char[]="Test" uint=123, long.max=9223372036854775807, float=$23445.00
action: Remove the format string from the Diva class
typeid= char[], addr=0x8C3EC0, tsize=0x08, value size=04, elements=004, value="Test" (0x422728)
typeid= uint, addr=0x8C3EC8, tsize=0x04, value size=04, elements=N/A, value=123
typeid= long, addr=0x8C3ECC, tsize=0x08, value size=08, elements=N/A, value=9223372036854775807
typeid= float, addr=0x8C3ED4, tsize=0x04, value size=04, elements=N/A, value=23445.000000
ending addr=8C3ED8
action: Pass the Diva class TypeInfo[] and va_list into a Box Array.
action: Display Box Array char[]="Test", uint=123, long=9223372036854775807, float=23445
action: Diva class freed all data.
!!!!!! No arguments to display !!!!!!
action: Display Diva with data prepend back in from the Box Array.
typeid= char[], addr=0x8C3E00, tsize=0x08, value size=04, elements=004, value="Test" (0x422728)
typeid= uint, addr=0x8C3E08, tsize=0x04, value size=04, elements=N/A, value=123
typeid= long, addr=0x8C3E0C, tsize=0x08, value size=08, elements=N/A, value=9223372036854775807
typeid= float, addr=0x8C3E14, tsize=0x04, value size=04, elements=N/A, value=23445.000000
ending addr=8C3E18
C:\dmd>
• Diva v1.0 (Dynamically Interconnected Variable Arguments) : class functions to work with
D's Variable Argument list. - Diva.d
Note:
The purpose of the Diva class, is to allow data passed in from the variadic parameter
to be gotten to (get()) and changed (set()), as well as, for selecting data to be deleted (remove(), or splice()) from it,
added (prepend(), insert(), or append()), and even selected data to be return into a new Diva class (copy() or splice())
easily. Currently the main focus is in accessing basic data types first, like: byte, char, ubyte, wchar, dchar, int, uint,
short, ushort, long, ulong, float, double, real, ifloat, idouble, ireal, cfloat, cdouble, creal, char[], void[], wchar[],
and dchar[].
-
-= Public Diva class functions =-
• TypeInfo[] getArgType() - 100% Done.
Returns Diva's internal _arguments that stores all the typeinfo for data it contains.
• va_list getArgValue() - 100% Done.
Returns Diva's internal _argptr, which points to a void[] where all the data stored.
• void prepend( ... ) - 100% Done.
• void prepend( in Diva ) - 100% Done.
• void prepend( in TypeInfo[], in va_list ) - 100% Done.
Prepends data to the very beginning of the stored data.
• void append( ... ) - 100% Done.
• void append( in Diva ) - 100% Done.
• void append( in TypeInfo[], in va_list ) - 100% Done.
Appends data to the very end of the stored data.
• void insert( in uint, ... ) - 100% Done.
• void insert( in uint uiDstPos, in Diva ) - 100% Done.
• void insert( in uint uiDstPos, in TypeInfo[], in va_list ) - 100% Done.
Insert data anywhere within the stored data.
• void remove( in uint, in uint = 0U ) - 100% Done.
• void remove( in TypeInfo, in uint = 0U, in uint = uint.max ) - 100% Done.
Removes data from anywhere within the stored data.
• void removeall( in TypeInfo[] ... ) - 100% Done.
Removes all datatypes passed in from anywhere within the stored data.
• Diva copy( in uint, in uint = 0U ) - 100% Done.
• Diva copy( in TypeInfo, in uint = 0U, in uint = uint.max ) - 100% Done.
Copys data from anywhere within the stored data to another Diva Object.
• Diva copyall( in TypeInfo[] ... ) - 100% Done.
Copys all datatypes passed in from anywhere within the stored data to another Diva Object.
• Diva splice( in uint, in uint = 0U ) - 100% Done.
• Diva splice( in TypeInfo, in uint = 0U, in uint = uint.max ) - 100% Done.
Copys and removes data from anywhere within the stored data to another Diva Object.
• Diva spliceall( in TypeInfo[] ... ) - 100% Done.
Copys and removes all datatypes passed in from anywhere within the stored data to another Diva Object.
• T get!( T )( in uint, in T = 0 ) - 100% Done.
• T get!( T : ifloat )( in uint, in T = 0.0fi ) - 100% Done.
• T get!( T : idouble )( in uint, in T = 0.0i ) - 100% Done.
• T get!( T : ireal )( in uint, in T = 0.0Li ) - 100% Done.
• T get!( T : cfloat )( in uint, in T = 0.0e0f+0.0fi ) - 100% Done.
• T get!( T : cdouble )( in uint, in T = 0.0e0+0.0i ) - 100% Done.
• T get!( T : creal )( in uint, in T = 0.0e0L+0.0Li ) - 100% Done.
• T get!( T : char[] )( in uint, in T = ""c ) - 100% Done.
• T get!( T : wchar[] )( in uint, in T = ""w ) - 100% Done.
• T get!( T : dchar[] )( in uint, in T = ""d ) - 100% Done.
• T get!( T : void[] )( in uint, in T = ""c ) - 100% Done.
Gets data from the stored data at the index passed in, and if the gotten value can't be converted the default value is returned.
• bool set!( T )( in uint, in T ) - 100% Done.
• bool set!( T : cfloat )( in uint, in T ) - 100% Done.
• bool set!( T : cdouble )( in uint, in T ) - 100% Done.
• bool set!( T : creal )( in uint, in T ) - 100% Done.
• bool set!( T : char[] )( in uint, in T ) - 100% Done.
• bool set!( T : wchar[] )( in uint, in T ) - 100% Done.
• bool set!( T : dchar[] )( in uint, in T ) - 100% Done.
• bool set!( T : void[] )( in uint, in T ) - 100% Done.
Sets data within the stored data at the index passed in, and returns true if it successes else false.
• TypeInfo gettype( ... ) - 100% Done.
Returns the typeid() of the first value passed in.
• TypeInfo gettypeid( in uint ) - 100% Done.
Returns the typeid() of the stored data found at the index passed in.
• int findtype( in TypeInfo, in uint = 0U ) - 100% Done.
Returns the index of the first datatype found in the stored data, starting
at the index passed in else -1 is returned (in which -1 means not found).
• uint counttype( in TypeInfo[] ... ) - 100% Done.
Returns a total count of the typeid(s) found in the stored data.
• bool reserve( in uint = 64U ) - 100% Done.
Reserve uses the size passed in to expand or diminish the capacity allotted space,
but it never be any less than the utilized allotted space where data resides.
• bool squeeze() - 100% Done.
Squeeze diminishs the capacity allotted space, down to only
the utilized allotted space where data resides.
• bool free() - 100% Done.
Free releases all the data, setting the internal TypeInfo[].length
to zero and sets the pointer to the internal data to null.
• uint getCapacity() - 100% Done.
Returns the total bytes currently allotted to the store data (or capacity).
• uint getUtilized() - 100% Done.
Returns the total bytes that are currently being utilized to store data.
• uint getNumberArgs() - 100% Done.
Returns the total number of arguments that are currently being stored.
-= Private Diva class functions =-
• void dedicate( in uint = 512U ) - 100% Done.
Use at initiation to set the capacity for storing data.
• uint getoffset( in uint ) - 100% Done.
• uint getoffset( in uint, in TypeInfo[] ) - 100% Done.
Returns the offset bytes of data at a index passed in for the stored data.
• bool setToNumeric!( T : char[] )( in uint uiPos, in T ) - 100% Done.
Called internally from a set() function to handle setting a char[] value
into a numeric argument within the stored data.
• void EmptyObjectError( in char[] ) - 100% Done.
• void OutOfBoundsError( in uint ) - 100% Done.
• void OtherError( in char[] ) - 100% Done.
Errors that throw a new Exception.
|